From 53d3cbe8b52f537fc5896cb3de143fc361276ce9 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 18 Feb 2022 09:47:20 -0500 Subject: [PATCH v4 2/2] Demote AC_CHECK_HEADERS calls to AC_CHECK_HEADER were we can. The difference between these two autoconf macros is that the former defines a preprocessor symbol while the latter does not. So we should prefer the latter where the preprocessor symbol is not used anywhere. Most of the tests in configure.ac follow this rule already, but these few escaped previous notice. Discussion: http://postgr.es/m/20220218013612.2fpzbbb7wnfogblj@alap3.anarazel.de --- configure | 28 ++-------------------------- configure.ac | 8 ++++---- src/include/pg_config.h.in | 12 ------------ src/tools/msvc/Solution.pm | 5 ----- 4 files changed, 6 insertions(+), 47 deletions(-) diff --git a/configure b/configure index ca890b8b07..eed516404f 100755 --- a/configure +++ b/configure @@ -14088,19 +14088,13 @@ $as_echo "$LZ4" >&6; } fi if test "$with_lz4" = yes; then - for ac_header in lz4.h -do : ac_fn_c_check_header_mongrel "$LINENO" "lz4.h" "ac_cv_header_lz4_h" "$ac_includes_default" if test "x$ac_cv_header_lz4_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LZ4_H 1 -_ACEOF else as_fn_error $? "lz4.h header file is required for LZ4" "$LINENO" 5 fi -done fi @@ -14170,13 +14164,8 @@ fi fi if test "$with_gssapi" = yes ; then - for ac_header in gssapi/gssapi.h -do : ac_fn_c_check_header_mongrel "$LINENO" "gssapi/gssapi.h" "ac_cv_header_gssapi_gssapi_h" "$ac_includes_default" if test "x$ac_cv_header_gssapi_gssapi_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GSSAPI_GSSAPI_H 1 -_ACEOF else for ac_header in gssapi.h @@ -14195,7 +14184,6 @@ done fi -done fi @@ -14294,19 +14282,13 @@ fi if test "$with_ldap" = yes ; then if test "$PORTNAME" != "win32"; then - for ac_header in ldap.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default" + ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default" if test "x$ac_cv_header_ldap_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LDAP_H 1 -_ACEOF else as_fn_error $? "header file is required for LDAP" "$LINENO" 5 fi -done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compatible LDAP implementation" >&5 $as_echo_n "checking for compatible LDAP implementation... " >&6; } @@ -14350,22 +14332,16 @@ $as_echo "$as_me: WARNING: *** also uses LDAP will crash on exit." >&2;} fi else - for ac_header in winldap.h -do : - ac_fn_c_check_header_compile "$LINENO" "winldap.h" "ac_cv_header_winldap_h" "$ac_includes_default + ac_fn_c_check_header_compile "$LINENO" "winldap.h" "ac_cv_header_winldap_h" "$ac_includes_default #include " if test "x$ac_cv_header_winldap_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_WINLDAP_H 1 -_ACEOF else as_fn_error $? "header file is required for LDAP" "$LINENO" 5 fi -done fi fi diff --git a/configure.ac b/configure.ac index 331683b336..c485831d46 100644 --- a/configure.ac +++ b/configure.ac @@ -1515,7 +1515,7 @@ fi PGAC_PATH_PROGS(LZ4, lz4) if test "$with_lz4" = yes; then - AC_CHECK_HEADERS(lz4.h, [], [AC_MSG_ERROR([lz4.h header file is required for LZ4])]) + AC_CHECK_HEADER(lz4.h, [], [AC_MSG_ERROR([lz4.h header file is required for LZ4])]) fi PGAC_PATH_PROGS(ZSTD, zstd) @@ -1524,7 +1524,7 @@ if test "$with_zstd" = yes; then fi if test "$with_gssapi" = yes ; then - AC_CHECK_HEADERS(gssapi/gssapi.h, [], + AC_CHECK_HEADER(gssapi/gssapi.h, [], [AC_CHECK_HEADERS(gssapi.h, [], [AC_MSG_ERROR([gssapi.h header file is required for GSSAPI])])]) fi @@ -1557,11 +1557,11 @@ fi if test "$with_ldap" = yes ; then if test "$PORTNAME" != "win32"; then - AC_CHECK_HEADERS(ldap.h, [], + AC_CHECK_HEADER(ldap.h, [], [AC_MSG_ERROR([header file is required for LDAP])]) PGAC_LDAP_SAFE else - AC_CHECK_HEADERS(winldap.h, [], + AC_CHECK_HEADER(winldap.h, [], [AC_MSG_ERROR([header file is required for LDAP])], [AC_INCLUDES_DEFAULT #include diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 635fbb2181..f3cfdd3a35 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -256,9 +256,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define to 1 if you have the header file. */ -#undef HAVE_GSSAPI_GSSAPI_H - /* Define to 1 if you have the header file. */ #undef HAVE_GSSAPI_H @@ -310,9 +307,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H -/* Define to 1 if you have the header file. */ -#undef HAVE_LDAP_H - /* Define to 1 if you have the `ldap_initialize' function. */ #undef HAVE_LDAP_INITIALIZE @@ -367,9 +361,6 @@ /* Define to 1 if `long long int' works and is 64 bits. */ #undef HAVE_LONG_LONG_INT_64 -/* Define to 1 if you have the header file. */ -#undef HAVE_LZ4_H - /* Define to 1 if you have the header file. */ #undef HAVE_MBARRIER_H @@ -709,9 +700,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_WCTYPE_H -/* Define to 1 if you have the header file. */ -#undef HAVE_WINLDAP_H - /* Define to 1 if you have the `writev' function. */ #undef HAVE_WRITEV diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index a21ea9bef9..21e575d1bf 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -279,7 +279,6 @@ sub GenerateFiles HAVE_GETRLIMIT => undef, HAVE_GETRUSAGE => undef, HAVE_GETTIMEOFDAY => undef, - HAVE_GSSAPI_GSSAPI_H => undef, HAVE_GSSAPI_H => undef, HAVE_HMAC_CTX_FREE => undef, HAVE_HMAC_CTX_NEW => undef, @@ -297,7 +296,6 @@ sub GenerateFiles HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P => undef, HAVE_KQUEUE => undef, HAVE_LANGINFO_H => undef, - HAVE_LDAP_H => undef, HAVE_LDAP_INITIALIZE => undef, HAVE_LIBCRYPTO => undef, HAVE_LIBLDAP => undef, @@ -316,7 +314,6 @@ sub GenerateFiles HAVE_LOCALE_T => 1, HAVE_LONG_INT_64 => undef, HAVE_LONG_LONG_INT_64 => 1, - HAVE_LZ4_H => undef, HAVE_MBARRIER_H => undef, HAVE_MBSTOWCS_L => 1, HAVE_MEMORY_H => 1, @@ -427,7 +424,6 @@ sub GenerateFiles HAVE_UUID_OSSP => undef, HAVE_UUID_H => undef, HAVE_UUID_UUID_H => undef, - HAVE_WINLDAP_H => undef, HAVE_WCSTOMBS_L => 1, HAVE_WCTYPE_H => 1, HAVE_WRITEV => undef, @@ -539,7 +535,6 @@ sub GenerateFiles if ($self->{options}->{lz4}) { $define{HAVE_LIBLZ4} = 1; - $define{HAVE_LZ4_H} = 1; $define{USE_LZ4} = 1; } if ($self->{options}->{zstd}) -- 2.24.3 (Apple Git-128)