Skip to content

Commit 2bd7f85

Browse files
committed
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.
1 parent 9e3755e commit 2bd7f85

File tree

9 files changed

+12
-86
lines changed

9 files changed

+12
-86
lines changed

config/ac_func_accept_argtypes.m4

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ dnl #define ACCEPT_TYPE_ARG1 int
1414
dnl #define ACCEPT_TYPE_ARG2 struct sockaddr *
1515
dnl #define ACCEPT_TYPE_ARG3 socklen_t
1616
dnl
17-
dnl This macro requires AC_CHECK_HEADERS to have already verified the
18-
dnl presence or absence of sys/types.h and sys/socket.h.
19-
dnl
2017
dnl NOTE: This is just a modified version of the AC_FUNC_SELECT_ARGTYPES
2118
dnl macro. Credit for that one goes to David MacKenzie et. al.
2219
dnl
@@ -51,12 +48,8 @@ AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES],
5148
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
5249
for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
5350
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
54-
[#ifdef HAVE_SYS_TYPES_H
55-
#include <sys/types.h>
56-
#endif
57-
#ifdef HAVE_SYS_SOCKET_H
51+
[#include <sys/types.h>
5852
#include <sys/socket.h>
59-
#endif
6053
extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);])],
6154
[ac_not_found=no; break 4], [ac_not_found=yes])
6255
done

config/c-library.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ fi
111111
AC_DEFUN([PGAC_UNION_SEMUN],
112112
[AC_CHECK_TYPES([union semun], [], [],
113113
[#include <sys/types.h>
114+
#ifdef HAVE_SYS_IPC_H
114115
#include <sys/ipc.h>
115-
#include <sys/sem.h>])])# PGAC_UNION_SEMUN
116+
#endif
117+
#ifdef HAVE_SYS_SEM_H
118+
#include <sys/sem.h>
119+
#endif])])# PGAC_UNION_SEMUN
116120

117121

118122
# PGAC_STRUCT_SOCKADDR_UN
@@ -135,9 +139,7 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_UN],
135139
AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE],
136140
[AC_CHECK_TYPES([struct sockaddr_storage], [], [],
137141
[#include <sys/types.h>
138-
#ifdef HAVE_SYS_SOCKET_H
139142
#include <sys/socket.h>
140-
#endif
141143
])])# PGAC_STRUCT_SOCKADDR_STORAGE
142144

143145
# PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
@@ -154,9 +156,7 @@ AC_DEFUN([PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS],
154156
struct sockaddr_storage.__ss_len,
155157
struct sockaddr.sa_len], [], [],
156158
[#include <sys/types.h>
157-
#ifdef HAVE_SYS_SOCKET_H
158159
#include <sys/socket.h>
159-
#endif
160160
])])# PGAC_STRUCT_SOCKADDR_STORAGE_MEMBERS
161161

162162

configure

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10332,7 +10332,7 @@ fi
1033210332
## Header files
1033310333
##
1033410334

10335-
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
10335+
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
1033610336
do :
1033710337
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
1033810338
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -10351,9 +10351,7 @@ done
1035110351
for ac_header in net/if.h
1035210352
do :
1035310353
ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default
10354-
#ifdef HAVE_SYS_SOCKET_H
1035510354
#include <sys/socket.h>
10356-
#endif
1035710355
1035810356
"
1035910357
if test "x$ac_cv_header_net_if_h" = xyes; then :
@@ -10386,24 +10384,10 @@ done
1038610384

1038710385
# At least on IRIX, test for netinet/tcp.h will fail unless
1038810386
# netinet/in.h is included first.
10389-
for ac_header in netinet/in.h
10390-
do :
10391-
ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default"
10392-
if test "x$ac_cv_header_netinet_in_h" = xyes; then :
10393-
cat >>confdefs.h <<_ACEOF
10394-
#define HAVE_NETINET_IN_H 1
10395-
_ACEOF
10396-
10397-
fi
10398-
10399-
done
10400-
1040110387
for ac_header in netinet/tcp.h
1040210388
do :
1040310389
ac_fn_c_check_header_compile "$LINENO" "netinet/tcp.h" "ac_cv_header_netinet_tcp_h" "$ac_includes_default
10404-
#ifdef HAVE_NETINET_IN_H
1040510390
#include <netinet/in.h>
10406-
#endif
1040710391
1040810392
"
1040910393
if test "x$ac_cv_header_netinet_tcp_h" = xyes; then :
@@ -11671,8 +11655,12 @@ $as_echo "#define HAVE_TZNAME 1" >>confdefs.h
1167111655
fi
1167211656

1167311657
ac_fn_c_check_type "$LINENO" "union semun" "ac_cv_type_union_semun" "#include <sys/types.h>
11658+
#ifdef HAVE_SYS_IPC_H
1167411659
#include <sys/ipc.h>
11660+
#endif
11661+
#ifdef HAVE_SYS_SEM_H
1167511662
#include <sys/sem.h>
11663+
#endif
1167611664
"
1167711665
if test "x$ac_cv_type_union_semun" = xyes; then :
1167811666

@@ -11696,9 +11684,7 @@ $as_echo "#define HAVE_UNIX_SOCKETS 1" >>confdefs.h
1169611684
fi
1169711685

1169811686
ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" "#include <sys/types.h>
11699-
#ifdef HAVE_SYS_SOCKET_H
1170011687
#include <sys/socket.h>
11701-
#endif
1170211688
1170311689
"
1170411690
if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then :
@@ -11711,9 +11697,7 @@ _ACEOF
1171111697
fi
1171211698

1171311699
ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "#include <sys/types.h>
11714-
#ifdef HAVE_SYS_SOCKET_H
1171511700
#include <sys/socket.h>
11716-
#endif
1171711701
1171811702
"
1171911703
if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes; then :
@@ -11725,9 +11709,7 @@ _ACEOF
1172511709

1172611710
fi
1172711711
ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "__ss_family" "ac_cv_member_struct_sockaddr_storage___ss_family" "#include <sys/types.h>
11728-
#ifdef HAVE_SYS_SOCKET_H
1172911712
#include <sys/socket.h>
11730-
#endif
1173111713
1173211714
"
1173311715
if test "x$ac_cv_member_struct_sockaddr_storage___ss_family" = xyes; then :
@@ -11739,9 +11721,7 @@ _ACEOF
1173911721

1174011722
fi
1174111723
ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_len" "ac_cv_member_struct_sockaddr_storage_ss_len" "#include <sys/types.h>
11742-
#ifdef HAVE_SYS_SOCKET_H
1174311724
#include <sys/socket.h>
11744-
#endif
1174511725
1174611726
"
1174711727
if test "x$ac_cv_member_struct_sockaddr_storage_ss_len" = xyes; then :
@@ -11753,9 +11733,7 @@ _ACEOF
1175311733

1175411734
fi
1175511735
ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "__ss_len" "ac_cv_member_struct_sockaddr_storage___ss_len" "#include <sys/types.h>
11756-
#ifdef HAVE_SYS_SOCKET_H
1175711736
#include <sys/socket.h>
11758-
#endif
1175911737
1176011738
"
1176111739
if test "x$ac_cv_member_struct_sockaddr_storage___ss_len" = xyes; then :
@@ -11767,9 +11745,7 @@ _ACEOF
1176711745

1176811746
fi
1176911747
ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include <sys/types.h>
11770-
#ifdef HAVE_SYS_SOCKET_H
1177111748
#include <sys/socket.h>
11772-
#endif
1177311749
1177411750
"
1177511751
if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then :
@@ -12427,12 +12403,8 @@ else
1242712403
for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
1242812404
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1242912405
/* end confdefs.h. */
12430-
#ifdef HAVE_SYS_TYPES_H
1243112406
#include <sys/types.h>
12432-
#endif
12433-
#ifdef HAVE_SYS_SOCKET_H
1243412407
#include <sys/socket.h>
12435-
#endif
1243612408
extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);
1243712409
_ACEOF
1243812410
if ac_fn_c_try_compile "$LINENO"; then :

configure.in

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,16 +1162,13 @@ AC_SUBST(UUID_LIBS)
11621162
## Header files
11631163
##
11641164

1165-
dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
1166-
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])
1165+
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])
11671166

11681167
# On BSD, test for net/if.h will fail unless sys/socket.h
11691168
# is included first.
11701169
AC_CHECK_HEADERS(net/if.h, [], [],
11711170
[AC_INCLUDES_DEFAULT
1172-
#ifdef HAVE_SYS_SOCKET_H
11731171
#include <sys/socket.h>
1174-
#endif
11751172
])
11761173

11771174
# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h
@@ -1183,12 +1180,9 @@ AC_CHECK_HEADERS(sys/ucred.h, [], [],
11831180

11841181
# At least on IRIX, test for netinet/tcp.h will fail unless
11851182
# netinet/in.h is included first.
1186-
AC_CHECK_HEADERS(netinet/in.h)
11871183
AC_CHECK_HEADERS(netinet/tcp.h, [], [],
11881184
[AC_INCLUDES_DEFAULT
1189-
#ifdef HAVE_NETINET_IN_H
11901185
#include <netinet/in.h>
1191-
#endif
11921186
])
11931187

11941188
if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then

src/backend/libpq/ifaddr.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data)
322322
}
323323
#else /* !HAVE_GETIFADDRS && !WIN32 */
324324

325-
#ifdef HAVE_SYS_IOCTL_H
326325
#include <sys/ioctl.h>
327-
#endif
328326

329327
#ifdef HAVE_NET_IF_H
330328
#include <net/if.h>

src/bin/psql/command.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
#include <ctype.h>
1616
#include <time.h>
17-
#ifdef HAVE_PWD_H
1817
#include <pwd.h>
19-
#endif
2018
#ifndef WIN32
2119
#include <sys/stat.h> /* for stat() */
2220
#include <fcntl.h> /* open() flags */

src/include/libpq/libpq-be.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
#ifndef LIBPQ_BE_H
1919
#define LIBPQ_BE_H
2020

21-
#ifdef HAVE_SYS_TIME_H
2221
#include <sys/time.h>
23-
#endif
2422
#ifdef USE_OPENSSL
2523
#include <openssl/ssl.h>
2624
#include <openssl/err.h>

src/include/pg_config.h.in

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,6 @@
370370
/* Define to 1 if you have the `mkdtemp' function. */
371371
#undef HAVE_MKDTEMP
372372

373-
/* Define to 1 if you have the <netinet/in.h> header file. */
374-
#undef HAVE_NETINET_IN_H
375-
376373
/* Define to 1 if you have the <netinet/tcp.h> header file. */
377374
#undef HAVE_NETINET_TCP_H
378375

@@ -415,9 +412,6 @@
415412
/* Have PTHREAD_PRIO_INHERIT. */
416413
#undef HAVE_PTHREAD_PRIO_INHERIT
417414

418-
/* Define to 1 if you have the <pwd.h> header file. */
419-
#undef HAVE_PWD_H
420-
421415
/* Define to 1 if you have the `random' function. */
422416
#undef HAVE_RANDOM
423417

@@ -557,9 +551,6 @@
557551
/* Define to 1 if you have the <sys/epoll.h> header file. */
558552
#undef HAVE_SYS_EPOLL_H
559553

560-
/* Define to 1 if you have the <sys/ioctl.h> header file. */
561-
#undef HAVE_SYS_IOCTL_H
562-
563554
/* Define to 1 if you have the <sys/ipc.h> header file. */
564555
#undef HAVE_SYS_IPC_H
565556

@@ -581,9 +572,6 @@
581572
/* Define to 1 if you have the <sys/shm.h> header file. */
582573
#undef HAVE_SYS_SHM_H
583574

584-
/* Define to 1 if you have the <sys/socket.h> header file. */
585-
#undef HAVE_SYS_SOCKET_H
586-
587575
/* Define to 1 if you have the <sys/sockio.h> header file. */
588576
#undef HAVE_SYS_SOCKIO_H
589577

@@ -593,9 +581,6 @@
593581
/* Define to 1 if you have the <sys/tas.h> header file. */
594582
#undef HAVE_SYS_TAS_H
595583

596-
/* Define to 1 if you have the <sys/time.h> header file. */
597-
#undef HAVE_SYS_TIME_H
598-
599584
/* Define to 1 if you have the <sys/types.h> header file. */
600585
#undef HAVE_SYS_TYPES_H
601586

src/include/pg_config.h.win32

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,6 @@
252252
/* Define to 1 if you have the `mkdtemp' function. */
253253
/* #undef HAVE_MKDTEMP */
254254

255-
/* Define to 1 if you have the <netinet/in.h> header file. */
256-
#define HAVE_NETINET_IN_H 1
257-
258255
/* Define to 1 if you have the <netinet/tcp.h> header file. */
259256
/* #undef HAVE_NETINET_TCP_H */
260257

@@ -273,9 +270,6 @@
273270
/* Define to 1 if the PS_STRINGS thing exists. */
274271
/* #undef HAVE_PS_STRINGS */
275272

276-
/* Define to 1 if you have the <pwd.h> header file. */
277-
#define HAVE_PWD_H 1
278-
279273
/* Define to 1 if you have the `random' function. */
280274
/* #undef HAVE_RANDOM */
281275

@@ -435,15 +429,9 @@
435429
/* Define to 1 if you have the <sys/shm.h> header file. */
436430
/* #undef HAVE_SYS_SHM_H */
437431

438-
/* Define to 1 if you have the <sys/socket.h> header file. */
439-
#define HAVE_SYS_SOCKET_H 1
440-
441432
/* Define to 1 if you have the <sys/stat.h> header file. */
442433
#define HAVE_SYS_STAT_H 1
443434

444-
/* Define to 1 if you have the <sys/time.h> header file. */
445-
#define HAVE_SYS_TIME_H 1
446-
447435
/* Define to 1 if you have the <sys/types.h> header file. */
448436
#define HAVE_SYS_TYPES_H 1
449437

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy