]> granicus.if.org Git - postgresql/blob - configure.in
Attached is a patch that prevents a NullPointerException in the JDBC
[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/config.h)
27
28 AC_PREREQ(2.13)
29 AC_CONFIG_AUX_DIR(config)
30
31 VERSION='7.1devel'
32 AC_SUBST(VERSION)
33 AC_DEFINE_UNQUOTED(PG_VERSION, "$VERSION")
34
35 AC_CANONICAL_HOST
36
37 template=
38 AC_MSG_CHECKING([which template to use])
39
40 # check if --with-template was given
41 if test x"${with_template+set}" = xset ; then
42   case $with_template in
43     yes|no) AC_MSG_ERROR([You must supply an argument to the --with-template option.]);;
44     list)   echo; ls "$srcdir/src/template"; exit;;
45     *)      if test -f "$srcdir/src/template/$with_template" ; then
46               template=$with_template
47             else
48               AC_MSG_ERROR([\`$with_template' is not a valid template name. Use \`list' for a list.])
49             fi;;
50   esac
51
52 else # --with-template not given
53
54 case $host_os in
55      aix*) template=aix ;;
56     bsdi*) template=bsdi ;;
57   cygwin*) template=win ;;
58     dgux*) template=dgux ;;
59  freebsd*) template=freebsd ;;
60     hpux*) template=hpux ;;
61     irix*) template=irix5 ;;
62    linux*) template=linux ;;
63   netbsd*) template=netbsd ;;
64 nextstep*) template=nextstep ;;
65  openbsd*) template=openbsd ;;
66      osf*) template=osf ;;
67      qnx*) template=qnx4 ;;
68      sco*) template=sco ;;
69  solaris*)
70         case $host_cpu in
71           sparc) template=solaris_sparc ;;
72            i?86) template=solaris_i386 ;;
73         esac ;;
74    sunos*) template=sunos4 ;;
75  sysv4.2*)
76         case $host_vendor in
77           univel) template=univel ;;
78         esac ;;
79    sysv4*) template=svr4 ;;
80  sysv5uw*) template=unixware ;;
81   ultrix*) template=ultrix4 ;;
82 esac
83
84   if test x"$template" = x"" ; then
85     AC_MSG_ERROR([
86 *******************************************************************
87 PostgreSQL has apparently not been ported to your platform yet.
88 To try a manual configuration, look into the src/template directory
89 for a similar platform and use the \`--with-template=' option.
90
91 Please also contact <pgsql-ports@postgresql.org> to see about
92 rectifying this.  Include the above \`checking host system type...'
93 line.
94 *******************************************************************
95 ])
96   fi
97
98 fi # --with-template not given
99
100 AC_MSG_RESULT([$template])
101
102 PORTNAME=$template
103 CPU=$host_cpu
104 AC_SUBST(PORTNAME)
105 AC_SUBST(CPU)
106
107 AC_LINK_FILES([src/backend/port/dynloader/${template}.c], [src/backend/port/dynloader.c])
108 AC_LINK_FILES([src/backend/port/dynloader/${template}.h], [src/include/dynloader.h])
109 AC_LINK_FILES([src/include/port/${template}.h], [src/include/os.h])
110 AC_LINK_FILES([src/makefiles/Makefile.${template}], [src/Makefile.port])
111
112 # Pick right test-and-set (TAS) code. Most platforms have inline
113 # assembler code in their port include file, so we just use a dummy
114 # file here.
115 tas_file=dummy.s
116 need_tas=no
117 case $template in
118   hpux)           need_tas=yes; tas_file=hpux.s ;;
119   solaris_sparc)  need_tas=yes; tas_file=solaris_sparc.s ;;
120   solaris_i386)   need_tas=yes; tas_file=solaris_i386.s ;;
121 esac
122
123 if test "$need_tas" = yes ; then
124   AC_LINK_FILES([src/backend/port/tas/${tas_file}], [src/backend/port/tas.s])
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 AC_ARG_WITH(includes, [  --with-includes=DIRS    look for additional header files in DIRS],
140 [
141   case $withval in
142     yes | no) AC_MSG_ERROR([You must supply an argument to the --with-includes option.]);;
143   esac
144 ])
145
146
147 #
148 # Add non-standard directories to the library search path
149 #
150 AC_ARG_WITH(libraries, [  --with-libraries=DIRS   look for additional libraries in DIRS],
151 [
152   case $withval in
153     yes | no) AC_MSG_ERROR([You must supply an argument to the --with-libraries option.]);;
154   esac
155   LIBRARY_DIRS=$withval
156 ])
157
158 AC_ARG_WITH(libs,      [  --with-libs=DIRS        alternative spelling of --with-libraries],
159 [
160   case $withval in
161     yes | no) AC_MSG_ERROR([You must supply an argument to the --with-libs option.]);;
162   esac
163   LIBRARY_DIRS=$withval
164 ])
165
166
167 #
168 # Locale (--enable-locale)
169 #
170 AC_MSG_CHECKING([whether to build with locale support])
171 AC_ARG_ENABLE(locale, [  --enable-locale         enable locale support],
172 [if test x"$enable_locale" != x"no" ; then
173   enable_locale=yes
174   AC_DEFINE(USE_LOCALE, 1, [Set to 1 if you want LOCALE support (--enable-locale)])
175 fi],
176 [enable_locale=no])
177 AC_MSG_RESULT([$enable_locale])
178
179
180 #
181 # Cyrillic recode (--enable-recode)
182 #
183 AC_MSG_CHECKING([whether to build with Cyrillic recode support])
184 AC_ARG_ENABLE(recode, [  --enable-recode         enable cyrillic recode support],
185 [if test x"$enable_recode" != x"no" ; then
186   enable_recode=yes
187   AC_DEFINE(CYR_RECODE, 1, [Set to 1 if you want cyrillic recode support (--enable-recode)])
188 fi],
189 [enable_recode=no])
190 AC_MSG_RESULT([$enable_recode])
191
192
193 #
194 # Multibyte support
195 #
196 MULTIBYTE=
197 AC_MSG_CHECKING([whether to build with multibyte character support])
198 AC_ARG_ENABLE(multibyte, [  --enable-multibyte      enable multibyte character support],
199 [
200   case $enableval in
201     no)         enable_multibyte=no;;
202     yes)        enable_multibyte=yes; MULTIBYTE=SQL_ASCII;;
203     SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
204                 enable_multibyte=yes; MULTIBYTE=$enableval;;
205     *)          AC_MSG_ERROR(
206 [argument to --enable-multibyte must be one of:
207   SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
208   UNICODE, MULE_INTERNAL,
209   LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
210   KOI8, WIN, ALT
211 Or do not specify an argument to the option to use the default.]) ;;
212   esac
213 ],
214 [enable_multibyte=no])
215
216 AC_SUBST(MULTIBYTE)
217
218 if test "$enable_multibyte" = yes ; then
219   AC_DEFINE(MULTIBYTE, 1, [Set to 1 if you want to use multibyte characters (--enable-multibyte)])
220   AC_MSG_RESULT([yes, default $MULTIBYTE])
221 else
222   AC_MSG_RESULT(no)
223 fi
224
225
226 #
227 # Default port number (--with-pgport), default 5432
228 #
229 AC_MSG_CHECKING([for default port number])
230 AC_ARG_WITH(pgport, [  --with-pgport=PORTNUM   change default port number [5432]],
231 [case $withval in
232   yes|no)       AC_MSG_ERROR([You must supply an argument to the --with-pgport option]);;
233   *)            default_port=$withval;;
234 esac
235 ],
236 [default_port=5432])
237 # Need both of these because backend wants an integer and frontend a string
238 AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
239 AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
240 AC_MSG_RESULT([$default_port])
241
242
243 #
244 # Maximum number of allowed connections (--with-maxbackends), default 32
245 #
246 AC_MSG_CHECKING([for default soft limit on number of connections])
247 AC_ARG_WITH(maxbackends, [  --with-maxbackends=N    set default maximum number of connections [32]],
248 [case $withval in
249   yes|no)       AC_MSG_ERROR([You must supply an argument to the --with-maxbackends option]);;
250 esac],
251 [with_maxbackends=32])
252 AC_MSG_RESULT([$with_maxbackends])
253 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)])
254
255
256 #
257 # C compiler
258 #
259
260 # For historical reasons you can also use --with-CC to specify the C compiler
261 # to use, although the standard way to do this is to set the CC environment
262 # variable.
263 if test "${with_CC+set}" = set; then
264   case $with_CC in
265     yes | no)   AC_MSG_ERROR([You must supply an argument to the --with-CC option.]);;
266     *)          CC=$with_CC;;
267   esac
268 fi
269
270 # On AIX, default compiler to xlc.
271 if test "$template" = aix && test -z "$CC" ; then CC=xlc; fi
272
273 AC_PROG_CC
274 # Read the template
275 . "$srcdir/src/template/$template" || exit
276 echo "using CFLAGS=$CFLAGS"
277 # Check if the compiler still works with the template settings
278 AC_PROG_CC_WORKS
279 AC_PROG_CPP
280 AC_PROG_GCC_TRADITIONAL
281
282 AC_SUBST(GCC)
283 AC_SUBST(AROPT)
284 AC_SUBST(SHARED_LIB)
285 AC_SUBST(DLSUFFIX)
286 AC_SUBST(DL_LIB)
287
288 # Create compiler version string
289 if test x"$GCC" = x"yes" ; then
290   cc_string="GCC `${CC} --version`"
291 else
292   cc_string=$CC
293 fi
294 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])
295
296
297 #
298 # Automatic dependency tracking
299 #
300 AC_ARG_ENABLE(depend, [  --enable-depend         turn on automatic dependency tracking],
301 [
302   if test x"$enableval" = x"yes" ; then
303     autodepend=yes
304   fi
305 ])
306 AC_SUBST(autodepend)
307
308
309 # --enable-debug adds -g to compiler flags
310 # --disable-debug will forcefully remove it
311 AC_MSG_CHECKING(setting debug compiler flag)
312 AC_ARG_ENABLE(debug, [  --enable-debug          build with debugging symbols (-g)],
313 [
314   case $enableval in
315     yes)  CFLAGS="$CFLAGS -g"
316           AC_MSG_RESULT(yes)
317           ;;
318     *)    CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' -e 's/^-g//'`
319           AC_MSG_RESULT(no)
320           ;;
321   esac
322 ],
323 [AC_MSG_RESULT(using default)])
324
325
326 #
327 # Include directories
328 #
329 ac_save_IFS=$IFS
330 IFS=':'
331 # SRCH_INC comes from the template file
332 for dir in $with_includes $SRCH_INC; do
333   if test -d "$dir"; then
334     INCLUDES="$INCLUDES -I$dir"
335   else
336     AC_MSG_WARN([*** Include directory $dir does not exist.])
337   fi
338 done
339 IFS=$ac_save_IFS
340 AC_SUBST(INCLUDES)
341
342
343 #
344 # Library directories
345 #
346 ac_save_IFS=$IFS
347 IFS=':'
348 # LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
349 for dir in $LIBRARY_DIRS $SRCH_LIB; do
350   if test -d "$dir"; then
351     PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
352   else
353     AC_MSG_WARN([*** Library directory $dir does not exist.])
354   fi
355 done
356 IFS=$ac_save_IFS
357
358
359
360 dnl We exclude tcl support unless user says --with-tcl
361 AC_MSG_CHECKING(setting USE_TCL)
362 AC_ARG_WITH(
363    tcl,
364    [  --with-tcl              build Tcl interfaces and pgtclsh ],
365    [
366         case "$withval" in
367         y | ye | yes)           USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
368         *)                      USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
369         esac
370    ],
371    [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
372 )
373 AC_SUBST(USE_TCL)
374 AC_SUBST(USE_TK)
375
376
377 dnl We see if the path to the TCL/TK configuration scripts is specified.
378 dnl This will override the use of tclsh to find the paths to search.
379
380 AC_ARG_WITH(tclconfig,
381     [  --with-tclconfig=DIR    tclConfig.sh and tkConfig.sh are in DIR],
382     [
383         case "$withval" in
384         "" | y | ye | yes | n | no)
385             AC_MSG_ERROR([*** You must supply an argument to the --with-tclconfig option.])
386           ;;
387         esac
388         TCL_DIRS="$withval"
389     ]
390 )
391
392 dnl We see if the path to the TK configuration scripts is specified.
393 dnl This will override the use of tclsh to find the paths to search.
394
395 AC_ARG_WITH(tkconfig,
396     [  --with-tkconfig=DIR     tkConfig.sh is in DIR],
397     [
398         case "$withval" in
399         "" | y | ye | yes | n | no)
400             AC_MSG_ERROR([*** You must supply an argument to the --with-tkconfig option.])
401           ;;
402         esac
403         TK_DIRS="$withval"
404     ]
405 )
406
407
408 dnl
409 dnl Optionally build Perl modules (Pg.pm and PL/Perl)
410 dnl
411 AC_MSG_CHECKING(whether to build Perl modules)
412 AC_ARG_WITH(perl, [  --with-perl             build Perl interface and plperl],
413 [if test x"${withval}" = x"yes" ; then
414   AC_MSG_RESULT(yes)
415 else
416   AC_MSG_RESULT(no)
417 fi],
418 [AC_MSG_RESULT(no)])
419 AC_SUBST(with_perl)
420
421
422 dnl
423 dnl Optionally build Python interface module
424 dnl
425 AC_MSG_CHECKING(whether to build Python modules)
426 AC_ARG_WITH(python, [  --with-python           build Python interface module],
427 [if test x"${withval}" = x"yes" ; then
428   AC_MSG_RESULT(yes)
429   PGAC_PROG_PYTHON
430   PGAC_PATH_PYTHONDIR
431 else
432   AC_MSG_RESULT(no)
433 fi],
434 [AC_MSG_RESULT(no)])
435 AC_SUBST(with_python)
436
437
438 dnl A note on the Kerberos and OpenSSL options:
439 dnl
440 dnl The user can give an argument to the option in order the specify
441 dnl the base path of the respective installation (what he specified
442 dnl perhaps as --prefix). If no argument is given ($withval is "yes")
443 dnl then we take the path where the package installs by default. This
444 dnl way the user doesn't have to use redundant --with-includes and
445 dnl --with-libraries options, but he can still use them if the layout
446 dnl is non-standard.
447
448 #
449 # Kerberos 4
450 #
451 AC_ARG_WITH(krb4, [  --with-krb4[=DIR]       use Kerberos 4 [/usr/athena]],
452 [if test x"$withval" != x"no"; then
453   if test x"$withval" != x"yes"; then
454     krb4_prefix=$withval
455   else
456     krb4_prefix=/usr/athena
457   fi
458   with_krb4=yes
459 else
460   with_krb4=no
461 fi],
462 [with_krb4=no])
463
464 AC_SUBST(with_krb4)
465 if test "$with_krb4" = yes ; then
466   AC_MSG_RESULT([building with Kerberos 4 support])
467   AC_DEFINE(KRB4, [], [Define if you are building with Kerberos 4 support.])
468
469   if test -d "$krb4_prefix"; then
470     if test -d "$krb4_prefix/include"; then
471       INCLUDES="$INCLUDES -I$krb4_prefix/include"
472     fi
473     if test -d "$krb4_prefix/lib"; then
474       krb_libdir="-L$krb4_prefix/lib"
475       LIBS="$krb_libdir $LIBS"
476     fi
477   fi
478   dnl Test for these libraries is below
479   KRB_LIBS="$krb_libdir -lkrb -ldes"
480
481   krb_srvtab='/etc/srvtab'
482 fi
483
484
485 #
486 # Kerberos 5
487 #
488 AC_ARG_WITH(krb5, [  --with-krb5[=DIR]       use Kerberos 5 [/usr/athena]],
489 [if test x"$withval" != x"no"; then
490   if test x"$withval" != x"yes"; then
491     krb5_prefix=$withval
492   else
493     krb5_prefix=/usr/athena
494   fi
495   with_krb5=yes
496 else
497   with_krb5=no
498 fi],
499 [with_krb5=no])
500
501 AC_SUBST(with_krb5)
502 if test "$with_krb5" = yes ; then
503   AC_MSG_RESULT([building with Kerberos 5 support])
504   AC_DEFINE(KRB5,, [Define if you are building with Kerberos 5 support.])
505
506   if test -d $krb5_prefix; then
507     if test -d "$krb5_prefix/include"; then
508       INCLUDES="$INCLUDES -I$krb5_prefix/include"
509     fi
510     if test -d "$krb5_prefix/lib"; then
511       krb_libdir="-L$krb5_prefix/lib"
512       LIBS="$krb_libdir $LIBS"
513     fi
514   fi
515
516   dnl Test for these libraries is below
517   KRB_LIBS="$krb_libdir -lkrb5 -lcrypto -lcom_err"
518
519   krb_srvtab='FILE:$(sysconfdir)/krb5.keytab'
520 fi
521
522
523 # Using both Kerberos 4 and Kerberos 5 at the same time isn't going to work.
524 if test "$with_krb4" = yes && test "$with_krb5" = yes ; then
525   AC_MSG_ERROR([Kerberos 4 and Kerberos 5 support cannot be combined])
526 fi
527
528
529 AC_SUBST(krb_srvtab)
530 dnl Necessary for special libpq link
531 AC_SUBST(KRB_LIBS)
532
533
534 #
535 # Kerberos configuration parameters
536 #
537 AC_ARG_WITH(krb-srvnam, [  --with-krb-srvnam=NAME  name of the Postgres service principal in Kerberos],
538 [if test x"$withval" = x"yes"; then
539   AC_MSG_ERROR([argument required for --with-krb-srvnam])
540 else
541   krb_srvnam=$withval
542 fi],
543 [krb_srvnam="postgres"])
544 AC_DEFINE_UNQUOTED(PG_KRB_SRVNAM, ["$krb_srvnam"], [The name of the Postgres service principal])
545
546
547
548 #
549 # OpenSSL
550 #
551 AC_ARG_WITH(openssl, [  --with-openssl[=DIR]    build with OpenSSL support [/usr/local/ssl]],
552 [if test x"$withval" != x"no" ; then
553   if test x"$withval" != x"yes" ; then
554     openssl_prefix=$withval
555   else
556     openssl_prefix=/usr/local/ssl
557   fi
558   with_openssl=yes
559 else
560   with_openssl=no
561 fi],
562 [with_openssl=no])
563
564 AC_SUBST(with_openssl)
565 if test "$with_openssl" = yes ; then
566   AC_MSG_RESULT([building with OpenSSL support])
567   AC_DEFINE([USE_SSL], [], [Define to build with (Open)SSL support])
568
569   if test -d "${openssl_prefix}/include" ; then
570     INCLUDES="$INCLUDES -I${openssl_prefix}/include"
571   fi
572   if test -d "${openssl_prefix}/lib" ; then
573     openssl_libdir="${openssl_prefix}/lib"
574     LIBS="$LIBS -L${openssl_prefix}/lib"
575   else
576     openssl_libdir="${openssl_prefix}"
577     LIBS="$LIBS -L${openssl_prefix}"
578   fi
579 fi
580
581
582 # OpenSSL and Kerberos 5 both have a `crypto' library, so if you want to
583 # use both of them you'll have to figure it out yourself.
584 if test "$with_openssl" = yes && test "$with_krb5" = yes ; then
585   AC_MSG_ERROR([OpenSSL and Kerberos 5 support cannot be combined])
586 fi
587
588
589 dnl
590 dnl Optionally enable the building of the ODBC driver
591 dnl
592  
593 dnl Old option name
594 if test "x${with_odbc+set}" = xset && test "x${enable_odbc+set}" != xset; then
595   enable_odbc=$with_odbc
596 fi
597  
598 AC_MSG_CHECKING(whether to build the ODBC driver)
599 AC_ARG_ENABLE(odbc, [  --enable-odbc           build the ODBC driver package],
600 [if test x"$enableval" = x"yes" ; then
601   AC_MSG_RESULT(yes)
602 else
603   AC_MSG_RESULT(no)
604 fi],
605 [AC_MSG_RESULT(no)])
606 AC_SUBST(enable_odbc)
607
608
609 dnl Allow for overriding the default location of the odbcinst.ini
610 dnl file which is normally ${datadir} (i.e., ${prefix}/share).
611 if test x"$enable_odbc" = x"yes" ; then
612 AC_ARG_WITH(odbcinst, [  --with-odbcinst=DIR     default directory for odbcinst.ini [sysconfdir]],
613 [if test x"$with_odbcinst" = x"yes" || test x"$with_odbcinst" = x"no" ; then
614   AC_MSG_ERROR([You must supply an argument to the --with-odbcinst option.])
615 fi
616 odbcinst_ini_dir=$withval],
617 [odbcinst_ini_dir='${sysconfdir}'])
618 else
619   odbcinst_ini_dir='${sysconfdir}'
620 fi
621 AC_SUBST(odbcinst_ini_dir)
622
623
624
625 dnl Unless we specify the command line options
626 dnl     --enable cassert        to explicitly enable it
627 dnl If you do not explicitly do it, it defaults to disabled
628 AC_MSG_CHECKING(setting ASSERT CHECKING)
629 AC_ARG_ENABLE(
630    cassert,
631    [  --enable-cassert        enable assertion checks (for debugging) ],
632    AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
633    AC_MSG_RESULT(disabled)
634 )
635
636
637 # Assume system is ELF if it predefines __ELF__ as 1,
638 # otherwise believe host_os based default.
639 case $host_os in
640   freebsd1*|freebsd2*) elf=yes;;
641 esac
642
643 AC_EGREP_CPP(yes,
644 [#if __ELF__
645   yes
646 #endif
647 ],
648 [ELF_SYS=true],
649 [if test "X$elf" = "Xyes" ; then
650   ELF_SYS=true
651 else
652   ELF_SYS=
653 fi])
654 AC_SUBST(ELF_SYS)
655
656
657
658 dnl
659 dnl Optionally build C++ code (i.e., libpq++)
660 dnl
661 AC_MSG_CHECKING([whether to build C++ modules])
662 AC_ARG_WITH(CXX, [  --with-CXX              build C++ modules (libpq++)],
663 [if test x"$withval" != x"no"; then
664   if test x"$withval" != x"yes" ; then
665     CXX=$withval
666   fi
667   with_CXX=yes
668 fi],
669 [with_CXX=no])
670
671 AC_MSG_RESULT([$with_CXX])
672 AC_SUBST(with_CXX)
673
674 if test $with_CXX = yes; then
675   AC_PROG_CXX
676   AC_PROG_CXXCPP
677   PGAC_CLASS_STRING
678   PGAC_CXX_NAMESPACE_STD
679 fi
680
681
682 CPPFLAGS="$CPPFLAGS $INCLUDES"
683 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
684
685 echo "using CPPFLAGS=$CPPFLAGS"
686 echo "using LDFLAGS=$LDFLAGS"
687
688
689 # Figure out how to invoke "install" and what install options to use.
690
691 AC_PROG_INSTALL
692 # When Autoconf chooses install-sh as install program it tries to generate
693 # a relative path to it in each makefile where it subsitutes it. This clashes
694 # with our Makefile.global concept. This workaround helps.
695 case $INSTALL in
696   *install-sh*) INSTALL='\${SHELL} \${top_srcdir}/config/install-sh -c';;
697 esac
698
699 # Fix Autoconf's brain-dead defaults for script installs.
700 INSTALL_SCRIPT="\${INSTALL} -m 755"
701
702 # HPUX wants shared libs to be mode 555. Add your platform's special
703 # needs here if necessary.
704 case $host_os in
705     hpux*)      INSTL_SHLIB_OPTS="-m 555" ;;
706     *)          INSTL_SHLIB_OPTS="-m 644" ;;
707 esac
708
709 INSTALL_SHLIB="\${INSTALL} $INSTL_SHLIB_OPTS"
710 AC_SUBST(INSTALL_SHLIB)
711
712
713 mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
714 AC_SUBST(mkinstalldirs)
715
716
717 AC_PROG_AWK
718 PGAC_PATH_FLEX
719 AC_PROG_LN_S
720 AC_PROG_RANLIB
721 AC_PATH_PROG(tar, tar)
722 AC_CHECK_PROGS(PERL, perl,)
723 AC_PROG_YACC
724 AC_SUBST(YFLAGS)
725
726
727 ##
728 ## Libraries
729 ##
730
731 AC_CHECK_LIB(sfio,     main)
732 AC_CHECK_LIB(ncurses,  main, [], [AC_CHECK_LIB(curses, main)])
733 AC_CHECK_LIB(termcap,  main)
734 AC_CHECK_LIB(readline, main)
735 AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
736     AC_CHECK_LIB(history,  main) )
737
738 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
739 then
740         AC_CHECK_LIB(bsd,      main)
741 fi
742 AC_CHECK_LIB(util,     setproctitle)
743 AC_CHECK_LIB(m,        main)
744 AC_CHECK_LIB(dl,       main)
745 AC_CHECK_LIB(socket,   main)
746 AC_CHECK_LIB(nsl,      main)
747 AC_CHECK_LIB(ipc,      main)
748 AC_CHECK_LIB(IPC,      main)
749 AC_CHECK_LIB(lc,       main)
750 AC_CHECK_LIB(dld,      main)
751 AC_CHECK_LIB(ln,       main)
752 AC_CHECK_LIB(ld,       main)
753 AC_CHECK_LIB(compat,   main)
754 AC_CHECK_LIB(BSD,      main)
755 AC_CHECK_LIB(gen,      main)
756 AC_CHECK_LIB(PW,       main)
757 AC_SEARCH_LIBS(crypt,  crypt)
758 AC_CHECK_LIB(z,        inflate)
759
760 if test "$with_krb4" = yes ; then
761   AC_CHECK_LIB(des, [des_encrypt], [], [AC_MSG_ERROR([library \`des' is required for Kerberos 4])])
762   AC_CHECK_LIB(krb, [krb_sendauth], [], [AC_MSG_ERROR([library \`krb' is required for Kerberos 4])])
763 fi
764
765 if test "$with_krb5" = yes ; then
766   AC_CHECK_LIB(com_err, main, [], [AC_MSG_ERROR([library \`com_err' is required for Kerberos 5])])
767   AC_CHECK_LIB(crypto,  main, [], [AC_MSG_ERROR([library \`crypto' is required for Kerberos 5])])
768   AC_CHECK_LIB(krb5,    main, [], [AC_MSG_ERROR([library \`krb5' is required for Kerberos 5])])
769 fi
770
771 if test "$with_openssl" = yes ; then
772   dnl Order matters!
773   AC_CHECK_LIB(crypto, [CRYPTO_new_ex_data], [], [AC_MSG_ERROR([library \`ssl' is required for OpenSSL])])
774   AC_CHECK_LIB(ssl,    [SSL_library_init], [], [AC_MSG_ERROR([library \`ssl' is required for OpenSSL])])
775 fi
776
777
778 ##
779 ## Header files
780 ##
781 dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
782 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])
783
784 AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
785 AC_CHECK_HEADERS([readline/history.h history.h], [break])
786
787 if test "$with_krb4" = yes ; then
788   AC_CHECK_HEADER(krb.h, [], [AC_MSG_ERROR([header file <krb.h> is required for Kerberos 4])])
789 fi
790
791 if test "$with_krb5" = yes ; then
792   AC_CHECK_HEADER(krb5.h, [], [AC_MSG_ERROR([header file <krb5.h> is required for Kerberos 5])])
793   AC_CHECK_HEADER(com_err.h, [], [AC_MSG_ERROR([header file <com_err.h> is required for Kerberos 5])])
794 fi
795
796 if test "$with_openssl" = yes ; then
797   AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file <openssl/ssl.h> is required for OpenSSL])])
798   AC_CHECK_HEADER([openssl/err.h], [], [AC_MSG_ERROR([header file <openssl/err.h> is required for OpenSSL])])
799 fi
800
801
802 ##
803 ## Types, structures, compiler characteristics
804 ##
805 AC_C_CONST
806 AC_C_INLINE
807 AC_C_STRINGIZE
808 PGAC_C_SIGNED
809 PGAC_C_VOLATILE
810 AC_STRUCT_TIMEZONE
811 PGAC_UNION_SEMUN
812
813
814 ##
815 ## Functions, global variables
816 ##
817 PGAC_VAR_INT_TIMEZONE
818 AC_FUNC_ACCEPT_ARGTYPES
819 PGAC_FUNC_GETTIMEOFDAY_1ARG
820
821 AC_MSG_CHECKING([for fcntl(F_SETLK)])
822 case $host_os in
823   linux*)       AC_MSG_RESULT([broken on Linux]) ;;
824   *)
825 AC_TRY_LINK(
826 [#include <stdio.h>
827 #include <fcntl.h>
828 ],
829 [struct flock lck;
830 lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
831 lck.l_type = F_WRLCK;
832 fcntl(0, F_SETLK, &lck);],
833 [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
834 [AC_MSG_RESULT(no)])
835         ;;
836 esac
837
838 AC_CHECK_FUNCS([fcvt getopt_long memmove pstat setproctitle setsid sigprocmask sysconf waitpid])
839
840 AC_CACHE_CHECK([for PS_STRINGS], [pgac_cv_var_PS_STRINGS],
841 [AC_TRY_LINK(
842 [#include <machine/vmparam.h>
843 #include <sys/exec.h>
844 ],
845 [PS_STRINGS->ps_nargvstr = 1;
846 PS_STRINGS->ps_argvstr = "foo";],
847 [pgac_cv_var_PS_STRINGS=yes],
848 [pgac_cv_var_PS_STRINGS=no])])
849 if test "$pgac_cv_var_PS_STRINGS" = yes ; then
850   AC_DEFINE([HAVE_PS_STRINGS], [], [Define if the PS_STRINGS thing exists.])
851 fi
852
853 dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
854 dnl is missing.  Yes, there are machines that have only one.
855 dnl We may also decide to use snprintf.c if snprintf() is present but does
856 dnl not have working "long long int" support -- see below.
857 SNPRINTF=''
858 AC_CHECK_FUNC(snprintf,
859               AC_DEFINE(HAVE_SNPRINTF),
860               SNPRINTF='snprintf.o')
861 AC_CHECK_FUNC(vsnprintf,
862               AC_DEFINE(HAVE_VSNPRINTF),
863               SNPRINTF='snprintf.o')
864 AC_SUBST(SNPRINTF)
865 dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
866 dnl include/c.h will provide declarations.  Note this is a separate test
867 dnl from whether the functions exist in the C library --- there are systems
868 dnl that have the functions but don't bother to declare them :-(
869 dnl Note: simple-minded pattern here will do wrong thing if stdio.h
870 dnl declares vsnprintf() but not snprintf().  Hopefully there are no
871 dnl systems that are *that* brain-damaged...
872 AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
873 AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
874
875 # do this one the hard way in case isinf() is a macro
876 AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
877 [AC_TRY_LINK(
878 [#include <math.h>
879 ],
880 [double x = 0.0; int res = isinf(x);],
881 [ac_cv_func_isinf=yes],
882 [ac_cv_func_isinf=no])])
883
884 if test $ac_cv_func_isinf = yes ; then
885   AC_DEFINE(HAVE_ISINF)
886   ISINF=
887 else
888   ISINF='isinf.o'
889   # Look for a way to implement a substitute for isinf()
890   AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
891 fi
892 AC_SUBST(ISINF)
893
894 AC_CHECK_FUNC(getrusage,
895               AC_DEFINE(HAVE_GETRUSAGE),
896               GETRUSAGE='getrusage.o')
897 AC_SUBST(GETRUSAGE)
898 AC_CHECK_FUNC(srandom,
899               AC_DEFINE(HAVE_SRANDOM),
900               SRANDOM='srandom.o')
901 AC_SUBST(SRANDOM)
902 AC_CHECK_FUNC(gethostname,
903               AC_DEFINE(HAVE_GETHOSTNAME),
904               GETHOSTNAME='gethostname.o')
905 AC_SUBST(GETHOSTNAME)
906 AC_CHECK_FUNC(random,
907               AC_DEFINE(HAVE_RANDOM),
908               MISSING_RANDOM='random.o')
909 AC_SUBST(MISSING_RANDOM)
910 AC_CHECK_FUNC(inet_aton,
911               AC_DEFINE(HAVE_INET_ATON),
912               INET_ATON='inet_aton.o')
913 AC_SUBST(INET_ATON)
914 AC_CHECK_FUNC(strerror,
915               AC_DEFINE(HAVE_STRERROR),
916               [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
917 AC_SUBST(STRERROR)
918 AC_SUBST(STRERROR2)
919 AC_CHECK_FUNC(strdup,
920               AC_DEFINE(HAVE_STRDUP),
921               STRDUP='../../utils/strdup.o')
922 AC_SUBST(STRDUP)
923 AC_CHECK_FUNC(strtol,
924               AC_DEFINE(HAVE_STRTOL),
925               STRTOL='strtol.o')
926 AC_SUBST(STRTOL)
927 AC_CHECK_FUNC(strtoul,
928               AC_DEFINE(HAVE_STRTOUL),
929               STRTOL='strtoul.o')
930 AC_SUBST(STRTOUL)
931 AC_CHECK_FUNC(strcasecmp,
932               AC_DEFINE(HAVE_STRCASECMP),
933               STRCASECMP='strcasecmp.o')
934 AC_SUBST(STRCASECMP)
935 AC_CHECK_FUNC(cbrt,
936               AC_DEFINE(HAVE_CBRT),
937               AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
938
939 # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
940 # this hackery with HPUXMATHLIB allows us to cope.
941 HPUXMATHLIB=""
942 case $host_cpu in
943   hppa1.1) 
944         if [[ -r /lib/pa1.1/libm.a ]] ; then
945             HPUXMATHLIB="-L /lib/pa1.1 -lm"
946         fi ;;
947 esac
948 AC_SUBST(HPUXMATHLIB)
949
950 AC_CHECK_FUNC(rint,
951               AC_DEFINE(HAVE_RINT),
952               AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
953
954 dnl Some old versions of libreadline don't have rl_completion_append_character
955 AC_EGREP_HEADER(rl_completion_append_character, readline.h,
956         AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER),
957         [AC_EGREP_HEADER(rl_completion_append_character, readline/readline.h,
958                 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
959 AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
960
961 dnl Check for readline's filename_completion_function.
962 dnl Some versions have it but it's not in the headers, so we have to take
963 dnl care of that, too.
964 AC_CHECK_FUNCS(filename_completion_function,
965     AC_EGREP_HEADER(filename_completion_function, readline.h,
966         AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
967         [AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
968             AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
969 )
970 AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
971 AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
972
973
974 dnl Cannot use AC_CHECK_FUNC because finite may be a macro
975 AC_MSG_CHECKING(for finite)
976 AC_TRY_LINK([#include <math.h>],
977         [int dummy=finite(1.0);],
978         [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
979         AC_MSG_RESULT(no))
980
981 dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
982 dnl (especially on GNU libc)
983 dnl See also comments in config.h.
984 AC_MSG_CHECKING(for sigsetjmp)
985 AC_TRY_LINK([#include <setjmp.h>],
986         [sigjmp_buf x; sigsetjmp(x, 1);],
987         [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
988         AC_MSG_RESULT(no))
989
990 AC_ARG_ENABLE(syslog, [  --enable-syslog         enable logging to syslog],
991     [case $enableval in y|ye|yes)
992         AC_CHECK_FUNC(syslog, [AC_DEFINE(ENABLE_SYSLOG)], [AC_MSG_ERROR([no syslog interface found])])
993         ;;
994      esac]
995 )
996
997 dnl Check to see if we have a working 64-bit integer type.
998 dnl This breaks down into two steps:
999 dnl (1) figure out if the compiler has a 64-bit int type with working
1000 dnl arithmetic, and if so
1001 dnl (2) see whether snprintf() can format the type correctly.  (Currently,
1002 dnl snprintf is the only library routine we really need for int8 support.)
1003 dnl It's entirely possible to have a compiler that handles a 64-bit type
1004 dnl when the C library doesn't; this is fairly likely when using gcc on
1005 dnl an older platform, for example.
1006 dnl If there is no native snprintf() or it does not handle the 64-bit type,
1007 dnl we force our own version of snprintf() to be used instead.
1008 dnl Note this test must be run after our initial check for snprintf/vsnprintf.
1009
1010 PGAC_TYPE_64BIT_INT([long int])
1011
1012 if test x"$HAVE_LONG_INT_64" = x"no" ; then
1013   PGAC_TYPE_64BIT_INT([long long int])
1014 fi
1015
1016
1017 dnl If we found "long int" is 64 bits, assume snprintf handles it.
1018 dnl If we found we need to use "long long int", better check.
1019 dnl We cope with snprintfs that use either %lld or %qd as the format.
1020 dnl If neither works, fall back to our own snprintf emulation (which we
1021 dnl know uses %lld).
1022
1023 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1024   if [[ x$SNPRINTF = x ]] ; then
1025     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
1026     AC_TRY_RUN([#include <stdio.h>
1027 typedef long long int int64;
1028 #define INT64_FORMAT "%lld"
1029
1030 int64 a = 20000001;
1031 int64 b = 40000005;
1032
1033 int does_int64_snprintf_work()
1034 {
1035   int64 c;
1036   char buf[100];
1037
1038   if (sizeof(int64) != 8)
1039     return 0;                   /* doesn't look like the right size */
1040
1041   c = a * b;
1042   snprintf(buf, 100, INT64_FORMAT, c);
1043   if (strcmp(buf, "800000140000005") != 0)
1044     return 0;                   /* either multiply or snprintf is busted */
1045   return 1;
1046 }
1047 main() {
1048   exit(! does_int64_snprintf_work());
1049 }],
1050         [ AC_MSG_RESULT(yes)
1051           INT64_FORMAT='"%lld"'
1052         ],
1053   [ AC_MSG_RESULT(no)
1054     AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd) 
1055     AC_TRY_RUN([#include <stdio.h>
1056 typedef long long int int64;
1057 #define INT64_FORMAT "%qd"
1058    
1059 int64 a = 20000001;
1060 int64 b = 40000005;
1061    
1062 int does_int64_snprintf_work()
1063 {  
1064   int64 c;
1065   char buf[100];
1066
1067   if (sizeof(int64) != 8)
1068     return 0;     /* doesn't look like the right size */
1069
1070   c = a * b;
1071   snprintf(buf, 100, INT64_FORMAT, c);
1072   if (strcmp(buf, "800000140000005") != 0)
1073     return 0;     /* either multiply or snprintf is busted */
1074   return 1;
1075 }
1076 main() {
1077   exit(! does_int64_snprintf_work());
1078 }],
1079   [ AC_MSG_RESULT(yes)
1080     INT64_FORMAT='"%qd"'
1081   ],
1082   [ AC_MSG_RESULT(no)
1083         # Force usage of our own snprintf, since system snprintf is broken
1084         SNPRINTF='snprintf.o'
1085         INT64_FORMAT='"%lld"'
1086   ],
1087   [ AC_MSG_RESULT(assuming not on target machine)
1088         # Force usage of our own snprintf, since we cannot test foreign snprintf
1089         SNPRINTF='snprintf.o'
1090         INT64_FORMAT='"%lld"'
1091   ]) ],
1092   [ AC_MSG_RESULT(assuming not on target machine)
1093         # Force usage of our own snprintf, since we cannot test foreign snprintf
1094         SNPRINTF='snprintf.o'
1095         INT64_FORMAT='"%lld"'
1096   ])
1097   else
1098     # here if we previously decided we needed to use our own snprintf
1099     INT64_FORMAT='"%lld"'
1100   fi
1101 else
1102   # Here if we are not using 'long long int' at all
1103   INT64_FORMAT='"%ld"'
1104 fi
1105
1106 AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1107
1108
1109 dnl Determine memory alignment requirements for the basic C datatypes.
1110
1111 PGAC_CHECK_ALIGNOF(short)
1112 PGAC_CHECK_ALIGNOF(int)
1113 PGAC_CHECK_ALIGNOF(long)
1114 if [[ x"$HAVE_LONG_LONG_INT_64" = xyes ]] ; then
1115   PGAC_CHECK_ALIGNOF(long long int)
1116 fi
1117 PGAC_CHECK_ALIGNOF(double)
1118
1119 dnl Compute maximum alignment of any basic type.
1120 dnl We assume long's alignment is at least as strong as char, short, or int;
1121 dnl but we must check long long (if it exists) and double.
1122
1123 if test $pgac_cv_alignof_double != 'sizeof(double)' ; then
1124   MAX_ALIGNOF=$pgac_cv_alignof_long
1125   if test $MAX_ALIGNOF -lt $pgac_cv_alignof_double ; then
1126     MAX_ALIGNOF=$pgac_cv_alignof_double
1127   fi
1128   if test x"$HAVE_LONG_LONG_INT_64" = xyes && test $MAX_ALIGNOF -lt $pgac_cv_alignof_long_long_int ; then
1129     MAX_ALIGNOF="$pgac_cv_alignof_long_long_int"
1130   fi
1131 else
1132   dnl cross-compiling: assume that double's alignment is worst case
1133   MAX_ALIGNOF="$pgac_cv_alignof_double"
1134 fi
1135 AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1136
1137 PGAC_FUNC_POSIX_SIGNALS
1138
1139
1140 dnl Check for Tcl configuration script tclConfig.sh
1141
1142 dnl If --with-tclconfig was given, don't check for tclsh, tcl
1143 if test -z "$TCL_DIRS"
1144 then
1145         AC_PATH_PROG(TCLSH, tclsh)
1146         if test -z "$TCLSH"
1147         then
1148                 AC_PATH_PROG(TCLSH, tcl)
1149                 if test -z "$TCLSH"
1150                 then
1151                         AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
1152                         USE_TCL=
1153                 fi
1154         fi
1155 fi
1156         
1157 if test "$USE_TCL" = true
1158 then
1159         AC_MSG_CHECKING(for tclConfig.sh)
1160         TCL_CONFIG_SH=
1161         library_dirs=
1162         if test -z "$TCL_DIRS"
1163         then
1164                 library_dirs=`echo 'puts $auto_path' | $TCLSH`
1165         fi
1166         library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
1167         for dir in $library_dirs; do
1168                 if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
1169                         TCL_CONFIG_SH=$dir/tclConfig.sh
1170                         break
1171                 fi
1172         done
1173         if test -z "$TCL_CONFIG_SH"; then
1174                 AC_MSG_RESULT(no)
1175                 AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
1176                 USE_TCL=
1177         else
1178                 AC_MSG_RESULT($TCL_CONFIG_SH)
1179                 AC_SUBST(TCL_CONFIG_SH)
1180         fi
1181 fi
1182
1183 USE_TK=$USE_TCL         # If TCL is disabled, disable TK
1184
1185 dnl Check for Tk configuration script tkConfig.sh
1186 if test "$USE_TK" = true
1187 then
1188         AC_MSG_CHECKING(for tkConfig.sh)
1189         TK_CONFIG_SH=
1190         # library_dirs are set in the check for TCL
1191         for dir in $library_dirs
1192         do
1193                 if test -d "$dir" -a -r "$dir/tkConfig.sh"
1194                 then
1195                         TK_CONFIG_SH=$dir/tkConfig.sh
1196                         break
1197                 fi
1198         done
1199         if test -z "$TK_CONFIG_SH"
1200         then
1201                 AC_MSG_RESULT(no)
1202                 AC_MSG_WARN(TK support disabled; Tk configuration script missing)
1203                 USE_TK=
1204         else
1205                 AC_MSG_RESULT($TK_CONFIG_SH)
1206                 AC_SUBST(TK_CONFIG_SH)
1207                 AC_PATH_PROG(WISH, wish)
1208         fi
1209 fi
1210 AC_SUBST(WISH)
1211
1212 USE_X=$USE_TK
1213
1214 dnl Check for X libraries
1215
1216 if test "$USE_X" = true; then
1217
1218         ice_save_LIBS="$LIBS"
1219         ice_save_CFLAGS="$CFLAGS"
1220         ice_save_CPPFLAGS="$CPPFLAGS"
1221         ice_save_LDFLAGS="$LDFLAGS"
1222
1223         AC_PATH_XTRA
1224
1225         LIBS="$LIBS $X_EXTRA_LIBS"
1226         CFLAGS="$CFLAGS $X_CFLAGS"
1227         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1228         LDFLAGS="$LDFLAGS $X_LIBS"
1229
1230         dnl Check for X library
1231
1232         X11_LIBS=""
1233         AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
1234         if test "$X11_LIBS" = ""; then
1235                 dnl Not having X is bad news for pgtksh. Let the user fix this.
1236                 AC_MSG_WARN([The X11 library '-lX11' could not be found,
1237 so TK support will be disabled.  To enable TK support,
1238 please use the configure options '--x-includes=DIR'
1239 and '--x-libraries=DIR' to specify the X location.
1240 See the file 'config.log' for further diagnostics.])
1241                 USE_TK=
1242         fi
1243         AC_SUBST(X_LIBS)
1244         AC_SUBST(X11_LIBS)
1245         AC_SUBST(X_PRE_LIBS)
1246
1247         LIBS="$ice_save_LIBS"
1248         CFLAGS="$ice_save_CFLAGS"
1249         CPPFLAGS="$ice_save_CPPFLAGS"
1250         LDFLAGS="$ice_save_LDFLAGS"
1251 fi
1252
1253
1254 # Wait with these until we're done so no tests fail because of too
1255 # many warnings.
1256 if test x"$GCC" = x"yes" ; then
1257   CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wmissing-declarations"
1258 fi
1259
1260 dnl Finally ready to produce output files ...
1261
1262 AC_OUTPUT(
1263 [
1264   GNUmakefile
1265   src/GNUmakefile
1266   src/Makefile.global
1267   src/backend/port/Makefile
1268 ],
1269 [echo timestamp > src/include/stamp-h]
1270 )