1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(src/backend/access/common/heaptuple.c)
3 AC_PREFIX_DEFAULT(/usr/local/pgsql)
4 AC_CONFIG_HEADER(src/include/config.h)
7 AC_CONFIG_AUX_DIR(`pwd`/config)
9 mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
10 AC_SUBST(mkinstalldirs)
18 sparc) os=solaris_sparc need_tas=yes tas_file=solaris_sparc.s ;;
19 i386) os=solaris_i386 need_tas=yes tas_file=solaris_i386.s ;;
21 sunos*) os=sunos4 need_tas=no ;;
22 beos) os=beos need_tas=no ;;
23 aux*) os=aux need_tas=no ;;
24 linux*) os=linux need_tas=no ;;
25 bsdi*) os=bsdi need_tas=no ;;
26 freebsd1*|freebsd2*) os=freebsd need_tas=no ;;
27 freebsd*) os=freebsd need_tas=no elf=yes ;;
28 netbsd*) os=netbsd need_tas=no ;;
29 openbsd*) os=bsd need_tas=no ;;
30 dgux*) os=dgux need_tas=no ;;
31 aix*) os=aix need_tas=no ;;
32 nextstep*) os=nextstep need_tas=no ;;
33 ultrix*) os=ultrix4 need_tas=no ;;
34 irix*) os=irix5 need_tas=no ;;
35 hpux*) os=hpux need_tas=yes tas_file=hpux.s ;;
36 osf*) os=alpha need_tas=no ;;
37 sco*) os=sco need_tas=no ;;
38 machten*) os=machten need_tas=no ;;
39 cygwin*) os=win need_tas=no ;;
41 case "$host_vendor" in
42 univel) os=univel need_tas=no ;;
43 *) os=unknown need_tas=no ;;
45 sysv4*) os=svr4 need_tas=no ;;
46 sysv5uw*) os=unixware need_tas=no ;;
47 unixware*) os=unixware need_tas=no ;;
48 qnx*) os=qnx4 need_tas=no ;;
50 echo "*************************************************************"
51 echo "configure does not currently recognize your operating system,"
52 echo "therefore you must do a manual configuration of:"
54 echo "Please contact scrappy@hub.org to see about rectifying this, "
55 echo "including the above 'checking host system type...' line "
56 echo "*************************************************************"
63 AC_LINK_FILES(src/backend/port/dynloader/${os}.c, src/backend/port/dynloader.c)
64 AC_LINK_FILES(src/backend/port/dynloader/${os}.h, src/include/dynloader.h)
65 AC_LINK_FILES(src/include/port/${os}.h, src/include/os.h)
66 AC_LINK_FILES(src/makefiles/Makefile.${os}, src/Makefile.port)
68 if test "X$need_tas" = "Xyes"
70 AC_LINK_FILES(src/backend/port/tas/${tas_file}, src/backend/port/tas.s)
75 dnl this part selects the template from the ones in the template directory.
77 AC_MSG_CHECKING(setting template to)
79 [ --with-template=TEMPLATE
80 use operating system template file
81 see template directory],
82 [ TEMPLATE=$withval ],
86 host="`echo $host | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`"
88 # First, try for a template exactly matching $host
89 if test -f "src/template/$host"
92 # Scan template/.similar for a rule that tells us which template to use.
93 # The format of each line of the file is
94 # hostnamepattern=templatefilename
95 # where the hostnamepattern is evaluated per the rules of expr(1) ---
96 # namely, it is a standard regular expression with an implicit ^ at the
97 # start. If multiple lines match, we will end up using the last match.
99 # The tempfile hackery is needed because some shells will run the loop
100 # inside a subshell, whereupon shell variables set therein aren't seen
101 # outside the loop :-(
103 cat /dev/null > $TMPFILE
106 SIMHOST=`expr "$LINE" : '\(.*\)='`
107 MATCH=`expr "$host" : "$SIMHOST"`
108 if test "$MATCH" != 0
110 echo "$LINE" | sed 's/^.*=//' > $TMPFILE
112 done <src/template/.similar
116 then TEMPLATE="$GUESS"
118 # Last chance ... maybe uname -s will match an entry.
119 TEMPLATE=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
123 AC_MSG_RESULT($TEMPLATE)
126 if test ! -f "src/template/$TEMPLATE"; then
128 echo "$TEMPLATE does not exist"
130 echo "Available Templates (select one using --with-template):"
137 dnl Read the selected template file.
138 dnl For reasons of backwards compatibility, lines of the form
139 dnl IDENTIFIER: something
140 dnl should be treated as variable assignments. However, we also want to
141 dnl allow other shell commands in the template file (in case the file
142 dnl needs to make conditional tests, etc). So, generate a temp file with
143 dnl the IDENTIFIER: lines translated, then source it.
147 sed 's/^\([A-Za-z_]*\):\(.*\)$/\1="\2"/' "src/template/$TEMPLATE" >conftest.sh
153 AC_ARG_WITH(includes,
154 [ --with-includes=DIRS look for header files for tcl/tk, etc in DIRS],
157 "" | y | ye | yes | n | no)
158 AC_MSG_ERROR([*** You must supply an argument to the --with-includes option.])
161 INCLUDE_DIRS="$withval"
164 dnl INCLUDE_DIRS comes from command line, SRCH_INC from template file.
165 dnl Each can name one or more directories.
166 if test "$INCLUDE_DIRS" -o "$SRCH_INC"; then
167 for dir in $INCLUDE_DIRS $SRCH_INC; do
168 if test -d "$dir"; then
169 PGSQL_INCLUDES="$PGSQL_INCLUDES -I$dir"
171 AC_MSG_WARN([*** Include directory $dir does not exist.])
176 AC_ARG_WITH(libraries,
177 [ --with-libraries=DIRS look for additional libraries in DIRS],
180 "" | y | ye | yes | n | no)
181 AC_MSG_ERROR([*** You must supply an argument to the --with-libraries option.])
184 LIBRARY_DIRS="$withval"
188 [ --with-libs=DIRS alternate spelling of --with-libraries],
191 "" | y | ye | yes | n | no)
192 AC_MSG_ERROR([*** You must supply an argument to the --with-libs option.])
195 LIBRARY_DIRS="$withval"
198 dnl LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
199 dnl Each can name one or more directories.
200 if test "$LIBRARY_DIRS" -o "$SRCH_LIB"; then
201 for dir in $LIBRARY_DIRS $SRCH_LIB; do
202 if test -d "$dir"; then
203 PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
205 AC_MSG_WARN([*** Library directory $dir does not exist.])
211 AC_MSG_CHECKING(whether to support locale)
214 [ --enable-locale enable locale support ],
215 [AC_DEFINE(USE_LOCALE) AC_MSG_RESULT(enabled)],
216 AC_MSG_RESULT(disabled)
219 dnl We exclude cyrillic recode support unless we override it with
220 dnl --enable-recode to explicitly enable it
221 dnl It defaults to disabled
222 AC_MSG_CHECKING(whether to support cyrillic recode)
225 [ --enable-recode enable cyrillic recode support ],
226 [AC_DEFINE(CYR_RECODE) AC_MSG_RESULT(enabled)],
227 AC_MSG_RESULT(disabled)
230 dnl Multibyte support
232 AC_MSG_CHECKING(whether to support multibyte)
233 AC_ARG_ENABLE(multibyte,
234 [ --enable-multibyte enable multibyte character support ],
237 if test "$enableval" != "yes"; then
239 SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
244 [Argument to --enable-multibyte must be one of:
245 SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
246 UNICODE, MULE_INTERNAL,
247 LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
249 Or do not specify an argument to the option to use the default.])
254 AC_MSG_RESULT(enabled)
256 AC_MSG_RESULT("disabled")
259 dnl Old option variant
260 if test "${with_mb}"; then
261 AC_MSG_ERROR([--with-mb is not supported anymore. Use --enable-multibyte instead.])
265 dnl We use the default value of 5432 for the DEF_PGPORT value. If
266 dnl we over-ride it with --with-pgport=port then we bypass this piece
267 AC_MSG_CHECKING(setting DEF_PGPORT)
270 [ --with-pgport=PORTNUM change default postmaster port ],
271 [default_port="$withval"],
274 dnl Need both of these because backend wants an integer and frontend a string
275 AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
276 AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
277 AC_MSG_RESULT(${default_port})
280 dnl DEF_MAXBACKENDS can be set by --with-maxbackends. Default value is 32.
281 AC_MSG_CHECKING(setting DEF_MAXBACKENDS)
284 [ --with-maxbackends=N set default maximum number of server processes ],
285 AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, ${withval}) AC_MSG_RESULT($with_maxbackends),
286 AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, 32) AC_MSG_RESULT(32)
290 dnl Check for C support (allow override if needed)
291 dnl Note: actually, setting CC environment variable works just as well.
293 [ --with-CC=compiler use specific C compiler],
296 "" | y | ye | yes | n | no)
297 AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
303 dnl Find a compiler if CC is not already set.
305 dnl Find CPP, then check traditional.
306 dnl Caution: these macros must be called in this order...
308 AC_PROG_GCC_TRADITIONAL
311 if test "$CC" = "gcc"
313 CC_VERSION=`${CC} --version`
320 dnl We exclude tcl support unless user says --with-tcl
321 AC_MSG_CHECKING(setting USE_TCL)
324 [ --with-tcl build Tcl interfaces and pgtclsh ],
327 y | ye | yes) USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
328 *) USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
331 [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
337 dnl We see if the path to the TCL/TK configuration scripts is specified.
338 dnl This will override the use of tclsh to find the paths to search.
340 AC_ARG_WITH(tclconfig,
341 [ --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR],
344 "" | y | ye | yes | n | no)
345 AC_MSG_ERROR([*** You must supply an argument to the --with-tclconfig option.])
352 dnl We see if the path to the TK configuration scripts is specified.
353 dnl This will override the use of tclsh to find the paths to search.
355 AC_ARG_WITH(tkconfig,
356 [ --with-tkconfig=DIR tkConfig.sh is in DIR],
359 "" | y | ye | yes | n | no)
360 AC_MSG_ERROR([*** You must supply an argument to the --with-tkconfig option.])
369 dnl Optionally build Perl modules (Pg.pm and PL/Perl)
371 AC_MSG_CHECKING(whether to build Perl modules)
372 AC_ARG_WITH(perl, [ --with-perl build Perl interface and plperl],
373 [if test x"${withval}" = x"yes" ; then
383 dnl Optionally build Python interface module
385 AC_MSG_CHECKING(whether to build Python modules)
386 AC_ARG_WITH(python, [ --with-python build Python interface module],
387 [if test x"${withval}" = x"yes" ; then
395 AC_SUBST(with_python)
397 dnl We include odbc support unless we disable it with --with-odbc=false
398 AC_MSG_CHECKING(setting USE_ODBC)
401 [ --with-odbc build ODBC driver package ],
404 y | ye | yes) USE_ODBC=true; AC_MSG_RESULT(enabled) ;;
405 *) USE_ODBC=false; AC_MSG_RESULT(disabled) ;;
408 [ USE_ODBC=false; AC_MSG_RESULT(disabled) ]
412 dnl check if we want to use unixODBC to provide access to the odbc.ini
416 AC_MSG_CHECKING(setting USE_UNIXODBC)
419 [ --with-unixODBC[=DIR] Use unixODBC located in DIR],
424 AC_MSG_RESULT(enabled);
426 [ USE_ODBC=false; use_unixODBC=no; AC_MSG_RESULT(disabled) ]
430 dnl Allow for overriding the default location of the odbcinst.ini
431 dnl file which is normally ${prefix}/share or ${prefix} if this is
432 dnl being compiled inside the postgres distribution.
433 dnl Link in the port and template directories
434 dnl to help build a "standalone ODBC" tar file
435 if test "X$USE_ODBC" = "Xtrue"
437 AC_LINK_FILES(src/include/port, src/interfaces/odbc/port)
438 AC_LINK_FILES(src/makefiles, src/interfaces/odbc/makefiles)
439 AC_LINK_FILES(src/template, src/interfaces/odbc/template)
440 AC_LINK_FILES(src/include/config.h, src/interfaces/odbc/config.h)
442 AC_MSG_CHECKING(setting ODBCINST)
445 [ --with-odbcinst=DIR change default directory for odbcinst.ini],
446 AC_DEFINE_UNQUOTED(ODBCINST, ${with_odbcinst}) AC_MSG_RESULT($with_odbcinst),
447 AC_DEFINE_UNQUOTED(ODBCINST, ${ODBCINSTDIR}) AC_MSG_RESULT(${ODBCINSTDIR})
450 if test "X$with_odbcinst" != "X"
452 ODBCINSTDIR=$with_odbcinst
454 AC_SUBST(ODBCINSTDIR)
456 #check for unixODBC libs
458 if test "x$use_unixODBC" = "xyes"
461 # default to /usr/local if not specified
462 if test "x$unixODBC" = "x"
464 unixODBC="/usr/local";
467 unixODBC_libs="$unixODBC/lib"
468 unixODBC_includes="$unixODBC/include"
470 CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
471 AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
473 odbc_headers="$odbc_headers $ac_hdr",
476 if test "x$unixODBC_ok" != "xyes"
478 AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
482 LIBS="-L$unixODBC_libs $LIBS"
484 AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
485 [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
486 SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
487 [LIBS="$save_LIBS"] )
491 dnl Unless we specify the command line options
492 dnl --enable cassert to explicitly enable it
493 dnl If you do not explicitly do it, it defaults to disabled
494 AC_MSG_CHECKING(setting ASSERT CHECKING)
497 [ --enable-cassert enable assertion checks (for debugging) ],
498 AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
499 AC_MSG_RESULT(disabled)
502 CPPFLAGS="$CPPFLAGS $PGSQL_INCLUDES"
503 echo "- setting CPPFLAGS=$CPPFLAGS"
505 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
506 echo "- setting LDFLAGS=$LDFLAGS"
508 dnl --enable-debug adds -g to compiler flags
509 dnl --disable-debug will forcefully remove it
510 AC_MSG_CHECKING(setting debug compiler flag)
513 [ --enable-debug build with debugging symbols (-g) ],
518 AC_MSG_RESULT(enabled)
521 CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
522 AC_MSG_RESULT(disabled)
526 AC_MSG_RESULT(using default)
529 # Assume system is ELF if it predefines __ELF__ as 1,
530 # otherwise believe "elf" setting from check of host_os above.
537 [if test "X$elf" = "Xyes"
551 AC_SUBST(PGSQL_INCLUDES)
566 dnl Optionally build C++ code (i.e., libpq++)
568 AC_MSG_CHECKING(whether to build C++ modules)
569 AC_ARG_WITH(CXX, [ --with-CXX build C++ modules (libpq++)],
570 [if test "x${withval+set}" = xset; then
572 if test x"$withval" != xyes ; then
578 PGAC_CXX_NAMESPACE_STD
587 dnl Figure out how to invoke "install" and what install options to use.
592 INSTL_EXE_OPTS="-m 555"
593 INSTL_LIB_OPTS="-m 644"
594 INSTL_SHLIB_OPTS="-m 644"
596 dnl HPUX wants shared libs to be mode 555.
599 INSTL_SHLIB_OPTS="-m 555" ;;
604 AC_SUBST(INSTL_LIB_OPTS)
605 AC_SUBST(INSTL_SHLIB_OPTS)
606 AC_SUBST(INSTL_EXE_OPTS)
611 if test "$LEX" = "flex"; then
612 $LEX --version 2> /dev/null | grep -s '2\.5\.3' > /dev/null 2>&1
613 if test $? -eq 0 ; then
616 You have flex version 2.5.3, which is broken. Get version 2.5.4 or
618 (If you are using the official distribution of PostgreSQL then you
619 do not need to worry about this because the lexer files are
620 pre-generated. However, other software using flex is likely to be
627 AC_PATH_PROG(find, find)
628 AC_PATH_PROG(tar, tar)
629 AC_PATH_PROG(split, split)
630 AC_PATH_PROG(etags, etags)
631 AC_PATH_PROG(xargs, xargs)
632 AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
633 AC_CHECK_PROGS(PERL, perl,)
638 AC_CHECK_LIB(sfio, main)
639 for curses in ncurses curses ; do
640 AC_CHECK_LIB(${curses}, main,
641 [LIBS="-l${curses} $LIBS"; break])
643 AC_CHECK_LIB(termcap, main)
644 AC_CHECK_LIB(readline, main)
645 AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
646 AC_CHECK_LIB(history, main) )
648 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
650 AC_CHECK_LIB(bsd, main)
652 AC_CHECK_LIB(util, main)
653 AC_CHECK_LIB(m, main)
654 AC_CHECK_LIB(dl, main)
655 AC_CHECK_LIB(socket, main)
656 AC_CHECK_LIB(nsl, main)
657 AC_CHECK_LIB(ipc, main)
658 AC_CHECK_LIB(IPC, main)
659 AC_CHECK_LIB(lc, main)
660 AC_CHECK_LIB(dld, main)
661 AC_CHECK_LIB(ln, main)
662 AC_CHECK_LIB(ld, main)
663 AC_CHECK_LIB(compat, main)
664 AC_CHECK_LIB(BSD, main)
665 AC_CHECK_LIB(crypt, main)
666 AC_CHECK_LIB(gen, main)
667 AC_CHECK_LIB(PW, main)
669 dnl Checks for header files.
672 AC_CHECK_HEADERS(arpa/inet.h)
673 AC_CHECK_HEADERS(crypt.h)
674 AC_CHECK_HEADERS(dld.h)
675 AC_CHECK_HEADERS(endian.h)
676 AC_CHECK_HEADERS(float.h)
677 AC_CHECK_HEADERS(fp_class.h)
678 AC_CHECK_HEADERS(getopt.h)
679 AC_CHECK_HEADERS(history.h)
680 AC_CHECK_HEADERS(ieeefp.h)
681 AC_CHECK_HEADERS(limits.h)
682 AC_CHECK_HEADERS(netdb.h)
683 AC_CHECK_HEADERS(netinet/in.h)
684 AC_CHECK_HEADERS(readline.h)
685 AC_CHECK_HEADERS(readline/history.h)
686 AC_CHECK_HEADERS(readline/readline.h)
687 AC_CHECK_HEADERS(sys/select.h)
688 AC_CHECK_HEADERS(termios.h)
689 AC_CHECK_HEADERS(unistd.h)
690 AC_CHECK_HEADERS(values.h)
691 AC_CHECK_HEADERS(sys/exec.h sys/pstat.h machine/vmparam.h)
692 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
694 AC_CHECK_HEADERS(sys/param.h pwd.h)
697 dnl Checks for typedefs, structures, and compiler characteristics.
708 AC_FUNC_ACCEPT_ARGTYPES
711 PGAC_VAR_INT_TIMEZONE
712 PGAC_FUNC_GETTIMEOFDAY_1ARG
716 AC_MSG_CHECKING(for fcntl(F_SETLK))
717 AC_TRY_LINK([#include <fcntl.h>],
719 lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
720 lck.l_type = F_WRLCK;
721 fcntl(0, F_SETLK, &lck);],
722 [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
725 dnl Checks for library functions.
729 AC_CHECK_FUNCS(memmove sysconf)
730 AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
731 AC_CHECK_FUNCS(setproctitle pstat)
733 AC_MSG_CHECKING(for PS_STRINGS)
735 [#ifdef HAVE_MACHINE_VMPARAM_H
736 # include <machine/vmparam.h>
738 #ifdef HAVE_SYS_EXEC_H
739 # include <sys/exec.h>
741 [PS_STRINGS->ps_nargvstr = 1;
742 PS_STRINGS->ps_argvstr = "foo";],
743 [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PS_STRINGS)],
746 AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
747 dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
748 dnl is missing. Yes, there are machines that have only one.
749 dnl We may also decide to use snprintf.c if snprintf() is present but does
750 dnl not have working "long long int" support -- see below.
752 AC_CHECK_FUNC(snprintf,
753 AC_DEFINE(HAVE_SNPRINTF),
754 SNPRINTF='snprintf.o')
755 AC_CHECK_FUNC(vsnprintf,
756 AC_DEFINE(HAVE_VSNPRINTF),
757 SNPRINTF='snprintf.o')
759 dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
760 dnl include/c.h will provide declarations. Note this is a separate test
761 dnl from whether the functions exist in the C library --- there are systems
762 dnl that have the functions but don't bother to declare them :-(
763 dnl Note: simple-minded pattern here will do wrong thing if stdio.h
764 dnl declares vsnprintf() but not snprintf(). Hopefully there are no
765 dnl systems that are *that* brain-damaged...
766 AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
767 AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
769 dnl do this one the hard way in case isinf() is a macro
770 AC_MSG_CHECKING(for isinf)
771 AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
774 [double x = 0.0; int res = isinf(x);],
775 [ac_cv_func_or_macro_isinf=yes],
776 [ac_cv_func_or_macro_isinf=no])])
777 if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
779 AC_DEFINE(HAVE_ISINF)
786 AC_CHECK_FUNC(getrusage,
787 AC_DEFINE(HAVE_GETRUSAGE),
788 GETRUSAGE='getrusage.o')
790 AC_CHECK_FUNC(srandom,
791 AC_DEFINE(HAVE_SRANDOM),
794 AC_CHECK_FUNC(gethostname,
795 AC_DEFINE(HAVE_GETHOSTNAME),
796 GETHOSTNAME='gethostname.o')
797 AC_SUBST(GETHOSTNAME)
798 AC_CHECK_FUNC(random,
799 AC_DEFINE(HAVE_RANDOM),
800 MISSING_RANDOM='random.o')
801 AC_SUBST(MISSING_RANDOM)
802 AC_CHECK_FUNC(inet_aton,
803 AC_DEFINE(HAVE_INET_ATON),
804 INET_ATON='inet_aton.o')
806 AC_CHECK_FUNC(strerror,
807 AC_DEFINE(HAVE_STRERROR),
808 [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
811 AC_CHECK_FUNC(strdup,
812 AC_DEFINE(HAVE_STRDUP),
813 STRDUP='../../utils/strdup.o')
815 AC_CHECK_FUNC(strtol,
816 AC_DEFINE(HAVE_STRTOL),
819 AC_CHECK_FUNC(strtoul,
820 AC_DEFINE(HAVE_STRTOUL),
823 AC_CHECK_FUNC(strcasecmp,
824 AC_DEFINE(HAVE_STRCASECMP),
825 STRCASECMP='strcasecmp.o')
828 AC_DEFINE(HAVE_CBRT),
829 AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
831 # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
832 # this hackery with HPUXMATHLIB allows us to cope.
836 if [[ -r /lib/pa1.1/libm.a ]] ; then
837 HPUXMATHLIB="-L /lib/pa1.1 -lm"
840 AC_SUBST(HPUXMATHLIB)
843 AC_DEFINE(HAVE_RINT),
844 AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
846 dnl Some old versions of libreadline don't have rl_completion_append_character
847 AC_EGREP_HEADER(rl_completion_append_character, readline.h,
848 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER),
849 [AC_EGREP_HEADER(rl_completion_append_character, readline/readline.h,
850 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
851 AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
853 dnl Check for readline's filename_completion_function.
854 dnl Some versions have it but it's not in the headers, so we have to take
855 dnl care of that, too.
856 AC_CHECK_FUNCS(filename_completion_function,
857 AC_EGREP_HEADER(filename_completion_function, readline.h,
858 AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
859 [AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
860 AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
862 AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
863 AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
865 dnl Check for GNU style long options support (getopt_long)
866 AC_CHECK_FUNCS(getopt_long)
868 dnl Cannot use AC_CHECK_FUNC because finite may be a macro
869 AC_MSG_CHECKING(for finite)
870 AC_TRY_LINK([#include <math.h>],
871 [int dummy=finite(1.0);],
872 [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
875 dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
876 dnl (especially on GNU libc)
877 dnl See also comments in config.h.
878 AC_MSG_CHECKING(for sigsetjmp)
879 AC_TRY_LINK([#include <setjmp.h>],
880 [sigjmp_buf x; sigsetjmp(x, 1);],
881 [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
884 AC_ARG_ENABLE(syslog, [ --enable-syslog enable logging to syslog],
885 [case $enableval in y|ye|yes)
886 AC_CHECK_FUNC(syslog, [AC_DEFINE(ENABLE_SYSLOG)], [AC_MSG_ERROR([no syslog interface found])])
891 dnl Check to see if we have a working 64-bit integer type.
892 dnl This breaks down into two steps:
893 dnl (1) figure out if the compiler has a 64-bit int type with working
894 dnl arithmetic, and if so
895 dnl (2) see whether snprintf() can format the type correctly. (Currently,
896 dnl snprintf is the only library routine we really need for int8 support.)
897 dnl It's entirely possible to have a compiler that handles a 64-bit type
898 dnl when the C library doesn't; this is fairly likely when using gcc on
899 dnl an older platform, for example.
900 dnl If there is no native snprintf() or it does not handle the 64-bit type,
901 dnl we force our own version of snprintf() to be used instead.
902 dnl Note this test must be run after our initial check for snprintf/vsnprintf.
904 PGAC_TYPE_64BIT_INT([long int])
906 if test x"$HAVE_LONG_INT_64" = x"no" ; then
907 PGAC_TYPE_64BIT_INT([long long int])
911 dnl If we found "long int" is 64 bits, assume snprintf handles it.
912 dnl If we found we need to use "long long int", better check.
913 dnl We cope with snprintfs that use either %lld or %qd as the format.
914 dnl If neither works, fall back to our own snprintf emulation (which we
917 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
918 if [[ x$SNPRINTF = x ]] ; then
919 AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
920 AC_TRY_RUN([#include <stdio.h>
921 typedef long long int int64;
922 #define INT64_FORMAT "%lld"
927 int does_int64_snprintf_work()
932 if (sizeof(int64) != 8)
933 return 0; /* doesn't look like the right size */
936 snprintf(buf, 100, INT64_FORMAT, c);
937 if (strcmp(buf, "800000140000005") != 0)
938 return 0; /* either multiply or snprintf is busted */
942 exit(! does_int64_snprintf_work());
945 INT64_FORMAT='"%lld"'
948 AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd)
949 AC_TRY_RUN([#include <stdio.h>
950 typedef long long int int64;
951 #define INT64_FORMAT "%qd"
956 int does_int64_snprintf_work()
961 if (sizeof(int64) != 8)
962 return 0; /* doesn't look like the right size */
965 snprintf(buf, 100, INT64_FORMAT, c);
966 if (strcmp(buf, "800000140000005") != 0)
967 return 0; /* either multiply or snprintf is busted */
971 exit(! does_int64_snprintf_work());
977 # Force usage of our own snprintf, since system snprintf is broken
978 SNPRINTF='snprintf.o'
979 INT64_FORMAT='"%lld"'
981 [ AC_MSG_RESULT(assuming not on target machine)
982 # Force usage of our own snprintf, since we cannot test foreign snprintf
983 SNPRINTF='snprintf.o'
984 INT64_FORMAT='"%lld"'
986 [ AC_MSG_RESULT(assuming not on target machine)
987 # Force usage of our own snprintf, since we cannot test foreign snprintf
988 SNPRINTF='snprintf.o'
989 INT64_FORMAT='"%lld"'
992 # here if we previously decided we needed to use our own snprintf
993 INT64_FORMAT='"%lld"'
996 # Here if we are not using 'long long int' at all
1000 AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1003 dnl Determine memory alignment requirements for the basic C datatypes.
1005 PGAC_CHECK_ALIGNOF(short)
1006 PGAC_CHECK_ALIGNOF(int)
1007 PGAC_CHECK_ALIGNOF(long)
1008 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1009 PGAC_CHECK_ALIGNOF(long long int)
1011 PGAC_CHECK_ALIGNOF(double)
1013 dnl Compute maximum alignment of any basic type.
1014 dnl We assume long's alignment is at least as strong as char, short, or int;
1015 dnl but we must check long long (if it exists) and double.
1017 if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
1018 MAX_ALIGNOF=$pgac_cv_alignof_long
1019 if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1020 MAX_ALIGNOF=$pgac_cv_alignof_double
1022 if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1023 MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1026 dnl cross-compiling: assume that double's alignment is worst case
1027 MAX_ALIGNOF="$pgac_cv_alignof_double"
1029 AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1031 PGAC_FUNC_POSIX_SIGNALS
1034 dnl Check for Tcl configuration script tclConfig.sh
1036 dnl If --with-tclconfig was given, don't check for tclsh, tcl
1037 if test -z "$TCL_DIRS"
1039 AC_PATH_PROG(TCLSH, tclsh)
1042 AC_PATH_PROG(TCLSH, tcl)
1045 AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
1051 if test "$USE_TCL" = true
1053 AC_MSG_CHECKING(for tclConfig.sh)
1056 if test -z "$TCL_DIRS"
1058 library_dirs=`echo 'puts $auto_path' | $TCLSH`
1060 library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
1061 for dir in $library_dirs; do
1062 if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
1063 TCL_CONFIG_SH=$dir/tclConfig.sh
1067 if test -z "$TCL_CONFIG_SH"; then
1069 AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
1072 AC_MSG_RESULT($TCL_CONFIG_SH)
1073 AC_SUBST(TCL_CONFIG_SH)
1077 USE_TK=$USE_TCL # If TCL is disabled, disable TK
1079 dnl Check for Tk configuration script tkConfig.sh
1080 if test "$USE_TK" = true
1082 AC_MSG_CHECKING(for tkConfig.sh)
1084 # library_dirs are set in the check for TCL
1085 for dir in $library_dirs
1087 if test -d "$dir" -a -r "$dir/tkConfig.sh"
1089 TK_CONFIG_SH=$dir/tkConfig.sh
1093 if test -z "$TK_CONFIG_SH"
1096 AC_MSG_WARN(TK support disabled; Tk configuration script missing)
1099 AC_MSG_RESULT($TK_CONFIG_SH)
1100 AC_SUBST(TK_CONFIG_SH)
1101 AC_PATH_PROG(WISH, wish)
1107 dnl Check for X libraries
1109 if test "$USE_X" = true; then
1111 ice_save_LIBS="$LIBS"
1112 ice_save_CFLAGS="$CFLAGS"
1113 ice_save_CPPFLAGS="$CPPFLAGS"
1114 ice_save_LDFLAGS="$LDFLAGS"
1118 LIBS="$LIBS $X_EXTRA_LIBS"
1119 CFLAGS="$CFLAGS $X_CFLAGS"
1120 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1121 LDFLAGS="$LDFLAGS $X_LIBS"
1123 dnl Check for X library
1126 AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
1127 if test "$X11_LIBS" = ""; then
1128 dnl Not having X is bad news for pgtksh. Let the user fix this.
1129 AC_MSG_WARN([The X11 library '-lX11' could not be found,
1130 so TK support will be disabled. To enable TK support,
1131 please use the configure options '--x-includes=DIR'
1132 and '--x-libraries=DIR' to specify the X location.
1133 See the file 'config.log' for further diagnostics.])
1138 AC_SUBST(X_PRE_LIBS)
1140 LIBS="$ice_save_LIBS"
1141 CFLAGS="$ice_save_CFLAGS"
1142 CPPFLAGS="$ice_save_CPPFLAGS"
1143 LDFLAGS="$ice_save_LDFLAGS"
1146 dnl cause configure to recurse into subdirectories with their own configure
1147 dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
1148 dnl file, but then configure doesn't bother using that list. Probably a bug in
1149 dnl this version of autoconf.
1150 dnl So at the moment interfaces/odbc gets configured unconditionally.
1151 dnl - thomas 1998-10-05
1152 #if test "X$USE_ODBC" = "Xtrue"
1154 # AC_CONFIG_SUBDIRS(interfaces/odbc)
1156 if test "$USE_ODBC" = "true"
1159 AC_CHECK_HEADER(pwd.h, PWD_INCDIR=yes)
1160 if test "$PWD_INCDIR" = "no"; then
1161 AC_MSG_WARN(odbc support disabled; pwd.h missing)
1167 dnl Output files that are neither makefiles nor shell scripts probably
1168 dnl need fully-expanded substitutions, rather than partial expansions
1169 dnl that include references to other variables. Currently the only
1170 dnl such item that's needed is an expanded version of libdir, but
1171 dnl others may be needed someday. NOTE: 'eval' technique only copes
1172 dnl with one level of indirect reference per expansion; two levels is
1173 dnl currently enough for libdir, but it's ugly...
1175 dnl First we have to force 'NONE' prefix to be expanded itself.
1176 dnl For some reason, autoconf 2.13 doesn't do this until AC_OUTPUT,
1177 dnl which is too late...
1178 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1179 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1181 eval expanded_libdir="$libdir"
1182 eval expanded_libdir="$expanded_libdir"
1183 AC_SUBST(expanded_libdir)
1185 dnl Finally ready to produce output files ...
1191 src/backend/port/Makefile
1192 src/backend/catalog/genbki.sh
1193 src/backend/utils/Gen_fmgrtab.sh
1194 src/bin/pg_dump/Makefile
1195 src/bin/pg_version/Makefile
1196 src/bin/pgtclsh/mkMakefile.tcldefs.sh
1197 src/bin/pgtclsh/mkMakefile.tkdefs.sh
1198 src/bin/psql/Makefile
1199 src/include/version.h
1200 src/interfaces/Makefile
1201 src/interfaces/libpq/Makefile
1202 src/interfaces/ecpg/lib/Makefile
1203 src/interfaces/ecpg/preproc/Makefile
1204 src/interfaces/perl5/GNUmakefile
1205 src/interfaces/libpq++/Makefile
1206 src/interfaces/libpgeasy/Makefile
1207 src/interfaces/libpgtcl/Makefile
1208 src/interfaces/odbc/GNUmakefile
1209 src/interfaces/odbc/Makefile.global
1210 src/interfaces/python/GNUmakefile
1212 src/pl/plpgsql/src/Makefile
1213 src/pl/plpgsql/src/mklang.sql
1214 src/pl/tcl/mkMakefile.tcldefs.sh
1215 src/pl/plperl/GNUmakefile
1216 src/test/regress/GNUmakefile