11# Macros that test various C library quirks
2- # $Header: /cvsroot/pgsql/config/c-library.m4,v 1.11 2002/02/23 04: 17:45 petere Exp $
2+ # $Header: /cvsroot/pgsql/config/c-library.m4,v 1.12 2002/03/29 17:32:53 petere Exp $
33
44
55# PGAC_VAR_INT_TIMEZONE
@@ -37,11 +37,11 @@ fi])# PGAC_FUNC_GETTIMEOFDAY_1ARG
3737
3838
3939# PGAC_FUNC_MEMCMP
40- # -----------
40+ # ----------------
4141# Check if memcmp() properly handles negative bytes and returns +/-.
4242# SunOS does not.
4343# AC_FUNC_MEMCMP
44- AC_DEFUN ( PGAC_FUNC_MEMCMP ,
44+ AC_DEFUN ( [ PGAC_FUNC_MEMCMP] ,
4545[ AC_CACHE_CHECK ( for 8-bit clean memcmp ,pgac_cv_func_memcmp_clean ,
4646[ AC_TRY_RUN ( [
4747main()
@@ -66,16 +66,10 @@ AC_SUBST(MEMCMP)dnl
6666# If it doesn't then one could define it as
6767# union semun { int val; struct semid_ds *buf; unsigned short *array; }
6868AC_DEFUN ( [ PGAC_UNION_SEMUN] ,
69- [ AC_CACHE_CHECK ( for union semun , pgac_cv_union_semun ,
70- [ AC_TRY_COMPILE ( [ #include <sys/types.h>
69+ [ AC_CHECK_TYPE ( [ union semun] , [ ] , [ ] ,
70+ [ #include <sys/types.h>
7171#include <sys/ipc.h>
72- #include <sys/sem.h>] ,
73- [ union semun semun;] ,
74- [ pgac_cv_union_semun=yes] ,
75- [ pgac_cv_union_semun=no] ) ] )
76- if test x"$pgac_cv_union_semun" = xyes ; then
77- AC_DEFINE ( HAVE_UNION_SEMUN ,1 ,[ Set to 1 if you have `union semun'] )
78- fi] ) # PGAC_UNION_SEMUN
72+ #include <sys/sem.h>] ) ] ) # PGAC_UNION_SEMUN
7973
8074
8175# PGAC_STRUCT_SOCKADDR_UN
@@ -84,17 +78,12 @@ fi])# PGAC_UNION_SEMUN
8478# it is missing then one could define it as { short int sun_family;
8579# char sun_path[108]; }. (Requires test for <sys/un.h>!)
8680AC_DEFUN ( [ PGAC_STRUCT_SOCKADDR_UN] ,
87- [ AC_CACHE_CHECK ( [ for struct sockaddr_un] ,pgac_cv_struct_sockaddr_un ,
88- [ AC_TRY_COMPILE ( [ #include <sys/types.h>
81+ [ AC_CHECK_TYPES ( [ struct sockaddr_un] ,[ ] , [ ] ,
82+ [ #include <sys/types.h>
8983#ifdef HAVE_SYS_UN_H
9084#include <sys/un.h>
91- #endif] ,
92- [ struct sockaddr_un un;] ,
93- [ pgac_cv_struct_sockaddr_un=yes] ,
94- [ pgac_cv_struct_sockaddr_un=no] ) ] )
95- if test x"$pgac_cv_struct_sockaddr_un" = xyes; then
96- AC_DEFINE ( HAVE_STRUCT_SOCKADDR_UN ,1 ,[ Set to 1 if you have `struct sockaddr_un'] )
97- fi] ) # PGAC_STRUCT_SOCKADDR_UN
85+ #endif
86+ ] ) ] ) # PGAC_STRUCT_SOCKADDR_UN
9887
9988
10089# PGAC_FUNC_POSIX_SIGNALS
@@ -121,109 +110,3 @@ if test x"$pgac_cv_func_posix_signals" = xyes ; then
121110fi
122111HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
123112AC_SUBST ( HAVE_POSIX_SIGNALS ) ] ) # PGAC_FUNC_POSIX_SIGNALS
124-
125-
126- # PGAC_STRUCT_CMSGCRED
127- # --------------------
128- # Check if `struct cmsgcred' exists. Define HAVE_STRUCT_CMSGCRED if so.
129- AC_DEFUN ( [ PGAC_STRUCT_CMSGCRED] ,
130- [ AC_CACHE_CHECK ( for struct cmsgcred ,pgac_cv_struct_cmsgcred ,
131- [ AC_TRY_COMPILE ( [ #include <sys/param.h>
132- #include <sys/socket.h>
133- #include <sys/ucred.h>] ,
134- [ struct cmsgcred sockcred;] ,
135- [ pgac_cv_struct_cmsgcred=yes] ,
136- [ pgac_cv_struct_cmsgcred=no] ) ] )
137- if test x"$pgac_cv_struct_cmsgcred" = xyes ; then
138- AC_DEFINE ( HAVE_STRUCT_CMSGCRED ,1 ,[ Set to 1 if you have `struct cmsgcred'] )
139- fi] ) # PGAC_STRUCT_CMSGCRED
140-
141-
142- # PGAC_STRUCT_FCRED
143- # -----------------
144- # Check if `struct fcred' exists. Define HAVE_STRUCT_FCRED if so.
145- AC_DEFUN ( [ PGAC_STRUCT_FCRED] ,
146- [ AC_CACHE_CHECK ( for struct fcred ,pgac_cv_struct_fcred ,
147- [ AC_TRY_COMPILE ( [ #include <sys/param.h>
148- #include <sys/socket.h>
149- #include <sys/ucred.h>] ,
150- [ struct fcred sockcred;] ,
151- [ pgac_cv_struct_fcred=yes] ,
152- [ pgac_cv_struct_fcred=no] ) ] )
153- if test x"$pgac_cv_struct_fcred" = xyes ; then
154- AC_DEFINE ( HAVE_STRUCT_FCRED ,1 ,[ Set to 1 if you have `struct fcred'] )
155- fi] ) # PGAC_STRUCT_FCRED
156-
157-
158- # PGAC_STRUCT_SOCKCRED
159- # --------------------
160- # Check if `struct sockcred' exists. Define HAVE_STRUCT_SOCKCRED if so.
161- AC_DEFUN ( [ PGAC_STRUCT_SOCKCRED] ,
162- [ AC_CACHE_CHECK ( for struct sockcred ,pgac_cv_struct_sockcred ,
163- [ AC_TRY_COMPILE ( [ #include <sys/param.h>
164- #include <sys/socket.h>
165- #include <sys/ucred.h>] ,
166- [ struct sockcred sockcred;] ,
167- [ pgac_cv_struct_sockcred=yes] ,
168- [ pgac_cv_struct_sockcred=no] ) ] )
169- if test x"$pgac_cv_struct_sockcred" = xyes ; then
170- AC_DEFINE ( HAVE_STRUCT_SOCKCRED ,1 ,[ Set to 1 if you have `struct sockcred'] )
171- fi] ) # PGAC_STRUCT_SOCKCRED
172-
173-
174- # PGAC_HEADER_STRING
175- # ------------------
176- # Tests whether <string.h> and <strings.h> can both be included
177- # (without generating warnings). This is mostly useful if you need
178- # str[n]casecmp(), since this is not in the "standard" <string.h>
179- # on some systems.
180- AC_DEFUN ( [ PGAC_HEADER_STRING] ,
181- [ AC_CACHE_CHECK ( [ whether string.h and strings.h may both be included] ,
182- [ pgac_cv_header_strings_both] ,
183- [ AC_TRY_CPP (
184- [ #include <string.h>
185- #include <strings.h>
186- ] ,
187- [ AC_TRY_COMPILE (
188- [ #include <string.h>
189- #include <strings.h>
190- ] ,
191- [ int n = strcasecmp("a", "b");] ,
192- [ pgac_cv_header_strings_both=yes] ,
193- [ pgac_cv_header_strings_both=no] ) ] ,
194- [ pgac_cv_header_strings_both=no] ) ] )
195- if test x"$pgac_cv_header_strings_both" = x"yes"; then
196- AC_DEFINE ( [ STRING_H_WITH_STRINGS_H] ,1 ,
197- [ Define if string.h and strings.h may both be included] )
198- fi] )
199-
200-
201- # PGAC_CHECK_MEMBER(AGGREGATE.MEMBER,
202- # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
203- # [INCLUDES])
204- # -----------------------------------------------------------
205-
206- AC_DEFUN ( [ PGAC_CHECK_MEMBER] ,
207- [ changequote ( << ,>> ) dnl
208- dnl The name to #define.
209- define ( <<pgac_define_name>> ,translit ( HAVE_$1 ,[ a-z .*] ,[ A-Z__P] ) ) dnl
210- dnl The cache variable name.
211- define ( <<pgac_cache_name>> ,translit ( pgac_cv_member_$1 ,[ .*] ,[ __p] ) ) dnl
212- changequote ( [ ,] ) dnl
213- AC_CACHE_CHECK ( [ for$1 ] ,[ pgac_cache_name] ,
214- [ AC_TRY_COMPILE ( [ $4 ] ,
215- [ static] patsubst ( [ $1 ] ,[ \..*] ) [ pgac_var;
216- if (pgac_var.] patsubst ( [ $1 ] ,[ ^[ ^.] *\.] ) [ )
217- return 0;] ,
218- [ pgac_cache_name=yes] ,
219- [ pgac_cache_name=no] ) ] )
220-
221- if test x"[ $] pgac_cache_name" = x"yes"; then
222- AC_DEFINE_UNQUOTED ( pgac_define_name )
223- $2
224- else
225- ifelse ( [ $3 ] ,[ ] ,: ,[ $3 ] )
226- fi
227- undefine ( [ pgac_define_name] ) [ ] dnl
228- undefine ( [ pgac_cache_name] ) [ ] dnl
229- ] )