]> granicus.if.org Git - postgresql/blob - configure.in
Cleanup README Makefile installs.
[postgresql] / configure.in
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)
5
6 AC_PREREQ(2.13)
7 AC_CONFIG_AUX_DIR(`pwd`/config)
8
9 mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
10 AC_SUBST(mkinstalldirs)
11
12 AC_CANONICAL_HOST
13
14 tas_file=dummy.s
15 case "$host_os" in
16  solaris*)
17         case "$host_cpu" in
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 ;;
20         esac ;;
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 ;;
40  sysv4.2*)
41        case "$host_vendor" in
42                univel) os=univel need_tas=no ;;
43                     *) os=unknown need_tas=no ;;
44        esac ;;
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 ;;
49 *) echo ""
50    echo "*************************************************************"
51    echo "configure does not currently recognize your operating system,"
52    echo "therefore you must do a manual configuration of:"
53    echo "$host_os"
54    echo "Please contact scrappy@hub.org to see about rectifying this, "
55    echo "including the above 'checking host system type...' line "
56    echo "*************************************************************"
57    echo ""
58    exit;;
59 esac
60
61 PORTNAME=${os}
62 CPU=${host_cpu}
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)
67
68 if test "X$need_tas" = "Xyes"
69 then
70         AC_LINK_FILES(src/backend/port/tas/${tas_file}, src/backend/port/tas.s)
71         TAS=tas.o
72         AC_SUBST(TAS)
73 fi
74
75 dnl this part selects the template from the ones in the template directory.
76
77 AC_MSG_CHECKING(setting template to)
78 AC_ARG_WITH(template,
79     [  --with-template=TEMPLATE
80                           use operating system template file 
81                               see template directory],
82     [  TEMPLATE=$withval ],
83     [
84
85 # lowercase $host
86 host="`echo $host | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`"
87
88 # First, try for a template exactly matching $host
89 if test -f "src/template/$host"
90 then TEMPLATE="$host"
91 else
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.
98     #
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 :-(
102     TMPFILE="guesses.$$"
103     cat /dev/null > $TMPFILE
104     while read LINE
105     do
106         SIMHOST=`expr "$LINE" : '\(.*\)='`
107         MATCH=`expr "$host" : "$SIMHOST"`
108         if test "$MATCH" != 0
109         then
110             echo "$LINE" | sed 's/^.*=//' > $TMPFILE
111         fi
112     done <src/template/.similar
113     GUESS=`cat $TMPFILE`
114     rm -f $TMPFILE
115     if test "$GUESS"
116     then TEMPLATE="$GUESS"
117     else
118         # Last chance ... maybe uname -s will match an entry.
119         TEMPLATE=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
120     fi
121 fi
122     ])
123 AC_MSG_RESULT($TEMPLATE)
124
125 export TEMPLATE
126 if test ! -f "src/template/$TEMPLATE"; then
127         echo ""
128         echo "$TEMPLATE does not exist"
129         echo ""
130         echo "Available Templates (select one using --with-template):"
131         echo ""
132         ls template
133         echo ""
134         exit
135 fi
136
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.
144
145 [
146 rm -f conftest.sh
147 sed 's/^\([A-Za-z_]*\):\(.*\)$/\1="\2"/' "src/template/$TEMPLATE" >conftest.sh
148 . ./conftest.sh
149 rm -f conftest.sh
150 ]
151
152
153 AC_ARG_WITH(includes,
154     [  --with-includes=DIRS    look for header files for tcl/tk, etc in DIRS],
155     [
156         case "$withval" in
157         "" | y | ye | yes | n | no)
158             AC_MSG_ERROR([*** You must supply an argument to the --with-includes option.])
159           ;;
160         esac
161         INCLUDE_DIRS="$withval"
162     ])
163
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"
170                 else
171                         AC_MSG_WARN([*** Include directory $dir does not exist.])
172                 fi
173         done
174 fi
175
176 AC_ARG_WITH(libraries,
177     [  --with-libraries=DIRS   look for additional libraries in DIRS],
178     [
179         case "$withval" in
180         "" | y | ye | yes | n | no)
181             AC_MSG_ERROR([*** You must supply an argument to the --with-libraries option.])
182           ;;
183         esac
184         LIBRARY_DIRS="$withval"
185     ])
186
187 AC_ARG_WITH(libs,
188     [  --with-libs=DIRS        alternate spelling of --with-libraries],
189     [
190         case "$withval" in
191         "" | y | ye | yes | n | no)
192             AC_MSG_ERROR([*** You must supply an argument to the --with-libs option.])
193           ;;
194         esac
195         LIBRARY_DIRS="$withval"
196     ])
197
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"
204                 else
205                         AC_MSG_WARN([*** Library directory $dir does not exist.])
206                 fi
207         done
208 fi
209
210
211 AC_MSG_CHECKING(whether to support locale)
212 AC_ARG_ENABLE(
213    locale,
214    [  --enable-locale         enable locale support ],
215    [AC_DEFINE(USE_LOCALE) AC_MSG_RESULT(enabled)],
216    AC_MSG_RESULT(disabled)
217 )
218
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)
223 AC_ARG_ENABLE(
224    recode,
225    [  --enable-recode         enable cyrillic recode support ],
226    [AC_DEFINE(CYR_RECODE) AC_MSG_RESULT(enabled)],
227    AC_MSG_RESULT(disabled)
228 )
229
230 dnl Multibyte support
231
232 AC_MSG_CHECKING(whether to support multibyte)
233 AC_ARG_ENABLE(multibyte,
234     [  --enable-multibyte      enable multibyte character support ], 
235     [
236         MULTIBYTE=SQL_ASCII
237         if test "$enableval" != "yes"; then
238                 case "$enableval" in
239                         SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
240                         # ok
241                         ;;
242                 *)
243                         AC_MSG_ERROR(
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,
248   KOI8, WIN, ALT
249 Or do not specify an argument to the option to use the default.])
250                 esac
251                 MULTIBYTE=$enableval
252         fi
253         AC_DEFINE(MULTIBYTE)
254         AC_MSG_RESULT(enabled)
255     ],
256     AC_MSG_RESULT("disabled")
257 )
258
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.])
262 fi
263
264
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)
268 AC_ARG_WITH(
269    pgport,
270    [  --with-pgport=PORTNUM   change default postmaster port ],
271    [default_port="$withval"],
272    [default_port=5432]
273 )
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})
278
279
280 dnl DEF_MAXBACKENDS can be set by --with-maxbackends.  Default value is 32.
281 AC_MSG_CHECKING(setting DEF_MAXBACKENDS)
282 AC_ARG_WITH(
283    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)
287 )
288
289
290 dnl Check for C support (allow override if needed)
291 dnl Note: actually, setting CC environment variable works just as well.
292 AC_ARG_WITH(CC,
293     [  --with-CC=compiler      use specific C compiler],
294     [
295         case "$withval" in
296         "" | y | ye | yes | n | no)
297             AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
298           ;;
299         esac
300         CC="$withval"
301     ])
302
303 dnl Find a compiler if CC is not already set.
304 AC_PROG_CC
305 dnl Find CPP, then check traditional.
306 dnl Caution: these macros must be called in this order...
307 AC_PROG_CPP
308 AC_PROG_GCC_TRADITIONAL
309 AC_SUBST(GCC)
310
311 if test "$CC" = "gcc"
312 then
313         CC_VERSION=`${CC} --version`
314 else
315         CC_VERSION=""
316 fi
317 AC_SUBST(CC_VERSION)
318
319
320 dnl We exclude tcl support unless user says --with-tcl
321 AC_MSG_CHECKING(setting USE_TCL)
322 AC_ARG_WITH(
323    tcl,
324    [  --with-tcl              build Tcl interfaces and pgtclsh ],
325    [
326         case "$withval" in
327         y | ye | yes)           USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
328         *)                      USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
329         esac
330    ],
331    [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
332 )
333
334 export USE_TCL
335 export USE_TK
336
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.
339
340 AC_ARG_WITH(tclconfig,
341     [  --with-tclconfig=DIR    tclConfig.sh and tkConfig.sh are in DIR],
342     [
343         case "$withval" in
344         "" | y | ye | yes | n | no)
345             AC_MSG_ERROR([*** You must supply an argument to the --with-tclconfig option.])
346           ;;
347         esac
348         TCL_DIRS="$withval"
349     ]
350 )
351
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.
354
355 AC_ARG_WITH(tkconfig,
356     [  --with-tkconfig=DIR     tkConfig.sh is in DIR],
357     [
358         case "$withval" in
359         "" | y | ye | yes | n | no)
360             AC_MSG_ERROR([*** You must supply an argument to the --with-tkconfig option.])
361           ;;
362         esac
363         TK_DIRS="$withval"
364     ]
365 )
366
367
368 dnl
369 dnl Optionally build Perl modules (Pg.pm and PL/Perl)
370 dnl
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
374   AC_MSG_RESULT(yes)
375 else
376   AC_MSG_RESULT(no)
377 fi],
378 [AC_MSG_RESULT(no)])
379 AC_SUBST(with_perl)
380
381
382 dnl
383 dnl Optionally build Python interface module
384 dnl
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
388   AC_MSG_RESULT(yes)
389   PGAC_PROG_PYTHON
390   PGAC_PATH_PYTHONDIR
391 else
392   AC_MSG_RESULT(no)
393 fi],
394 [AC_MSG_RESULT(no)])
395 AC_SUBST(with_python)
396
397 dnl We include odbc support unless we disable it with --with-odbc=false
398 AC_MSG_CHECKING(setting USE_ODBC)
399 AC_ARG_WITH(
400    odbc,
401    [  --with-odbc             build ODBC driver package ],
402    [
403         case "$withval" in
404         y | ye | yes)           USE_ODBC=true; AC_MSG_RESULT(enabled) ;;
405         *)                      USE_ODBC=false; AC_MSG_RESULT(disabled) ;;
406         esac
407    ],
408    [ USE_ODBC=false; AC_MSG_RESULT(disabled) ]
409 )
410 export USE_ODBC
411
412 dnl check if we want to use unixODBC to provide access to the odbc.ini
413 dnl files
414
415 use_unixODBC=no
416 AC_MSG_CHECKING(setting USE_UNIXODBC)
417 AC_ARG_WITH(
418     unixODBC,
419     [  --with-unixODBC[=DIR]   Use unixODBC located in DIR],
420     [
421         use_unixODBC=yes;
422         unixODBC="$withval";
423         USE_ODBC=true;
424         AC_MSG_RESULT(enabled);
425     ],
426     [ USE_ODBC=false; use_unixODBC=no; AC_MSG_RESULT(disabled) ]
427 )
428 export USE_ODBC
429
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"
436 then
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)
441
442    AC_MSG_CHECKING(setting ODBCINST)
443    AC_ARG_WITH(
444       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})
448    )
449 fi
450 if test "X$with_odbcinst" != "X"
451 then
452     ODBCINSTDIR=$with_odbcinst
453 fi
454 AC_SUBST(ODBCINSTDIR)
455
456 #check for unixODBC libs
457
458 if test "x$use_unixODBC" = "xyes"
459 then
460
461   # default to /usr/local if not specified
462   if test "x$unixODBC" = "x"
463   then
464       unixODBC="/usr/local";
465   fi
466   
467   unixODBC_libs="$unixODBC/lib"
468   unixODBC_includes="$unixODBC/include"
469
470   CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
471   AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
472           unixODBC_ok=yes;
473           odbc_headers="$odbc_headers $ac_hdr",
474           unixODBC_ok=no )
475   
476   if test "x$unixODBC_ok" != "xyes"
477   then
478       AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
479   fi
480  
481   save_LIBS="$LIBS"
482   LIBS="-L$unixODBC_libs $LIBS"
483   
484   AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
485     [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
486     SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
487     [LIBS="$save_LIBS"] )
488 fi
489 export SHLIB_ODBC
490
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)
495 AC_ARG_ENABLE(
496    cassert,
497    [  --enable-cassert        enable assertion checks (for debugging) ],
498    AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
499    AC_MSG_RESULT(disabled)
500 )
501
502 CPPFLAGS="$CPPFLAGS $PGSQL_INCLUDES"
503 echo "- setting CPPFLAGS=$CPPFLAGS"
504
505 LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
506 echo "- setting LDFLAGS=$LDFLAGS"
507
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)
511 AC_ARG_ENABLE(
512     debug,
513     [  --enable-debug          build with debugging symbols (-g) ],
514     [
515         case "$enableval" in
516         y | ye | yes)
517             CFLAGS="$CFLAGS -g"
518             AC_MSG_RESULT(enabled)
519             ;;
520         *)
521             CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
522             AC_MSG_RESULT(disabled)
523             ;;
524         esac            
525    ],
526    AC_MSG_RESULT(using default)
527 )
528
529 # Assume system is ELF if it predefines __ELF__ as 1,
530 # otherwise believe "elf" setting from check of host_os above.
531 AC_EGREP_CPP(yes,
532 [#if __ELF__
533   yes
534 #endif
535 ],
536         ELF_SYS=true,
537 [if test "X$elf" = "Xyes"
538 then
539         ELF_SYS=true
540 else
541         ELF_SYS=
542 fi
543 ])
544
545 AC_SUBST(ELF_SYS)
546 AC_SUBST(PORTNAME)
547 AC_SUBST(CPU)
548 AC_SUBST(SRCDIR)
549 AC_SUBST(LDFLAGS)
550 AC_SUBST(CPPFLAGS)
551 AC_SUBST(PGSQL_INCLUDES)
552 AC_SUBST(AROPT)
553 AC_SUBST(SHARED_LIB)
554 AC_SUBST(CFLAGS)
555 AC_SUBST(DLSUFFIX)
556 AC_SUBST(DL_LIB)
557 AC_SUBST(USE_TCL)
558 AC_SUBST(USE_TK)
559 AC_SUBST(WISH)
560 AC_SUBST(USE_ODBC)
561 AC_SUBST(SHLIB_ODBC)
562 AC_SUBST(MULTIBYTE)
563
564
565 dnl
566 dnl Optionally build C++ code (i.e., libpq++)
567 dnl
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
571   AC_MSG_RESULT(yes)
572   if test x"$withval" != xyes ; then
573     CXX=$withval
574   fi
575   AC_PROG_CXX
576   AC_PROG_CXXCPP
577   PGAC_CLASS_STRING
578   PGAC_CXX_NAMESPACE_STD
579 else
580   AC_MSG_RESULT(no)
581 fi],
582 [AC_MSG_RESULT(no)])
583 AC_SUBST(with_CXX)
584
585
586
587 dnl Figure out how to invoke "install" and what install options to use.
588
589 AC_PROG_INSTALL
590
591 INSTLOPTS="-m 444"
592 INSTL_EXE_OPTS="-m 555"
593 INSTL_LIB_OPTS="-m 644"
594 INSTL_SHLIB_OPTS="-m 644"
595
596 dnl HPUX wants shared libs to be mode 555.
597 case "$host_os" in
598  hpux*)
599         INSTL_SHLIB_OPTS="-m 555" ;;
600 esac
601
602 AC_SUBST(INSTALL)
603 AC_SUBST(INSTLOPTS)
604 AC_SUBST(INSTL_LIB_OPTS)
605 AC_SUBST(INSTL_SHLIB_OPTS)
606 AC_SUBST(INSTL_EXE_OPTS)
607
608 AC_PROG_AWK
609
610 AC_PROG_LEX
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
614                 AC_MSG_WARN([
615 ***
616 You have flex version 2.5.3, which is broken. Get version 2.5.4 or
617 a different lex.
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
621 broken as well.)
622 ***])
623         fi
624 fi
625 AC_PROG_LN_S
626 AC_PROG_RANLIB
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,)
634 AC_PROG_YACC
635 AC_SUBST(YFLAGS)
636
637
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])
642 done
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) )
647
648 if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
649 then
650         AC_CHECK_LIB(bsd,      main)
651 fi
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)
668
669 dnl Checks for header files.
670 AC_HEADER_STDC
671 AC_HEADER_SYS_WAIT
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)
693 dnl ODBC headers...
694 AC_CHECK_HEADERS(sys/param.h pwd.h)
695 dnl
696
697 dnl Checks for typedefs, structures, and compiler characteristics.
698 AC_C_CONST
699 AC_C_INLINE
700 AC_C_STRINGIZE
701 AC_TYPE_UID_T
702 AC_TYPE_MODE_T
703 AC_TYPE_OFF_T
704 AC_TYPE_SIZE_T
705 AC_STRUCT_TIMEZONE
706 PGAC_C_SIGNED
707 PGAC_C_VOLATILE
708 AC_FUNC_ACCEPT_ARGTYPES
709
710
711 PGAC_VAR_INT_TIMEZONE
712 PGAC_FUNC_GETTIMEOFDAY_1ARG
713 PGAC_UNION_SEMUN
714
715
716 AC_MSG_CHECKING(for fcntl(F_SETLK))
717 AC_TRY_LINK([#include <fcntl.h>],
718             [struct flock lck;
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)],
723             AC_MSG_RESULT(no))
724
725 dnl Checks for library functions.
726 AC_FUNC_MEMCMP
727 AC_TYPE_SIGNAL
728 AC_FUNC_VPRINTF
729 AC_CHECK_FUNCS(memmove sysconf)
730 AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
731 AC_CHECK_FUNCS(setproctitle pstat)
732
733 AC_MSG_CHECKING(for PS_STRINGS)
734 AC_TRY_LINK(
735 [#ifdef HAVE_MACHINE_VMPARAM_H
736 # include <machine/vmparam.h>
737 #endif
738 #ifdef HAVE_SYS_EXEC_H
739 # include <sys/exec.h>
740 #endif],
741 [PS_STRINGS->ps_nargvstr = 1;
742 PS_STRINGS->ps_argvstr = "foo";],
743 [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PS_STRINGS)],
744 AC_MSG_RESULT(no))
745
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.
751 SNPRINTF=''
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')
758 AC_SUBST(SNPRINTF)
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))
768 dnl
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,
772 [AC_TRY_LINK(
773 [#include <math.h>],
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
778   AC_MSG_RESULT(yes)
779   AC_DEFINE(HAVE_ISINF)
780   ISINF=''
781 else
782   AC_MSG_RESULT(no)
783   ISINF='isinf.o'
784 fi
785 AC_SUBST(ISINF)
786 AC_CHECK_FUNC(getrusage,
787               AC_DEFINE(HAVE_GETRUSAGE),
788               GETRUSAGE='getrusage.o')
789 AC_SUBST(GETRUSAGE)
790 AC_CHECK_FUNC(srandom,
791               AC_DEFINE(HAVE_SRANDOM),
792               SRANDOM='srandom.o')
793 AC_SUBST(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')
805 AC_SUBST(INET_ATON)
806 AC_CHECK_FUNC(strerror,
807               AC_DEFINE(HAVE_STRERROR),
808               [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
809 AC_SUBST(STRERROR)
810 AC_SUBST(STRERROR2)
811 AC_CHECK_FUNC(strdup,
812               AC_DEFINE(HAVE_STRDUP),
813               STRDUP='../../utils/strdup.o')
814 AC_SUBST(STRDUP)
815 AC_CHECK_FUNC(strtol,
816               AC_DEFINE(HAVE_STRTOL),
817               STRTOL='strtol.o')
818 AC_SUBST(STRTOL)
819 AC_CHECK_FUNC(strtoul,
820               AC_DEFINE(HAVE_STRTOUL),
821               STRTOL='strtoul.o')
822 AC_SUBST(STRTOUL)
823 AC_CHECK_FUNC(strcasecmp,
824               AC_DEFINE(HAVE_STRCASECMP),
825               STRCASECMP='strcasecmp.o')
826 AC_SUBST(STRCASECMP)
827 AC_CHECK_FUNC(cbrt,
828               AC_DEFINE(HAVE_CBRT),
829               AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
830
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.
833 HPUXMATHLIB=""
834 case "$host_cpu" in
835   hppa1.1) 
836         if [[ -r /lib/pa1.1/libm.a ]] ; then
837             HPUXMATHLIB="-L /lib/pa1.1 -lm"
838         fi ;;
839 esac
840 AC_SUBST(HPUXMATHLIB)
841
842 AC_CHECK_FUNC(rint,
843               AC_DEFINE(HAVE_RINT),
844               AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
845
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)
852
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))])
861 )
862 AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
863 AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
864
865 dnl Check for GNU style long options support (getopt_long)
866 AC_CHECK_FUNCS(getopt_long)
867
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)],
873         AC_MSG_RESULT(no))
874
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)],
882         AC_MSG_RESULT(no))
883
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])])
887         ;;
888      esac]
889 )
890
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.
903
904 PGAC_TYPE_64BIT_INT([long int])
905
906 if test x"$HAVE_LONG_INT_64" = x"no" ; then
907   PGAC_TYPE_64BIT_INT([long long int])
908 fi
909
910
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
915 dnl know uses %lld).
916
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"
923
924 int64 a = 20000001;
925 int64 b = 40000005;
926
927 int does_int64_snprintf_work()
928 {
929   int64 c;
930   char buf[100];
931
932   if (sizeof(int64) != 8)
933     return 0;                   /* doesn't look like the right size */
934
935   c = a * b;
936   snprintf(buf, 100, INT64_FORMAT, c);
937   if (strcmp(buf, "800000140000005") != 0)
938     return 0;                   /* either multiply or snprintf is busted */
939   return 1;
940 }
941 main() {
942   exit(! does_int64_snprintf_work());
943 }],
944         [ AC_MSG_RESULT(yes)
945           INT64_FORMAT='"%lld"'
946         ],
947   [ AC_MSG_RESULT(no)
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"
952    
953 int64 a = 20000001;
954 int64 b = 40000005;
955    
956 int does_int64_snprintf_work()
957 {  
958   int64 c;
959   char buf[100];
960
961   if (sizeof(int64) != 8)
962     return 0;     /* doesn't look like the right size */
963
964   c = a * b;
965   snprintf(buf, 100, INT64_FORMAT, c);
966   if (strcmp(buf, "800000140000005") != 0)
967     return 0;     /* either multiply or snprintf is busted */
968   return 1;
969 }
970 main() {
971   exit(! does_int64_snprintf_work());
972 }],
973   [ AC_MSG_RESULT(yes)
974     INT64_FORMAT='"%qd"'
975   ],
976   [ AC_MSG_RESULT(no)
977         # Force usage of our own snprintf, since system snprintf is broken
978         SNPRINTF='snprintf.o'
979         INT64_FORMAT='"%lld"'
980   ],
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"'
985   ]) ],
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"'
990   ])
991   else
992     # here if we previously decided we needed to use our own snprintf
993     INT64_FORMAT='"%lld"'
994   fi
995 else
996   # Here if we are not using 'long long int' at all
997   INT64_FORMAT='"%ld"'
998 fi
999
1000 AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1001
1002
1003 dnl Determine memory alignment requirements for the basic C datatypes.
1004
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)
1010 fi
1011 PGAC_CHECK_ALIGNOF(double)
1012
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.
1016
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
1021   fi
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"
1024   fi
1025 else
1026   dnl cross-compiling: assume that double's alignment is worst case
1027   MAX_ALIGNOF="$pgac_cv_alignof_double"
1028 fi
1029 AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF, [Define as the maximum alignment requirement of any type])
1030
1031 PGAC_FUNC_POSIX_SIGNALS
1032
1033
1034 dnl Check for Tcl configuration script tclConfig.sh
1035
1036 dnl If --with-tclconfig was given, don't check for tclsh, tcl
1037 if test -z "$TCL_DIRS"
1038 then
1039         AC_PATH_PROG(TCLSH, tclsh)
1040         if test -z "$TCLSH"
1041         then
1042                 AC_PATH_PROG(TCLSH, tcl)
1043                 if test -z "$TCLSH"
1044                 then
1045                         AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
1046                         USE_TCL=
1047                 fi
1048         fi
1049 fi
1050         
1051 if test "$USE_TCL" = true
1052 then
1053         AC_MSG_CHECKING(for tclConfig.sh)
1054         TCL_CONFIG_SH=
1055         library_dirs=
1056         if test -z "$TCL_DIRS"
1057         then
1058                 library_dirs=`echo 'puts $auto_path' | $TCLSH`
1059         fi
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
1064                         break
1065                 fi
1066         done
1067         if test -z "$TCL_CONFIG_SH"; then
1068                 AC_MSG_RESULT(no)
1069                 AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
1070                 USE_TCL=
1071         else
1072                 AC_MSG_RESULT($TCL_CONFIG_SH)
1073                 AC_SUBST(TCL_CONFIG_SH)
1074         fi
1075 fi
1076
1077 USE_TK=$USE_TCL         # If TCL is disabled, disable TK
1078
1079 dnl Check for Tk configuration script tkConfig.sh
1080 if test "$USE_TK" = true
1081 then
1082         AC_MSG_CHECKING(for tkConfig.sh)
1083         TK_CONFIG_SH=
1084         # library_dirs are set in the check for TCL
1085         for dir in $library_dirs
1086         do
1087                 if test -d "$dir" -a -r "$dir/tkConfig.sh"
1088                 then
1089                         TK_CONFIG_SH=$dir/tkConfig.sh
1090                         break
1091                 fi
1092         done
1093         if test -z "$TK_CONFIG_SH"
1094         then
1095                 AC_MSG_RESULT(no)
1096                 AC_MSG_WARN(TK support disabled; Tk configuration script missing)
1097                 USE_TK=
1098         else
1099                 AC_MSG_RESULT($TK_CONFIG_SH)
1100                 AC_SUBST(TK_CONFIG_SH)
1101                 AC_PATH_PROG(WISH, wish)
1102         fi
1103 fi
1104
1105 USE_X=$USE_TK
1106
1107 dnl Check for X libraries
1108
1109 if test "$USE_X" = true; then
1110
1111         ice_save_LIBS="$LIBS"
1112         ice_save_CFLAGS="$CFLAGS"
1113         ice_save_CPPFLAGS="$CPPFLAGS"
1114         ice_save_LDFLAGS="$LDFLAGS"
1115
1116         AC_PATH_XTRA
1117
1118         LIBS="$LIBS $X_EXTRA_LIBS"
1119         CFLAGS="$CFLAGS $X_CFLAGS"
1120         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1121         LDFLAGS="$LDFLAGS $X_LIBS"
1122
1123         dnl Check for X library
1124
1125         X11_LIBS=""
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.])
1134                 USE_TK=
1135         fi
1136         AC_SUBST(X_LIBS)
1137         AC_SUBST(X11_LIBS)
1138         AC_SUBST(X_PRE_LIBS)
1139
1140         LIBS="$ice_save_LIBS"
1141         CFLAGS="$ice_save_CFLAGS"
1142         CPPFLAGS="$ice_save_CPPFLAGS"
1143         LDFLAGS="$ice_save_LDFLAGS"
1144 fi
1145
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"
1153 #then
1154 #       AC_CONFIG_SUBDIRS(interfaces/odbc)
1155 #fi
1156 if test "$USE_ODBC" = "true"
1157 then
1158         PWD_INCDIR=no
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)
1162                 USE_ODBC=
1163         fi
1164         AC_SUBST(USE_ODBC)
1165 fi
1166
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...
1174
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}'
1180
1181 eval expanded_libdir="$libdir"
1182 eval expanded_libdir="$expanded_libdir"
1183 AC_SUBST(expanded_libdir)
1184
1185 dnl Finally ready to produce output files ...
1186
1187 AC_OUTPUT(
1188         GNUmakefile
1189         src/GNUmakefile
1190         src/Makefile.global
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
1211         src/pl/Makefile
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
1217 )