From b79173943ac93078e9faf27b775eba78fa6b9d1a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 18 Jul 2020 16:54:13 +0200 Subject: [PATCH 1/3] Fix problem with caching in sub-configure scripts Since the changes of ef2b015e39 (Export CC and similar variables for sub-configure scripts, 2018-10-20), using "-C" option with configure didn't work any longer when also using built-in libtiff or expat, as their configure scripts aborted due to detecting inconsistent build environment because the values of exported CC etc variables they saw differed from the values in the cache file. Fixing this seems to be difficult, as we'd need to update the cache before running the sub-configure scripts (which is simple enough), but also remove the cached entries from it after doing it, as otherwise we'd get the same inconsistent build environment problem simply by running "configure -C" without any other options twice in a row, because the first run would cache CC=gcc etc. So work around this instead by disabling cache when exporting these variables. And to make this workaround less annoying, restrict it to only the cases when it's really needed, i.e. when we do modify these variables in a non-trivial way. With these changes, "configure -C" works again, but only uses caching if possible. --- configure | 16 +++++++++++++++- configure.in | 29 +++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 9698d321ea..2580e5dfba 100755 --- a/configure +++ b/configure @@ -18656,6 +18656,8 @@ fi fi +export_compiler_flags=no + if test "$USE_DARWIN" = 1; then retest_macosx_linking=no @@ -18708,6 +18710,8 @@ $as_echo "$as_me: WARNING: Disabling precompiled headers due to universal binary OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS" OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS" LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS" + + export_compiler_flags=yes fi if test "$wxUSE_MAC" = 1; then @@ -18893,6 +18897,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + export_compiler_flags=yes fi fi @@ -19095,7 +19101,15 @@ if test "$USE_UNIX" = 1 ; then fi -export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS +if test "$export_compiler_flags" = "yes"; then + export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS + + if test "$cache_file" != "/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling caching due to a change in compiler options." >&5 +$as_echo "$as_me: WARNING: Disabling caching due to a change in compiler options." >&2;} + cache_file="/dev/null" + fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 diff --git a/configure.in b/configure.in index 91cc451dbd..69284c308e 100644 --- a/configure.in +++ b/configure.in @@ -1177,6 +1177,11 @@ dnl --------------------------------------------------------------------------- dnl Mac-specific SDK/architectures checks dnl --------------------------------------------------------------------------- +dnl If we modify compiler or compiler flags variables in non-trivial way (e.g. +dnl by specifying the non-default architecture to use), we need to export them +dnl after doing it, so that sub-configure scripts use the same values too. +export_compiler_flags=no + dnl Note that some checks here are OS-specific, and need to be done for any dnl port, while others are wxOSX-specific and are performed only for it inside dnl another test below. @@ -1250,6 +1255,8 @@ if test "x$OSX_ARCH_OPTS" != "x"; then OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS" OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS" LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS" + + export_compiler_flags=yes fi if test "$wxUSE_MAC" = 1; then @@ -1384,6 +1391,12 @@ version or omitting it entirely." [AC_MSG_FAILURE([$error_message])] ) AC_LANG_POP() + + dnl If we are here, we must have set retest_macosx_linking to yes above, + dnl i.e. we must have modified compiler/linker variables to set + dnl SDK/availability options, and so we must export them to build any + dnl bundled third party libraries with them too. + export_compiler_flags=yes fi fi dnl USE_DARWIN @@ -1541,8 +1554,20 @@ if test "$USE_UNIX" = 1 ; then fi dnl Values of these variables shouldn't change any longer from now on, we -dnl export them to ensure they're picked up by sub-configure scripts. -export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS +dnl export them to ensure they're picked up by sub-configure scripts if they +dnl were modified above. +if test "$export_compiler_flags" = "yes"; then + export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS + + if test "$cache_file" != "/dev/null"; then + dnl We must do this to avoid fatal errors due to inconsistent build + dnl environment from sub-configure scripts. We could do it just before + dnl actually running them, but doing it here is simpler and more robust + dnl (e.g. in case we add other sub-configure scripts later). + AC_MSG_WARN([Disabling caching due to a change in compiler options.]) + cache_file="/dev/null" + fi +fi dnl ------------------------------------------------------------------------ dnl Check for headers From 36f3164ea05092ac261ed2abfe0054a7c16b2a5a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 18 Jul 2020 16:59:48 +0200 Subject: [PATCH 2/3] Pass options needed by it to libtiff configure only Use non-standard but convenient AX_SUBDIRS_CONFIGURE() macro instead of the standard AC_CONFIG_SUBDIRS() for libtiff, in order to allow passing extra options to this sub-configure script without affecting any other sub-configure ones and also without wrongly caching these options as part of the main configure options, as happened before. This notably fixes the problem with running "config.status", which complained about unknown "--disable-jbig" and similar options, as they were cached by the previous configure run. We could also manually remove these options from ac_configure_args, but doing it like this seems cleaner and simpler. --- aclocal.m4 | 1 + build/aclocal/ax_subdirs_configure.m4 | 337 ++++++++++++++++++++++++++ configure | 233 +++++++++++++++++- configure.in | 29 ++- 4 files changed, 579 insertions(+), 21 deletions(-) create mode 100644 build/aclocal/ax_subdirs_configure.m4 diff --git a/aclocal.m4 b/aclocal.m4 index 6eb3cbd0b8..c46ee945f5 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -19,6 +19,7 @@ m4_include([build/aclocal/ax_cxx_compile_stdcxx.m4]) m4_include([build/aclocal/ax_func_which_gethostbyname_r.m4]) m4_include([build/aclocal/ax_gcc_option.m4]) m4_include([build/aclocal/ax_gxx_version.m4]) +m4_include([build/aclocal/ax_subdirs_configure.m4]) m4_include([build/aclocal/bakefile-lang.m4]) m4_include([build/aclocal/bakefile.m4]) m4_include([build/aclocal/gtk-2.0.m4]) diff --git a/build/aclocal/ax_subdirs_configure.m4 b/build/aclocal/ax_subdirs_configure.m4 new file mode 100644 index 0000000000..b4ec96962c --- /dev/null +++ b/build/aclocal/ax_subdirs_configure.m4 @@ -0,0 +1,337 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_subdirs_configure.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_SUBDIRS_CONFIGURE( [subdirs], [mandatory arguments], [possibly merged arguments], [replacement arguments], [forbidden arguments]) +# +# DESCRIPTION +# +# AX_SUBDIRS_CONFIGURE attempts to be the equivalent of AC_CONFIG_SUBDIRS +# with customizable options for configure scripts. +# +# Run the configure script for each directory from the comma-separated m4 +# list 'subdirs'. This macro can be used multiple times. All arguments of +# this macro must be comma-separated lists. +# +# All command line arguments from the parent configure script will be +# given to the subdirectory configure script after the following +# modifications (in that order): +# +# 1. The arguments from the 'mandatory arguments' list shall always be +# appended to the argument list. +# +# 2. The arguments from the 'possibly merged arguments' list shall be +# added if not present in the arguments of the parent configure script or +# merged with the existing argument otherwise. +# +# 3. The arguments from the 'replacement arguments' list shall be added if +# not present in the arguments of the parent configure script or replace +# the existing argument otherwise. +# +# 4. The arguments from the 'forbidden arguments' list shall always be +# removed from the argument list. +# +# The lists 'mandatory arguments' and 'forbidden arguments' can hold any +# kind of argument. The 'possibly merged arguments' and 'replacement +# arguments' expect their arguments to be of the form --option-name=value. +# +# This macro aims to remain as close as possible to the AC_CONFIG_SUBDIRS +# macro. It corrects the paths for '--cache-file' and '--srcdir' and adds +# '--disable-option-checking' and '--silent' if necessary. +# +# This macro also sets the output variable subdirs_extra to the list of +# directories recorded with AX_SUBDIRS_CONFIGURE. This variable can be +# used in Makefile rules or substituted in configured files. +# +# This macro shall do nothing more than managing the arguments of the +# configure script. Just like when using AC_CONFIG_SUBDIRS, it is up to +# the user to check any requirements or define and substitute any required +# variable for the remainder of the project. +# +# Configure scripts recorded with AX_SUBDIRS_CONFIGURE may be executed +# before configure scripts recorded with AC_CONFIG_SUBDIRS. +# +# Without additional arguments, the behaviour of AX_SUBDIRS_CONFIGURE +# should be identical to the behaviour of AC_CONFIG_SUBDIRS, apart from +# the contents of the variables subdirs and subdirs_extra (except that +# AX_SUBDIRS_CONFIGURE expects a comma-separated m4 list): +# +# AC_CONFIG_SUBDIRS([something]) +# AX_SUBDIRS_CONFIGURE([something]) +# +# This macro may be called multiple times. +# +# Usage example: +# +# Let us assume our project has 4 dependencies, namely A, B, C and D. Here +# are some characteristics of our project and its dependencies: +# +# - A does not require any special option. +# +# - we want to build B with an optional feature which can be enabled with +# its configure script's option '--enable-special-feature'. +# +# - B's configure script is strange and has an option '--with-B=build'. +# After close inspection of its documentation, we don't want B to receive +# this option. +# +# - C and D both need B. +# +# - Just like our project, C and D can build B themselves with the option +# '--with-B=build'. +# +# - We want C and D to use the B we build instead of building it +# themselves. +# +# Our top-level configure script will be called as follows: +# +# $ --with-A=build --with-B=build --with-C=build \ +# --with-D=build --some-option +# +# Thus we have to make sure that: +# +# - neither B, C or D receive the option '--with-B=build' +# +# - C and D know where to find the headers and libraries of B. +# +# Under those conditions, we can use the AC_CONFIG_SUBDIRS macro for A, +# but need to use AX_SUBDIRS_CONFIGURE for B, C and D: +# +# - B must receive '--enable-special-feature' but cannot receive +# '--with-B=build' +# +# - C and D cannot receive '--with-B=build' (or else it would be built +# thrice) and need to be told where to find B (since we are building it, +# it would probably not be available in standard paths). +# +# Here is a configure.ac snippet that solves our problem: +# +# AC_CONFIG_SUBDIRS([dependencies/A]) +# AX_SUBDIRS_CONFIGURE( +# [dependencies/B], [--enable-special-feature], [], [], +# [--with-B=build]) +# AX_SUBDIRS_CONFIGURE( +# [[dependencies/C],[dependencies/D]], +# [], +# [[CPPFLAGS=-I${ac_top_srcdir}/dependencies/B -I${ac_top_builddir}/dependencies/B], +# [LDFLAGS=-L${ac_abs_top_builddir}/dependencies/B/.libs]], +# [--with-B=system], +# []) +# +# If using automake, the following can be added to the Makefile.am (we use +# both $(subdirs) and $(subdirs_extra) since our example above used both +# AC_CONFIG_SUBDIRS and AX_SUBDIRS_CONFIGURE): +# +# SUBDIRS = $(subdirs) $(subdirs_extra) +# +# LICENSE +# +# Copyright (c) 2017 Harenome Ranaivoarivony-Razanajato +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# Under Section 7 of GPL version 3, you are granted additional permissions +# described in the Autoconf Configure Script Exception, version 3.0, as +# published by the Free Software Foundation. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +#serial 5 + +AC_DEFUN([AX_SUBDIRS_CONFIGURE], +[ + dnl Calls to AC_CONFIG_SUBDIRS perform preliminary steps and build a list + dnl '$subdirs' which is used later by _AC_OUTPUT_SUBDIRS (used by AC_OUTPUT) + dnl to actually run the configure scripts. + dnl This macro performs similar preliminary steps but uses + dnl AC_CONFIG_COMMANDS_PRE to delay the final tasks instead of building an + dnl intermediary list and relying on another macro. + dnl + dnl Since each configure script can get different options, a special variable + dnl named 'ax_sub_configure_args_' is constructed for each + dnl subdirectory. + + # Various preliminary checks. + AC_REQUIRE([AC_DISABLE_OPTION_CHECKING]) + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) + AS_LITERAL_IF([$1], [], + [AC_DIAGNOSE([syntax], [$0: you should use literals])]) + + m4_foreach(subdir_path, [$1], + [ + ax_dir="subdir_path" + + dnl Build the argument list in a similar fashion to AC_CONFIG_SUBDIRS. + dnl A few arguments found in the final call to the configure script are not + dnl added here because they rely on variables that may not yet be available + dnl (see below the part that is similar to _AC_OUTPUT_SUBDIRS). + # Do not complain, so a configure script can configure whichever parts of a + # large source tree are present. + if test -d "$srcdir/$ax_dir"; then + _AC_SRCDIRS(["$ax_dir"]) + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ax_args= + ax_prev= + eval "set x $ac_configure_args" + shift + for ax_arg; do + if test -n "$ax_prev"; then + ax_prev= + continue + fi + case $ax_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi | --cache-f \ + | --cache- | --cache | --cach | --cac | --ca | --c) + ax_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ax_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ax_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* \ + | --p=*) + ;; + --disable-option-checking) + ;; + *) case $ax_arg in + *\'*) ax_arg=$(AS_ECHO(["$ax_arg"]) | sed "s/'/'\\\\\\\\''/g");; + esac + AS_VAR_APPEND([ax_args], [" '$ax_arg'"]) ;; + esac + done + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ax_args="--disable-option-checking $ax_args" + # Options that must be added as they are provided. + m4_ifnblank([$2], [m4_foreach(opt, [$2], [AS_VAR_APPEND(ax_args, " 'opt'") + ])]) + # New options that may need to be merged with existing options. + m4_ifnblank([$3], [m4_foreach(opt, [$3], + [ax_candidate="opt" + ax_candidate_flag="${ax_candidate%%=*}" + ax_candidate_content="${ax_candidate#*=}" + if test "x$ax_candidate" != "x" -a "x$ax_candidate_flag" != "x"; then + if echo "$ax_args" | grep -- "${ax_candidate_flag}=" >/dev/null 2>&1; then + [ax_args=$(echo $ax_args | sed "s,\(${ax_candidate_flag}=[^']*\),\1 ${ax_candidate_content},")] + else + AS_VAR_APPEND(ax_args, " 'opt'") + fi + fi + ])]) + # New options that must replace existing options. + m4_ifnblank([$4], [m4_foreach(opt, [$4], + [ax_candidate="opt" + ax_candidate_flag="${ax_candidate%%=*}" + ax_candidate_content="${ax_candidate#*=}" + if test "x$ax_candidate" != "x" -a "x$ax_candidate_flag" != "x"; then + if echo "$ax_args" | grep -- "${ax_candidate_flag}=" >/dev/null 2>&1; then + [ax_args=$(echo $ax_args | sed "s,${ax_candidate_flag}=[^']*,${ax_candidate},")] + else + AS_VAR_APPEND(ax_args, " 'opt'") + fi + fi + ])]) + # Options that must be removed. + m4_ifnblank([$5], [m4_foreach(opt, [$5], [ax_args=$(echo $ax_args | sed "s,'opt',,") + ])]) + AS_VAR_APPEND([ax_args], [" '--srcdir=$ac_srcdir'"]) + + # Add the subdirectory to the list of target subdirectories. + ax_subconfigures="$ax_subconfigures $ax_dir" + # Save the argument list for this subdirectory. + dnl $1 is a path to some subdirectory: m4_bpatsubsts() is used to convert + dnl $1 into a valid shell variable name. + dnl For instance, "ax_sub_configure_args_path/to/subdir" becomes + dnl "ax_sub_configure_args_path_to_subdir". + ax_var=$(printf "$ax_dir" | tr -c "0-9a-zA-Z_" "_") + eval "ax_sub_configure_args_$ax_var=\"$ax_args\"" + eval "ax_sub_configure_$ax_var=\"yes\"" + else + AC_MSG_WARN([could not find source tree for $ax_dir]) + fi + + dnl Add some more arguments to the argument list and then actually run the + dnl configure script. This is mostly what happens in _AC_OUTPUT_SUBDIRS + dnl except it does not iterate over an intermediary list. + AC_CONFIG_COMMANDS_PRE( + dnl This very line cannot be quoted! m4_foreach has some work here. + ax_dir="subdir_path" + [ + # Convert the path to the subdirectory into a shell variable name. + ax_var=$(printf "$ax_dir" | tr -c "0-9a-zA-Z_" "_") + ax_configure_ax_var=$(eval "echo \"\$ax_sub_configure_$ax_var\"") + if test "$no_recursion" != "yes" -a "x$ax_configure_ax_var" = "xyes"; then + AC_SUBST([subdirs_extra], ["$subdirs_extra $ax_dir"]) + ax_msg="=== configuring in $ax_dir ($(pwd)/$ax_dir)" + _AS_ECHO_LOG([$ax_msg]) + _AS_ECHO([$ax_msg]) + AS_MKDIR_P(["$ax_dir"]) + _AC_SRCDIRS(["$ax_dir"]) + + ax_popdir=$(pwd) + cd "$ax_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ax_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ax_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ax_sub_configure=$ac_aux_dir/configure + else + AC_MSG_WARN([no configuration information is in $ax_dir]) + ax_sub_configure= + fi + + if test -n "$ax_sub_configure"; then + # Get the configure arguments for the current configure. + eval "ax_sub_configure_args=\"\$ax_sub_configure_args_${ax_var}\"" + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ax_arg="--prefix=$prefix" + case $ax_arg in + *\'*) ax_arg=$(AS_ECHO(["$ax_arg"]) | sed "s/'/'\\\\\\\\''/g");; + esac + ax_sub_configure_args="'$ax_arg' $ax_sub_configure_args" + if test "$silent" = yes; then + ax_sub_configure_args="--silent $ax_sub_configure_args" + fi + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [[\\/]]* | ?:[[\\/]]* ) + ax_sub_cache_file=$cache_file ;; + *) # Relative name. + ax_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + AC_MSG_NOTICE([running $SHELL $ax_sub_configure $ax_sub_configure_args --cache-file=$ac_sub_cache_file]) + eval "\$SHELL \"$ax_sub_configure\" $ax_sub_configure_args --cache-file=\"$ax_sub_cache_file\"" \ + || AC_MSG_ERROR([$ax_sub_configure failed for $ax_dir]) + fi + + cd "$ax_popdir" + fi + ]) + ]) +]) diff --git a/configure b/configure index 2580e5dfba..933b2c52ad 100755 --- a/configure +++ b/configure @@ -624,7 +624,8 @@ ac_includes_default="\ enable_option_checking=no enable_option_checking=fatal -ac_subst_vars='LTLIBOBJS +ac_subst_vars='subdirs_extra +LTLIBOBJS LIBOBJS RESCOMP DLLTOOL @@ -978,8 +979,8 @@ DIRECTFB_CFLAGS GTK_CONFIG GTK_LIBS GTK_CFLAGS -wxCFLAGS_C99 subdirs +wxCFLAGS_C99 LIBTIFF_LIBS LIBTIFF_CFLAGS PKG_CONFIG @@ -1418,8 +1419,7 @@ CAIRO_CFLAGS CAIRO_LIBS GST_CFLAGS GST_LIBS' -ac_subdirs_all='src/tiff -src/expat/expat' +ac_subdirs_all='src/expat/expat' # Initialize some variables set by options. ac_init_help= @@ -22300,17 +22300,135 @@ $as_echo "no" >&6; } $as_echo "yes" >&6; } fi - ac_configure_args="$ac_configure_args --disable-webp --disable-zstd" - if test "$wxUSE_LIBLZMA" = "no"; then - ac_configure_args="$ac_configure_args --disable-lzma" + if test "$wxUSE_LIBLZMA" = "no"; then + tiff_lzma_option=--disable-lzma + else + tiff_lzma_option=--enable-lzma fi if test "$wxUSE_LIBJPEG" = "no"; then - ac_configure_args="$ac_configure_args --disable-jpeg" + tiff_jpeg_option=--disable-jpeg + else + tiff_jpeg_option=--enable-jpeg fi - ac_configure_args="$ac_configure_args --disable-jbig" -subdirs="$subdirs src/tiff" + + + + # Various preliminary checks. + + + + + + ax_dir="src/tiff" + + # Do not complain, so a configure script can configure whichever parts of a + # large source tree are present. + if test -d "$srcdir/$ax_dir"; then + ac_builddir=. + +case "$ax_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ax_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. + ax_args= + ax_prev= + eval "set x $ac_configure_args" + shift + for ax_arg; do + if test -n "$ax_prev"; then + ax_prev= + continue + fi + case $ax_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi | --cache-f \ + | --cache- | --cache | --cach | --cac | --ca | --c) + ax_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ax_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ax_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* \ + | --p=*) + ;; + --disable-option-checking) + ;; + *) case $ax_arg in + *\'*) ax_arg=$($as_echo "$ax_arg" | sed "s/'/'\\\\\\\\''/g");; + esac + as_fn_append ax_args " '$ax_arg'" ;; + esac + done + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ax_args="--disable-option-checking $ax_args" + # Options that must be added as they are provided. + as_fn_append ax_args " '--disable-jbig'" + as_fn_append ax_args " '--disable-webp'" + as_fn_append ax_args " '--disable-zstd'" + as_fn_append ax_args " '$tiff_lzma_option'" + as_fn_append ax_args " '$tiff_jpeg_option'" + + # New options that may need to be merged with existing options. + + # New options that must replace existing options. + + # Options that must be removed. + + as_fn_append ax_args " '--srcdir=$ac_srcdir'" + + # Add the subdirectory to the list of target subdirectories. + ax_subconfigures="$ax_subconfigures $ax_dir" + # Save the argument list for this subdirectory. + ax_var=$(printf "$ax_dir" | tr -c "0-9a-zA-Z_" "_") + eval "ax_sub_configure_args_$ax_var=\"$ax_args\"" + eval "ax_sub_configure_$ax_var=\"yes\"" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find source tree for $ax_dir" >&5 +$as_echo "$as_me: WARNING: could not find source tree for $ax_dir" >&2;} + fi + + + fi fi @@ -40817,6 +40935,101 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs + ax_dir="src/tiff" + + # Convert the path to the subdirectory into a shell variable name. + ax_var=$(printf "$ax_dir" | tr -c "0-9a-zA-Z_" "_") + ax_configure_ax_var=$(eval "echo \"\$ax_sub_configure_$ax_var\"") + if test "$no_recursion" != "yes" -a "x$ax_configure_ax_var" = "xyes"; then + subdirs_extra="$subdirs_extra $ax_dir" + + ax_msg="=== configuring in $ax_dir ($(pwd)/$ax_dir)" + $as_echo "$as_me:${as_lineno-$LINENO}: $ax_msg" >&5 + $as_echo "$ax_msg" >&6 + as_dir="$ax_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ax_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ax_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + ax_popdir=$(pwd) + cd "$ax_dir" + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_srcdir/configure.gnu"; then + ax_sub_configure=$ac_srcdir/configure.gnu + elif test -f "$ac_srcdir/configure"; then + ax_sub_configure=$ac_srcdir/configure + elif test -f "$ac_srcdir/configure.in"; then + # This should be Cygnus configure. + ax_sub_configure=$ac_aux_dir/configure + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ax_dir" >&5 +$as_echo "$as_me: WARNING: no configuration information is in $ax_dir" >&2;} + ax_sub_configure= + fi + + if test -n "$ax_sub_configure"; then + # Get the configure arguments for the current configure. + eval "ax_sub_configure_args=\"\$ax_sub_configure_args_${ax_var}\"" + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ax_arg="--prefix=$prefix" + case $ax_arg in + *\'*) ax_arg=$($as_echo "$ax_arg" | sed "s/'/'\\\\\\\\''/g");; + esac + ax_sub_configure_args="'$ax_arg' $ax_sub_configure_args" + if test "$silent" = yes; then + ax_sub_configure_args="--silent $ax_sub_configure_args" + fi + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) + ax_sub_cache_file=$cache_file ;; + *) # Relative name. + ax_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ax_sub_configure $ax_sub_configure_args --cache-file=$ac_sub_cache_file" >&5 +$as_echo "$as_me: running $SHELL $ax_sub_configure $ax_sub_configure_args --cache-file=$ac_sub_cache_file" >&6;} + eval "\$SHELL \"$ax_sub_configure\" $ax_sub_configure_args --cache-file=\"$ax_sub_cache_file\"" \ + || as_fn_error $? "$ax_sub_configure failed for $ax_dir" "$LINENO" 5 + fi + + cd "$ax_popdir" + fi + : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 diff --git a/configure.in b/configure.in index 69284c308e..728af3eb7e 100644 --- a/configure.in +++ b/configure.in @@ -2818,13 +2818,15 @@ if test "$wxUSE_LIBTIFF" != "no" ; then AC_MSG_RESULT([yes]) fi - 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 undesirable when using builtin libraries. If we use lzma ourselves, keep it - dnl enabled. - ac_configure_args="$ac_configure_args --disable-webp --disable-zstd" + dnl Disable the use of lzma, jbig, webp and zstd in built-in libtiff + dnl explicitly, as otherwise we'd depend on the system libraries, which + dnl is typically undesirable when using builtin libraries. If we use + dnl lzma ourselves, keep it enabled (note that we must still define the + dnl variable used below). if test "$wxUSE_LIBLZMA" = "no"; then - ac_configure_args="$ac_configure_args --disable-lzma" + tiff_lzma_option=--disable-lzma + else + tiff_lzma_option=--enable-lzma fi if test "$wxUSE_LIBJPEG" = "no"; then dnl we have to prevent the builtin libtiff configure from building the @@ -2833,12 +2835,17 @@ if test "$wxUSE_LIBTIFF" != "no" ; then dnl (which will be passed to it anyhow as configure passes arguments to dnl the top-level script to all the other ones called recursively), so dnl we need to hack around this - ac_configure_args="$ac_configure_args --disable-jpeg" + tiff_jpeg_option=--disable-jpeg + else + tiff_jpeg_option=--enable-jpeg fi - dnl We don't provide a built-in version of the libjbig library, so - dnl disable it for the builtin libtiff. - ac_configure_args="$ac_configure_args --disable-jbig" - AC_CONFIG_SUBDIRS([src/tiff]) + + AX_SUBDIRS_CONFIGURE([src/tiff], + [[--disable-jbig], + [--disable-webp], + [--disable-zstd], + [$tiff_lzma_option], + [$tiff_jpeg_option]]) fi fi From 0df485c9283a3a49cf95f1e64f7e403757178a0a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 18 Jul 2020 17:07:22 +0200 Subject: [PATCH 3/3] Fix caching of inotify() availability check in configure Commit 0fe1146b19 (Cache the result of inotify check in configure, 2020-04-15) was wrong as it defined wxHAS_INOTIFY inside the AC_CACHE_CHECK(), meaning that this wasn't done at all if the value was already cached. Fix this by crrectly defining wxHAS_INOTIFY if inotify() availability was either detected or cached. --- configure | 8 +++++--- configure.in | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 933b2c52ad..568533f824 100755 --- a/configure +++ b/configure @@ -33166,8 +33166,7 @@ else int main() { return inotify_init(); } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - wx_cv_inotify_usable=yes; $as_echo "#define wxHAS_INOTIFY 1" >>confdefs.h - + wx_cv_inotify_usable=yes else wx_cv_inotify_usable=no @@ -33178,7 +33177,10 @@ rm -f core conftest.err conftest.$ac_objext \ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_inotify_usable" >&5 $as_echo "$wx_cv_inotify_usable" >&6; } - if test "$wx_cv_inotify_usable" = "no"; then + if test "$wx_cv_inotify_usable" = "yes"; then + $as_echo "#define wxHAS_INOTIFY 1" >>confdefs.h + + else for ac_header in sys/event.h do : ac_fn_c_check_header_compile "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default diff --git a/configure.in b/configure.in index 728af3eb7e..3ff854e79d 100644 --- a/configure.in +++ b/configure.in @@ -5604,11 +5604,13 @@ if test "$wxUSE_FSWATCHER" = "yes"; then wx_cv_inotify_usable, AC_LINK_IFELSE( [AC_LANG_SOURCE([int main() { return inotify_init(); }])], - [wx_cv_inotify_usable=yes; AC_DEFINE(wxHAS_INOTIFY) ], + [wx_cv_inotify_usable=yes], [wx_cv_inotify_usable=no] ) ) - if test "$wx_cv_inotify_usable" = "no"; then + if test "$wx_cv_inotify_usable" = "yes"; then + AC_DEFINE(wxHAS_INOTIFY) + else AC_CHECK_HEADERS(sys/event.h,,, [AC_INCLUDES_DEFAULT()]) if test "$ac_cv_header_sys_event_h" = "yes"; then AC_DEFINE(wxHAS_KQUEUE)