Skip to content

Commit fc54be8

Browse files
committed
autoconf 2.61's AC_FUNC_FSEEKO reports success/failure differently, so
reorganize code for NetBSD/BSDi port/fseeko.c usage, and make code more modular.
1 parent a345dcd commit fc54be8

File tree

2 files changed

+128
-20
lines changed

2 files changed

+128
-20
lines changed

configure

Lines changed: 116 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16409,8 +16409,7 @@ LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
1640916409

1641016410

1641116411

16412-
16413-
for ac_func in crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul unsetenv
16412+
for ac_func in crypt getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul unsetenv
1641416413
do
1641516414
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
1641616415
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -16744,13 +16743,6 @@ esac
1674416743

1674516744
fi
1674616745

16747-
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
16748-
# We override the previous test that said fseeko/ftello didn't exist
16749-
# OS tests are also done in include/c.h and port/fseeko.c
16750-
case $host_os in bsdi*|netbsd*)
16751-
ac_cv_func_fseeko=yes
16752-
esac
16753-
1675416746
# Win32 support
1675516747
if test "$PORTNAME" = "win32"; then
1675616748

@@ -17935,7 +17927,119 @@ fi
1793517927
done
1793617928

1793717929

17938-
{ echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5
17930+
17931+
for ac_func in fseeko
17932+
do
17933+
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
17934+
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
17935+
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
17936+
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
17937+
echo $ECHO_N "(cached) $ECHO_C" >&6
17938+
else
17939+
cat >conftest.$ac_ext <<_ACEOF
17940+
/* confdefs.h. */
17941+
_ACEOF
17942+
cat confdefs.h >>conftest.$ac_ext
17943+
cat >>conftest.$ac_ext <<_ACEOF
17944+
/* end confdefs.h. */
17945+
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
17946+
For example, HP-UX 11i <limits.h> declares gettimeofday. */
17947+
#define $ac_func innocuous_$ac_func
17948+
17949+
/* System header to define __stub macros and hopefully few prototypes,
17950+
which can conflict with char $ac_func (); below.
17951+
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
17952+
<limits.h> exists even on freestanding compilers. */
17953+
17954+
#ifdef __STDC__
17955+
# include <limits.h>
17956+
#else
17957+
# include <assert.h>
17958+
#endif
17959+
17960+
#undef $ac_func
17961+
17962+
/* Override any GCC internal prototype to avoid an error.
17963+
Use char because int might match the return type of a GCC
17964+
builtin and then its argument prototype would still apply. */
17965+
#ifdef __cplusplus
17966+
extern "C"
17967+
#endif
17968+
char $ac_func ();
17969+
/* The GNU C library defines this for functions which it implements
17970+
to always fail with ENOSYS. Some functions are actually named
17971+
something starting with __ and the normal name is an alias. */
17972+
#if defined __stub_$ac_func || defined __stub___$ac_func
17973+
choke me
17974+
#endif
17975+
17976+
int
17977+
main ()
17978+
{
17979+
return $ac_func ();
17980+
;
17981+
return 0;
17982+
}
17983+
_ACEOF
17984+
rm -f conftest.$ac_objext conftest$ac_exeext
17985+
if { (ac_try="$ac_link"
17986+
case "(($ac_try" in
17987+
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
17988+
*) ac_try_echo=$ac_try;;
17989+
esac
17990+
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
17991+
(eval "$ac_link") 2>conftest.er1
17992+
ac_status=$?
17993+
grep -v '^ *+' conftest.er1 >conftest.err
17994+
rm -f conftest.er1
17995+
cat conftest.err >&5
17996+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
17997+
(exit $ac_status); } && {
17998+
test -z "$ac_c_werror_flag" ||
17999+
test ! -s conftest.err
18000+
} && test -s conftest$ac_exeext &&
18001+
$as_test_x conftest$ac_exeext; then
18002+
eval "$as_ac_var=yes"
18003+
else
18004+
echo "$as_me: failed program was:" >&5
18005+
sed 's/^/| /' conftest.$ac_ext >&5
18006+
18007+
eval "$as_ac_var=no"
18008+
fi
18009+
18010+
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
18011+
conftest$ac_exeext conftest.$ac_ext
18012+
fi
18013+
ac_res=`eval echo '${'$as_ac_var'}'`
18014+
{ echo "$as_me:$LINENO: result: $ac_res" >&5
18015+
echo "${ECHO_T}$ac_res" >&6; }
18016+
if test `eval echo '${'$as_ac_var'}'` = yes; then
18017+
cat >>confdefs.h <<_ACEOF
18018+
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
18019+
_ACEOF
18020+
18021+
else
18022+
case " $LIBOBJS " in
18023+
*" $ac_func.$ac_objext "* ) ;;
18024+
*) LIBOBJS="$LIBOBJS $ac_func.$ac_objext"
18025+
;;
18026+
esac
18027+
18028+
fi
18029+
done
18030+
18031+
18032+
case $host_os in
18033+
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
18034+
bsdi*|netbsd*)
18035+
18036+
cat >>confdefs.h <<\_ACEOF
18037+
#define HAVE_FSEEKO 1
18038+
_ACEOF
18039+
18040+
ac_cv_func_fseeko=yes;;
18041+
*)
18042+
{ echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5
1793918043
echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6; }
1794018044
if test "${ac_cv_sys_largefile_source+set}" = set; then
1794118045
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18054,6 +18158,8 @@ cat >>confdefs.h <<\_ACEOF
1805418158
_ACEOF
1805518159

1805618160
fi
18161+
;;
18162+
esac
1805718163

1805818164

1805918165
#

configure.in

Lines changed: 12 additions & 10 deletions
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.548 2008/02/17 16:36:42 petere Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.549 2008/02/18 21:46:22 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1080,7 +1080,7 @@ fi
10801080
pgac_save_LIBS="$LIBS"
10811081
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
10821082

1083-
AC_REPLACE_FUNCS([crypt fseeko getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul unsetenv])
1083+
AC_REPLACE_FUNCS([crypt getopt getrusage inet_aton random rint srandom strdup strerror strlcat strlcpy strtol strtoul unsetenv])
10841084

10851085
LIBS="$pgac_save_LIBS"
10861086

@@ -1102,13 +1102,6 @@ else
11021102
AC_LIBOBJ(getopt_long)
11031103
fi
11041104

1105-
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1106-
# We override the previous test that said fseeko/ftello didn't exist
1107-
# OS tests are also done in include/c.h and port/fseeko.c
1108-
case $host_os in bsdi*|netbsd*)
1109-
ac_cv_func_fseeko=yes
1110-
esac
1111-
11121105
# Win32 support
11131106
if test "$PORTNAME" = "win32"; then
11141107
AC_REPLACE_FUNCS(gettimeofday)
@@ -1160,7 +1153,16 @@ AC_CHECK_FUNCS(atexit, [],
11601153
[AC_CHECK_FUNCS(on_exit, [],
11611154
[AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
11621155

1163-
AC_FUNC_FSEEKO
1156+
AC_REPLACE_FUNCS(fseeko)
1157+
case $host_os in
1158+
# BSD/OS & NetBSD use a custom fseeko/ftello built on fsetpos/fgetpos
1159+
bsdi*|netbsd*)
1160+
AC_DEFINE(HAVE_FSEEKO, 1, [Define to 1 because replacement version used.])
1161+
ac_cv_func_fseeko=yes;;
1162+
*)
1163+
AC_FUNC_FSEEKO;;
1164+
esac
1165+
11641166

11651167
#
11661168
# Pthreads

0 commit comments

Comments
 (0)