Move Gnulib configuration back to where it was

* configure.ac: Move the gl_INIT call back to where it was,
as Mattias Engdegård reported the following problem:
  checking whether pthread_sigmask is a macro... no
  ./configure: line 32767: test: =: unary operator expected
because moving gl_INIT up made the check for pthread_sigmask’s
availability appear later than Gnulib’s check whether it’s a macro.
Instead of moving gl_INIT up, call gl_ALIGNASOF earlier,
as that’s the only part of gl_INIT that is needed earlier.
This commit is contained in:
Paul Eggert 2025-12-08 18:05:13 -08:00
parent 238c2dc3b6
commit 4990849514

View file

@ -3226,31 +3226,6 @@ to configure.])
fi
fi
# Configure gnulib.
#
# Do this after any CC or CFLAGS changes that affect Gnulib,
# and before any tests that depend on gnulib tests,
# e.g., the system_malloc=no test below.
#
# Do not affect CFLAGS or LIBS permanently.
# Instead, temporarily revert them to their pre-pkg-config values,
# because gnulib needs to work with both src (which uses the
# pkg-config stuff) and lib-src (which does not). For example, gnulib
# may need to determine whether CLOCK_TIME_LIB should contain -lrt,
# and it therefore needs to run in an environment where LIBS does not
# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
# for some package unrelated to lib-src.
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS=$pre_PKG_CONFIG_CFLAGS
LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
gl_ASSERT_NO_GNULIB_POSIXCHECK
gl_ASSERT_NO_GNULIB_TESTS
gl_EEMALLOC
gl_INIT
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
# Does the opsystem file prohibit the use of the GNU malloc?
# Assume not, until told otherwise.
GNU_MALLOC=yes
@ -3302,6 +3277,15 @@ if test "$emacs_cv_struct_alignment" = yes; then
structure to an N-byte boundary.])
fi
# Check for alignas now rather than waiting for gl_INIT to do it,
# as the system_malloc=no test below needs $gl_cv_header_working_stdalign_h.
# Do not simply call gl_INIT here, as the ac_cv_func_pthread_sigmask=yes
# assignment below affects how gl_INIT works.
# Instead, call gl_ALIGNASOF, the only part of gl_INIT needed here.
# Then make gl_ALIGNASOF a no-op so gl_INIT does not duplicate its code.
gl_ALIGNASOF
AC_DEFUN([gl_ALIGNASOF])
system_malloc=yes
# If it appears as if the system malloc can't be trusted to return
@ -7384,6 +7368,25 @@ if test "$with_features" = no && test "$enable_acl" != yes; then
enable_acl=no
fi
# Configure gnulib. Although this does not affect CFLAGS or LIBS permanently,
# it temporarily reverts them to their pre-pkg-config values,
# because gnulib needs to work with both src (which uses the
# pkg-config stuff) and lib-src (which does not). For example, gnulib
# may need to determine whether CLOCK_TIME_LIB should contain -lrt,
# and it therefore needs to run in an environment where LIBS does not
# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
# for some package unrelated to lib-src.
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
CFLAGS=$pre_PKG_CONFIG_CFLAGS
LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
gl_ASSERT_NO_GNULIB_POSIXCHECK
gl_ASSERT_NO_GNULIB_TESTS
gl_EEMALLOC
gl_INIT
CFLAGS=$SAVE_CFLAGS
LIBS=$SAVE_LIBS
# Set up libgmp on Android. Make sure to override what gnulib has
# found.
LIBGMP_CFLAGS=