From d7046ada024752df1fbcede0220c0fd32a9a1d09 Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Fri, 19 Dec 1997 03:08:03 +0000 Subject: [PATCH] Update configure so that it auto-detects and configures for missing functions... --- src/configure | 314 +++++++++++++++++++++++++++++++++++++++++++---- src/configure.in | 39 ++++-- 2 files changed, 319 insertions(+), 34 deletions(-) diff --git a/src/configure b/src/configure index 5f2f8f2736..dbc34521cb 100755 --- a/src/configure +++ b/src/configure @@ -3448,7 +3448,7 @@ fi fi -for ac_func in isinf tzset getrusage vfork memmove sigsetjmp kill sysconf +for ac_func in isinf tzset vfork memmove sigsetjmp kill sysconf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3455: checking for $ac_func" >&5 @@ -3503,7 +3503,7 @@ else fi done -for ac_func in sigprocmask waitpid setsid random srandom fcvt gethostname +for ac_func in sigprocmask waitpid setsid fcvt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:3510: checking for $ac_func" >&5 @@ -3558,14 +3558,222 @@ else fi done -echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 -echo "configure:3563: checking for inet_aton" >&5 -if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then +echo $ac_n "checking for getrusage""... $ac_c" 1>&6 +echo "configure:3563: checking for getrusage" >&5 +if eval "test \"`echo '$''{'ac_cv_func_getrusage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char getrusage(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_getrusage) || defined (__stub___getrusage) +choke me +#else +getrusage(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_getrusage=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_getrusage=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'getrusage`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETRUSAGE 1 +EOF + +else + echo "$ac_t""no" 1>&6 +GETRUSAGE='getrusage.o' +fi + +echo $ac_n "checking for srandom""... $ac_c" 1>&6 +echo "configure:3615: checking for srandom" >&5 +if eval "test \"`echo '$''{'ac_cv_func_srandom'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char srandom(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_srandom) || defined (__stub___srandom) +choke me +#else +srandom(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_srandom=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_srandom=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'srandom`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_SRANDOM 1 +EOF + +else + echo "$ac_t""no" 1>&6 +SRANDOM='srandom.o' +fi + +echo $ac_n "checking for gethostname""... $ac_c" 1>&6 +echo "configure:3667: checking for gethostname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_gethostname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostname(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostname) || defined (__stub___gethostname) +choke me +#else +gethostname(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_gethostname=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostname=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'gethostname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_GETHOSTNAME 1 +EOF + +else + echo "$ac_t""no" 1>&6 +GETHOSTNAME='gethostname.o' +fi + +echo $ac_n "checking for random""... $ac_c" 1>&6 +echo "configure:3719: checking for random" >&5 +if eval "test \"`echo '$''{'ac_cv_func_random'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char random(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_random) || defined (__stub___random) +choke me +#else +random(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_random=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_random=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'random`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_RANDOM 1 +EOF + +else + echo "$ac_t""no" 1>&6 +RANDOM='random.o' +fi + +echo $ac_n "checking for inet_aton""... $ac_c" 1>&6 +echo "configure:3771: checking for inet_aton" >&5 +if eval "test \"`echo '$''{'ac_cv_func_inet_aton'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < @@ -3587,7 +3795,7 @@ inet_aton(); ; return 0; } EOF -if { (eval echo configure:3591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_inet_aton=yes" else @@ -3611,12 +3819,12 @@ INET_ATON='inet_aton.o' fi echo $ac_n "checking for strerror""... $ac_c" 1>&6 -echo "configure:3615: checking for strerror" >&5 +echo "configure:3823: checking for strerror" >&5 if eval "test \"`echo '$''{'ac_cv_func_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strerror=yes" else @@ -3663,12 +3871,12 @@ STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o' fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 -echo "configure:3667: checking for strdup" >&5 +echo "configure:3875: checking for strdup" >&5 if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else @@ -3714,17 +3922,69 @@ else STRDUP='../../utils/strdup.o' fi +echo $ac_n "checking for strcasecmp""... $ac_c" 1>&6 +echo "configure:3927: checking for strcasecmp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_strcasecmp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char strcasecmp(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_strcasecmp) || defined (__stub___strcasecmp) +choke me +#else +strcasecmp(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3955: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_strcasecmp=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_strcasecmp=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'strcasecmp`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_STRCASECMP 1 +EOF + +else + echo "$ac_t""no" 1>&6 +STRCASECMP='strcasecmp.o' +fi + echo $ac_n "checking for cbrt""... $ac_c" 1>&6 -echo "configure:3723: checking for cbrt" >&5 +echo "configure:3983: checking for cbrt" >&5 if eval "test \"`echo '$''{'ac_cv_func_cbrt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_cbrt=yes" else @@ -3768,7 +4028,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for cbrt in -lm""... $ac_c" 1>&6 -echo "configure:3772: checking for cbrt in -lm" >&5 +echo "configure:4032: checking for cbrt in -lm" >&5 ac_lib_var=`echo m'_'cbrt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3776,7 +4036,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3813,12 +4073,12 @@ fi fi echo $ac_n "checking for rint""... $ac_c" 1>&6 -echo "configure:3817: checking for rint" >&5 +echo "configure:4077: checking for rint" >&5 if eval "test \"`echo '$''{'ac_cv_func_rint'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_rint=yes" else @@ -3862,7 +4122,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for rint in -lm""... $ac_c" 1>&6 -echo "configure:3866: checking for rint in -lm" >&5 +echo "configure:4126: checking for rint in -lm" >&5 ac_lib_var=`echo m'_'rint | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3870,7 +4130,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:4145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3908,7 +4168,7 @@ fi echo $ac_n "checking setting USE_LOCALE""... $ac_c" 1>&6 -echo "configure:3912: checking setting USE_LOCALE" >&5 +echo "configure:4172: checking setting USE_LOCALE" >&5 if test "$USE_LOCALE" = "yes" then echo "$ac_t""enabled" 1>&6 @@ -3920,14 +4180,14 @@ else echo "$ac_t""disabled" 1>&6 fi echo $ac_n "checking setting DEF_PGPORT""... $ac_c" 1>&6 -echo "configure:3924: checking setting DEF_PGPORT" >&5 +echo "configure:4184: checking setting DEF_PGPORT" >&5 cat >> confdefs.h <&6 echo $ac_n "checking setting HBA""... $ac_c" 1>&6 -echo "configure:3931: checking setting HBA" >&5 +echo "configure:4191: checking setting HBA" >&5 if test "$NOHBA" = "no" then echo "$ac_t""enabled" 1>&6 diff --git a/src/configure.in b/src/configure.in index 0a33597909..abc1e24ebc 100644 --- a/src/configure.in +++ b/src/configure.in @@ -454,17 +454,42 @@ AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_VPRINTF -AC_CHECK_FUNCS(isinf tzset getrusage vfork memmove sigsetjmp kill sysconf) -AC_CHECK_FUNCS(sigprocmask waitpid setsid random srandom fcvt gethostname) -AC_CHECK_FUNC(inet_aton, AC_DEFINE(HAVE_INET_ATON), INET_ATON='inet_aton.o') -AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR), [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o']) -AC_CHECK_FUNC(strdup, AC_DEFINE(HAVE_STRDUP), STRDUP='../../utils/strdup.o') +AC_CHECK_FUNCS(isinf tzset vfork memmove sigsetjmp kill sysconf) +AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt) +AC_CHECK_FUNC(getrusage, + AC_DEFINE(HAVE_GETRUSAGE), + GETRUSAGE='getrusage.o') +AC_CHECK_FUNC(srandom, + AC_DEFINE(HAVE_SRANDOM), + SRANDOM='srandom.o') +AC_CHECK_FUNC(gethostname, + AC_DEFINE(HAVE_GETHOSTNAME), + GETHOSTNAME='gethostname.o') +AC_CHECK_FUNC(random, + AC_DEFINE(HAVE_RANDOM), + RANDOM='random.o') +AC_CHECK_FUNC(inet_aton, + AC_DEFINE(HAVE_INET_ATON), + INET_ATON='inet_aton.o') +AC_CHECK_FUNC(strerror, + AC_DEFINE(HAVE_STRERROR), + [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o']) +AC_CHECK_FUNC(strdup, + AC_DEFINE(HAVE_STRDUP), + STRDUP='../../utils/strdup.o') +AC_CHECK_FUNC(strcasecmp, + AC_DEFINE(HAVE_STRCASECMP), + STRCASECMP='strcasecmp.o') AC_SUBST(STRDUP) AC_SUBST(INET_ATON) AC_SUBST(STRERROR) AC_SUBST(STRERROR2) -AC_CHECK_FUNC(cbrt, AC_DEFINE(HAVE_CBRT), AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT))) -AC_CHECK_FUNC(rint, AC_DEFINE(HAVE_RINT), AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT))) +AC_CHECK_FUNC(cbrt, + AC_DEFINE(HAVE_CBRT), + AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT))) +AC_CHECK_FUNC(rint, + AC_DEFINE(HAVE_RINT), + AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT))) AC_MSG_CHECKING(setting USE_LOCALE) if test "$USE_LOCALE" = "yes"