Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit af49a16

Browse files
committed
Adjust probe for getaddrinfo to cope with macro-ized definitions, such
as Tru64's. Per previous discussion.
1 parent 45594a6 commit af49a16

File tree

3 files changed

+37
-103
lines changed

3 files changed

+37
-103
lines changed

configure

+23-69
Original file line numberDiff line numberDiff line change
@@ -14160,66 +14160,26 @@ done
1416014160

1416114161
# System's version of getaddrinfo(), if any, may be used only if we found
1416214162
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
14163-
# (Note: the AC_REPLACE_FUNCS probe fails on Windows, where the available
14163+
# (Note: the AC_TRY_LINK probe fails on Windows, where the available
1416414164
# versions of getaddrinfo don't follow normal C call protocol. This is OK
1416514165
# because we want to use our own getaddrinfo.c on Windows anyway.)
1416614166
if test x"$ac_cv_type_struct_addrinfo" = xyes ; then
14167-
14168-
for ac_func in getaddrinfo
14169-
do
14170-
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
14171-
echo "$as_me:$LINENO: checking for $ac_func" >&5
14172-
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
14173-
if eval "test \"\${$as_ac_var+set}\" = set"; then
14174-
echo $ECHO_N "(cached) $ECHO_C" >&6
14175-
else
14167+
echo "$as_me:$LINENO: checking for getaddrinfo" >&5
14168+
echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6
1417614169
cat >conftest.$ac_ext <<_ACEOF
1417714170
/* confdefs.h. */
1417814171
_ACEOF
1417914172
cat confdefs.h >>conftest.$ac_ext
1418014173
cat >>conftest.$ac_ext <<_ACEOF
1418114174
/* end confdefs.h. */
14182-
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
14183-
For example, HP-UX 11i <limits.h> declares gettimeofday. */
14184-
#define $ac_func innocuous_$ac_func
14185-
14186-
/* System header to define __stub macros and hopefully few prototypes,
14187-
which can conflict with char $ac_func (); below.
14188-
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
14189-
<limits.h> exists even on freestanding compilers. */
14190-
14191-
#ifdef __STDC__
14192-
# include <limits.h>
14193-
#else
14194-
# include <assert.h>
14195-
#endif
14196-
14197-
#undef $ac_func
1419814175

14199-
/* Override any gcc2 internal prototype to avoid an error. */
14200-
#ifdef __cplusplus
14201-
extern "C"
14202-
{
14203-
#endif
14204-
/* We use char because int might match the return type of a gcc2
14205-
builtin and then its argument prototype would still apply. */
14206-
char $ac_func ();
14207-
/* The GNU C library defines this for functions which it implements
14208-
to always fail with ENOSYS. Some functions are actually named
14209-
something starting with __ and the normal name is an alias. */
14210-
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
14211-
choke me
14212-
#else
14213-
char (*f) () = $ac_func;
14214-
#endif
14215-
#ifdef __cplusplus
14216-
}
14217-
#endif
14176+
#include <sys/socket.h>
14177+
#include <netdb.h>
1421814178

1421914179
int
1422014180
main ()
1422114181
{
14222-
return f != $ac_func;
14182+
return getaddrinfo("", "", NULL, NULL) ? 0 : 1;
1422314183
;
1422414184
return 0;
1422514185
}
@@ -14246,36 +14206,30 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1424614206
ac_status=$?
1424714207
echo "$as_me:$LINENO: \$? = $ac_status" >&5
1424814208
(exit $ac_status); }; }; then
14249-
eval "$as_ac_var=yes"
14250-
else
14251-
echo "$as_me: failed program was:" >&5
14252-
sed 's/^/| /' conftest.$ac_ext >&5
1425314209

14254-
eval "$as_ac_var=no"
14255-
fi
14256-
rm -f conftest.err conftest.$ac_objext \
14257-
conftest$ac_exeext conftest.$ac_ext
14258-
fi
14259-
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
14260-
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
14261-
if test `eval echo '${'$as_ac_var'}'` = yes; then
14262-
cat >>confdefs.h <<_ACEOF
14263-
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
14210+
cat >>confdefs.h <<\_ACEOF
14211+
#define HAVE_GETADDRINFO 1
1426414212
_ACEOF
1426514213

14214+
echo "$as_me:$LINENO: result: yes" >&5
14215+
echo "${ECHO_T}yes" >&6
1426614216
else
14267-
case $LIBOBJS in
14268-
"$ac_func.$ac_objext" | \
14269-
*" $ac_func.$ac_objext" | \
14270-
"$ac_func.$ac_objext "* | \
14271-
*" $ac_func.$ac_objext "* ) ;;
14272-
*) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;;
14217+
echo "$as_me: failed program was:" >&5
14218+
sed 's/^/| /' conftest.$ac_ext >&5
14219+
14220+
echo "$as_me:$LINENO: result: no" >&5
14221+
echo "${ECHO_T}no" >&6
14222+
case $LIBOBJS in
14223+
"getaddrinfo.$ac_objext" | \
14224+
*" getaddrinfo.$ac_objext" | \
14225+
"getaddrinfo.$ac_objext "* | \
14226+
*" getaddrinfo.$ac_objext "* ) ;;
14227+
*) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext" ;;
1427314228
esac
1427414229

1427514230
fi
14276-
done
14277-
14278-
14231+
rm -f conftest.err conftest.$ac_objext \
14232+
conftest$ac_exeext conftest.$ac_ext
1427914233
else
1428014234
case $LIBOBJS in
1428114235
"getaddrinfo.$ac_objext" | \

configure.in

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.449 2006/02/15 17:23:10 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.450 2006/02/21 06:06:50 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -902,11 +902,21 @@ AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom st
902902

903903
# System's version of getaddrinfo(), if any, may be used only if we found
904904
# a definition for struct addrinfo; see notes in src/include/getaddrinfo.h.
905-
# (Note: the AC_REPLACE_FUNCS probe fails on Windows, where the available
905+
# (Note: the AC_TRY_LINK probe fails on Windows, where the available
906906
# versions of getaddrinfo don't follow normal C call protocol. This is OK
907907
# because we want to use our own getaddrinfo.c on Windows anyway.)
908908
if test x"$ac_cv_type_struct_addrinfo" = xyes ; then
909-
AC_REPLACE_FUNCS([getaddrinfo])
909+
dnl Cannot use AC_CHECK_FUNC because getaddrinfo may be a macro
910+
AC_MSG_CHECKING(for getaddrinfo)
911+
AC_TRY_LINK([
912+
#include <sys/socket.h>
913+
#include <netdb.h>
914+
],
915+
[return getaddrinfo("", "", NULL, NULL) ? 0 : 1;],
916+
[AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have getaddrinfo().])
917+
AC_MSG_RESULT(yes)],
918+
[AC_MSG_RESULT(no)
919+
AC_LIBOBJ(getaddrinfo)])
910920
else
911921
AC_LIBOBJ(getaddrinfo)
912922
fi

src/include/pg_config.h.in

+1-31
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
/* Define to 1 if your compiler understands __FUNCTION__. */
130130
#undef HAVE_FUNCNAME__FUNCTION
131131

132-
/* Define to 1 if you have the `getaddrinfo' function. */
132+
/* Define to 1 if you have getaddrinfo(). */
133133
#undef HAVE_GETADDRINFO
134134

135135
/* Define to 1 if you have the `gethostbyname_r' function. */
@@ -204,54 +204,24 @@
204204
/* Define to 1 if you have the <langinfo.h> header file. */
205205
#undef HAVE_LANGINFO_H
206206

207-
/* Define to 1 if you have the `BSD' library (-lBSD). */
208-
#undef HAVE_LIBBSD
209-
210-
/* Define to 1 if you have the `compat' library (-lcompat). */
211-
#undef HAVE_LIBCOMPAT
212-
213207
/* Define to 1 if you have the `crypto' library (-lcrypto). */
214208
#undef HAVE_LIBCRYPTO
215209

216210
/* Define to 1 if you have the `eay32' library (-leay32). */
217211
#undef HAVE_LIBEAY32
218212

219-
/* Define to 1 if you have the `gen' library (-lgen). */
220-
#undef HAVE_LIBGEN
221-
222-
/* Define to 1 if you have the `IPC' library (-lIPC). */
223-
#undef HAVE_LIBIPC
224-
225-
/* Define to 1 if you have the `lc' library (-llc). */
226-
#undef HAVE_LIBLC
227-
228-
/* Define to 1 if you have the `ld' library (-lld). */
229-
#undef HAVE_LIBLD
230-
231-
/* Define to 1 if you have the `nsl' library (-lnsl). */
232-
#undef HAVE_LIBNSL
233-
234213
/* Define to 1 if you have the `pam' library (-lpam). */
235214
#undef HAVE_LIBPAM
236215

237-
/* Define to 1 if you have the `PW' library (-lPW). */
238-
#undef HAVE_LIBPW
239-
240216
/* Define if you have a function readline library */
241217
#undef HAVE_LIBREADLINE
242218

243-
/* Define to 1 if you have the `resolv' library (-lresolv). */
244-
#undef HAVE_LIBRESOLV
245-
246219
/* Define to 1 if you have the `ssl' library (-lssl). */
247220
#undef HAVE_LIBSSL
248221

249222
/* Define to 1 if you have the `ssleay32' library (-lssleay32). */
250223
#undef HAVE_LIBSSLEAY32
251224

252-
/* Define to 1 if you have the `unix' library (-lunix). */
253-
#undef HAVE_LIBUNIX
254-
255225
/* Define to 1 if you have the `z' library (-lz). */
256226
#undef HAVE_LIBZ
257227

0 commit comments

Comments
 (0)