]> granicus.if.org Git - postgresql/blob - configure.in
1b71856cfe1672cc56fcbff22450790587a2db13
[postgresql] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl Developers, please strive to achieve this order:
4 dnl
5 dnl 0. Initialization and options processing
6 dnl 1. Programs
7 dnl 2. Libraries
8 dnl 3. Header files
9 dnl 4. Types
10 dnl 5. Structures
11 dnl 6. Compiler characteristics
12 dnl 7. Functions, global variables
13 dnl 8. System services
14 dnl
15 dnl Read the Autoconf manual for details.
16
17 dnl The GNU folks apparently haven't heard that some people don't use
18 dnl Texinfo. Use this sorcery to use "docdir" instead of "infodir".
19 define([info], [doc])
20 define([infodir], [docdir])
21 AC_INIT(src/backend/access/common/heaptuple.c)
22 undefine([infodir])
23 undefine([info])
24
25 AC_PREFIX_DEFAULT(/usr/local/pgsql)
26 AC_CONFIG_HEADER(src/include/pg_config.h)
27
28 AC_PREREQ(2.13)
29 AC_CONFIG_AUX_DIR(config)
30
31 VERSION='7.2devel'
32 AC_SUBST(VERSION)
33 AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
34
35 unset CDPATH
36
37 AC_CANONICAL_HOST
38 AC_SUBST(host)
39 AC_SUBST(host_cpu)
40 AC_SUBST(host_os)
41
42 template=
43 AC_MSG_CHECKING([which template to use])
44
45 PGAC_ARG_REQ(with, template, [],
46 [
47   case $withval in
48     list)   echo; ls "$srcdir/src/template"; exit;;
49     *)      if test -f "$srcdir/src/template/$with_template" ; then
50               template=$withval
51             else
52               AC_MSG_ERROR(['$withval' is not a valid template name. Use 'list' for a list.])
53             fi;;
54   esac
55 ],
56 [
57   # --with-template not given
58
59 case $host_os in
60      aix*) template=aix ;;
61     beos*) template=beos ;;
62     bsdi*) template=bsdi ;;
63   cygwin*) template=win ;;
64   darwin*) template=darwin ;;
65     dgux*) template=dgux ;;
66  freebsd*) template=freebsd ;;
67     hpux*) template=hpux ;;
68     irix*) template=irix5 ;;
69    linux*) template=linux ;;
70   netbsd*) template=netbsd ;;
71 nextstep*) template=nextstep ;;
72  openbsd*) template=openbsd ;;
73      osf*) template=osf ;;
74      qnx*) template=qnx4 ;;
75      sco*) template=sco ;;
76  solaris*) template=solaris ;;
77    sunos*) template=sunos4 ;;
78  sysv4.2*)
79         case $host_vendor in
80           univel) template=univel ;;
81         esac ;;
82    sysv4*) template=svr4 ;;
83    sysv5*) template=unixware ;;
84   ultrix*) template=ultrix4 ;;
85 esac
86
87   if test x"$template" = x"" ; then
88     AC_MSG_ERROR([[
89 *******************************************************************
90 PostgreSQL has apparently not been ported to your platform yet.
91 To try a manual configuration, look into the src/template directory
92 for a similar platform and use the '--with-template=' option.
93
94 Please also contact <pgsql-ports@postgresql.org> to see about
95 rectifying this.  Include the above 'checking host system type...'
96 line.
97 *******************************************************************
98 ]])
99   fi
100
101 ])
102
103 AC_MSG_RESULT([$template])
104
105 PORTNAME=$template
106 AC_SUBST(PORTNAME)
107
108 AC_LINK_FILES([src/backend/port/dynloader/${template}.c], [src/backend/port/dynloader.c])
109 AC_LINK_FILES([src/backend/port/dynloader/${template}.h], [src/include/dynloader.h])
110 AC_LINK_FILES([src/include/port/${template}.h], [src/include/pg_config_os.h])
111 AC_LINK_FILES([src/makefiles/Makefile.${template}], [src/Makefile.port])
112
113 # Pick right test-and-set (TAS) code.  Most platforms have inline
114 # assembler code in src/include/storage/s_lock.h, so we just use
115 # a dummy file here.
116 case $host in
117   *-*-hpux*)        need_tas=yes; tas_file=hpux.s ;;
118   sparc-*-solaris*) need_tas=yes; tas_file=solaris_sparc.s ;;
119   i?86-*-solaris)   need_tas=yes; tas_file=solaris_i386.s ;;
120   *)                need_tas=no;  tas_file=dummy.s ;;
121 esac
122 AC_LINK_FILES([src/backend/port/tas/${tas_file}], [src/backend/port/tas.s])
123
124 if test "$need_tas" = yes ; then
125   TAS=tas.o
126 fi
127 AC_SUBST(TAS)
128
129
130
131 ##
132 ## Command line options
133 ##
134
135
136 #
137 # Add non-standard directories to the include path
138 #
139 PGAC_ARG_REQ(with, includes, [  --with-includes=DIRS    look for additional header files in DIRS])
140
141
142 #
143 # Add non-standard directories to the library search path
144 #
145 PGAC_ARG_REQ(with, libraries, [  --with-libraries=DIRS   look for additional libraries in DIRS],
146              [LIBRARY_DIRS=$withval])
147
148 PGAC_ARG_REQ(with, libs,      [  --with-libs=DIRS        alternative spelling of --with-libraries],
149              [LIBRARY_DIRS=$withval])
150
151
152 #
153 # Locale (--enable-locale)
154 #
155 AC_MSG_CHECKING([whether to build with locale support])
156 PGAC_ARG_BOOL(enable, locale, no, [  --enable-locale         enable locale support],
157               [AC_DEFINE([USE_LOCALE], 1,
158                          [Set to 1 if you want LOCALE support (--enable-locale)])])
159 AC_MSG_RESULT([$enable_locale])
160
161
162 #
163 # Character set recode (--enable-recode)
164 #
165 AC_MSG_CHECKING([whether to build with recode support])
166 PGAC_ARG_BOOL(enable, recode, no, [  --enable-recode         enable character set recode support],
167               [AC_DEFINE([CYR_RECODE], 1,
168                          [Set to 1 if you want cyrillic recode support (--enable-recode)])])
169 AC_MSG_RESULT([$enable_recode])
170
171
172 #
173 # Multibyte support
174 #
175 MULTIBYTE=
176 AC_MSG_CHECKING([whether to build with multibyte character support])
177
178 PGAC_ARG_OPTARG(enable, multibyte, [  --enable-multibyte      enable multibyte character support],
179 [MULTIBYTE=SQL_ASCII],
180 [
181   case $enableval in
182     SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
183       MULTIBYTE=$enableval;;
184     *)
185       AC_MSG_ERROR(
186 [argument to --enable-multibyte must be one of:
187   SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
188   UNICODE, MULE_INTERNAL,
189   LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
190   KOI8, WIN, ALT
191 Or do not specify an argument to the option to use the default.]);;
192   esac
193 ],
194 [
195   AC_DEFINE(MULTIBYTE, 1, [Set to 1 if you want to use multibyte characters (--enable-multibyte)])
196   AC_MSG_RESULT([yes, default $MULTIBYTE])
197 ],
198 [AC_MSG_RESULT(no)])
199
200 AC_SUBST(MULTIBYTE)
201
202 #
203 # Unicode conversion (--enable-unicode-conversion)
204 #
205 AC_MSG_CHECKING([whether to build with Unicode conversion support])
206 PGAC_ARG_BOOL(enable, unicode-conversion, no,
207               [  --enable-unicode-conversion  enable unicode conversion support],
208 [if test -z "$MULTIBYTE"; then
209   AC_MSG_ERROR([--enable-unicode-conversion only works with --enable-multibyte])
210 fi
211 AC_DEFINE([UNICODE_CONVERSION], 1,
212           [Set to 1 if you want Unicode conversion support (--enable-unicode-conversion)])])
213 AC_MSG_RESULT([$enable_unicode_conversion])
214
215 #
216 # NLS
217 #
218 AC_MSG_CHECKING([whether NLS is wanted])
219 PGAC_ARG_OPTARG(enable, nls,
220                 [  --enable-nls[=LANGUAGES]     enable Native Language Support],
221                 [],
222                 [WANTED_LANGUAGES=$enableval],
223                 [AC_DEFINE(ENABLE_NLS)])
224 AC_MSG_RESULT([$enable_nls])
225 AC_SUBST(enable_nls)
226 AC_SUBST(WANTED_LANGUAGES)
227
228 #
229 # Default port number (--with-pgport), default 5432
230 #
231 AC_MSG_CHECKING([for default port number])
232 PGAC_ARG_REQ(with, pgport, [  --with-pgport=PORTNUM   change default port number [5432]],
233              [default_port=$withval],
234              [default_port=5432])
235 AC_MSG_RESULT([$default_port])
236 # Need both of these because some places want an integer and some a string
237 AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
238 AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
239 AC_SUBST(default_port)
240
241 #
242 # Maximum number of allowed connections (--with-maxbackends), default 32
243 #
244 AC_MSG_CHECKING([for default soft limit on number of connections])
245 PGAC_ARG_REQ(with, maxbackends, [  --with-maxbackends=N    set default maximum number of connections [32]],
246              [],
247              [with_maxbackends=32])
248 AC_MSG_RESULT([$with_maxbackends])
249 AC_DEFINE_UNQUOTED([DEF_MAXBACKENDS], [$with_maxbackends],
250                    [The default soft limit on the number of concurrent connections, i.e., the default for the postmaster -N switch (--with-maxbackends)])
251
252
253 #
254 # Option to disable shared libraries
255 #
256 PGAC_ARG_BOOL(enable, shared, yes,
257               [  --disable-shared        do not build shared libraries])
258 AC_SUBST(enable_shared)
259
260 #
261 # '-rpath'-like feature can be disabled
262 #
263 PGAC_ARG_BOOL(enable, rpath, yes,
264               [  --disable-rpath         do not embed shared library search path in executables])
265 AC_SUBST(enable_rpath)
266
267
268 #
269 # --enable-debug adds -g to compiler flags
270 #
271 PGAC_ARG_BOOL(enable, debug, no,
272               [  --enable-debug          build with debugging symbols (-g)])
273
274
275 #
276 # C compiler
277 #
278
279 # For historical reasons you can also use --with-CC to specify the C compiler
280 # to use, although the standard way to do this is to set the CC environment
281 # variable.
282 PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
283
284 # On AIX, default compiler to xlc.
285 if test "$template" = aix && test -z "$CC" ; then CC=xlc; fi
286
287 # Save CFLAGS from the environment
288 has_environ_CFLAGS="${CFLAGS+yes}"
289 save_CFLAGS=$CFLAGS
290
291 AC_PROG_CC
292 # Read the template
293 . "$srcdir/src/template/$template" || exit
294
295 if test "$has_environ_CFLAGS" = yes; then
296   CFLAGS=$save_CFLAGS
297 fi
298 if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
299   CFLAGS="$CFLAGS -g"
300 fi
301 echo "using CFLAGS=$CFLAGS"
302 # Check if the compiler still works with the template settings
303 AC_PROG_CC_WORKS
304 AC_EXEEXT
305 AC_PROG_CPP
306 AC_PROG_GCC_TRADITIONAL
307 AC_SUBST(GCC)
308
309 # Create compiler version string
310 if test x"$GCC" = x"yes" ; then
311   cc_string="GCC `${CC} --version`"
312 else
313   cc_string=$CC
314 fi
315 AC_DEFINE_UNQUOTED(PG_VERSION_STR, ["PostgreSQL $VERSION on $host, compiled by $cc_string"], [A canonical string containing the version number, platform, and C compiler])
316
317
318 #
319 # Automatic dependency tracking
320 #
321 PGAC_ARG_BOOL(enable, depend, no, [  --enable-depend         turn on automatic dependency tracking],
322               [autodepend=yes])
323 AC_SUBST(autodepend)
324
325
326 #
327 # Enable assert checks
328 #
329 PGAC_ARG_BOOL(enable, cassert, no, [  --enable-cassert        enable assertion checks (for debugging)],
330               [AC_DEFINE([USE_ASSERT_CHECKING], 1,
331                          [Define to 1 to build with assertion checks])])
332
333
334 #
335 # Include directories
336 #
337 ac_save_IFS=$IFS
338 IFS="${IFS}:"
339 # SRCH_INC comes from the template file
340 for dir in $with_includes $SRCH_INC; do
341   if test -d "$dir"; then
342     INCLUDES="$INCLUDES -I$dir"
343   else
344     AC_MSG_WARN([*** Include directory $dir does not exist.])
345   fi
346 done
347 IFS=$ac_save_IFS
348 AC_SUBST(INCLUDES)
349
350
351 #
352 # Library directories
353 #
354 ac_save_IFS=$IFS
355 IFS="${IFS}:"
356 # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
357 for dir in $LIBRARY_DIRS $SRCH_LIB; do
358   if test -d "$dir"; then
359     LIBDIRS="$LIBDIRS -L$dir"
360   else
361     AC_MSG_WARN([*** Library directory $dir does not exist.])
362   fi
363 done
364 IFS=$ac_save_IFS
365
366
367 #
368 # Tcl/Tk
369 #
370 AC_MSG_CHECKING([whether to build with Tcl])
371 PGAC_ARG_BOOL(with, tcl, no, [  --with-tcl              build Tcl and Tk interfaces])
372 AC_MSG_RESULT([$with_tcl])
373 AC_SUBST([with_tcl])
374
375 # If Tcl is enabled (above) then Tk is also, unless the user disables it using --without-tk
376 AC_MSG_CHECKING([whether to build with Tk])
377 if test "$with_tcl" = yes; then
378   PGAC_ARG_BOOL(with, tk, yes, [  --without-tk            do not build Tk interfaces if Tcl is enabled])
379 else
380   with_tk=no
381 fi
382 AC_MSG_RESULT([$with_tk])
383 AC_SUBST([with_tk])
384
385
386 # We see if the path to the TCL/TK configuration scripts is specified.
387 # This will override the use of tclsh to find the paths to search.
388
389 PGAC_ARG_REQ(with, tclconfig, [  --with-tclconfig=DIR    tclConfig.sh and tkConfig.sh are in DIR])
390
391 # We see if the path to the TK configuration scripts is specified.
392 # This will override the use of tclsh to find the paths to search.
393
394 PGAC_ARG_REQ(with, tkconfig,  [  --with-tkconfig=DIR     tkConfig.sh is in DIR])
395
396
397 #
398 # If Tcl is enabled (above) then check for pltcl_unknown_support
399 #
400 AC_MSG_CHECKING([whether to build with PL/Tcl unknown support])
401 if test "$with_tcl" = yes; then
402   PGAC_ARG_BOOL(enable, pltcl-unknown, no,
403                 [  --enable-pltcl-unknown  build PL/Tcl unknown support (if Tcl is enabled)],
404                 [AC_DEFINE([ENABLE_PLTCL_UNKNOWN])])
405 else
406   enable_pltcl_unknown=no
407 fi
408 AC_MSG_RESULT([$enable_pltcl_unknown])
409 AC_SUBST([enable_pltcl_unknown])
410
411
412 #
413 # If Tcl is enabled (above) then check for pltcl_utf
414 #
415 AC_MSG_CHECKING([whether to build with PL/Tcl with UTF support])
416 if test "$with_tcl" = yes; then
417   PGAC_ARG_BOOL(enable, pltcl-utf, no,
418                 [  --enable-pltcl-utf      build PL/Tcl UTF support (if Tcl is enabled)],
419                 [AC_DEFINE([ENABLE_PLTCL_UTF])])
420 else
421   enable_pltcl_utf=no
422 fi
423 AC_MSG_RESULT([$enable_pltcl_utf])
424 AC_SUBST([enable_pltcl_utf])
425
426
427 #
428 # Optionally build Perl modules (Pg.pm and PL/Perl)
429 #
430 AC_MSG_CHECKING([whether to build Perl modules])
431 PGAC_ARG_BOOL(with, perl, no, [  --with-perl             build Perl interface and PL/Perl])
432 AC_MSG_RESULT([$with_perl])
433 AC_SUBST(with_perl)
434
435 #
436 # Optionally build Python interface module
437 #
438 AC_MSG_CHECKING([whether to build Python modules])
439 PGAC_ARG_BOOL(with, python, no, [  --with-python           build Python interface module])
440 AC_MSG_RESULT([$with_python])
441 AC_SUBST(with_python)
442
443 #
444 # Optionally build the Java/JDBC tools
445 #
446 AC_MSG_CHECKING([whether to build Java/JDBC tools])
447 PGAC_ARG_BOOL(with, java, no, [  --with-java             build JDBC interface and Java tools],
448 [AC_MSG_RESULT(yes)
449 PGAC_PATH_ANT
450 if test -z "$ANT"; then
451   AC_MSG_ERROR([Ant is required to build Java components])
452 fi],
453 [AC_MSG_RESULT(no)])
454 AC_SUBST(with_java)
455
456 dnl A note on the Kerberos and OpenSSL options:
457 dnl
458 dnl The user can give an argument to the option in order the specify
459 dnl the base path of the respective installation (what he specified
460 dnl perhaps as --prefix). If no argument is given ($withval is "yes")
461 dnl then we take the path where the package installs by default. This
462 dnl way the user doesn't have to use redundant --with-includes and
463 dnl --with-libraries options, but he can still use them if the layout
464 dnl is non-standard.
465
466 #
467 # Kerberos 4
468 #
469 PGAC_ARG_OPTARG(with, krb4, [  --with-krb4[=DIR]       build with Kerberos 4 support [/usr/athena]],
470                 [krb4_prefix=/usr/athena],
471                 [krb4_prefix=$withval],
472 [
473   AC_MSG_RESULT([building with Kerberos 4 support])
474   AC_DEFINE(KRB4, 1, [Define if you are building with Kerberos 4 support.])
475
476   if test -d "$krb4_prefix/include"; then
477     INCLUDES="$INCLUDES -I$krb4_prefix/include"
478   fi
479   if test -d "$krb4_prefix/lib"; then
480     LIBDIRS="$LIBDIRS -L$krb4_prefix/lib"
481   fi
482
483   krb_srvtab="/etc/srvtab"
484 ])
485
486 AC_SUBST(with_krb4)
487
488
489 #
490 # Kerberos 5
491 #
492 PGAC_ARG_OPTARG(with, krb5, [  --with-krb5[=DIR]       build with Kerberos 5 support [/usr/athena]],
493               [krb5_prefix=/usr/athena],
494               [krb5_prefix=$withval],
495 [
496   AC_MSG_RESULT([building with Kerberos 5 support])
497   AC_DEFINE(KRB5, 1, [Define if you are building with Kerberos 5 support.])
498
499   if test -d "$krb5_prefix/include"; then
500     INCLUDES="$INCLUDES -I$krb5_prefix/include"
501   fi
502   if test -d "$krb5_prefix/lib"; then
503     LIBDIRS="$LIBDIRS -L$krb5_prefix/lib"
504   fi
505
506   krb_srvtab="FILE:\$(sysconfdir)/krb5.keytab"
507 ])
508
509 AC_SUBST(with_krb5)
510
511
512 # Using both Kerberos 4 and Kerberos 5 at the same time isn't going to work.
513 if test "$with_krb4" = yes && test "$with_krb5" = yes ; then
514   AC_MSG_ERROR([Kerberos 4 and Kerberos 5 support cannot be combined])
515 fi
516
517 AC_SUBST(krb_srvtab)
518
519
520 #
521 # Kerberos configuration parameters
522 #
523 PGAC_ARG_REQ(with, krb-srvnam,
524              [  --with-krb-srvnam=NAME  name of the service principal in Kerberos [postgres]],
525              [],
526              [with_krb_srvnam="postgres"])
527 AC_DEFINE_UNQUOTED([PG_KRB_SRVNAM], ["$with_krb_srvnam"],
528                    [The name of the PostgreSQL service principal in Kerberos])
529
530
531 #
532 # PAM
533 #
534 AC_MSG_CHECKING([whether to build with PAM support])
535 PGAC_ARG_OPTARG(with, pam,
536                 [  --with-pam[=DIR]        build with PAM support [/usr]],
537                 [pam_prefix=/usr],
538                 [pam_prefix=$withval],
539 [
540   AC_MSG_RESULT([yes])
541   AC_DEFINE([USE_PAM], 1, [Define to build with PAM support])
542
543 ],
544 [AC_MSG_RESULT(no)])
545
546 AC_SUBST(with_pam)
547
548
549 #
550 # OpenSSL
551 #
552 PGAC_ARG_OPTARG(with, openssl,
553                 [  --with-openssl[=DIR]    build with OpenSSL support [/usr/local/ssl]],
554                 [openssl_prefix=/usr/local/ssl],
555                 [openssl_prefix=$withval],
556 [
557   AC_MSG_RESULT([building with OpenSSL support])
558   AC_DEFINE([USE_SSL], 1, [Define to build with (Open)SSL support])
559
560   if test -d "${openssl_prefix}/include" ; then
561     INCLUDES="$INCLUDES -I${openssl_prefix}/include"
562   fi
563   if test -d "${openssl_prefix}/lib" ; then
564     LIBDIRS="$LIBDIRS -L${openssl_prefix}/lib"
565   fi
566 ])
567
568 AC_SUBST(with_openssl)
569
570
571
572 #
573 # Optionally enable the building of the ODBC driver
574 #
575  
576 # Old option name
577 if test "${with_odbc+set}" = set && test "${enable_odbc+set}" != set; then
578   enable_odbc=$with_odbc
579 fi
580  
581 AC_MSG_CHECKING([whether to build the ODBC driver])
582 PGAC_ARG_BOOL(enable, odbc, no, [  --enable-odbc           build the ODBC driver package])
583 AC_MSG_RESULT([$enable_odbc])
584 AC_SUBST([enable_odbc])
585
586
587 # Allow for overriding the default location of the odbcinst.ini
588 # file which is normally ${sysconfdir} (i.e., ${prefix}/etc).
589 PGAC_ARG_REQ(with, odbcinst,
590              [  --with-odbcinst=DIR     default directory for odbcinst.ini [sysconfdir]],
591              [odbcinst_ini_dir=$withval],
592              [odbcinst_ini_dir="\${sysconfdir}"])
593 AC_SUBST([odbcinst_ini_dir])
594
595
596
597 # Assume system is ELF if it predefines __ELF__ as 1,
598 # otherwise believe host_os based default.
599 case $host_os in
600     freebsd1*|freebsd2*) elf=no;;
601     freebsd3*|freebsd4*) elf=yes;;
602 esac
603
604 AC_EGREP_CPP(yes,
605 [#if __ELF__
606   yes
607 #endif
608 ],
609 [ELF_SYS=true],
610 [if test "X$elf" = "Xyes" ; then
611   ELF_SYS=true
612 else
613   ELF_SYS=
614 fi])
615 AC_SUBST(ELF_SYS)
616
617
618
619 #
620 # Optionally build C++ code (i.e., libpq++)
621 #
622 AC_MSG_CHECKING([whether to build C++ modules])
623 PGAC_ARG_OPTARG(with, CXX, [  --with-CXX              build C++ modules (libpq++)],
624                 [],
625                 [CXX=$withval],
626 [
627   AC_MSG_RESULT(yes)
628
629   # If the user has specified CXXFLAGS in the environment, leave it
630   # alone, else use a default.
631
632   has_environ_CXXFLAGS="${CXXFLAGS+yes}"
633   AC_PROG_CXX
634   if test "$has_environ_CXXFLAGS" != yes; then
635     if test "$GXX" = yes; then
636       CXXFLAGS=-O2
637     else
638       case $template in
639         osf)            CXXFLAGS='-O4 -Olimit 2000' ;;
640         unixware)       CXXFLAGS='-O' ;;
641         *)              CXXFLAGS= ;;
642       esac
643     fi
644   fi
645   if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
646     CXXFLAGS="$CXXFLAGS -g"
647   fi
648   echo "using CXXFLAGS=$CXXFLAGS"
649
650   AC_PROG_CXXCPP
651   AC_SUBST(GXX)
652   PGAC_CLASS_STRING
653   PGAC_CXX_NAMESPACE_STD
654 ],
655 [AC_MSG_RESULT(no)])
656 AC_SUBST(with_CXX)
657
658 CPPFLAGS="$CPPFLAGS $INCLUDES"
659 LDFLAGS="$LDFLAGS $LIBDIRS"
660
661 echo "using CPPFLAGS=$CPPFLAGS"
662 echo "using LDFLAGS=$LDFLAGS"
663
664
665 AC_PROG_AWK
666 PGAC_PATH_FLEX
667 AC_PROG_LN_S
668 AC_PROG_LD
669 AC_SUBST(LD)
670 AC_SUBST(with_gnu_ld)
671 case $host_os in sysv5*)
672   AC_CACHE_CHECK([whether ld -R works], [pgac_cv_prog_ld_R],
673   [
674     pgac_save_LDFLAGS=$LDFLAGS; LDFLAGS="$LDFLAGS -Wl,-R/usr/lib"
675     AC_TRY_LINK([], [], [pgac_cv_prog_ld_R=yes], [pgac_cv_prog_ld_R=no])
676     LDFLAGS=$pgac_save_LDFLAGS
677   ])
678   ld_R_works=$pgac_cv_prog_ld_R
679   AC_SUBST(ld_R_works)
680 esac
681 AC_PROG_RANLIB
682 AC_CHECK_PROGS(LORDER, lorder)
683 AC_PATH_PROG(TAR, tar)
684
685 AC_CHECK_PROGS(YACC, ['bison -y'])
686 if test -z "$YACC"; then
687   AC_MSG_WARN([
688 *** Without Bison you will not be able to build PostgreSQL from CVS or
689 *** change any of the parser definition files.  You can obtain Bison from
690 *** a GNU mirror site.  (If you are using the official distribution of
691 *** PostgreSQL then you do not need to worry about this because the Bison
692 *** output is pre-generated.)  To use a different yacc program (possible,
693 *** but not recommended), set the environment variable YACC before running
694 *** 'configure'.])
695 fi
696 AC_SUBST(YFLAGS)
697
698 if test "$with_tk" = yes; then
699     AC_PATH_PROG(WISH, wish)
700     test -z "$WISH" && AC_MSG_ERROR(['wish' is required for Tk support])
701 fi
702
703 PGAC_PATH_PERL
704 if test "$with_perl" = yes; then
705   PGAC_CHECK_PERL_DIRS
706 fi
707
708 if test "$with_python" = yes; then
709   PGAC_PATH_PYTHON
710   PGAC_CHECK_PYTHON_MODULE_SETUP
711   PGAC_CHECK_PYTHON_EMBED_SETUP
712 fi
713
714
715 ##
716 ## Libraries
717 ##
718
719 PGAC_CHECK_READLINE
720 AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)])
721
722 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
723 then
724         AC_CHECK_LIB(bsd,      main)
725 fi
726 AC_CHECK_LIB(util,     setproctitle)
727 AC_CHECK_LIB(m,        main)
728 AC_CHECK_LIB(dl,       main)
729 AC_CHECK_LIB(socket,   main)
730 AC_CHECK_LIB(nsl,      main)
731 AC_CHECK_LIB(ipc,      main)
732 AC_CHECK_LIB(IPC,      main)
733 AC_CHECK_LIB(lc,       main)
734 AC_CHECK_LIB(dld,      main)
735 AC_CHECK_LIB(ld,       main)
736 AC_CHECK_LIB(compat,   main)
737 AC_CHECK_LIB(BSD,      main)
738 AC_CHECK_LIB(gen,      main)
739 AC_CHECK_LIB(PW,       main)
740 AC_CHECK_LIB(resolv,   main)
741 # QNX:
742 AC_CHECK_LIB([[unix]], main)
743 AC_SEARCH_LIBS(crypt,  crypt)
744 # BeOS:
745 AC_CHECK_LIB(bind,     __inet_ntoa)
746 # Only consider libz to be present if we find <zlib.h> as well;
747 # furthermore, check that <zlib.h> defines z_streamp (versions before
748 # about 1.0.4 did not).  While we could work around the lack of z_streamp,
749 # it seems unwise to encourage people to use such old zlib versions...
750 AC_EGREP_HEADER(z_streamp, zlib.h, [
751 AC_CHECK_LIB(z,        inflate)
752 ])
753 # Solaris:
754 AC_SEARCH_LIBS(fdatasync, [rt posix4])
755
756 if test "$with_krb4" = yes ; then
757   AC_CHECK_LIB(des, [des_encrypt], [], [AC_MSG_ERROR([library 'des' is required for Kerberos 4])])
758   AC_CHECK_LIB(krb, [krb_sendauth], [], [AC_MSG_ERROR([library 'krb' is required for Kerberos 4])])
759 fi
760
761 if test "$with_krb5" = yes ; then
762   AC_CHECK_LIB(com_err, [com_err], [], [AC_MSG_ERROR([library 'com_err' is required for Kerberos 5])])
763   AC_CHECK_LIB(crypto,  [krb5_encrypt], [],
764     [AC_CHECK_LIB(k5crypto, [krb5_encrypt], [], [AC_MSG_ERROR([library 'crypto' or 'k5crypto' is required for Kerberos 5])])])
765   AC_CHECK_LIB(krb5,    [krb5_sendauth], [], [AC_MSG_ERROR([library 'krb5' is required for Kerberos 5])])
766 fi
767
768 if test "$with_openssl" = yes ; then
769   dnl Order matters!
770   AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])])
771   AC_CHECK_LIB(ssl,    [SSL_library_init], [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])])
772 fi
773
774 if test "$with_pam" = yes ; then
775   AC_CHECK_LIB(pam,    [pam_start], [], [AC_MSG_ERROR([library 'pam' is required for PAM])])
776 fi
777
778 if test "$enable_nls" = yes ; then
779   PGAC_CHECK_GETTEXT
780 fi
781
782 ##
783 ## Header files
784 ##
785 dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
786 AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/types.h sys/un.h termios.h kernel/OS.h kernel/image.h SupportDefs.h])
787
788 dnl At least on IRIX, cpp test for netinet/tcp.h will fail unless netinet/in.h
789 dnl is included first.  So can't just use AC_CHECK_HEADERS; do it this way:
790 AC_CHECK_HEADERS([netinet/in.h])
791 AC_MSG_CHECKING([for netinet/tcp.h])
792 AC_TRY_CPP([
793 #ifdef HAVE_NETINET_IN_H
794 #include <netinet/in.h>
795 #endif
796 #include <netinet/tcp.h>
797 ], [AC_DEFINE(HAVE_NETINET_TCP_H) AC_MSG_RESULT(yes)],
798 [AC_MSG_RESULT(no)])
799
800 PGAC_HEADER_STRING
801
802 AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
803 AC_CHECK_HEADERS([readline/history.h history.h], [break])
804
805 if test "$with_krb4" = yes ; then
806   AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
807 fi
808
809 if test "$with_krb5" = yes ; then
810   AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
811   AC_CHECK_HEADER(com_err.h, [], [AC_MSG_ERROR([header file <com_err.h> is required for Kerberos 5])])
812 fi
813
814 if test "$with_openssl" = yes ; then
815   AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
816   AC_CHECK_HEADER([openssl/err.h], [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
817 fi
818
819 if test "$with_pam" = yes ; then
820   AC_CHECK_HEADER([security/pam_appl.h], [], [AC_MSG_ERROR([header file <security/pam_appl.h> is required for PAM])])
821 fi
822
823
824 ##
825 ## Types, structures, compiler characteristics
826 ##
827 AC_C_CONST
828 AC_C_INLINE
829 AC_C_STRINGIZE
830 PGAC_C_SIGNED
831 PGAC_C_VOLATILE
832 AC_STRUCT_TIMEZONE
833 PGAC_UNION_SEMUN
834 PGAC_STRUCT_CMSGCRED
835 PGAC_STRUCT_FCRED
836 PGAC_STRUCT_SOCKCRED
837 PGAC_STRUCT_SOCKADDR_UN
838
839 ##
840 ## Functions, global variables
841 ##
842 PGAC_VAR_INT_TIMEZONE
843 AC_FUNC_ACCEPT_ARGTYPES
844 PGAC_FUNC_GETTIMEOFDAY_1ARG
845
846 AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid dlopen fdatasync])
847
848 dnl Check whether <unistd.h> declares fdatasync().
849 AC_EGREP_HEADER(fdatasync, unistd.h, AC_DEFINE(HAVE_FDATASYNC_DECL))
850
851 AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
852 [AC_TRY_LINK(
853 [#include <machine/vmparam.h>
854 #include <sys/exec.h>
855 ],
856 [PS_STRINGS->ps_nargvstr = 1;
857 PS_STRINGS->ps_argvstr = "foo";],
858 [pgac_cv_var_PS_STRINGS=yes],
859 [pgac_cv_var_PS_STRINGS=no])])
860 if test "$pgac_cv_var_PS_STRINGS" = yes ; then
861   AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
862 fi
863
864 dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
865 dnl is missing.  Yes, there are machines that have only one.
866 dnl We may also decide to use snprintf.c if snprintf() is present but does
867 dnl not have working "long long int" support -- see below.
868 SNPRINTF=''
869 AC_CHECK_FUNC(snprintf,
870               AC_DEFINE(HAVE_SNPRINTF),
871               SNPRINTF='snprintf.o')
872 AC_CHECK_FUNC(vsnprintf,
873               AC_DEFINE(HAVE_VSNPRINTF),
874               SNPRINTF='snprintf.o')
875 AC_SUBST(SNPRINTF)
876 dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
877 dnl include/c.h will provide declarations.  Note this is a separate test
878 dnl from whether the functions exist in the C library --- there are systems
879 dnl that have the functions but don't bother to declare them :-(
880 dnl Note: simple-minded pattern here will do wrong thing if stdio.h
881 dnl declares vsnprintf() but not snprintf().  Hopefully there are no
882 dnl systems that are *that* brain-damaged...
883 AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
884 AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
885
886 # do this one the hard way in case isinf() is a macro
887 AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
888 [AC_TRY_LINK(
889 [#include <math.h>
890 ],
891 [double x = 0.0; int res = isinf(x);],
892 [ac_cv_func_isinf=yes],
893 [ac_cv_func_isinf=no])])
894
895 if test $ac_cv_func_isinf = yes ; then
896   AC_DEFINE(HAVE_ISINF)
897   ISINF=
898 else
899   ISINF='isinf.o'
900   # Look for a way to implement a substitute for isinf()
901   AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
902 fi
903 AC_SUBST(ISINF)
904
905 AC_CHECK_FUNC(getrusage,
906               AC_DEFINE(HAVE_GETRUSAGE),
907               GETRUSAGE='getrusage.o')
908 AC_SUBST(GETRUSAGE)
909 AC_CHECK_FUNC(srandom,
910               AC_DEFINE(HAVE_SRANDOM),
911               SRANDOM='srandom.o')
912 AC_SUBST(SRANDOM)
913 AC_CHECK_FUNC(gethostname,
914               AC_DEFINE(HAVE_GETHOSTNAME),
915               GETHOSTNAME='gethostname.o')
916 AC_SUBST(GETHOSTNAME)
917 AC_CHECK_FUNC(random,
918               AC_DEFINE(HAVE_RANDOM),
919               MISSING_RANDOM='random.o')
920 AC_SUBST(MISSING_RANDOM)
921 AC_CHECK_FUNC(inet_aton,
922               AC_DEFINE(HAVE_INET_ATON),
923               INET_ATON='inet_aton.o')
924 AC_SUBST(INET_ATON)
925 AC_CHECK_FUNC(strerror,
926               AC_DEFINE(HAVE_STRERROR),
927               STRERROR='strerror.o')
928 AC_SUBST(STRERROR)
929 AC_CHECK_FUNC(strdup,
930               AC_DEFINE(HAVE_STRDUP),
931               STRDUP='../../utils/strdup.o')
932 AC_SUBST(STRDUP)
933 AC_CHECK_FUNC(strtol,
934               AC_DEFINE(HAVE_STRTOL),
935               STRTOL='strtol.o')
936 AC_SUBST(STRTOL)
937 AC_CHECK_FUNC(strtoul,
938               AC_DEFINE(HAVE_STRTOUL),
939               STRTOUL='strtoul.o')
940 AC_SUBST(STRTOUL)
941 AC_CHECK_FUNC(strcasecmp,
942               AC_DEFINE(HAVE_STRCASECMP),
943               STRCASECMP='strcasecmp.o')
944 AC_SUBST(STRCASECMP)
945 AC_CHECK_FUNC(cbrt,
946               AC_DEFINE(HAVE_CBRT),
947               AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
948
949 # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
950 # this hackery with HPUXMATHLIB allows us to cope.
951 HPUXMATHLIB=""
952 case $host_cpu in
953   hppa1.1) 
954         if [[ -r /lib/pa1.1/libm.a ]] ; then
955             HPUXMATHLIB="-L /lib/pa1.1 -lm"
956         fi ;;
957 esac
958 AC_SUBST(HPUXMATHLIB)
959
960 AC_CHECK_FUNC(rint,
961               AC_DEFINE(HAVE_RINT),
962               AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
963
964
965 # Readline versions < 2.1 don't have rl_completion_append_character
966 AC_MSG_CHECKING([for rl_completion_append_character])
967 AC_TRY_LINK([#include <stdio.h>
968 #ifdef HAVE_READLINE_READLINE_H
969 # include <readline/readline.h>
970 #elif defined(HAVE_READLINE_H)
971 # include <readline.h>
972 #endif
973 ],
974 [rl_completion_append_character = 'x';],
975 [AC_MSG_RESULT(yes)
976 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
977 [AC_MSG_RESULT(no)])
978
979 AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
980
981
982 dnl Cannot use AC_CHECK_FUNC because finite may be a macro
983 AC_MSG_CHECKING(for finite)
984 AC_TRY_LINK([#include <math.h>],
985         [int dummy=finite(1.0);],
986         [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
987         AC_MSG_RESULT(no))
988
989 dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
990 dnl (especially on GNU libc)
991 dnl See also comments in pg_config.h.
992 AC_MSG_CHECKING(for sigsetjmp)
993 AC_TRY_LINK([#include <setjmp.h>],
994         [sigjmp_buf x; sigsetjmp(x, 1);],
995         [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
996         AC_MSG_RESULT(no))
997
998
999 PGAC_ARG_BOOL(enable, syslog, no, [  --enable-syslog         enable logging to syslog],
1000               [AC_CHECK_FUNC(syslog,
1001                              [AC_DEFINE([ENABLE_SYSLOG], 1,
1002                                         [Define to 1 if to enable the syslogging code])],
1003                              [AC_MSG_ERROR([no syslog interface found])])])
1004
1005
1006 AC_CACHE_CHECK([for optreset], pgac_cv_var_int_optreset,
1007 [AC_TRY_LINK([#include <unistd.h>],
1008   [extern int optreset; optreset = 1;],
1009   [pgac_cv_var_int_optreset=yes],
1010   [pgac_cv_var_int_optreset=no])])
1011 if test x"$pgac_cv_var_int_optreset" = x"yes"; then
1012   AC_DEFINE(HAVE_INT_OPTRESET, 1)
1013 fi
1014
1015
1016 # This test makes sure that run tests work at all.  Sometimes a shared
1017 # library is found by the linker, but the runtime linker can't find it.
1018 # This check should come after all modifications of compiler or linker
1019 # variables, and before any other run tests.
1020 AC_MSG_CHECKING([test program])
1021 AC_TRY_RUN([int main() { return 0; }],
1022 [AC_MSG_RESULT(ok)],
1023 [AC_MSG_RESULT(failed)
1024 AC_MSG_ERROR([[
1025 *** Could not execute a simple test program.  This may be a problem
1026 *** related to locating shared libraries.  Check the file 'config.log'
1027 *** for the exact reason.]])],
1028 [AC_MSG_RESULT([cross-compiling])])
1029
1030
1031 dnl Check to see if we have a working 64-bit integer type.
1032 dnl This breaks down into two steps:
1033 dnl (1) figure out if the compiler has a 64-bit int type with working
1034 dnl arithmetic, and if so
1035 dnl (2) see whether snprintf() can format the type correctly.  (Currently,
1036 dnl snprintf is the only library routine we really need for int8 support.)
1037 dnl It's entirely possible to have a compiler that handles a 64-bit type
1038 dnl when the C library doesn't; this is fairly likely when using gcc on
1039 dnl an older platform, for example.
1040 dnl If there is no native snprintf() or it does not handle the 64-bit type,
1041 dnl we force our own version of snprintf() to be used instead.
1042 dnl Note this test must be run after our initial check for snprintf/vsnprintf.
1043
1044 PGAC_TYPE_64BIT_INT([long int])
1045
1046 if test x"$HAVE_LONG_INT_64" = x"no" ; then
1047   PGAC_TYPE_64BIT_INT([long long int])
1048 fi
1049
1050
1051 dnl If we need to use "long long int", figure out whether nnnLL notation works.
1052
1053 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1054   AC_TRY_COMPILE([
1055 #define INT64CONST(x)  x##LL
1056 long long int foo = INT64CONST(0x1234567890123456);
1057 ],
1058         [],
1059         [AC_DEFINE(HAVE_LL_CONSTANTS)],
1060         [])
1061 fi
1062
1063
1064 dnl If we found "long int" is 64 bits, assume snprintf handles it.
1065 dnl If we found we need to use "long long int", better check.
1066 dnl We cope with snprintfs that use either %lld or %qd as the format.
1067 dnl If neither works, fall back to our own snprintf emulation (which we
1068 dnl know uses %lld).
1069
1070 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1071   if [[ x$SNPRINTF = x ]] ; then
1072     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
1073     AC_TRY_RUN([#include <stdio.h>
1074 typedef long long int int64;
1075 #define INT64_FORMAT "%lld"
1076
1077 int64 a = 20000001;
1078 int64 b = 40000005;
1079
1080 int does_int64_snprintf_work()
1081 {
1082   int64 c;
1083   char buf[100];
1084
1085   if (sizeof(int64) != 8)
1086     return 0;                   /* doesn't look like the right size */
1087
1088   c = a * b;
1089   snprintf(buf, 100, INT64_FORMAT, c);
1090   if (strcmp(buf, "800000140000005") != 0)
1091     return 0;                   /* either multiply or snprintf is busted */
1092   return 1;
1093 }
1094 main() {
1095   exit(! does_int64_snprintf_work());
1096 }],
1097         [ AC_MSG_RESULT(yes)
1098           INT64_FORMAT='"%lld"'
1099         ],
1100   [ AC_MSG_RESULT(no)
1101     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
1102     AC_TRY_RUN([#include <stdio.h>
1103 typedef long long int int64;
1104 #define INT64_FORMAT "%qd"
1105    
1106 int64 a = 20000001;
1107 int64 b = 40000005;
1108    
1109 int does_int64_snprintf_work()
1110 {  
1111   int64 c;
1112   char buf[100];
1113
1114   if (sizeof(int64) != 8)
1115     return 0;     /* doesn't look like the right size */
1116
1117   c = a * b;
1118   snprintf(buf, 100, INT64_FORMAT, c);
1119   if (strcmp(buf, "800000140000005") != 0)
1120     return 0;     /* either multiply or snprintf is busted */
1121   return 1;
1122 }
1123 main() {
1124   exit(! does_int64_snprintf_work());
1125 }],
1126   [ AC_MSG_RESULT(yes)
1127     INT64_FORMAT='"%qd"'
1128   ],
1129   [ AC_MSG_RESULT(no)
1130         # Force usage of our own snprintf, since system snprintf is broken
1131         SNPRINTF='snprintf.o'
1132         INT64_FORMAT='"%lld"'
1133   ],
1134   [ AC_MSG_RESULT(assuming not on target machine)
1135         # Force usage of our own snprintf, since we cannot test foreign snprintf
1136         SNPRINTF='snprintf.o'
1137         INT64_FORMAT='"%lld"'
1138   ]) ],
1139   [ AC_MSG_RESULT(assuming not on target machine)
1140         # Force usage of our own snprintf, since we cannot test foreign snprintf
1141         SNPRINTF='snprintf.o'
1142         INT64_FORMAT='"%lld"'
1143   ])
1144   else
1145     # here if we previously decided we needed to use our own snprintf
1146     INT64_FORMAT='"%lld"'
1147   fi
1148 else
1149   # Here if we are not using 'long long int' at all
1150   INT64_FORMAT='"%ld"'
1151 fi
1152
1153 AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1154
1155
1156 AC_CHECK_FUNCS([strtoll strtoq], [break])
1157 AC_CHECK_FUNCS([strtoull strtouq], [break])
1158
1159 dnl psql needs atexit() or on_exit()
1160 AC_CHECK_FUNC(atexit,
1161         [AC_DEFINE(HAVE_ATEXIT)],
1162         [AC_CHECK_FUNCS(on_exit,
1163                 [AC_DEFINE(HAVE_ON_EXIT)],
1164                 [AC_MSG_ERROR([neither atexit() nor on_exit() found])])])
1165
1166 dnl Need a #define for the size of Datum (unsigned long)
1167
1168 AC_CHECK_SIZEOF(unsigned long, 4)
1169 AC_DEFINE_UNQUOTED(SIZEOF_DATUM, $ac_cv_sizeof_unsigned_long)
1170
1171 dnl Determine memory alignment requirements for the basic C datatypes.
1172
1173 PGAC_CHECK_ALIGNOF(short)
1174 PGAC_CHECK_ALIGNOF(int)
1175 PGAC_CHECK_ALIGNOF(long)
1176 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1177   PGAC_CHECK_ALIGNOF(long long int)
1178 fi
1179 PGAC_CHECK_ALIGNOF(double)
1180
1181 dnl Compute maximum alignment of any basic type.
1182 dnl We assume long's alignment is at least as strong as char, short, or int;
1183 dnl but we must check long long (if it exists) and double.
1184
1185 if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
1186   MAX_ALIGNOF=$pgac_cv_alignof_long
1187   if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1188     MAX_ALIGNOF=$pgac_cv_alignof_double
1189   fi
1190   if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1191     MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1192   fi
1193 else
1194   dnl cross-compiling: assume that double's alignment is worst case
1195   MAX_ALIGNOF="$pgac_cv_alignof_double"
1196 fi
1197 AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1198
1199 PGAC_FUNC_POSIX_SIGNALS
1200
1201
1202 # Check for Tcl configuration script tclConfig.sh
1203 if test "$with_tcl" = yes; then
1204     PGAC_PATH_TCLCONFIGSH([$with_tclconfig])
1205 fi
1206
1207 # Check for Tk configuration script tkConfig.sh
1208 if test "$with_tk" = yes; then
1209     PGAC_PATH_TKCONFIGSH([$with_tkconfig $with_tclconfig])
1210 fi
1211
1212
1213 #
1214 # Check for DocBook and tools
1215 #
1216 PGAC_PROG_NSGMLS
1217 # If you don't have nsgmls you won't get very far, so save the cycles.
1218 if test -n "$NSGMLS"; then
1219   PGAC_PROG_JADE
1220   PGAC_CHECK_DOCBOOK([3.1])
1221   PGAC_PATH_DOCBOOK_STYLESHEETS
1222   AC_CHECK_PROGS(SGMLSPL, sgmlspl)
1223 fi
1224
1225 abs_top_srcdir=
1226 AC_SUBST(abs_top_srcdir)
1227
1228 # prepare build tree if outside source tree
1229 # Note 1: test -ef might not exist, but it's more reliable than `pwd`.
1230 # Note 2: /bin/pwd might be better than shell's built-in at getting
1231 #         a symlink-free name.
1232 if ( test "$srcdir" -ef . ) >/dev/null 2>&1 || test "`cd $srcdir && /bin/pwd`" = "`/bin/pwd`"; then
1233     :
1234 else
1235     abs_top_srcdir=`cd $srcdir && pwd`
1236     echo $ac_n "preparing build tree... $ac_c" 1>&6
1237     /bin/sh "$srcdir/config/prep_buildtree" "$abs_top_srcdir" "." \
1238       || AC_MSG_ERROR(failed)
1239     AC_MSG_RESULT(done)
1240 fi
1241
1242 AC_OUTPUT(
1243 [
1244   GNUmakefile
1245   src/GNUmakefile
1246   src/Makefile.global
1247   src/backend/port/Makefile
1248 ],
1249 [
1250 # Update timestamp for pg_config.h (see Makefile.global)
1251 test x"$CONFIG_HEADERS" != x"" && echo >src/include/stamp-h
1252 ])