From 2bd7f85796ec373ecae61dd480437b3e668ec883 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 25 Feb 2017 18:10:09 -0500 Subject: [PATCH] Remove some configure header-file checks that we weren't really using. We had some AC_CHECK_HEADER tests that were really wastes of cycles, because the code proceeded to #include those headers unconditionally anyway, in all or a large majority of cases. The lack of complaints shows that those headers are available on every platform of interest, so we might as well let configure run a bit faster by not probing those headers at all. I suspect that some of the tests I left alone are equally useless, but since all the existing #includes of the remaining headers are properly guarded, I didn't touch them. --- config/ac_func_accept_argtypes.m4 | 9 +------- config/c-library.m4 | 10 ++++---- configure | 38 ++++--------------------------- configure.in | 8 +------ src/backend/libpq/ifaddr.c | 2 -- src/bin/psql/command.c | 2 -- src/include/libpq/libpq-be.h | 2 -- src/include/pg_config.h.in | 15 ------------ src/include/pg_config.h.win32 | 12 ---------- 9 files changed, 12 insertions(+), 86 deletions(-) diff --git a/config/ac_func_accept_argtypes.m4 b/config/ac_func_accept_argtypes.m4 index e57f3e6f00..ee28bacf4b 100644 --- a/config/ac_func_accept_argtypes.m4 +++ b/config/ac_func_accept_argtypes.m4 @@ -14,9 +14,6 @@ dnl #define ACCEPT_TYPE_ARG1 int dnl #define ACCEPT_TYPE_ARG2 struct sockaddr * dnl #define ACCEPT_TYPE_ARG3 socklen_t dnl -dnl This macro requires AC_CHECK_HEADERS to have already verified the -dnl presence or absence of sys/types.h and sys/socket.h. -dnl dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES dnl macro. Credit for that one goes to David MacKenzie et. al. dnl @@ -51,12 +48,8 @@ AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES], for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do AC_COMPILE_IFELSE([AC_LANG_SOURCE( -[#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H +[#include #include -#endif extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);])], [ac_not_found=no; break 4], [ac_not_found=yes]) done diff --git a/config/c-library.m4 b/config/c-library.m4 index 4ff8dae141..9c2207b03d 100644 --- a/config/c-library.m4 +++ b/config/c-library.m4 @@ -111,8 +111,12 @@ fi AC_DEFUN([PGAC_UNION_SEMUN], [AC_CHECK_TYPES([union semun], [], [], [#include +#ifdef HAVE_SYS_IPC_H #include -#include ])])# PGAC_UNION_SEMUN +#endif +#ifdef HAVE_SYS_SEM_H +#include +#endif])])# PGAC_UNION_SEMUN # PGAC_STRUCT_SOCKADDR_UN @@ -135,9 +139,7 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_UN], AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE], [AC_CHECK_TYPES([struct sockaddr_storage], [], [], [#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif ])])# PGAC_STRUCT_SOCKADDR_STORAGE # PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS @@ -154,9 +156,7 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS], struct sockaddr_storage.__ss_len, struct sockaddr.sa_len], [], [], [#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif ])])# PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS diff --git a/configure b/configure index bbbe81170a..b5cdebb510 100755 --- a/configure +++ b/configure @@ -10332,7 +10332,7 @@ fi ## Header files ## -for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h pwd.h sys/epoll.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h +for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -10351,9 +10351,7 @@ done for ac_header in net/if.h do : ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_header_net_if_h" = xyes; then : @@ -10386,24 +10384,10 @@ done # At least on IRIX, test for netinet/tcp.h will fail unless # netinet/in.h is included first. -for ac_header in netinet/in.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_NETINET_IN_H 1 -_ACEOF - -fi - -done - for ac_header in netinet/tcp.h do : ac_fn_c_check_header_compile "$LINENO" "netinet/tcp.h" "ac_cv_header_netinet_tcp_h" "$ac_includes_default -#ifdef HAVE_NETINET_IN_H #include -#endif " if test "x$ac_cv_header_netinet_tcp_h" = xyes; then : @@ -11671,8 +11655,12 @@ $as_echo "#define HAVE_TZNAME 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "union semun" "ac_cv_type_union_semun" "#include +#ifdef HAVE_SYS_IPC_H #include +#endif +#ifdef HAVE_SYS_SEM_H #include +#endif " if test "x$ac_cv_type_union_semun" = xyes; then : @@ -11696,9 +11684,7 @@ $as_echo "#define HAVE_UNIX_SOCKETS 1" >>confdefs.h fi ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" "#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then : @@ -11711,9 +11697,7 @@ _ACEOF fi ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes; then : @@ -11725,9 +11709,7 @@ _ACEOF fi ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "__ss_family" "ac_cv_member_struct_sockaddr_storage___ss_family" "#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_member_struct_sockaddr_storage___ss_family" = xyes; then : @@ -11739,9 +11721,7 @@ _ACEOF fi ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_len" "ac_cv_member_struct_sockaddr_storage_ss_len" "#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_member_struct_sockaddr_storage_ss_len" = xyes; then : @@ -11753,9 +11733,7 @@ _ACEOF fi ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "__ss_len" "ac_cv_member_struct_sockaddr_storage___ss_len" "#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_member_struct_sockaddr_storage___ss_len" = xyes; then : @@ -11767,9 +11745,7 @@ _ACEOF fi ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include -#ifdef HAVE_SYS_SOCKET_H #include -#endif " if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then : @@ -12427,12 +12403,8 @@ else for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef HAVE_SYS_TYPES_H #include -#endif -#ifdef HAVE_SYS_SOCKET_H #include -#endif extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *); _ACEOF if ac_fn_c_try_compile "$LINENO"; then : diff --git a/configure.in b/configure.in index dab8ab3b32..1d99cda1d8 100644 --- a/configure.in +++ b/configure.in @@ -1162,16 +1162,13 @@ AC_SUBST(UUID_LIBS) ## Header files ## -dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES -AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h pwd.h sys/epoll.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) +AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) # On BSD, test for net/if.h will fail unless sys/socket.h # is included first. AC_CHECK_HEADERS(net/if.h, [], [], [AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H #include -#endif ]) # On OpenBSD, test for sys/ucred.h will fail unless sys/param.h @@ -1183,12 +1180,9 @@ AC_CHECK_HEADERS(sys/ucred.h, [], [], # At least on IRIX, test for netinet/tcp.h will fail unless # netinet/in.h is included first. -AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADERS(netinet/tcp.h, [], [], [AC_INCLUDES_DEFAULT -#ifdef HAVE_NETINET_IN_H #include -#endif ]) if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c index f81003f7c8..10643978c7 100644 --- a/src/backend/libpq/ifaddr.c +++ b/src/backend/libpq/ifaddr.c @@ -322,9 +322,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) } #else /* !HAVE_GETIFADDRS && !WIN32 */ -#ifdef HAVE_SYS_IOCTL_H #include -#endif #ifdef HAVE_NET_IF_H #include diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index a28f5134b9..a52adc8186 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -14,9 +14,7 @@ #include #include -#ifdef HAVE_PWD_H #include -#endif #ifndef WIN32 #include /* for stat() */ #include /* open() flags */ diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index 79d38cedd7..2d43815238 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -18,9 +18,7 @@ #ifndef LIBPQ_BE_H #define LIBPQ_BE_H -#ifdef HAVE_SYS_TIME_H #include -#endif #ifdef USE_OPENSSL #include #include diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 8dd73f1d91..5bcd8a1160 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -370,9 +370,6 @@ /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - /* Define to 1 if you have the header file. */ #undef HAVE_NETINET_TCP_H @@ -415,9 +412,6 @@ /* Have PTHREAD_PRIO_INHERIT. */ #undef HAVE_PTHREAD_PRIO_INHERIT -/* Define to 1 if you have the header file. */ -#undef HAVE_PWD_H - /* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM @@ -557,9 +551,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_EPOLL_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_IOCTL_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IPC_H @@ -581,9 +572,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SHM_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKIO_H @@ -593,9 +581,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TAS_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index fd1af59839..3e4132cd82 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -252,9 +252,6 @@ /* Define to 1 if you have the `mkdtemp' function. */ /* #undef HAVE_MKDTEMP */ -/* Define to 1 if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - /* Define to 1 if you have the header file. */ /* #undef HAVE_NETINET_TCP_H */ @@ -273,9 +270,6 @@ /* Define to 1 if the PS_STRINGS thing exists. */ /* #undef HAVE_PS_STRINGS */ -/* Define to 1 if you have the header file. */ -#define HAVE_PWD_H 1 - /* Define to 1 if you have the `random' function. */ /* #undef HAVE_RANDOM */ @@ -435,15 +429,9 @@ /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_SHM_H */ -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 -- 2.40.0