Checks for 3rdparty libraries availability in configure

Abort configure run with an error if a 3rd party library doesn't seem to
be present, when it's supposed to be used during the build, as this is
better than postponing the error until make runs into it much later and
also allows us to give a hopefully helpful message telling people that
they might be missing the relevant submodules.

Also add --disable-tests configure option to allow skipping building
tests entirely. In particular, this allows to avoid cloning any
submodules at all when using system libraries on a Unix system.

Closes https://github.com/wxWidgets/wxWidgets/pull/1954
This commit is contained in:
Hertatijanto Hartono
2020-07-13 02:53:55 +07:00
committed by Vadim Zeitlin
parent 3ec166f960
commit f1f27bc37c
2 changed files with 278 additions and 3 deletions

165
configure vendored
View File

@@ -1028,6 +1028,7 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@@ -1059,6 +1060,7 @@ enable_official_build
enable_vendor enable_vendor
enable_all_features enable_all_features
enable_sys_libs enable_sys_libs
enable_tests
with_dpi with_dpi
enable_universal enable_universal
with_themes with_themes
@@ -1454,6 +1456,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1706,6 +1709,15 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1843,7 +1855,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir libdir localedir mandir runstatedir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@@ -1996,6 +2008,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2040,6 +2053,7 @@ Optional Features:
--enable-vendor=VENDOR vendor name (win32 DLL only) --enable-vendor=VENDOR vendor name (win32 DLL only)
--disable-all-features disable all optional features to build minimal library --disable-all-features disable all optional features to build minimal library
--disable-sys-libs disable all use of system libraries, use only built-in ones --disable-sys-libs disable all use of system libraries, use only built-in ones
--disable-tests disable building tests
--enable-universal use wxWidgets GUI controls instead of native ones --enable-universal use wxWidgets GUI controls instead of native ones
--enable-nanox use NanoX --enable-nanox use NanoX
--enable-gpe use GNOME PDA Environment features if possible --enable-gpe use GNOME PDA Environment features if possible
@@ -4292,6 +4306,35 @@ fi
eval "$wx_cv_use_sys_libs" eval "$wx_cv_use_sys_libs"
enablestring=disable
defaultval=
if test -z "$defaultval"; then
if test x"$enablestring" = xdisable; then
defaultval=yes
else
defaultval=no
fi
fi
# Check whether --enable-tests was given.
if test "${enable_tests+set}" = set; then :
enableval=$enable_tests;
if test "$enableval" = yes; then
wx_cv_use_tests='wxUSE_TESTS_SUBDIR=yes'
else
wx_cv_use_tests='wxUSE_TESTS_SUBDIR=no'
fi
else
wx_cv_use_tests='wxUSE_TESTS_SUBDIR=${'DEFAULT_wxUSE_TESTS_SUBDIR":-$defaultval}"
fi
eval "$wx_cv_use_tests"
if test "$wxUSE_ALL_FEATURES" = "no"; then if test "$wxUSE_ALL_FEATURES" = "no"; then
DEFAULT_wxUSE_ARTPROVIDER_TANGO=no DEFAULT_wxUSE_ARTPROVIDER_TANGO=no
DEFAULT_wxUSE_MEDIACTRL=no DEFAULT_wxUSE_MEDIACTRL=no
@@ -21524,6 +21567,26 @@ $as_echo "$as_me: WARNING: zlib library not found or too old, will use built-in
else else
wxUSE_ZLIB=sys wxUSE_ZLIB=sys
fi fi
fi
if test "$wxUSE_ZLIB" = "builtin" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether zlib.h file exists" >&5
$as_echo_n "checking whether zlib.h file exists... " >&6; }
if ! test -f "$ac_confdir/src/zlib/zlib.h" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "
Configured to use built-in zlib library, but the required file
$ac_confdir/src/zlib/zlib.h couldn't be found.
You might need to run
git submodule update --init src/zlib
to fix this." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi fi
fi fi
@@ -21640,6 +21703,26 @@ $as_echo "$as_me: WARNING: system png library not found or too old, will use bui
else else
wxUSE_LIBPNG=sys wxUSE_LIBPNG=sys
fi fi
fi
if test "$wxUSE_LIBPNG" = "builtin" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether png.c file exists" >&5
$as_echo_n "checking whether png.c file exists... " >&6; }
if ! test -f "$ac_confdir/src/png/png.c" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "
Configured to use built-in png library, but the required file
$ac_confdir/src/png/png.c couldn't be found.
You might need to run
git submodule update --init src/png
to fix this." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi fi
fi fi
@@ -21795,6 +21878,26 @@ fi
fi fi
fi fi
fi
if test "$wxUSE_LIBJPEG" = "builtin" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether jpeglib.h file exists" >&5
$as_echo_n "checking whether jpeglib.h file exists... " >&6; }
if ! test -f "$ac_confdir/src/jpeg/jpeglib.h" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "
Configured to use built-in jpeg library, but the required file
$ac_confdir/src/jpeg/jpeglib.h couldn't be found.
You might need to run
git submodule update --init src/jpeg
to fix this." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi fi
fi fi
@@ -22134,6 +22237,24 @@ $as_echo "$as_me: WARNING: system tiff library not found, will use built-in inst
fi fi
fi fi
if test "$wxUSE_LIBTIFF" = "builtin" ; then if test "$wxUSE_LIBTIFF" = "builtin" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tiff.h file exists" >&5
$as_echo_n "checking whether tiff.h file exists... " >&6; }
if ! test -f "$ac_confdir/src/tiff/libtiff/tiff.h" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "
Configured to use built-in tiff library, but the required file
$ac_confdir/src/tiff/libtiff/tiff.h couldn't be found.
You might need to run:
git submodule update --init src/tiff
to fix this." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
ac_configure_args="$ac_configure_args --disable-webp --disable-zstd" ac_configure_args="$ac_configure_args --disable-webp --disable-zstd"
if test "$wxUSE_LIBLZMA" = "no"; then if test "$wxUSE_LIBLZMA" = "no"; then
ac_configure_args="$ac_configure_args --disable-lzma" ac_configure_args="$ac_configure_args --disable-lzma"
@@ -22263,6 +22384,24 @@ $as_echo "$as_me: WARNING: system expat library not found, will use built-in ins
fi fi
fi fi
if test "$wxUSE_EXPAT" = "builtin" ; then if test "$wxUSE_EXPAT" = "builtin" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether expat.h file exists" >&5
$as_echo_n "checking whether expat.h file exists... " >&6; }
if ! test -f "$ac_confdir/src/expat/expat/lib/expat.h" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "
Configured to use built-in expat library, but the required file
$ac_confdir/src/expat/expat/lib/expat.h couldn't be found.
You might need to run:
git submodule update --init src/expat
to fix this." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
save_CC="$CC" save_CC="$CC"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } $as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
@@ -40448,7 +40587,29 @@ if test "$wxUSE_GUI" = "yes"; then
else else
SUBDIRS="samples utils" SUBDIRS="samples utils"
fi fi
SUBDIRS="$SUBDIRS tests"
if test "$wxUSE_TESTS_SUBDIR" != "no"; then
SUBDIRS="$SUBDIRS tests"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether catch.hpp file exists" >&5
$as_echo_n "checking whether catch.hpp file exists... " >&6; }
if ! test -f "$ac_confdir/3rdparty/catch/include/catch.hpp" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "
CATCH (C++ Automated Test Cases in Headers) is required, the required file
$ac_confdir/3rdparty/catch/include/catch.hpp couldn't found.
You might need to run
git submodule update --init 3rdparty/catch
to fix this." "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
for subdir in $SUBDIRS; do for subdir in $SUBDIRS; do
if test -d ${srcdir}/${subdir} ; then if test -d ${srcdir}/${subdir} ; then

View File

@@ -402,6 +402,7 @@ fi
WX_ARG_DISABLE(all-features,[ --disable-all-features disable all optional features to build minimal library], wxUSE_ALL_FEATURES) WX_ARG_DISABLE(all-features,[ --disable-all-features disable all optional features to build minimal library], wxUSE_ALL_FEATURES)
WX_ARG_DISABLE(sys-libs, [ --disable-sys-libs disable all use of system libraries, use only built-in ones], wxUSE_SYS_LIBS) WX_ARG_DISABLE(sys-libs, [ --disable-sys-libs disable all use of system libraries, use only built-in ones], wxUSE_SYS_LIBS)
WX_ARG_DISABLE(tests, [ --disable-tests disable building tests], wxUSE_TESTS_SUBDIR)
if test "$wxUSE_ALL_FEATURES" = "no"; then if test "$wxUSE_ALL_FEATURES" = "no"; then
dnl this is a bit ugly but currently we have no choice but to manually dnl this is a bit ugly but currently we have no choice but to manually
@@ -2487,6 +2488,26 @@ if test "$wxUSE_ZLIB" != "no" ; then
wxUSE_ZLIB=sys wxUSE_ZLIB=sys
fi fi
fi fi
dnl We should test if built-in zlib library is avalable, preferably
dnl downloaded through --recurse-submodules option if cloned from git.
dnl Would be available when downloaded as a zipped or tarball release.
if test "$wxUSE_ZLIB" = "builtin" ; then
AC_MSG_CHECKING([whether zlib.h file exists])
if ! test -f "$ac_confdir/src/zlib/zlib.h" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Configured to use built-in zlib library, but the required file
$ac_confdir/src/zlib/zlib.h couldn't be found.
You might need to run
git submodule update --init src/zlib
to fix this.])
else
AC_MSG_RESULT([yes])
fi
fi
fi fi
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
@@ -2547,6 +2568,26 @@ if test "$wxUSE_LIBPNG" != "no" ; then
wxUSE_LIBPNG=sys wxUSE_LIBPNG=sys
fi fi
fi fi
dnl We should test if built-in png library is avalable, preferably
dnl downloaded through --recurse-submodules option if cloned from git.
dnl Would be available when downloaded as a zipped or tarball release.
if test "$wxUSE_LIBPNG" = "builtin" ; then
AC_MSG_CHECKING([whether png.c file exists])
if ! test -f "$ac_confdir/src/png/png.c" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Configured to use built-in png library, but the required file
$ac_confdir/src/png/png.c couldn't be found.
You might need to run
git submodule update --init src/png
to fix this.])
else
AC_MSG_RESULT([yes])
fi
fi
fi fi
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
@@ -2619,6 +2660,26 @@ if test "$wxUSE_LIBJPEG" != "no" ; then
fi fi
fi fi
fi fi
dnl We should test if built-in jpeg library is avalable, preferably
dnl downloaded through --recurse-submodules option if cloned from git.
dnl Would be available when downloaded as a zipped or tarball release.
if test "$wxUSE_LIBJPEG" = "builtin" ; then
AC_MSG_CHECKING([whether jpeglib.h file exists])
if ! test -f "$ac_confdir/src/jpeg/jpeglib.h" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Configured to use built-in jpeg library, but the required file
$ac_confdir/src/jpeg/jpeglib.h couldn't be found.
You might need to run
git submodule update --init src/jpeg
to fix this.])
else
AC_MSG_RESULT([yes])
fi
fi
fi fi
dnl ------------------------------------------------------------------------ dnl ------------------------------------------------------------------------
@@ -2715,6 +2776,22 @@ if test "$wxUSE_LIBTIFF" != "no" ; then
fi fi
fi fi
if test "$wxUSE_LIBTIFF" = "builtin" ; then if test "$wxUSE_LIBTIFF" = "builtin" ; then
dnl Test for built-in tiff library avalability.
AC_MSG_CHECKING([whether tiff.h file exists])
if ! test -f "$ac_confdir/src/tiff/libtiff/tiff.h" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Configured to use built-in tiff library, but the required file
$ac_confdir/src/tiff/libtiff/tiff.h couldn't be found.
You might need to run:
git submodule update --init src/tiff
to fix this.])
else
AC_MSG_RESULT([yes])
fi
dnl Disable the use of lzma, webp and zstd in built-in libtiff explicitly, as dnl Disable the use of lzma, webp and zstd in built-in libtiff explicitly, as
dnl otherwise we'd depend on the system libraries, which is typically dnl otherwise we'd depend on the system libraries, which is typically
dnl undesirable when using builtin libraries. If we use lzma ourselves, keep it dnl undesirable when using builtin libraries. If we use lzma ourselves, keep it
@@ -2780,6 +2857,22 @@ if test "$wxUSE_EXPAT" != "no"; then
fi fi
fi fi
if test "$wxUSE_EXPAT" = "builtin" ; then if test "$wxUSE_EXPAT" = "builtin" ; then
dnl Test for built-in expat library avalability.
AC_MSG_CHECKING([whether expat.h file exists])
if ! test -f "$ac_confdir/src/expat/expat/lib/expat.h" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Configured to use built-in expat library, but the required file
$ac_confdir/src/expat/expat/lib/expat.h couldn't be found.
You might need to run:
git submodule update --init src/expat
to fix this.])
else
AC_MSG_RESULT([yes])
fi
dnl Expat requires C99 compiler, so define wxCFLAGS_C99 variable which dnl Expat requires C99 compiler, so define wxCFLAGS_C99 variable which
dnl is used when compiling it in our makefiles. dnl is used when compiling it in our makefiles.
save_CC="$CC" save_CC="$CC"
@@ -8445,7 +8538,28 @@ else
dnl there are no wxBase programs in demos dnl there are no wxBase programs in demos
SUBDIRS="samples utils" SUBDIRS="samples utils"
fi fi
SUBDIRS="$SUBDIRS tests"
if test "$wxUSE_TESTS_SUBDIR" != "no"; then
dnl Configure tests directory
SUBDIRS="$SUBDIRS tests"
dnl Check for catch (C++ Automated Test Cases in Headers) availability.
AC_MSG_CHECKING([whether catch.hpp file exists])
if ! test -f "$ac_confdir/3rdparty/catch/include/catch.hpp" ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([
CATCH (C++ Automated Test Cases in Headers) is required, the required file
$ac_confdir/3rdparty/catch/include/catch.hpp couldn't found.
You might need to run
git submodule update --init 3rdparty/catch
to fix this.])
else
AC_MSG_RESULT([yes])
fi
fi
for subdir in $SUBDIRS; do for subdir in $SUBDIRS; do
if test -d ${srcdir}/${subdir} ; then if test -d ${srcdir}/${subdir} ; then