Annotation of pgsql/configure.in, revision 1.5
1.1 petere 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)
1.5 ! petere 7: AC_CONFIG_AUX_DIR(`pwd`/config)
! 8:
! 9: mkinstalldirs="\$(SHELL) \$(top_srcdir)/config/mkinstalldirs"
! 10: AC_SUBST(mkinstalldirs)
1.1 petere 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 [email protected] 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: echo "checking echo setting..."
76: if echo '\c' | grep -s c >/dev/null 2>&1
77: then
78: ECHO_N="echo -n"
79: ECHO_C=""
80: else
81: ECHO_N="echo"
82: ECHO_C='\c'
83: fi
84:
85: dnl this part selects the template from the ones in the template directory.
86:
87: AC_MSG_CHECKING(setting template to)
88: AC_ARG_WITH(template,
89: [ --with-template=TEMPLATE
90: use operating system template file
91: see template directory],
92: [ TEMPLATE=$withval ],
93: [
94:
95: # lowercase $host
96: host="`echo $host | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`"
97:
98: # First, try for a template exactly matching $host
99: if test -f "src/template/$host"
100: then TEMPLATE="$host"
101: else
102: # Scan template/.similar for a rule that tells us which template to use.
103: # The format of each line of the file is
104: # hostnamepattern=templatefilename
105: # where the hostnamepattern is evaluated per the rules of expr(1) ---
106: # namely, it is a standard regular expression with an implicit ^ at the
107: # start. If multiple lines match, we will end up using the last match.
108: #
109: # The tempfile hackery is needed because some shells will run the loop
110: # inside a subshell, whereupon shell variables set therein aren't seen
111: # outside the loop :-(
112: TMPFILE="guesses.$$"
113: cat /dev/null > $TMPFILE
114: while read LINE
115: do
116: SIMHOST=`expr "$LINE" : '\(.*\)='`
117: MATCH=`expr "$host" : "$SIMHOST"`
118: if test "$MATCH" != 0
119: then
120: echo "$LINE" | sed 's/^.*=//' > $TMPFILE
121: fi
122: done <src/template/.similar
123: GUESS=`cat $TMPFILE`
124: rm -f $TMPFILE
125: if test "$GUESS"
126: then TEMPLATE="$GUESS"
127: else
128: # Last chance ... maybe uname -s will match an entry.
129: TEMPLATE=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
130: fi
131: fi
132: ])
133: AC_MSG_RESULT($TEMPLATE)
134:
135: export TEMPLATE
136: if test ! -f "src/template/$TEMPLATE"; then
137: echo ""
138: echo "$TEMPLATE does not exist"
139: echo ""
140: echo "Available Templates (select one using --with-template):"
141: echo ""
142: ls template
143: echo ""
144: exit
145: fi
146:
147: dnl Read the selected template file.
148: dnl For reasons of backwards compatibility, lines of the form
149: dnl IDENTIFIER: something
150: dnl should be treated as variable assignments. However, we also want to
151: dnl allow other shell commands in the template file (in case the file
152: dnl needs to make conditional tests, etc). So, generate a temp file with
153: dnl the IDENTIFIER: lines translated, then source it.
154:
155: [
156: rm -f conftest.sh
157: sed 's/^\([A-Za-z_]*\):\(.*\)$/\1="\2"/' "src/template/$TEMPLATE" >conftest.sh
158: . ./conftest.sh
159: rm -f conftest.sh
160: ]
161:
162:
163: AC_ARG_WITH(includes,
164: [ --with-includes=DIRS look for header files for tcl/tk, etc in DIRS],
165: [
166: case "$withval" in
167: "" | y | ye | yes | n | no)
168: AC_MSG_ERROR([*** You must supply an argument to the --with-includes option.])
169: ;;
170: esac
171: INCLUDE_DIRS="$withval"
172: ])
173:
174: dnl INCLUDE_DIRS comes from command line, SRCH_INC from template file.
175: dnl Each can name one or more directories.
176: if test "$INCLUDE_DIRS" -o "$SRCH_INC"; then
177: for dir in $INCLUDE_DIRS $SRCH_INC; do
178: if test -d "$dir"; then
179: PGSQL_INCLUDES="$PGSQL_INCLUDES -I$dir"
180: else
181: AC_MSG_WARN([*** Include directory $dir does not exist.])
182: fi
183: done
184: fi
185:
186: AC_ARG_WITH(libraries,
187: [ --with-libraries=DIRS look for additional libraries in DIRS],
188: [
189: case "$withval" in
190: "" | y | ye | yes | n | no)
191: AC_MSG_ERROR([*** You must supply an argument to the --with-libraries option.])
192: ;;
193: esac
194: LIBRARY_DIRS="$withval"
195: ])
196:
197: AC_ARG_WITH(libs,
198: [ --with-libs=DIRS alternate spelling of --with-libraries],
199: [
200: case "$withval" in
201: "" | y | ye | yes | n | no)
202: AC_MSG_ERROR([*** You must supply an argument to the --with-libs option.])
203: ;;
204: esac
205: LIBRARY_DIRS="$withval"
206: ])
207:
208: dnl LIBRARY_DIRS comes from command line, SRCH_LIB from template file.
209: dnl Each can name one or more directories.
210: if test "$LIBRARY_DIRS" -o "$SRCH_LIB"; then
211: for dir in $LIBRARY_DIRS $SRCH_LIB; do
212: if test -d "$dir"; then
213: PGSQL_LDFLAGS="$PGSQL_LDFLAGS -L$dir"
214: else
215: AC_MSG_WARN([*** Library directory $dir does not exist.])
216: fi
217: done
218: fi
219:
1.2 petere 220:
1.1 petere 221: AC_MSG_CHECKING(whether to support locale)
222: AC_ARG_ENABLE(
223: locale,
224: [ --enable-locale enable locale support ],
1.2 petere 225: [AC_DEFINE(USE_LOCALE) AC_MSG_RESULT(enabled)],
1.1 petere 226: AC_MSG_RESULT(disabled)
227: )
228:
229: dnl We exclude cyrillic recode support unless we override it with
230: dnl --enable-recode to explicitly enable it
231: dnl It defaults to disabled
232: AC_MSG_CHECKING(whether to support cyrillic recode)
233: AC_ARG_ENABLE(
234: recode,
235: [ --enable-recode enable cyrillic recode support ],
1.2 petere 236: [AC_DEFINE(CYR_RECODE) AC_MSG_RESULT(enabled)],
1.1 petere 237: AC_MSG_RESULT(disabled)
238: )
239:
240: dnl Multibyte support
241:
242: AC_MSG_CHECKING(whether to support multibyte)
243: AC_ARG_ENABLE(multibyte,
244: [ --enable-multibyte enable multibyte character support ],
245: [
246: MULTIBYTE=SQL_ASCII
247: if test "$enableval" != "yes"; then
248: case "$enableval" in
249: SQL_ASCII|EUC_JP|EUC_CN|EUC_KR|EUC_TW|UNICODE|MULE_INTERNAL|LATIN1|LATIN2|LATIN3|LATIN4|LATIN5|KOI8|WIN|ALT)
250: # ok
251: ;;
252: *)
253: AC_MSG_ERROR(
254: [Argument to --enable-multibyte must be one of:
255: SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW,
256: UNICODE, MULE_INTERNAL,
257: LATIN1, LATIN2, LATIN3, LATIN4, LATIN5,
258: KOI8, WIN, ALT
259: Or do not specify an argument to the option to use the default.])
260: esac
261: MULTIBYTE=$enableval
262: fi
263: AC_DEFINE(MULTIBYTE)
264: AC_MSG_RESULT(enabled)
265: ],
266: AC_MSG_RESULT("disabled")
267: )
268:
269: dnl Old option variant
1.4 tgl 270: if test "${with_mb}"; then
1.1 petere 271: AC_MSG_ERROR([--with-mb is not supported anymore. Use --enable-multibyte instead.])
1.4 tgl 272: fi
1.1 petere 273:
274:
275: dnl We use the default value of 5432 for the DEF_PGPORT value. If
276: dnl we over-ride it with --with-pgport=port then we bypass this piece
277: AC_MSG_CHECKING(setting DEF_PGPORT)
278: AC_ARG_WITH(
279: pgport,
280: [ --with-pgport=PORTNUM change default postmaster port ],
281: [default_port="$withval"],
282: [default_port=5432]
283: )
1.4 tgl 284: dnl Need both of these because backend wants an integer and frontend a string
1.1 petere 285: AC_DEFINE_UNQUOTED(DEF_PGPORT, ${default_port})
286: AC_DEFINE_UNQUOTED(DEF_PGPORT_STR, "${default_port}")
287: AC_MSG_RESULT(${default_port})
288:
289:
290: dnl DEF_MAXBACKENDS can be set by --with-maxbackends. Default value is 32.
291: AC_MSG_CHECKING(setting DEF_MAXBACKENDS)
292: AC_ARG_WITH(
293: maxbackends,
294: [ --with-maxbackends=N set default maximum number of server processes ],
295: AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, ${withval}) AC_MSG_RESULT($with_maxbackends),
296: AC_DEFINE_UNQUOTED(DEF_MAXBACKENDS, 32) AC_MSG_RESULT(32)
297: )
298:
1.4 tgl 299:
300: dnl Check for C support (allow override if needed)
301: dnl Note: actually, setting CC environment variable works just as well.
302: AC_ARG_WITH(CC,
303: [ --with-CC=compiler use specific C compiler],
304: [
305: case "$withval" in
306: "" | y | ye | yes | n | no)
307: AC_MSG_ERROR([*** You must supply an argument to the --with-CC option.])
308: ;;
309: esac
310: CC="$withval"
311: ])
312:
313: dnl Find a compiler if CC is not already set.
314: AC_PROG_CC
315: dnl Find CPP, then check traditional.
316: dnl Caution: these macros must be called in this order...
317: AC_PROG_CPP
318: AC_PROG_GCC_TRADITIONAL
319:
320: if test "$CC" = "gcc"
321: then
322: CC_VERSION=`${CC} --version`
323: else
324: CC_VERSION=""
325: fi
326: AC_SUBST(CC_VERSION)
327:
328:
1.1 petere 329: dnl We exclude tcl support unless user says --with-tcl
330: AC_MSG_CHECKING(setting USE_TCL)
331: AC_ARG_WITH(
332: tcl,
333: [ --with-tcl build Tcl interfaces and pgtclsh ],
334: [
335: case "$withval" in
336: y | ye | yes) USE_TCL=true; USE_TK=true; AC_MSG_RESULT(enabled) ;;
337: *) USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ;;
338: esac
339: ],
340: [ USE_TCL=; USE_TK=; AC_MSG_RESULT(disabled) ]
341: )
342:
343: export USE_TCL
344: export USE_TK
345:
346: dnl We see if the path to the TCL/TK configuration scripts is specified.
347: dnl This will override the use of tclsh to find the paths to search.
348:
349: AC_ARG_WITH(tclconfig,
350: [ --with-tclconfig=DIR tclConfig.sh and tkConfig.sh are in DIR],
351: [
352: case "$withval" in
353: "" | y | ye | yes | n | no)
354: AC_MSG_ERROR([*** You must supply an argument to the --with-tclconfig option.])
355: ;;
356: esac
357: TCL_DIRS="$withval"
358: ]
359: )
360:
361: dnl We see if the path to the TK configuration scripts is specified.
362: dnl This will override the use of tclsh to find the paths to search.
363:
364: AC_ARG_WITH(tkconfig,
365: [ --with-tkconfig=DIR tkConfig.sh is in DIR],
366: [
367: case "$withval" in
368: "" | y | ye | yes | n | no)
369: AC_MSG_ERROR([*** You must supply an argument to the --with-tkconfig option.])
370: ;;
371: esac
372: TK_DIRS="$withval"
373: ]
374: )
375:
1.5 ! petere 376:
! 377: dnl
! 378: dnl Optionally build Perl modules (Pg.pm and PL/Perl)
! 379: dnl
! 380: AC_MSG_CHECKING(whether to build Perl modules)
! 381: AC_ARG_WITH(perl, [ --with-perl build Perl interface and plperl],
! 382: [if test x"${withval}" = x"yes" ; then
! 383: AC_MSG_RESULT(yes)
! 384: else
! 385: AC_MSG_RESULT(no)
! 386: fi],
! 387: [AC_MSG_RESULT(no)])
! 388: AC_SUBST(with_perl)
! 389:
! 390:
! 391: dnl
! 392: dnl Optionally build Python interface module
! 393: dnl
! 394: AC_MSG_CHECKING(whether to build Python modules)
! 395: AC_ARG_WITH(python, [ --with-python build Python interface module],
! 396: [if test x"${withval}" = x"yes" ; then
! 397: AC_MSG_RESULT(yes)
! 398: PGAC_PROG_PYTHON
! 399: PGAC_PATH_PYTHONDIR
! 400: else
! 401: AC_MSG_RESULT(no)
! 402: fi],
! 403: [AC_MSG_RESULT(no)])
! 404: AC_SUBST(with_python)
1.1 petere 405:
406: dnl We include odbc support unless we disable it with --with-odbc=false
407: AC_MSG_CHECKING(setting USE_ODBC)
408: AC_ARG_WITH(
409: odbc,
410: [ --with-odbc build ODBC driver package ],
411: [
412: case "$withval" in
413: y | ye | yes) USE_ODBC=true; AC_MSG_RESULT(enabled) ;;
414: *) USE_ODBC=false; AC_MSG_RESULT(disabled) ;;
415: esac
416: ],
417: [ USE_ODBC=false; AC_MSG_RESULT(disabled) ]
418: )
419: export USE_ODBC
420:
421:
422: dnl Allow for overriding the default location of the odbcinst.ini
423: dnl file which is normally ${prefix}/share or ${prefix} if this is
424: dnl being compiled inside the postgres distribution.
425: dnl Link in the port and template directories
426: dnl to help build a "standalone ODBC" tar file
427: if test "X$USE_ODBC" = "Xtrue"
428: then
429: AC_LINK_FILES(src/include/port, src/interfaces/odbc/port)
430: AC_LINK_FILES(src/makefiles, src/interfaces/odbc/makefiles)
431: AC_LINK_FILES(src/template, src/interfaces/odbc/template)
432: AC_LINK_FILES(src/include/config.h, src/interfaces/odbc/config.h)
433:
434: AC_MSG_CHECKING(setting ODBCINST)
435: AC_ARG_WITH(
436: odbcinst,
437: [ --with-odbcinst=DIR change default directory for odbcinst.ini],
438: AC_DEFINE_UNQUOTED(ODBCINST, ${with_odbcinst}) AC_MSG_RESULT($with_odbcinst),
439: AC_DEFINE_UNQUOTED(ODBCINST, ${ODBCINSTDIR}) AC_MSG_RESULT(${ODBCINSTDIR})
440: )
441: fi
442: if test "X$with_odbcinst" != "X"
443: then
444: ODBCINSTDIR=$with_odbcinst
445: fi
446: AC_SUBST(ODBCINSTDIR)
447:
1.4 tgl 448: # check for unixODBC
1.3 momjian 449:
450: use_unixODBC=no
451: AC_ARG_WITH(unixODBC,
1.4 tgl 452: [ --with-unixODBC[=DIR] Use unixODBC located in DIR],
453: [use_unixODBC=yes; unixODBC="$withval"],
454: use_unixODBC=no)
1.3 momjian 455:
456: if test "x$use_unixODBC" = "xyes"
457: then
458:
459: # default to /usr if not specified
460: if test "x$unixODBC" = "x"
461: then
462: unixODBC="/usr";
463: fi
464:
465: AC_ARG_WITH(unixODBC-includes,
466: [ --with-unixODBC-includes=DIR Find unixODBC headers in DIR],
1.4 tgl 467: unixODBC_includes="$withval",
468: unixODBC_includes="$unixODBC/include")
1.3 momjian 469:
1.4 tgl 470: AC_ARG_WITH(unixODBC-libs,
1.3 momjian 471: [ --with-unixODBC-libs=DIR Find unixODBC libraries in DIR],
1.4 tgl 472: unixODBC_libs="$withval",
473: unixODBC_libs="$unixODBC/lib")
1.3 momjian 474:
1.4 tgl 475: PGSQL_INCLUDES="$PGSQL_INCLUDES -I$unixODBC_includes"
476:
477: AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
478: [unixODBC_ok=yes; odbc_headers="$odbc_headers $ac_hdr"],
479: [unixODBC_ok=no; break])
1.3 momjian 480:
481: if test "x$unixODBC_ok" != "xyes"
482: then
483: AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
484: fi
485:
486: save_LIBS="$LIBS"
1.4 tgl 487: LIBS="$LIBS -L$unixODBC_libs"
488:
489: AC_CHECK_LIB(odbcinst, SQLGetPrivateProfileString,
490: [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
491: LIBS="$LIBS -lodbcinst"],
492: [LIBS="$save_LIBS"])
1.3 momjian 493:
494: fi
495:
1.1 petere 496: dnl Unless we specify the command line options
497: dnl --enable cassert to explicitly enable it
498: dnl If you do not explicitly do it, it defaults to disabled
499: AC_MSG_CHECKING(setting ASSERT CHECKING)
500: AC_ARG_ENABLE(
501: cassert,
502: [ --enable-cassert enable assertion checks (for debugging) ],
503: AC_DEFINE(USE_ASSERT_CHECKING) AC_MSG_RESULT(enabled),
504: AC_MSG_RESULT(disabled)
505: )
506:
507: CPPFLAGS="$CPPFLAGS $PGSQL_INCLUDES"
508: echo "- setting CPPFLAGS=$CPPFLAGS"
509:
510: LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
511: echo "- setting LDFLAGS=$LDFLAGS"
512:
513: dnl --enable-debug adds -g to compiler flags
514: dnl --disable-debug will forcefully remove it
515: AC_MSG_CHECKING(setting debug compiler flag)
516: AC_ARG_ENABLE(
517: debug,
518: [ --enable-debug build with debugging symbols (-g) ],
519: [
520: case "$enableval" in
521: y | ye | yes)
522: CFLAGS="$CFLAGS -g"
523: AC_MSG_RESULT(enabled)
524: ;;
525: *)
526: CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
527: AC_MSG_RESULT(disabled)
528: ;;
529: esac
530: ],
531: AC_MSG_RESULT(using default)
532: )
533:
534: # Assume system is ELF if it predefines __ELF__ as 1,
535: # otherwise believe "elf" setting from check of host_os above.
536: AC_EGREP_CPP(yes,
537: [#if __ELF__
538: yes
539: #endif
540: ],
541: ELF_SYS=true,
542: [if test "X$elf" = "Xyes"
543: then
544: ELF_SYS=true
545: else
546: ELF_SYS=
547: fi
548: ])
549:
550: AC_SUBST(ELF_SYS)
551: AC_SUBST(PORTNAME)
552: AC_SUBST(CPU)
553: AC_SUBST(SRCDIR)
554: AC_SUBST(LDFLAGS)
555: AC_SUBST(CPPFLAGS)
556: AC_SUBST(PGSQL_INCLUDES)
557: AC_SUBST(AROPT)
558: AC_SUBST(SHARED_LIB)
559: AC_SUBST(CFLAGS)
560: AC_SUBST(DLSUFFIX)
561: AC_SUBST(DL_LIB)
562: AC_SUBST(USE_TCL)
563: AC_SUBST(USE_TK)
564: AC_SUBST(WISH)
565: AC_SUBST(USE_ODBC)
566: AC_SUBST(MULTIBYTE)
567:
568: dnl Check for C++ support (allow override if needed)
569: dnl XXX: probably should default to HAVECXX='false'
570: HAVECXX='true'
571: AC_ARG_WITH(CXX,
572: [ --with-CXX=compiler use specific C++ compiler
573: --without-CXX prevent building C++ code ],
574: [
575: case "$withval" in
576: "" | y | ye | yes)
577: HAVECXX='true'
578: # allow configure to choose C++ compiler
579: ;;
580: n | no)
581: HAVECXX='false'
582: ;;
583: *)
584: HAVECXX='true'
585: CXX="$withval"
586: ;;
587: esac
588: ])
589: AC_SUBST(HAVECXX)
590:
591: if test "$HAVECXX" = 'true' ; then
592: dnl Even if CXX value was given to us, need to run AC_PROG_CXX ...
593: AC_PROG_CXX
594: AC_LANG_CPLUSPLUS
595:
596: dnl check whether "#include <string>" works on this C++ compiler
597: AC_MSG_CHECKING([for include <string> in C++])
598: AC_TRY_COMPILE([#include <stdio.h>
599: #include <stdlib.h>
600: #include <string>
601: ], [],
602: [AC_DEFINE(HAVE_CXX_STRING_HEADER) AC_MSG_RESULT(yes)],
603: [AC_MSG_RESULT(no)
604:
605: dnl If we found a <string> header then it's probably safe to assume
606: dnl class string exists. But if not, check to make sure that <string.h>
607: dnl defines class string; libpq++ can't build without class string.
608: AC_MSG_CHECKING([for class string in C++])
609: AC_TRY_COMPILE([#include <stdio.h>
610: #include <stdlib.h>
611: #include <string.h>
612: ], [string foo = "test"],
613: [AC_MSG_RESULT(yes)],
614: [AC_MSG_RESULT(no)
615: AC_MSG_WARN([
616: ***
617: Disabling build of libpq++ because we cannot find class string in the
618: system's C++ header files.
619: ***])
620: HAVECXX='false'
621: ])
622: ])
623: fi
624:
625: if test "$HAVECXX" = 'true' ; then
626: dnl check whether "using namespace std" works on this C++ compiler.
627: dnl NOTE: on at least some compilers, it will not work until you've
628: dnl included a header that mentions namespace std. Thus, include
629: dnl the usual suspects before trying it.
630: AC_MSG_CHECKING([for namespace std in C++])
631: AC_TRY_COMPILE([#include <stdio.h>
632: #include <stdlib.h>
633: #ifdef HAVE_CXX_STRING_HEADER
634: #include <string>
635: #endif
636: using namespace std;
637: ], [],
638: [AC_DEFINE(HAVE_NAMESPACE_STD) AC_MSG_RESULT(yes)],
639: [AC_MSG_RESULT(no)])
640: fi
641:
642: dnl make sure we revert to C compiler, not C++, for subsequent tests
643: AC_LANG_C
644:
645: dnl Figure out how to invoke "install" and what install options to use.
646:
647: AC_PROG_INSTALL
648:
649: INSTLOPTS="-m 444"
650: INSTL_EXE_OPTS="-m 555"
651: INSTL_LIB_OPTS="-m 644"
652: INSTL_SHLIB_OPTS="-m 644"
653:
654: dnl HPUX wants shared libs to be mode 555.
655: case "$host_os" in
656: hpux*)
657: INSTL_SHLIB_OPTS="-m 555" ;;
658: esac
659:
660: AC_SUBST(INSTALL)
661: AC_SUBST(INSTLOPTS)
662: AC_SUBST(INSTL_LIB_OPTS)
663: AC_SUBST(INSTL_SHLIB_OPTS)
664: AC_SUBST(INSTL_EXE_OPTS)
665:
1.2 petere 666: AC_PROG_AWK
1.5 ! petere 667: AM_MISSING_PROG(AUTOCONF, autoconf, [\${SHELL} \${top_srcdir}/config])
! 668: AM_MISSING_PROG(ACLOCAL, aclocal, [\${SHELL} \${top_srcdir}/config])
1.2 petere 669:
1.1 petere 670: dnl Check the option to echo to inhibit newlines.
671: ECHO_N_OUT=`echo -n "" | wc -c`
672: ECHO_C_OUT=`echo "\c" | wc -c`
673: if test "$ECHO_N_OUT" -eq 0; then
674: DASH_N='-n'
675: BACKSLASH_C=
676: else
677: if test "ECHO_C_OUT" -eq 0; then
678: DASH_N=
679: BACKSLASH_C='\\\\c'
680: else
681: AC_MSG_ERROR("echo behaviour undetermined")
682: fi
683: fi
684: AC_SUBST(DASH_N)
685: AC_SUBST(BACKSLASH_C)
686:
687: AC_PROG_LEX
688: if test "$LEX" = "flex"; then
689: $LEX --version 2> /dev/null | grep -s '2\.5\.3' > /dev/null 2>&1
690: if test $? -eq 0 ; then
691: AC_MSG_WARN([
692: ***
693: You have flex version 2.5.3, which is broken. Get version 2.5.4 or
694: a different lex.
695: (If you are using the official distribution of PostgreSQL then you
696: do not need to worry about this because the lexer files are
697: pre-generated. However, other software using flex is likely to be
698: broken as well.)
699: ***])
700: fi
701: fi
702: AC_PROG_LN_S
703: AC_PROG_RANLIB
704: AC_PATH_PROG(find, find)
705: AC_PATH_PROG(tar, tar)
706: AC_PATH_PROG(split, split)
707: AC_PATH_PROG(etags, etags)
708: AC_PATH_PROG(xargs, xargs)
709: AC_PATH_PROGS(GZCAT, gzcat zcat, gzcat)
710: AC_CHECK_PROGS(PERL, perl,)
1.2 petere 711: AC_PROG_YACC
1.1 petere 712:
713:
714: AC_CHECK_LIB(sfio, main)
715: for curses in ncurses curses ; do
716: AC_CHECK_LIB(${curses}, main,
717: [LIBS="-l${curses} $LIBS"; break])
718: done
719: AC_CHECK_LIB(termcap, main)
720: AC_CHECK_LIB(readline, main)
721: AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
722: AC_CHECK_LIB(history, main) )
723:
724: if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
725: then
726: AC_CHECK_LIB(bsd, main)
727: fi
728: AC_CHECK_LIB(util, main)
729: AC_CHECK_LIB(m, main)
730: AC_CHECK_LIB(dl, main)
731: AC_CHECK_LIB(socket, main)
732: AC_CHECK_LIB(nsl, main)
733: AC_CHECK_LIB(ipc, main)
734: AC_CHECK_LIB(IPC, main)
735: AC_CHECK_LIB(lc, main)
736: AC_CHECK_LIB(dld, main)
737: AC_CHECK_LIB(ln, main)
738: AC_CHECK_LIB(ld, main)
739: AC_CHECK_LIB(compat, main)
740: AC_CHECK_LIB(BSD, main)
741: AC_CHECK_LIB(crypt, main)
742: AC_CHECK_LIB(gen, main)
743: AC_CHECK_LIB(PW, main)
744:
745: dnl Checks for header files.
746: AC_HEADER_STDC
747: AC_HEADER_SYS_WAIT
748: AC_CHECK_HEADERS(arpa/inet.h)
749: AC_CHECK_HEADERS(crypt.h)
750: AC_CHECK_HEADERS(dld.h)
751: AC_CHECK_HEADERS(endian.h)
752: AC_CHECK_HEADERS(float.h)
753: AC_CHECK_HEADERS(fp_class.h)
754: AC_CHECK_HEADERS(getopt.h)
755: AC_CHECK_HEADERS(history.h)
756: AC_CHECK_HEADERS(ieeefp.h)
757: AC_CHECK_HEADERS(limits.h)
758: AC_CHECK_HEADERS(netdb.h)
759: AC_CHECK_HEADERS(netinet/in.h)
760: AC_CHECK_HEADERS(readline.h)
761: AC_CHECK_HEADERS(readline/history.h)
762: AC_CHECK_HEADERS(readline/readline.h)
763: AC_CHECK_HEADERS(sys/select.h)
764: AC_CHECK_HEADERS(termios.h)
765: AC_CHECK_HEADERS(unistd.h)
766: AC_CHECK_HEADERS(values.h)
767: AC_CHECK_HEADERS(sys/exec.h sys/pstat.h machine/vmparam.h)
768: dnl ODBC headers...
769: AC_CHECK_HEADERS(sys/param.h pwd.h)
770: dnl
771:
772: dnl Checks for typedefs, structures, and compiler characteristics.
773: AC_C_CONST
774: AC_C_INLINE
775: AC_C_STRINGIZE
776: AC_TYPE_UID_T
777: AC_TYPE_MODE_T
778: AC_TYPE_OFF_T
779: AC_TYPE_SIZE_T
780: AC_HEADER_TIME
781: AC_STRUCT_TM
782: AC_STRUCT_TIMEZONE
783:
784: AC_MSG_CHECKING(for signed types)
785: AC_TRY_COMPILE([],
786: [signed char c; signed short s; signed int i;],
787: [AC_MSG_RESULT(yes)],
788: [AC_DEFINE(signed, ) AC_MSG_RESULT(no)])
789:
790: AC_MSG_CHECKING(for volatile)
791: AC_TRY_COMPILE([],
792: [extern volatile int i;],
793: [AC_MSG_RESULT(yes)],
794: [AC_DEFINE(volatile, ) AC_MSG_RESULT(no)])
795:
796: AC_MSG_CHECKING(for type of last arg to accept)
797: AC_TRY_COMPILE([#include <stdlib.h>
798: #include <sys/types.h>
799: #include <sys/socket.h>
800: ],
801: [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
802: [AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
803: [AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
804:
805: dnl Check for any "odd" conditions
806: AC_MSG_CHECKING(for int timezone)
807: AC_TRY_LINK([#include <time.h>],
808: [int res = timezone / 60; ],
809: [AC_DEFINE(HAVE_INT_TIMEZONE) AC_MSG_RESULT(yes)],
810: AC_MSG_RESULT(no))
811:
812: AC_MSG_CHECKING(for gettimeofday args)
813: AC_TRY_LINK([#include <sys/time.h>],
814: [struct timeval *tp; struct timezone *tzp; gettimeofday(tp,tzp); ],
815: [AC_DEFINE(HAVE_GETTIMEOFDAY_2_ARGS) AC_MSG_RESULT(2 args)],
816: AC_MSG_RESULT(no))
817:
818: AC_MSG_CHECKING(for union semun)
819: AC_TRY_LINK([#include <sys/types.h>
820: #include <sys/ipc.h>
821: #include <sys/sem.h>],
822: [union semun semun;],
823: [AC_DEFINE(HAVE_UNION_SEMUN) AC_MSG_RESULT(yes)],
824: AC_MSG_RESULT(no))
825:
826: AC_MSG_CHECKING(for fcntl(F_SETLK))
827: AC_TRY_LINK([#include <fcntl.h>],
828: [struct flock lck;
829: lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
830: lck.l_type = F_WRLCK;
831: fcntl(0, F_SETLK, &lck);],
832: [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
833: AC_MSG_RESULT(no))
834:
835: dnl Checks for library functions.
836: AC_FUNC_MEMCMP
837: AC_TYPE_SIGNAL
838: AC_FUNC_VPRINTF
839: AC_CHECK_FUNCS(memmove sysconf)
840: AC_CHECK_FUNCS(sigprocmask waitpid setsid fcvt)
841: AC_CHECK_FUNCS(setproctitle pstat)
842:
843: AC_MSG_CHECKING(for PS_STRINGS)
844: AC_TRY_LINK(
845: [#ifdef HAVE_MACHINE_VMPARAM_H
846: # include <machine/vmparam.h>
847: #endif
848: #ifdef HAVE_SYS_EXEC_H
849: # include <sys/exec.h>
850: #endif],
851: [PS_STRINGS->ps_nargvstr = 1;
852: PS_STRINGS->ps_argvstr = "foo";],
853: [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_PS_STRINGS)],
854: AC_MSG_RESULT(no))
855:
856: AC_CHECK_FUNCS(fpclass fp_class fp_class_d class)
857: dnl We use our snprintf.c emulation if either snprintf() or vsnprintf()
858: dnl is missing. Yes, there are machines that have only one.
859: dnl We may also decide to use snprintf.c if snprintf() is present but does
860: dnl not have working "long long int" support -- see below.
861: SNPRINTF=''
862: AC_CHECK_FUNC(snprintf,
863: AC_DEFINE(HAVE_SNPRINTF),
864: SNPRINTF='snprintf.o')
865: AC_CHECK_FUNC(vsnprintf,
866: AC_DEFINE(HAVE_VSNPRINTF),
867: SNPRINTF='snprintf.o')
868: AC_SUBST(SNPRINTF)
869: dnl Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
870: dnl include/c.h will provide declarations. Note this is a separate test
871: dnl from whether the functions exist in the C library --- there are systems
872: dnl that have the functions but don't bother to declare them :-(
873: dnl Note: simple-minded pattern here will do wrong thing if stdio.h
874: dnl declares vsnprintf() but not snprintf(). Hopefully there are no
875: dnl systems that are *that* brain-damaged...
876: AC_EGREP_HEADER(snprintf, stdio.h, AC_DEFINE(HAVE_SNPRINTF_DECL))
877: AC_EGREP_HEADER(vsnprintf, stdio.h, AC_DEFINE(HAVE_VSNPRINTF_DECL))
878: dnl
879: dnl do this one the hard way in case isinf() is a macro
880: AC_MSG_CHECKING(for isinf)
881: AC_CACHE_VAL(ac_cv_func_or_macro_isinf,
882: [AC_TRY_LINK(
883: [#include <math.h>],
884: [double x = 0.0; int res = isinf(x);],
885: [ac_cv_func_or_macro_isinf=yes],
886: [ac_cv_func_or_macro_isinf=no])])
887: if [[ $ac_cv_func_or_macro_isinf = yes ]]; then
888: AC_MSG_RESULT(yes)
889: AC_DEFINE(HAVE_ISINF)
890: ISINF=''
891: else
892: AC_MSG_RESULT(no)
893: ISINF='isinf.o'
894: fi
895: AC_SUBST(ISINF)
896: AC_CHECK_FUNC(getrusage,
897: AC_DEFINE(HAVE_GETRUSAGE),
898: GETRUSAGE='getrusage.o')
899: AC_SUBST(GETRUSAGE)
900: AC_CHECK_FUNC(srandom,
901: AC_DEFINE(HAVE_SRANDOM),
902: SRANDOM='srandom.o')
903: AC_SUBST(SRANDOM)
904: AC_CHECK_FUNC(gethostname,
905: AC_DEFINE(HAVE_GETHOSTNAME),
906: GETHOSTNAME='gethostname.o')
907: AC_SUBST(GETHOSTNAME)
908: AC_CHECK_FUNC(random,
909: AC_DEFINE(HAVE_RANDOM),
910: MISSING_RANDOM='random.o')
911: AC_SUBST(MISSING_RANDOM)
912: AC_CHECK_FUNC(inet_aton,
913: AC_DEFINE(HAVE_INET_ATON),
914: INET_ATON='inet_aton.o')
915: AC_SUBST(INET_ATON)
916: AC_CHECK_FUNC(strerror,
917: AC_DEFINE(HAVE_STRERROR),
918: [STRERROR='strerror.o' STRERROR2='../../backend/port/strerror.o'])
919: AC_SUBST(STRERROR)
920: AC_SUBST(STRERROR2)
921: AC_CHECK_FUNC(strdup,
922: AC_DEFINE(HAVE_STRDUP),
923: STRDUP='../../utils/strdup.o')
924: AC_SUBST(STRDUP)
925: AC_CHECK_FUNC(strtol,
926: AC_DEFINE(HAVE_STRTOL),
927: STRTOL='strtol.o')
928: AC_SUBST(STRTOL)
929: AC_CHECK_FUNC(strtoul,
930: AC_DEFINE(HAVE_STRTOUL),
931: STRTOL='strtoul.o')
932: AC_SUBST(STRTOUL)
933: AC_CHECK_FUNC(strcasecmp,
934: AC_DEFINE(HAVE_STRCASECMP),
935: STRCASECMP='strcasecmp.o')
936: AC_SUBST(STRCASECMP)
937: AC_CHECK_FUNC(cbrt,
938: AC_DEFINE(HAVE_CBRT),
939: AC_CHECK_LIB(m, cbrt, AC_DEFINE(HAVE_CBRT)))
940:
941: # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;
942: # this hackery with HPUXMATHLIB allows us to cope.
943: HPUXMATHLIB=""
944: case "$host_cpu" in
945: hppa1.1)
946: if [[ -r /lib/pa1.1/libm.a ]] ; then
947: HPUXMATHLIB="-L /lib/pa1.1 -lm"
948: fi ;;
949: esac
950: AC_SUBST(HPUXMATHLIB)
951:
952: AC_CHECK_FUNC(rint,
953: AC_DEFINE(HAVE_RINT),
954: AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
955:
956: dnl Some old versions of libreadline don't have rl_completion_append_character
957: AC_EGREP_HEADER(rl_completion_append_character, readline.h,
958: AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER),
959: [AC_EGREP_HEADER(rl_completion_append_character, readline/readline.h,
960: AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
961: AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
962:
963: dnl Check for readline's filename_completion_function.
964: dnl Some versions have it but it's not in the headers, so we have to take
965: dnl care of that, too.
966: AC_CHECK_FUNCS(filename_completion_function,
967: AC_EGREP_HEADER(filename_completion_function, readline.h,
968: AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
969: [AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
970: AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
971: )
972: AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
973: AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
974:
975: dnl Check for GNU style long options support (getopt_long)
976: AC_CHECK_FUNCS(getopt_long)
977:
978: dnl Cannot use AC_CHECK_FUNC because finite may be a macro
979: AC_MSG_CHECKING(for finite)
980: AC_TRY_LINK([#include <math.h>],
981: [int dummy=finite(1.0);],
982: [AC_DEFINE(HAVE_FINITE) AC_MSG_RESULT(yes)],
983: AC_MSG_RESULT(no))
984:
985: dnl Cannot use AC_CHECK_FUNC because sigsetjmp may be a macro
986: dnl (especially on GNU libc)
987: dnl See also comments in config.h.
988: AC_MSG_CHECKING(for sigsetjmp)
989: AC_TRY_LINK([#include <setjmp.h>],
990: [sigjmp_buf x; sigsetjmp(x, 1);],
991: [AC_DEFINE(HAVE_SIGSETJMP) AC_MSG_RESULT(yes)],
992: AC_MSG_RESULT(no))
993:
994: AC_ARG_ENABLE(syslog, [ --enable-syslog enable logging to syslog],
995: [case $enableval in y|ye|yes)
996: AC_CHECK_FUNC(syslog, [AC_DEFINE(ENABLE_SYSLOG)], [AC_MSG_ERROR([no syslog interface found])])
997: ;;
998: esac]
999: )
1000:
1001: dnl Check to see if we have a working 64-bit integer type.
1002: dnl This breaks down into two steps:
1003: dnl (1) figure out if the compiler has a 64-bit int type with working
1004: dnl arithmetic, and if so
1005: dnl (2) see whether snprintf() can format the type correctly. (Currently,
1006: dnl snprintf is the only library routine we really need for int8 support.)
1007: dnl It's entirely possible to have a compiler that handles a 64-bit type
1008: dnl when the C library doesn't; this is fairly likely when using gcc on
1009: dnl an older platform, for example.
1010: dnl If there is no native snprintf() or it does not handle the 64-bit type,
1011: dnl we force our own version of snprintf() to be used instead.
1012: dnl Note this test must be run after our initial check for snprintf/vsnprintf.
1013:
1014: HAVE_LONG_INT_64=0
1015: AC_MSG_CHECKING(whether 'long int' is 64 bits)
1016: AC_TRY_RUN([typedef long int int64;
1017:
1018: /* These are globals to discourage the compiler from folding all the
1019: * arithmetic tests down to compile-time constants.
1020: */
1021: int64 a = 20000001;
1022: int64 b = 40000005;
1023:
1024: int does_int64_work()
1025: {
1026: int64 c,d;
1027:
1028: if (sizeof(int64) != 8)
1029: return 0; /* doesn't look like the right size */
1030:
1031: /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
1032: c = a * b;
1033: d = (c + b) / b;
1034: if (d != a+1)
1035: return 0;
1036: return 1;
1037: }
1038: main() {
1039: exit(! does_int64_work());
1040: }],
1041: [HAVE_LONG_INT_64=1
1042: AC_DEFINE(HAVE_LONG_INT_64)
1043: AC_MSG_RESULT(yes)],
1044: AC_MSG_RESULT(no),
1045: AC_MSG_RESULT(assuming not on target machine))
1046:
1047: HAVE_LONG_LONG_INT_64=0
1048: if [[ $HAVE_LONG_INT_64 -eq 0 ]] ; then
1049: AC_MSG_CHECKING(whether 'long long int' is 64 bits)
1050: AC_TRY_RUN([typedef long long int int64;
1051:
1052: /* These are globals to discourage the compiler from folding all the
1053: * arithmetic tests down to compile-time constants.
1054: */
1055: int64 a = 20000001;
1056: int64 b = 40000005;
1057:
1058: int does_int64_work()
1059: {
1060: int64 c,d;
1061:
1062: if (sizeof(int64) != 8)
1063: return 0; /* doesn't look like the right size */
1064:
1065: /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
1066: c = a * b;
1067: d = (c + b) / b;
1068: if (d != a+1)
1069: return 0;
1070: return 1;
1071: }
1072: main() {
1073: exit(! does_int64_work());
1074: }],
1075: [HAVE_LONG_LONG_INT_64=1
1076: AC_DEFINE(HAVE_LONG_LONG_INT_64)
1077: AC_MSG_RESULT(yes)],
1078: AC_MSG_RESULT(no),
1079: AC_MSG_RESULT(assuming not on target machine))
1080: fi
1081:
1082: dnl If we found "long int" is 64 bits, assume snprintf handles it.
1083: dnl If we found we need to use "long long int", better check.
1084: dnl We cope with snprintfs that use either %lld or %qd as the format.
1085: dnl If neither works, fall back to our own snprintf emulation (which we
1086: dnl know uses %lld).
1087:
1088: if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1089: if [[ x$SNPRINTF = x ]] ; then
1090: AC_MSG_CHECKING(whether snprintf handles 'long long int' as %lld)
1091: AC_TRY_RUN([#include <stdio.h>
1092: typedef long long int int64;
1093: #define INT64_FORMAT "%lld"
1094:
1095: int64 a = 20000001;
1096: int64 b = 40000005;
1097:
1098: int does_int64_snprintf_work()
1099: {
1100: int64 c;
1101: char buf[100];
1102:
1103: if (sizeof(int64) != 8)
1104: return 0; /* doesn't look like the right size */
1105:
1106: c = a * b;
1107: snprintf(buf, 100, INT64_FORMAT, c);
1108: if (strcmp(buf, "800000140000005") != 0)
1109: return 0; /* either multiply or snprintf is busted */
1110: return 1;
1111: }
1112: main() {
1113: exit(! does_int64_snprintf_work());
1114: }],
1115: [ AC_MSG_RESULT(yes)
1116: INT64_FORMAT='"%lld"'
1117: ],
1118: [ AC_MSG_RESULT(no)
1119: AC_MSG_CHECKING(whether snprintf handles 'long long int' as %qd)
1120: AC_TRY_RUN([#include <stdio.h>
1121: typedef long long int int64;
1122: #define INT64_FORMAT "%qd"
1123:
1124: int64 a = 20000001;
1125: int64 b = 40000005;
1126:
1127: int does_int64_snprintf_work()
1128: {
1129: int64 c;
1130: char buf[100];
1131:
1132: if (sizeof(int64) != 8)
1133: return 0; /* doesn't look like the right size */
1134:
1135: c = a * b;
1136: snprintf(buf, 100, INT64_FORMAT, c);
1137: if (strcmp(buf, "800000140000005") != 0)
1138: return 0; /* either multiply or snprintf is busted */
1139: return 1;
1140: }
1141: main() {
1142: exit(! does_int64_snprintf_work());
1143: }],
1144: [ AC_MSG_RESULT(yes)
1145: INT64_FORMAT='"%qd"'
1146: ],
1147: [ AC_MSG_RESULT(no)
1148: # Force usage of our own snprintf, since system snprintf is broken
1149: SNPRINTF='snprintf.o'
1150: INT64_FORMAT='"%lld"'
1151: ],
1152: [ AC_MSG_RESULT(assuming not on target machine)
1153: # Force usage of our own snprintf, since we cannot test foreign snprintf
1154: SNPRINTF='snprintf.o'
1155: INT64_FORMAT='"%lld"'
1156: ]) ],
1157: [ AC_MSG_RESULT(assuming not on target machine)
1158: # Force usage of our own snprintf, since we cannot test foreign snprintf
1159: SNPRINTF='snprintf.o'
1160: INT64_FORMAT='"%lld"'
1161: ])
1162: else
1163: # here if we previously decided we needed to use our own snprintf
1164: INT64_FORMAT='"%lld"'
1165: fi
1166: else
1167: # Here if we are not using 'long long int' at all
1168: INT64_FORMAT='"%ld"'
1169: fi
1170:
1171: AC_DEFINE_UNQUOTED(INT64_FORMAT, $INT64_FORMAT)
1172:
1173:
1174: dnl Determine memory alignment requirements for the basic C datatypes.
1175:
1176: dnl CHECK_ALIGNOF(TYPE)
1177: dnl This is modeled on the standard autoconf macro AC_CHECK_SIZEOF,
1178: dnl except it finds the alignment requirement of the type instead of the size.
1179: dnl The defined symbol is named ALIGNOF_TYPE, where the type name is
1180: dnl converted in the same way as for AC_CHECK_SIZEOF.
1181: dnl If cross-compiling, sizeof(type) is used as a default assumption.
1182:
1183: AC_DEFUN(CHECK_ALIGNOF,
1184: [changequote(<<, >>)dnl
1185: dnl The name to #define.
1186: define(<<AC_TYPE_NAME>>, translit(alignof_$1, [a-z *], [A-Z_P]))dnl
1187: dnl The cache variable name.
1188: define(<<AC_CV_NAME>>, translit(ac_cv_alignof_$1, [ *], [_p]))dnl
1189: changequote([, ])dnl
1190: AC_MSG_CHECKING(alignment of $1)
1191: AC_CACHE_VAL(AC_CV_NAME,
1192: [AC_TRY_RUN([#include <stdio.h>
1193: struct { char filler; $1 field; } mystruct;
1194: main()
1195: {
1196: FILE *f=fopen("conftestval", "w");
1197: if (!f) exit(1);
1198: fprintf(f, "%d\n", ((char*) & mystruct.field) - ((char*) & mystruct));
1199: exit(0);
1200: }], AC_CV_NAME=`cat conftestval`,
1201: AC_CV_NAME='sizeof($1)',
1202: AC_CV_NAME='sizeof($1)')])dnl
1203: AC_MSG_RESULT($AC_CV_NAME)
1204: AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
1205: undefine([AC_TYPE_NAME])dnl
1206: undefine([AC_CV_NAME])dnl
1207: ])
1208:
1209: CHECK_ALIGNOF(short)
1210: CHECK_ALIGNOF(int)
1211: CHECK_ALIGNOF(long)
1212: if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1213: CHECK_ALIGNOF(long long int)
1214: fi
1215: CHECK_ALIGNOF(double)
1216:
1217: dnl Compute maximum alignment of any basic type.
1218: dnl We assume long's alignment is at least as strong as char, short, or int;
1219: dnl but we must check long long (if it exists) and double.
1220:
1221: if [[ $ac_cv_alignof_double != 'sizeof(double)' ]] ; then
1222: MAX_ALIGNOF="$ac_cv_alignof_long"
1223: if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_double ]] ; then
1224: MAX_ALIGNOF="$ac_cv_alignof_double"
1225: fi
1226: if [[ $HAVE_LONG_LONG_INT_64 -eq 1 ]] ; then
1227: if [[ $MAX_ALIGNOF -lt $ac_cv_alignof_long_long_int ]] ; then
1228: MAX_ALIGNOF="$ac_cv_alignof_long_long_int"
1229: fi
1230: fi
1231: else
1232: dnl cross-compiling: assume that double's alignment is worst case
1233: MAX_ALIGNOF="$ac_cv_alignof_double"
1234: fi
1235: AC_DEFINE_UNQUOTED(MAXIMUM_ALIGNOF, $MAX_ALIGNOF)
1236:
1237:
1238: dnl Check to see if platform has POSIX signal interface.
1239: dnl NOTE: if this test fails then POSIX signals definitely don't work.
1240: dnl It could be that the test compiles but the POSIX routines don't
1241: dnl really work ... in that case the platform-specific port files
1242: dnl can unset USE_POSIX_SIGNALS and HAVE_POSIX_SIGNALS. (The former
1243: dnl goes into config.h, the latter into Makefile.global.)
1244:
1245: AC_MSG_CHECKING(for POSIX signal interface)
1246: AC_TRY_LINK([#include <signal.h>],
1247: [struct sigaction act, oact;
1248: sigemptyset(&act.sa_mask);
1249: act.sa_flags = SA_RESTART;
1250: sigaction(0, &act, &oact);],
1251: [AC_DEFINE(USE_POSIX_SIGNALS)
1252: HAVE_POSIX_SIGNALS="1"
1253: AC_MSG_RESULT(yes)],
1254: [HAVE_POSIX_SIGNALS=""
1255: AC_MSG_RESULT(no)])
1256: AC_SUBST(HAVE_POSIX_SIGNALS)
1257:
1258: dnl Check for Tcl configuration script tclConfig.sh
1259:
1260: dnl If --with-tclconfig was given, don't check for tclsh, tcl
1261: if test -z "$TCL_DIRS"
1262: then
1263: AC_PATH_PROG(TCLSH, tclsh)
1264: if test -z "$TCLSH"
1265: then
1266: AC_PATH_PROG(TCLSH, tcl)
1267: if test -z "$TCLSH"
1268: then
1269: AC_MSG_WARN(TCL/TK support disabled; tcl shell is not in your path)
1270: USE_TCL=
1271: fi
1272: fi
1273: fi
1274:
1275: if test "$USE_TCL" = true
1276: then
1277: AC_MSG_CHECKING(for tclConfig.sh)
1278: TCL_CONFIG_SH=
1279: library_dirs=
1280: if test -z "$TCL_DIRS"
1281: then
1282: library_dirs=`echo 'puts $auto_path' | $TCLSH`
1283: fi
1284: library_dirs="$TCL_DIRS $TK_DIRS $library_dirs"
1285: for dir in $library_dirs; do
1286: if test -d "$dir" -a -r "$dir/tclConfig.sh"; then
1287: TCL_CONFIG_SH=$dir/tclConfig.sh
1288: break
1289: fi
1290: done
1291: if test -z "$TCL_CONFIG_SH"; then
1292: AC_MSG_RESULT(no)
1293: AC_MSG_WARN(TCL/TK support disabled; Tcl configuration script missing)
1294: USE_TCL=
1295: else
1296: AC_MSG_RESULT($TCL_CONFIG_SH)
1297: AC_SUBST(TCL_CONFIG_SH)
1298: fi
1299: fi
1300:
1301: USE_TK=$USE_TCL # If TCL is disabled, disable TK
1302:
1303: dnl Check for Tk configuration script tkConfig.sh
1304: if test "$USE_TK" = true
1305: then
1306: AC_MSG_CHECKING(for tkConfig.sh)
1307: TK_CONFIG_SH=
1308: # library_dirs are set in the check for TCL
1309: for dir in $library_dirs
1310: do
1311: if test -d "$dir" -a -r "$dir/tkConfig.sh"
1312: then
1313: TK_CONFIG_SH=$dir/tkConfig.sh
1314: break
1315: fi
1316: done
1317: if test -z "$TK_CONFIG_SH"
1318: then
1319: AC_MSG_RESULT(no)
1320: AC_MSG_WARN(TK support disabled; Tk configuration script missing)
1321: USE_TK=
1322: else
1323: AC_MSG_RESULT($TK_CONFIG_SH)
1324: AC_SUBST(TK_CONFIG_SH)
1325: AC_PATH_PROG(WISH, wish)
1326: fi
1327: fi
1328:
1329: USE_X=$USE_TK
1330:
1331: dnl Check for X libraries
1332:
1333: if test "$USE_X" = true; then
1334:
1335: ice_save_LIBS="$LIBS"
1336: ice_save_CFLAGS="$CFLAGS"
1337: ice_save_CPPFLAGS="$CPPFLAGS"
1338: ice_save_LDFLAGS="$LDFLAGS"
1339:
1340: AC_PATH_XTRA
1341:
1342: LIBS="$LIBS $X_EXTRA_LIBS"
1343: CFLAGS="$CFLAGS $X_CFLAGS"
1344: CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1345: LDFLAGS="$LDFLAGS $X_LIBS"
1346:
1347: dnl Check for X library
1348:
1349: X11_LIBS=""
1350: AC_CHECK_LIB(X11, XOpenDisplay, X11_LIBS="-lX11",,${X_PRE_LIBS})
1351: if test "$X11_LIBS" = ""; then
1352: dnl Not having X is bad news for pgtksh. Let the user fix this.
1353: AC_MSG_WARN([The X11 library '-lX11' could not be found,
1354: so TK support will be disabled. To enable TK support,
1355: please use the configure options '--x-includes=DIR'
1356: and '--x-libraries=DIR' to specify the X location.
1357: See the file 'config.log' for further diagnostics.])
1358: USE_TK=
1359: fi
1360: AC_SUBST(X_LIBS)
1361: AC_SUBST(X11_LIBS)
1362: AC_SUBST(X_PRE_LIBS)
1363:
1364: LIBS="$ice_save_LIBS"
1365: CFLAGS="$ice_save_CFLAGS"
1366: CPPFLAGS="$ice_save_CPPFLAGS"
1367: LDFLAGS="$ice_save_LDFLAGS"
1368: fi
1369:
1370: dnl cause configure to recurse into subdirectories with their own configure
1371: dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
1372: dnl file, but then configure doesn't bother using that list. Probably a bug in
1373: dnl this version of autoconf.
1374: dnl So at the moment interfaces/odbc gets configured unconditionally.
1375: dnl - thomas 1998-10-05
1376: #if test "X$USE_ODBC" = "Xtrue"
1377: #then
1378: # AC_CONFIG_SUBDIRS(interfaces/odbc)
1379: #fi
1380: if test "$USE_ODBC" = "true"
1381: then
1382: PWD_INCDIR=no
1383: AC_CHECK_HEADER(pwd.h, PWD_INCDIR=yes)
1384: if test "$PWD_INCDIR" = "no"; then
1385: AC_MSG_WARN(odbc support disabled; pwd.h missing)
1386: USE_ODBC=
1387: fi
1388: AC_SUBST(USE_ODBC)
1389: fi
1390:
1391: dnl Output files that are neither makefiles nor shell scripts probably
1392: dnl need fully-expanded substitutions, rather than partial expansions
1393: dnl that include references to other variables. Currently the only
1394: dnl such item that's needed is an expanded version of libdir, but
1395: dnl others may be needed someday. NOTE: 'eval' technique only copes
1396: dnl with one level of indirect reference per expansion; two levels is
1397: dnl currently enough for libdir, but it's ugly...
1398:
1399: dnl First we have to force 'NONE' prefix to be expanded itself.
1400: dnl For some reason, autoconf 2.13 doesn't do this until AC_OUTPUT,
1401: dnl which is too late...
1402: test "x$prefix" = xNONE && prefix=$ac_default_prefix
1403: test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1404:
1405: eval expanded_libdir="$libdir"
1406: eval expanded_libdir="$expanded_libdir"
1407: AC_SUBST(expanded_libdir)
1408:
1409: dnl Finally ready to produce output files ...
1410:
1411: AC_OUTPUT(
1412: GNUmakefile
1413: src/GNUmakefile
1414: src/Makefile.global
1415: src/backend/port/Makefile
1416: src/backend/catalog/genbki.sh
1417: src/backend/utils/Gen_fmgrtab.sh
1418: src/bin/pg_dump/Makefile
1419: src/bin/pg_version/Makefile
1420: src/bin/pgtclsh/mkMakefile.tcldefs.sh
1421: src/bin/pgtclsh/mkMakefile.tkdefs.sh
1422: src/bin/psql/Makefile
1423: src/include/version.h
1.5 ! petere 1424: src/interfaces/Makefile
1.1 petere 1425: src/interfaces/libpq/Makefile
1426: src/interfaces/ecpg/lib/Makefile
1427: src/interfaces/ecpg/preproc/Makefile
1.5 ! petere 1428: src/interfaces/perl5/GNUmakefile
1.1 petere 1429: src/interfaces/libpq++/Makefile
1430: src/interfaces/libpgeasy/Makefile
1431: src/interfaces/libpgtcl/Makefile
1432: src/interfaces/odbc/GNUmakefile
1433: src/interfaces/odbc/Makefile.global
1.5 ! petere 1434: src/interfaces/python/GNUmakefile
! 1435: src/pl/Makefile
1.1 petere 1436: src/pl/plpgsql/src/Makefile
1437: src/pl/plpgsql/src/mklang.sql
1438: src/pl/tcl/mkMakefile.tcldefs.sh
1.5 ! petere 1439: src/pl/plperl/GNUmakefile
1.1 petere 1440: src/test/regress/GNUmakefile
1441: )
PostgreSQL CVSweb <[email protected]>