Skip to content

Commit 922ea91

Browse files
committed
Check for and include <getopt.h>
1 parent 6ab7e31 commit 922ea91

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ dnl Checks for header files.
419419
AC_HEADER_STDC
420420
AC_HEADER_SYS_WAIT
421421
AC_CHECK_HEADERS(limits.h unistd.h termios.h values.h sys/select.h)
422-
AC_CHECK_HEADERS(sys/resource.h netdb.h arpa/inet.h)
422+
AC_CHECK_HEADERS(sys/resource.h netdb.h arpa/inet.h getopt.h)
423423
AC_CHECK_HEADERS(readline.h history.h dld.h crypt.h endian.h float.h)
424424
AC_CHECK_HEADERS(readline/history.h ieeefp.h fp_class.h)
425425

src/include/config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* The following is set using configure.
1515
*/
1616

17+
/* Set to 1 if you have <getopt.h> */
18+
#undef HAVE_GETOPT_H
19+
1720
/* Set to 1 if you have <fp_class.h> */
1821
#undef HAVE_FP_CLASS_H
1922

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
/* Placed under the same copyright as PostgresSQL */
44

55
#include <stdio.h>
6-
#include <getopt.h>
6+
#if HAVE_GETOPT_H
7+
# include <getopt.h>
8+
#else
9+
# include <unistd.h>
10+
#endif
711
#include <stdlib.h>
812
#include <strings.h>
913

0 commit comments

Comments
 (0)