OSDN Git Service

Add sys/types include for sockaddr test to configure
[pg-rex/syncrep.git] / config / c-library.m4
1 # Macros that test various C library quirks
2 # $Header: /cvsroot/pgsql/config/c-library.m4,v 1.3 2000/10/02 03:55:15 momjian Exp $
3
4
5 # PGAC_VAR_INT_TIMEZONE
6 # ---------------------
7 # Check if the global variable `timezone' exists. If so, define
8 # HAVE_INT_TIMEZONE.
9 AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
10 [AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
11 [AC_TRY_LINK([#include <time.h>],
12   [int res = timezone / 60;],
13   [pgac_cv_var_int_timezone=yes],
14   [pgac_cv_var_int_timezone=no])])
15 if test x"$pgac_cv_var_int_timezone" = xyes ; then
16   AC_DEFINE(HAVE_INT_TIMEZONE,, [Set to 1 if you have the global variable timezone])
17 fi])# PGAC_VAR_INT_TIMEZONE
18
19
20 # PGAC_FUNC_GETTIMEOFDAY_1ARG
21 # ---------------------------
22 # Check if gettimeofday() has only one arguments. (Normal is two.)
23 # If so, define GETTIMEOFDAY_1ARG.
24 AC_DEFUN([PGAC_FUNC_GETTIMEOFDAY_1ARG],
25 [AC_CACHE_CHECK(whether gettimeofday takes only one argument,
26 pgac_cv_func_gettimeofday_1arg,
27 [AC_TRY_COMPILE([#include <sys/time.h>],
28 [struct timeval *tp;
29 struct timezone *tzp;
30 gettimeofday(tp,tzp);],
31 [pgac_cv_func_gettimeofday_1arg=no],
32 [pgac_cv_func_gettimeofday_1arg=yes])])
33 if test x"$pgac_cv_func_gettimeofday_1arg" = xyes ; then
34   AC_DEFINE(GETTIMEOFDAY_1ARG,, [Set to 1 if gettimeofday() takes only 1 argument])
35 fi])# PGAC_FUNC_GETTIMEOFDAY_1ARG
36
37
38 # PGAC_UNION_SEMUN
39 # ----------------
40 # Check if `union semun' exists. Define HAVE_UNION_SEMUN if so.
41 # If it doesn't then one could define it as
42 # union semun { int val; struct semid_ds *buf; unsigned short *array; }
43 AC_DEFUN([PGAC_UNION_SEMUN],
44 [AC_CACHE_CHECK(for union semun, pgac_cv_union_semun,
45 [AC_TRY_COMPILE([#include <sys/types.h>
46 #include <sys/ipc.h>
47 #include <sys/sem.h>],
48   [union semun semun;],
49   [pgac_cv_union_semun=yes],
50   [pgac_cv_union_semun=no])])
51 if test x"$pgac_cv_union_semun" = xyes ; then
52   AC_DEFINE(HAVE_UNION_SEMUN, 1, [Set to 1 if you have `union semun'])
53 fi])# PGAC_UNION_SEMUN
54
55
56 # PGAC_STRUCT_SOCKADDR_UN
57 # -----------------------
58 # If `struct sockaddr_un' exists, define HAVE_STRUCT_SOCKADDR_UN. If
59 # it is missing then one could define it as { short int sun_family;
60 # char sun_path[108]; }. (Requires test for <sys/un.h>!)
61 AC_DEFUN([PGAC_STRUCT_SOCKADDR_UN],
62 [AC_CACHE_CHECK([for struct sockaddr_un], pgac_cv_struct_sockaddr_un,
63 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
64 #include <sys/types.h>
65 #endif],
66 [AC_TRY_COMPILE([#ifdef HAVE_SYS_UN_H
67 #include <sys/un.h>
68 #endif],
69                 [struct sockaddr_un un;],
70                 [pgac_cv_struct_sockaddr_un=yes],
71                 [pgac_cv_struct_sockaddr_un=no])])
72 if test x"$pgac_cv_struct_sockaddr_un" = xyes; then
73   AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN, 1, [Set to 1 if you have `struct sockaddr_un'])
74 fi])# PGAC_STRUCT_SOCKADDR_UN
75
76
77 # PGAC_FUNC_POSIX_SIGNALS
78 # -----------------------
79 # Check to see if the machine has the POSIX signal interface. Define
80 # HAVE_POSIX_SIGNALS if so. Also set the output variable HAVE_POSIX_SIGNALS
81 # to yes or no.
82 #
83 # Note that this test only compiles a test program, it doesn't check
84 # whether the routines actually work. If that becomes a problem, make
85 # a fancier check.
86 AC_DEFUN([PGAC_FUNC_POSIX_SIGNALS],
87 [AC_CACHE_CHECK(for POSIX signal interface, pgac_cv_func_posix_signals,
88 [AC_TRY_LINK([#include <signal.h>
89 ],
90 [struct sigaction act, oact;
91 sigemptyset(&act.sa_mask);
92 act.sa_flags = SA_RESTART;
93 sigaction(0, &act, &oact);],
94 [pgac_cv_func_posix_signals=yes],
95 [pgac_cv_func_posix_signals=no])])
96 if test x"$pgac_cv_func_posix_signals" = xyes ; then
97   AC_DEFINE(HAVE_POSIX_SIGNALS,, [Set to 1 if you have the POSIX signal interface])
98 fi
99 HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
100 AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS