@@ -224,107 +224,124 @@ if test "$LIBRARY_DIRS" -o "$SRCH_LIB"; then
224224 done
225225fi
226226
227+ ##
228+ ## Command line options
229+ ##
227230
228- AC_MSG_CHECKING(whether to support locale)
229- AC_ARG_ENABLE(
230- locale,
231- [ --enable-locale enable locale support ],
232- [AC_DEFINE(USE_LOCALE) AC_MSG_RESULT(enabled)],
233- AC_MSG_RESULT(disabled)
234- )
235231
236- dnl We exclude cyrillic recode support unless we override it with
237- dnl --enable-recode to explicitly enable it
238- dnl It defaults to disabled
239- AC_MSG_CHECKING(whether to support cyrillic recode)
240- AC_ARG_ENABLE(
241- recode,
242- [ --enable-recode enable cyrillic recode support ],
243- [AC_DEFINE(CYR_RECODE) AC_MSG_RESULT(enabled)],
244- AC_MSG_RESULT(disabled)
245- )
232+ #
233+ # Locale (--enable-locale)
234+ #
235+ AC_MSG_CHECKING([whether to build with locale support])
236+ AC_ARG_ENABLE(locale, [ --enable-locale enable locale support],
237+ [if test x"$enable_locale" != x"no" ; then
238+ enable_locale=yes
239+ AC_DEFINE(USE_LOCALE, [], [Set to 1 if you want LOCALE support (--enable-locale)])
240+ fi],
241+ [enable_locale=no])
242+ AC_MSG_RESULT([$enable_locale])
246243
247- dnl Multibyte support
248244
249- AC_MSG_CHECKING(whether to support multibyte)
250- AC_ARG_ENABLE(multibyte,
251- [ --enable-multibyte enable multibyte character support ],
252- [
253- MULTIBYTE=SQL_ASCII
254- if test "$enableval" != "yes"; then
255- case "$enableval" in
256- SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
257- # ok
258- ;;
259- *)
260- AC_MSG_ERROR(
261- [Argument to --enable-multibyte must be one of:
245+ #
246+ # Cyrillic recode (--enable-recode)
247+ #
248+ AC_MSG_CHECKING([whether to build with Cyrillic recode support])
249+ AC_ARG_ENABLE(recode, [ --enable-recode enable cyrillic recode support],
250+ [if test x"$enable_recode" != x"no" ; then
251+ enable_recode=yes
252+ AC_DEFINE(CYR_RECODE, [], [Set to 1 if you want cyrillic recode support (--enable-recode)])
253+ fi],
254+ [enable_recode=no])
255+ AC_MSG_RESULT([$enable_recode])
256+
257+
258+ #
259+ # Multibyte support
260+ #
261+ MULTIBYTE=
262+ AC_MSG_CHECKING([whether to build with multibyte character support])
263+ AC_ARG_ENABLE(multibyte, [ --enable-multibyte enable multibyte character support],
264+ [
265+ case $enableval in
266+ no) enable_multibyte=no;;
267+ yes) enable_multibyte=yes; MULTIBYTE=SQL_ASCII;;
268+ SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
269+ enable_multibyte=yes; MULTIBYTE=$enableval;;
270+ *) AC_MSG_ERROR(
271+ [argument to --enable-multibyte must be one of:
262272 SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
263273 UNICODE, MULE_INTERNAL,
264274 LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
265275 KOI8, WIN, ALT
266- Or do not specify an argument to the option to use the default.])
267- esac
268- MULTIBYTE=$enableval
269- fi
270- AC_DEFINE(MULTIBYTE)
271- AC_MSG_RESULT(enabled)
272- ],
273- AC_MSG_RESULT("disabled")
274- )
276+ Or do not specify an argument to the option to use the default.]) ;;
277+ esac
278+ ],
279+ [enable_multibyte=no])
280+
281+ AC_SUBST(MULTIBYTE)
275282
276- dnl Old option variant
277- if test "${with_mb}"; then
278- AC_MSG_ERROR([--with-mb is not supported anymore. Use --enable-multibyte instead.])
283+ if test "$enable_multibyte" = yes ; then
284+ AC_DEFINE(MULTIBYTE, [], [Set to 1 if you want to use multibyte characters (--enable-multibyte)])
285+ AC_MSG_RESULT([yes, default $MULTIBYTE])
286+ else
287+ AC_MSG_RESULT(no)
279288fi
280289
281290
282- dnl We use the default value of 5432 for the DEF_PGPORT value. If
283- dnl we over-ride it with --with-pgport=port then we bypass this piece
284- AC_MSG_CHECKING(setting DEF_PGPORT)
285- AC_ARG_WITH(
286- pgport,
287- [ --with-pgport=PORTNUM change default postmaster port ],
288- [default_port="$withval"],
289- [default_port=5432]
290- )
291- dnl Need both of these because backend wants an integer and frontend a string
291+ #
292+ # Default port number (--with-pgport), default 5432
293+ #
294+ AC_MSG_CHECKING([for default port number])
295+ AC_ARG_WITH(pgport, [ --with-pgport=PORTNUM change default port number [5432]],
296+ [case $withval in
297+ yes|no) AC_MSG_ERROR([You must supply an argument to the --with-pgport option]);;
298+ *) default_port=$withval;;
299+ esac
300+ ],
301+ [default_port=5432])
302+ # Need both of these because backend wants an integer and frontend a string
292303AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
293304AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
294- AC_MSG_RESULT(${ default_port} )
305+ AC_MSG_RESULT([$ default_port] )
295306
296307
297- dnl DEF_MAXBACKENDS can be set by --with-maxbackends. Default value is 32.
298- AC_MSG_CHECKING(setting DEF_MAXBACKENDS)
299- AC_ARG_WITH(
300- maxbackends,
301- [ --with-maxbackends=N set default maximum number of server processes ],
302- AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, ${withval}) AC_MSG_RESULT($with_maxbackends),
303- AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, 32) AC_MSG_RESULT(32)
304- )
308+ #
309+ # Maximum number of allowed connections (--with-maxbackends), default 32
310+ #
311+ AC_MSG_CHECKING([for default soft limit on number of connections])
312+ AC_ARG_WITH(maxbackends, [ --with-maxbackends=N set default maximum number of connections [32]],
313+ [case $withval in
314+ yes|no) AC_MSG_ERROR([You must supply an argument to the --with-maxbackends option]);;
315+ esac],
316+ [with_maxbackends=32])
317+ AC_MSG_RESULT([$with_maxbackends])
318+ AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, [$with_maxbackends], [The default soft limit on the number of concurrent connections, i.e., the default for the postmaster -N switch (--with-maxbackends)])
305319
306320
307- dnl Check for C support (allow override if needed)
308- dnl Note: actually, setting CC environment variable works just as well.
309- AC_ARG_WITH(CC,
310- [ --with-CC=compiler use specific C compiler],
311- [
312- case "$withval" in
313- "" | y | ye | yes | n | no)
314- AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
315- ;;
316- esac
317- CC="$withval"
318- ])
321+ #
322+ # For historical reasons you can also use --with-CC to specify the C compiler
323+ # to use, although the standard way to do this is to set the CC environment
324+ # variable.
325+ #
326+ if test "${with_CC+set}" = set; then
327+ case $with_CC in
328+ yes | no) AC_MSG_ERROR([You must supply an argument to the --with-CC option.]);;
329+ *) CC=$with_CC;;
330+ esac
331+ fi
319332
320- dnl Find a compiler if CC is not already set.
333+
334+ #
335+ # C compiler
336+ #
321337AC_PROG_CC
322- dnl Find CPP, then check traditional.
323- dnl Caution: these macros must be called in this order...
324338AC_PROG_CPP
325339AC_PROG_GCC_TRADITIONAL
326340AC_SUBST(GCC)
327341
342+ #
343+ # Create compiler version string
344+ #
328345if test x"$GCC" = x"yes" ; then
329346 cc_string="GCC `${CC} --version`"
330347else
@@ -671,7 +688,6 @@ AC_SUBST(DL_LIB)
671688AC_SUBST(USE_TCL)
672689AC_SUBST(USE_TK)
673690AC_SUBST(WISH)
674- AC_SUBST(MULTIBYTE)
675691
676692
677693dnl
@@ -748,6 +764,10 @@ AC_PROG_YACC
748764AC_SUBST(YFLAGS)
749765
750766
767+ ##
768+ ## Libraries
769+ ##
770+
751771AC_CHECK_LIB(sfio, main)
752772AC_CHECK_LIB(ncurses, main, [], [AC_CHECK_LIB(curses, main)])
753773AC_CHECK_LIB(termcap, main)
@@ -795,31 +815,14 @@ if test "$with_openssl" = yes ; then
795815fi
796816
797817
798- dnl
799- dnl Checks for header files.
800- dnl
801- AC_HEADER_STDC
802- AC_HEADER_SYS_WAIT
803- AC_CHECK_HEADERS(arpa/inet.h)
804- AC_CHECK_HEADERS(crypt.h)
805- AC_CHECK_HEADERS(dld.h)
806- AC_CHECK_HEADERS(endian.h)
807- AC_CHECK_HEADERS(float.h)
808- AC_CHECK_HEADERS(fp_class.h)
809- AC_CHECK_HEADERS(getopt.h)
810- AC_CHECK_HEADERS(ieeefp.h)
811- AC_CHECK_HEADERS(limits.h)
812- AC_CHECK_HEADERS(netdb.h)
813- AC_CHECK_HEADERS(netinet/in.h)
818+ ##
819+ ## Header files
820+ ##
821+ dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
822+ AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h pwd.h sys/pstat.h sys/select.h sys/socket.h sys/types.h termios.h values.h])
823+
814824AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
815825AC_CHECK_HEADERS([readline/history.h history.h], [break])
816- AC_CHECK_HEADERS(sys/select.h)
817- AC_CHECK_HEADERS(termios.h)
818- AC_CHECK_HEADERS(unistd.h)
819- AC_CHECK_HEADERS(values.h)
820- AC_CHECK_HEADERS(sys/pstat.h)
821- AC_CHECK_HEADERS(sys/types.h sys/socket.h)
822- AC_CHECK_HEADERS(sys/param.h pwd.h)
823826
824827if test "$with_krb4" = yes ; then
825828 AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
@@ -836,26 +839,24 @@ if test "$with_openssl" = yes ; then
836839fi
837840
838841
839- dnl
840- dnl Checks for typedefs , structures, and compiler characteristics.
841- dnl
842+ ##
843+ ## Types , structures, compiler characteristics
844+ ##
842845AC_C_CONST
843846AC_C_INLINE
844847AC_C_STRINGIZE
845- AC_TYPE_UID_T
846- AC_TYPE_MODE_T
847- AC_TYPE_OFF_T
848- AC_TYPE_SIZE_T
849- AC_STRUCT_TIMEZONE
850848PGAC_C_SIGNED
851849PGAC_C_VOLATILE
852- AC_FUNC_ACCEPT_ARGTYPES
850+ AC_STRUCT_TIMEZONE
851+ PGAC_UNION_SEMUN
853852
854853
854+ ##
855+ ## Functions, global variables
856+ ##
855857PGAC_VAR_INT_TIMEZONE
858+ AC_FUNC_ACCEPT_ARGTYPES
856859PGAC_FUNC_GETTIMEOFDAY_1ARG
857- PGAC_UNION_SEMUN
858-
859860
860861AC_MSG_CHECKING(for fcntl(F_SETLK))
861862if test "$os" != linux ; then
@@ -871,13 +872,7 @@ else
871872 AC_MSG_RESULT([broken on Linux])
872873fi
873874
874- dnl Checks for library functions.
875- AC_FUNC_MEMCMP
876- AC_TYPE_SIGNAL
877- AC_FUNC_VPRINTF
878- AC_CHECK_FUNCS(memmove sysconf)
879- AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
880- AC_CHECK_FUNCS(setproctitle pstat)
875+ AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid])
881876
882877AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
883878[AC_TRY_LINK(
@@ -892,7 +887,6 @@ if test "$pgac_cv_var_PS_STRINGS" = yes ; then
892887 AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
893888fi
894889
895- AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
896890dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
897891dnl is missing. Yes, there are machines that have only one.
898892dnl We may also decide to use snprintf.c if snprintf() is present but does
@@ -914,24 +908,26 @@ dnl declares vsnprintf() but not snprintf(). Hopefully there are no
914908dnl systems that are *that* brain-damaged...
915909AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
916910AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
917- dnl
918- dnl do this one the hard way in case isinf() is a macro
919- AC_MSG_CHECKING(for isinf)
920- AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
911+
912+ # do this one the hard way in case isinf() is a macro
913+ AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
921914[AC_TRY_LINK(
922- [#include <math.h>],
915+ [#include <math.h>
916+ ],
923917[double x = 0.0; int res = isinf(x);],
924- [ac_cv_func_or_macro_isinf =yes],
925- [ac_cv_func_or_macro_isinf =no])])
926- if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
927- AC_MSG_RESULT( yes)
918+ [ac_cv_func_isinf =yes],
919+ [ac_cv_func_isinf =no])])
920+
921+ if test $ac_cv_func_isinf = yes ; then
928922 AC_DEFINE(HAVE_ISINF)
929- ISINF=''
923+ ISINF=
930924else
931- AC_MSG_RESULT(no)
932925 ISINF='isinf.o'
926+ # Look for a way to implement a substitute for isinf()
927+ AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
933928fi
934929AC_SUBST(ISINF)
930+
935931AC_CHECK_FUNC(getrusage,
936932 AC_DEFINE(HAVE_GETRUSAGE),
937933 GETRUSAGE='getrusage.o')
@@ -1011,8 +1007,6 @@ AC_CHECK_FUNCS(filename_completion_function,
10111007AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
10121008AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
10131009
1014- dnl Check for GNU style long options support (getopt_long)
1015- AC_CHECK_FUNCS(getopt_long)
10161010
10171011dnl Cannot use AC_CHECK_FUNC because finite may be a macro
10181012AC_MSG_CHECKING(for finite)
0 commit comments