From 9448e3ecf24c4add93b03f5da39e3e2353eae95d Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 25 Aug 2023 09:28:25 +0100 Subject: [PATCH 1/7] autoconf: Use AS_HELP_STRING if available, fixes warnings for any recent version of autoconf. --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index c40cbd2304b..0216f4297e6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -4,7 +4,7 @@ dnl Autoconf 2.50 can not handle substr correctly. It does have dnl AC_HELP_STRING, so let's try to call it if we can. dnl Note: this define must be on one line so that it can be properly returned dnl as the help string. -AC_DEFUN([APACHE_HELP_STRING],[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[ ]$1 substr([ ],len($1))$2)])dnl +AC_DEFUN([APACHE_HELP_STRING],[ifdef([AS_HELP_STRING], AS_HELP_STRING($1, $2),[ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING($1,$2),[ ]$1 substr([ ],len($1))$2)])])dnl dnl APACHE_SUBST(VARIABLE) dnl Makes VARIABLE available in generated files From a10a6946167e3f52e0ecca3154e0fdc2b46ea091 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 25 Aug 2023 09:29:11 +0100 Subject: [PATCH 2/7] configure: Fix autoconf warnings. --- configure.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure.in b/configure.in index c56c8972afd..f88b8dfa031 100644 --- a/configure.in +++ b/configure.in @@ -429,8 +429,6 @@ AC_AIX AC_MINIX ]) -AC_ISC_POSIX - # Ensure that satisfactory versions of apr and apr-util are # found if external copies are configured. if test "${apr_found}" = "yes"; then @@ -744,7 +742,7 @@ if test "$enable_pie" = "yes"; then PICFLAGS="-fPIE" PILDFLAGS="-pie" else - AC_ERROR([--enable-pie requested but $CC failed using PIE flags]) + AC_MSG_ERROR([--enable-pie requested but $CC failed using PIE flags]) fi fi APACHE_SUBST(PICFLAGS) From 59e0e8580768846dec4cf1c2e47a1efbbeba01dc Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 25 Aug 2023 09:30:41 +0100 Subject: [PATCH 3/7] * acinclude.m4 (APACHE_CHECK_OPENSSL): Use AC_CACHE_CHECK/AC_COMPILE_IFELSE to fix autoconf warnings. --- acinclude.m4 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 0216f4297e6..46c515d9143 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -585,17 +585,17 @@ AC_DEFUN([APACHE_CHECK_OPENSSL],[ fi fi - AC_MSG_CHECKING([for OpenSSL version >= 0.9.8a]) - AC_TRY_COMPILE([#include ],[ + AC_CACHE_CHECK([for OpenSSL version >= 0.9.8a], [ap_cv_openssl098a], [ + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include ],[ #if !defined(OPENSSL_VERSION_NUMBER) #error "Missing OpenSSL version" #endif #if OPENSSL_VERSION_NUMBER < 0x0090801f #error "Unsupported OpenSSL version " OPENSSL_VERSION_TEXT -#endif], - [AC_MSG_RESULT(yes) - ac_cv_openssl=yes], - [AC_MSG_RESULT(no)]) +#endif]), [ap_cv_openssl098a=yes], [ap_cv_openssl098a=no])]) + if test "x$ap_cv_openssl098a" = xyes; then + ac_cv_openssl=yes + fi if test "x$ac_cv_openssl" = "xyes"; then ap_openssl_libs="${ap_openssl_libs:--lssl -lcrypto} `$apr_config --libs`" From ae8455c468762a7ef01a9c7f8a6ca4e08a7afe66 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 14 Feb 2025 09:45:25 +0000 Subject: [PATCH 4/7] * os/unix/config.m4: Move check for rlim_t here and use AC_CHECK_TYPE. * acinclude.m4: Remove APACHE_TYPE_RLIM_T. --- acinclude.m4 | 22 ---------------------- os/unix/config.m4 | 7 ++++++- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 46c515d9143..21fb645310a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -120,28 +120,6 @@ AC_DEFUN([APACHE_GEN_CONFIG_VARS],[ done ]) -dnl -dnl APACHE_TYPE_RLIM_T -dnl -dnl If rlim_t is not defined, define it to int -dnl -AC_DEFUN([APACHE_TYPE_RLIM_T], [ - AC_CACHE_CHECK([for rlim_t], ac_cv_type_rlim_t, [ - AC_TRY_COMPILE([ -#include -#include -#include -], [rlim_t spoon;], [ - ac_cv_type_rlim_t=yes - ],[ac_cv_type_rlim_t=no - ]) - ]) - if test "$ac_cv_type_rlim_t" = "no" ; then - AC_DEFINE(rlim_t, int, - [Define to 'int' if doesn't define it for us]) - fi -]) - dnl the list of build variables which are available for customization on a dnl per module subdir basis (to be inserted into modules.mk with a "MOD_" dnl prefix, i.e. MOD_CFLAGS etc.). Used in APACHE_MODPATH_{INIT,FINISH}. diff --git a/os/unix/config.m4 b/os/unix/config.m4 index dacbf6b5398..a2b443334ed 100644 --- a/os/unix/config.m4 +++ b/os/unix/config.m4 @@ -1,5 +1,10 @@ if test "$OS" = "unix" ; then - APACHE_TYPE_RLIM_T + AC_CHECK_TYPE(rlim_t, [], + AC_DEFINE_UNQUOTED(rlim_t, int, + [Define to 'int' if doesn't define it for us]), + [#include +#include +#include ]) AC_CHECK_HEADERS(sys/time.h sys/resource.h sys/sem.h sys/ipc.h) From a954ab6b930498eccc14f811d216f4585ff79168 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 14 Feb 2025 10:03:23 +0000 Subject: [PATCH 5/7] * configure.in: Use AC_CHECK_MEMBER for struct tm.tm_gmtoff test. --- configure.in | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/configure.in b/configure.in index f88b8dfa031..a835570a43c 100644 --- a/configure.in +++ b/configure.in @@ -567,13 +567,10 @@ case ${host}X${ac_cv_func_gettid}X${ap_cv_gettid} in esac dnl ## Check for the tm_gmtoff field in struct tm to get the timezone diffs -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([#include -#include ], [struct tm tm; tm.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) -if test "$ac_cv_struct_tm_gmtoff" = "yes"; then - AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field]) -fi +AC_CHECK_MEMBER([struct tm.tm_gmtoff], + [AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field])], [], + [#include +#include ]) AC_CHECK_DECL(CMSG_DATA,,, [#include #include ]) From e83da00e7e29bbab3ae0a301ece2e87b8651c0a7 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 14 Feb 2025 10:10:25 +0000 Subject: [PATCH 6/7] * buildconf: Run autoconf with -Wall -Wno-cross to suppress cross-compilation warnings by default, rather than grep. Support --with-errors argument to add -Werror and fail on autoconf/autoheader warnings. Fail if autoheader or autoconf fail. Add "buildconf: " prefix to output messages. --- buildconf | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/buildconf b/buildconf index e7199a70d87..74ad23c7a40 100755 --- a/buildconf +++ b/buildconf @@ -36,6 +36,7 @@ esac apr_src_dir="srclib/apr ../apr" apu_src_dir="" +autoconf_args="-Wall" # By default, touch the checked-in sources to suppress regeneration of # the ap_expr parser. @@ -61,6 +62,10 @@ do --with-regen-expr) regen_expr=yes ;; + + --with-errors) + autoconf_args="$autoconf_args -Werror" + ;; -h|--help) cat <&1 | grep -v "$cross_compile_warning" +if ${AUTOHEADER:-autoheader} ${autoconf_args}; then + : +else + echo buildconf: ERROR: autoheader failed, bailing out. + exit 1 +fi -echo rebuilding configure +echo buildconf: rebuilding configure rm -f config.cache -${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning" +if ${AUTOCONF:-autoconf} ${autoconf_args}; then + : +else + echo buildconf: ERROR: autoconf failed, bailing out. + exit 2 +fi # Remove autoconf 2.5x cache directories rm -rf autom4te*.cache @@ -309,7 +326,7 @@ rm -rf autom4te*.cache rm -rf bsd_converted if [ -f `which cut` ]; then - echo rebuilding rpm spec file + echo buildconf: rebuilding rpm spec file ( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER` EPOCH=`build/get-version.sh epoch include/ap_release.h AP_SERVER` REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER` From ef398dd207b84ad73c3020ac292b69731fbf52dc Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Fri, 14 Feb 2025 10:12:52 +0000 Subject: [PATCH 7/7] CI: Add workflow to fail if autoconf/autoheader warnings are produced. --- .github/workflows/linux.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 50433612e67..9e032ae1e52 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -36,6 +36,11 @@ jobs: SKIP_TESTING=1 TEST_LOGNO=1 # ------------------------------------------------------------------------- + - name: autoconf warnings test + env: | + BUILDCONFIG=--with-errors + SKIP_TESTING=1 + # ------------------------------------------------------------------------- - name: Default # ------------------------------------------------------------------------- - name: All-static modules