implemented --with-<lib> options (yes, no, sys, and builtin) for libjpeg,
libtiff, libpng, freetype, regex and zlib default is sys which falls back to builtin if the system library is not found git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
396
configure.in
396
configure.in
@@ -32,7 +32,7 @@ for ac_dir in $1;
|
||||
])
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_includes
|
||||
dnl call WX_PATH_FIND_LIBRARIES(search path, header name), sets ac_find_libraries
|
||||
dnl to the full name of the file that was found or leaves it empty if not found
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_DEFUN(WX_PATH_FIND_LIBRARIES,
|
||||
@@ -205,7 +205,7 @@ AC_DEFUN(WX_ARG_CACHE_FLUSH,
|
||||
])
|
||||
|
||||
dnl this macro checks for a three-valued command line --with argument:
|
||||
dnl possible arguments are 'yes', 'no', or 'sys'
|
||||
dnl possible arguments are 'yes', 'no', 'sys', or 'builtin'
|
||||
dnl usage: WX_ARG_SYS_WITH(option, helpmessage, variable-name)
|
||||
AC_DEFUN(WX_ARG_SYS_WITH,
|
||||
[
|
||||
@@ -219,8 +219,10 @@ AC_DEFUN(WX_ARG_SYS_WITH,
|
||||
ac_cv_use_$1='$3=no'
|
||||
elif test "$withval" = sys; then
|
||||
ac_cv_use_$1='$3=sys'
|
||||
elif test "$withval" = builtin; then
|
||||
ac_cv_use_$1='$3=builtin'
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no or sys])
|
||||
AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
|
||||
fi
|
||||
],
|
||||
[
|
||||
@@ -245,8 +247,10 @@ AC_DEFUN(WX_ARG_SYS_WITH,
|
||||
AC_MSG_RESULT(no)
|
||||
elif test "$$3" = sys; then
|
||||
AC_MSG_RESULT(system version)
|
||||
elif test "$$3" = builtin; then
|
||||
AC_MSG_RESULT(builtin version)
|
||||
else
|
||||
AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no or sys])
|
||||
AC_MSG_ERROR([Invalid value for --with-$1: should be yes, no, sys, or builtin])
|
||||
fi
|
||||
])
|
||||
|
||||
@@ -1598,28 +1602,250 @@ dnl ------------------------------------------------------------------------
|
||||
dnl flush the cache because checking for libraries below might abort
|
||||
AC_CACHE_SAVE
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Optional libraries
|
||||
dnl
|
||||
dnl --with-<lib>=sys
|
||||
dnl looks for system library and fails if not found
|
||||
dnl
|
||||
dnl --with-<lib>
|
||||
dnl --with-<lib>=yes
|
||||
dnl looks for system library and, if not found, prints a warning,
|
||||
dnl falls back to the builtin wx version, and continues configuration
|
||||
dnl
|
||||
dnl --with-<lib>=builtin
|
||||
dnl uses builtin wx version without searching for system library
|
||||
dnl
|
||||
dnl --with-<lib>=no
|
||||
dnl --without-<lib>
|
||||
dnl do not use library (neither system nor builtin wx version)
|
||||
dnl
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl Check for regex libraries
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
REGEX_INCLUDE=
|
||||
if test "$wxUSE_REGEX" != "no"; then
|
||||
dnl according to Unix 98 specs, regcomp() is in libc but I believe that
|
||||
dnl on some old systems it may be in libregex - check for it too?
|
||||
AC_CHECK_HEADER(regex.h, AC_CHECK_FUNCS(regcomp))
|
||||
AC_DEFINE(wxUSE_REGEX)
|
||||
|
||||
if test "x$ac_cv_func_regcomp" != "xyes"; then
|
||||
dnl we were asked to use the system version of regex lib only but it
|
||||
dnl is not available
|
||||
if test "$wxUSE_REGEX" = "sys"; then
|
||||
AC_MSG_ERROR([system regex library not found! Use --with-regex to use the built-in regex library.])
|
||||
if test "$wxUSE_REGEX" = "sys" -o "$wxUSE_REGEX" = "yes" ; then
|
||||
dnl according to Unix 98 specs, regcomp() is in libc but I believe that
|
||||
dnl on some old systems it may be in libregex - check for it too?
|
||||
AC_CHECK_HEADER(regex.h, AC_CHECK_FUNCS(regcomp))
|
||||
|
||||
if test "x$ac_cv_func_regcomp" != "xyes"; then
|
||||
if test "$wxUSE_REGEX" = "sys" ; then
|
||||
AC_MSG_ERROR([system regex library not found! Use --with-regex to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system regex library not found, will compile built-in version instead])
|
||||
wxUSE_REGEX=builtin
|
||||
fi
|
||||
else
|
||||
dnl we are using the system library
|
||||
wxUSE_REGEX=sys
|
||||
fi
|
||||
|
||||
dnl fallback to the built in code
|
||||
REGEX_INCLUDE="-I\${top_srcdir}/src/regex"
|
||||
fi
|
||||
|
||||
AC_DEFINE(wxUSE_REGEX)
|
||||
if test "$wxUSE_REGEX" = "builtin" ; then
|
||||
REGEX_INCLUDE="-I\${top_srcdir}/src/regex"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl Check for zlib compression library
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
ZLIB_INCLUDE=
|
||||
ZLIB_LINK=
|
||||
if test "$wxUSE_ZLIB" != "no" ; then
|
||||
AC_DEFINE(wxUSE_ZLIB)
|
||||
|
||||
if test "$wxUSE_ZLIB" = "sys" -o "$wxUSE_ZLIB" = "yes" ; then
|
||||
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, deflate, ZLIB_LINK="-lz"))
|
||||
|
||||
if test "x$ZLIB_LINK" = "x" ; then
|
||||
if test "$wxUSE_ZLIB" = "sys" ; then
|
||||
AC_MSG_ERROR([system zlib compression library not found! Use --with-zlib=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system zlib compression library not found, will compile built-in version instead])
|
||||
wxUSE_ZLIB=builtin
|
||||
fi
|
||||
else
|
||||
dnl we are using the system library
|
||||
wxUSE_ZLIB=sys
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_ZLIB" = "builtin" ; then
|
||||
ZLIB_INCLUDE="-I\${top_srcdir}/src/zlib"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl Check for png library
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
PNG_INCLUDE=
|
||||
PNG_LINK=
|
||||
if test "$wxUSE_LIBPNG" != "no" ; then
|
||||
AC_DEFINE(wxUSE_LIBPNG)
|
||||
|
||||
dnl for the check below to have a chance to succeed, we must already have
|
||||
dnl libz somewhere
|
||||
if test "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
|
||||
AC_MSG_WARN([system png library doesn't work without system zlib, will compile built-in instead])
|
||||
wxUSE_LIBPNG=builtin
|
||||
fi
|
||||
|
||||
if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_CHECK_LIB(png, png_check_sig,
|
||||
PNG_LINK="-lpng",
|
||||
,
|
||||
[-lz -lm])
|
||||
)
|
||||
|
||||
if test "x$PNG_LINK" = "x" ; then
|
||||
if test "$wxUSE_LIBPNG" = "sys" ; then
|
||||
AC_MSG_ERROR([system png library not found! Use --with-libpng=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system png library not found, will compile built-in version instead])
|
||||
wxUSE_LIBPNG=builtin
|
||||
fi
|
||||
else
|
||||
dnl we are using the system library
|
||||
wxUSE_LIBPNG=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_LIBPNG" = "builtin" ; then
|
||||
PNG_INCLUDE="-I\${top_srcdir}/src/png"
|
||||
fi
|
||||
|
||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS png"
|
||||
fi
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl Check for jpeg library
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
JPEG_INCLUDE=
|
||||
JPEG_LINK=
|
||||
if test "$wxUSE_LIBJPEG" != "no" ; then
|
||||
AC_DEFINE(wxUSE_LIBJPEG)
|
||||
|
||||
if test "$wxUSE_LIBJPEG" = "sys" -o "$wxUSE_LIBJPEG" = "yes" ; then
|
||||
dnl can't use AC_CHECK_HEADER as jconfig.h defines things like
|
||||
dnl HAVE_STDLIB_H which are already defined and this provokes
|
||||
dnl a compiler warning which configure considers as an error...
|
||||
AC_MSG_CHECKING(for jpeglib.h)
|
||||
AC_CACHE_VAL(ac_cv_header_jpeglib_h,
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#undef HAVE_STDLIB_H
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
],
|
||||
[
|
||||
],
|
||||
ac_cv_header_jpeglib_h=yes,
|
||||
ac_cv_header_jpeglib_h=no
|
||||
)
|
||||
)
|
||||
AC_MSG_RESULT($ac_cv_header_jpeglib_h)
|
||||
|
||||
if test "$ac_cv_header_jpeglib_h" = "yes"; then
|
||||
AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK="-ljpeg")
|
||||
fi
|
||||
|
||||
if test "x$JPEG_LINK" = "x" ; then
|
||||
if test "$wxUSE_LIBJPEG" = "sys" ; then
|
||||
AC_MSG_ERROR([system jpeg library not found! Use --with-libjpeg=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system jpeg library not found, will compile built-in version instead])
|
||||
wxUSE_LIBJPEG=builtin
|
||||
fi
|
||||
else
|
||||
dnl we are using the system library
|
||||
wxUSE_LIBJPEG=sys
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_LIBJPEG" = "builtin" ; then
|
||||
JPEG_INCLUDE="-I\${top_srcdir}/src/jpeg"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl Check for tiff library
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
TIFF_INCLUDE=
|
||||
TIFF_LINK=
|
||||
if test "$wxUSE_LIBTIFF" != "no" ; then
|
||||
AC_DEFINE(wxUSE_LIBTIFF)
|
||||
|
||||
if test "$wxUSE_LIBTIFF" = "sys" -o "$wxUSE_LIBTIFF" = "yes" ; then
|
||||
AC_CHECK_HEADER(tiffio.h,
|
||||
AC_CHECK_LIB(tiff, TIFFError,
|
||||
TIFF_LINK="-ltiff",
|
||||
,
|
||||
-lm)
|
||||
)
|
||||
|
||||
if test "x$TIFF_LINK" = "x" ; then
|
||||
if test "$wxUSE_LIBTIFF" = "sys" ; then
|
||||
AC_MSG_ERROR([system tiff library not found! Use --with-libtiff=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system tiff library not found, will compile built-in version instead])
|
||||
wxUSE_LIBTIFF=builtin
|
||||
fi
|
||||
else
|
||||
dnl we are using the system library
|
||||
wxUSE_LIBTIFF=sys
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_LIBTIFF" = "builtin" ; then
|
||||
TIFF_INCLUDE="-I\${top_srcdir}/src/tiff"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ------------------------------------------------------------------------
|
||||
dnl Check for freetype library
|
||||
dnl ------------------------------------------------------------------------
|
||||
|
||||
FREETYPE_INCLUDE=
|
||||
FREETYPE_LINK=
|
||||
if test "$wxUSE_FREETYPE" != "no" ; then
|
||||
AC_DEFINE(wxUSE_FREETYPE)
|
||||
|
||||
if test "$wxUSE_FREETYPE" = "sys" -o "$wxUSE_FREETYPE" = "yes" ; then
|
||||
AC_CHECK_HEADER(freetype.h,
|
||||
AC_CHECK_LIB(freetype, FT_Render_Glyph,
|
||||
FREETYPE_LINK="-lfreetype",
|
||||
,
|
||||
[-lm])
|
||||
)
|
||||
|
||||
if test "x$FREETYPE_LINK" = "x" ; then
|
||||
if test "$wxUSE_FREETYPE" = "sys" ; then
|
||||
AC_MSG_ERROR([system freetype library not found! Use --with-freetype=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system freetype library not found, will compile built-in version instead])
|
||||
wxUSE_FREETYPE=builtin
|
||||
fi
|
||||
else
|
||||
dnl we are using the system library
|
||||
wxUSE_FREETYPE=sys
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_FREETYPE" = "builtin" ; then
|
||||
FREETYPE_INCLUDE="-I\${top_srcdir}/src/freetype"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
@@ -2007,16 +2233,16 @@ equivalent variable and GTK+ is version 1.2.3 or above.
|
||||
if test "$TOOLKIT" != "MSW" -a "$wxUSE_ODBC" = "yes" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(IODBCOBJS)"
|
||||
fi
|
||||
if test "$wxUSE_LIBJPEG" = "yes" ; then
|
||||
if test "$wxUSE_LIBJPEG" = "builtin" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(JPEGOBJS)"
|
||||
fi
|
||||
if test "$wxUSE_LIBTIFF" = "yes" ; then
|
||||
if test "$wxUSE_LIBTIFF" = "builtin" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(TIFFOBJS)"
|
||||
fi
|
||||
if test "$wxUSE_LIBPNG" = "yes" ; then
|
||||
if test "$wxUSE_LIBPNG" = "builtin" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(PNGOBJS)"
|
||||
fi
|
||||
if test "$wxUSE_FREETYPE" = "yes" ; then
|
||||
if test "$wxUSE_FREETYPE" = "builtin" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(FREETYPEOBJS)"
|
||||
fi
|
||||
|
||||
@@ -2055,15 +2281,19 @@ else
|
||||
DISTDIR="wxBase"
|
||||
fi
|
||||
|
||||
dnl REGEX_INCLUDE is only set if we want regex support and if we use our
|
||||
dnl own sources and not the system library
|
||||
if test "x$REGEX_INCLUDE" != "x" ; then
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Optional libraries included when system library is not used
|
||||
dnl ---------------------------------------------------------------------------
|
||||
if test "$wxUSE_REGEX" = "builtin" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(REGEXOBJS)"
|
||||
fi
|
||||
if test "$wxUSE_ZLIB" = "yes" ; then
|
||||
if test "$wxUSE_ZLIB" = "builtin" ; then
|
||||
ALL_OBJECTS="${ALL_OBJECTS} \$(ZLIBOBJS)"
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl OpenGL libraries
|
||||
dnl ---------------------------------------------------------------------------
|
||||
if test "$wxUSE_OPENGL" = "yes"; then
|
||||
if test "$wxUSE_MAC" = 1; then
|
||||
AC_DEFINE(wxUSE_OPENGL)
|
||||
@@ -3216,124 +3446,6 @@ if test "$WXWIN_COMPATIBILITY_2_2" = "yes"; then
|
||||
AC_DEFINE(WXWIN_COMPATIBILITY_2_2)
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Optional libraries
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
ZLIB_INCLUDE=
|
||||
if test "$wxUSE_ZLIB" = "yes" -o "$wxUSE_ZLIB" = "sys" ; then
|
||||
AC_DEFINE(wxUSE_ZLIB)
|
||||
if test "$wxUSE_ZLIB" = "yes" ; then
|
||||
ZLIB_INCLUDE="-I\${top_srcdir}/src/zlib"
|
||||
else
|
||||
ZLIB_LINK=
|
||||
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, deflate, ZLIB_LINK="-lz"))
|
||||
if test "x$ZLIB_LINK" = "x" ; then
|
||||
AC_MSG_ERROR(system zlib compression library not found! Use --with-zlib=yes to use built-in zlib)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
PNG_INCLUDE=
|
||||
if test "$wxUSE_LIBPNG" = "yes" -o "$wxUSE_LIBPNG" = "sys" ; then
|
||||
AC_DEFINE(wxUSE_LIBPNG)
|
||||
dnl for the check below to have a chance to succeed, we must already have
|
||||
dnl libz somewhere
|
||||
if test "$wxUSE_LIBPNG" = "sys" -a "$wxUSE_ZLIB" != "sys" ; then
|
||||
AC_MSG_WARN([--with-libpng=sys doesn't work without --with-zlib=sys, will compile the built-in libpng instead])
|
||||
wxUSE_LIBPNG=yes
|
||||
fi
|
||||
|
||||
if test "$wxUSE_LIBPNG" = "yes" ; then
|
||||
PNG_INCLUDE="-I\${top_srcdir}/src/png"
|
||||
else
|
||||
PNG_LINK=
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_CHECK_LIB(png, png_check_sig,
|
||||
PNG_LINK="-lpng",
|
||||
,
|
||||
[-lz -lm])
|
||||
)
|
||||
if test "x$PNG_LINK" = "x" ; then
|
||||
AC_MSG_ERROR(system png library not found! Use --with-libpng=yes to use the built-in libpng)
|
||||
fi
|
||||
fi
|
||||
|
||||
SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS png"
|
||||
fi
|
||||
|
||||
JPEG_INCLUDE=
|
||||
if test "$wxUSE_LIBJPEG" = "yes" -o "$wxUSE_LIBJPEG" = "sys" ; then
|
||||
AC_DEFINE(wxUSE_LIBJPEG)
|
||||
if test "$wxUSE_LIBJPEG" = "yes" ; then
|
||||
JPEG_INCLUDE="-I\${top_srcdir}/src/jpeg"
|
||||
else
|
||||
JPEG_LINK=
|
||||
dnl can't use AC_CHECK_HEADER as jconfig.h defines things like
|
||||
dnl HAVE_STDLIB_H which are already defined and this provokes
|
||||
dnl a compiler warning which configure considers as an error...
|
||||
AC_MSG_CHECKING(for jpeglib.h)
|
||||
AC_CACHE_VAL(ac_cv_header_jpeglib_h,
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#undef HAVE_STDLIB_H
|
||||
#include <stdio.h>
|
||||
#include <jpeglib.h>
|
||||
],
|
||||
[
|
||||
],
|
||||
ac_cv_header_jpeglib_h=yes,
|
||||
ac_cv_header_jpeglib_h=no
|
||||
)
|
||||
)
|
||||
AC_MSG_RESULT($ac_cv_header_jpeglib_h)
|
||||
|
||||
if test "$ac_cv_header_jpeglib_h" = "yes"; then
|
||||
AC_CHECK_LIB(jpeg, jpeg_read_header, JPEG_LINK="-ljpeg")
|
||||
fi
|
||||
|
||||
if test "x$JPEG_LINK" = "x" ; then
|
||||
AC_MSG_ERROR(system jpeg library not found! Use --with-libjpeg=yes to use the built-in one)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
TIFF_INCLUDE=
|
||||
if test "$wxUSE_LIBTIFF" = "yes" -o "$wxUSE_LIBTIFF" = "sys" ; then
|
||||
AC_DEFINE(wxUSE_LIBTIFF)
|
||||
if test "$wxUSE_LIBTIFF" = "yes" ; then
|
||||
TIFF_INCLUDE="-I\${top_srcdir}/src/tiff"
|
||||
else
|
||||
TIFF_LINK=
|
||||
AC_CHECK_HEADER(tiffio.h, AC_CHECK_LIB(tiff, TIFFError,
|
||||
TIFF_LINK="-ltiff",
|
||||
,
|
||||
-lm))
|
||||
if test "x$TIFF_LINK" = "x" ; then
|
||||
AC_MSG_ERROR(system tiff library not found! Use --with-libtiff=yes to use the built-in one)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
FREETYPE_INCLUDE=
|
||||
if test "$wxUSE_FREETYPE" = "yes" -o "$wxUSE_FREETYPE" = "sys" ; then
|
||||
AC_DEFINE(wxUSE_FREETYPE)
|
||||
if test "$wxUSE_FREETYPE" = "yes" ; then
|
||||
FREETYPE_INCLUDE="-I\${top_srcdir}/src/freetype"
|
||||
else
|
||||
FREETYPE_LINK=
|
||||
AC_CHECK_HEADER(freetype.h,
|
||||
AC_CHECK_LIB(freetype, FT_Render_Glyph,
|
||||
FREETYPE_LINK="-lfreetype",
|
||||
,
|
||||
[-lm])
|
||||
)
|
||||
if test "x$FREETYPE_LINK" = "x" ; then
|
||||
AC_MSG_ERROR(system freetype library not found! Use --with-freetype=yes to use the built-in freetype)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl the library may be built without GUI classes at all
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user