@@ -149,30 +149,31 @@ sed 's/^\([A-Za-z_]*\):\(.*\)$/\1="\2"/' "src/template/$TEMPLATE" >conftest.sh
149149rm -f conftest.sh
150150]
151151
152+ dnl
153+ dnl Add non-standard directories to the include path
154+ dnl
155+ AC_ARG_WITH(includes, [ --with-includes=DIRS add non-standard include paths],
156+ [if test x"$withval" = x"yes" || test x"$withval" = x"no" ; then
157+ AC_MSG_ERROR([You must supply an argument to the --with-includes option.])
158+ fi])
159+
160+ # SRCH_INC comes from the template file
161+ ac_save_IFS=$IFS
162+ IFS=':'
163+ for dir in $with_includes $SRCH_INC; do
164+ if test -d "$dir"; then
165+ INCLUDES="$INCLUDES -I$dir"
166+ else
167+ AC_MSG_WARN([*** Include directory $dir does not exist.])
168+ fi
169+ done
170+ IFS=$ac_save_IFS
171+ AC_SUBST(INCLUDES)
152172
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
175173
174+ dnl
175+ dnl Add non-standard directories to the library search path
176+ dnl
176177AC_ARG_WITH(libraries,
177178 [ --with-libraries=DIRS look for additional libraries in DIRS],
178179 [
@@ -394,6 +395,108 @@ fi],
394395[AC_MSG_RESULT(no)])
395396AC_SUBST(with_python)
396397
398+
399+ dnl
400+ dnl Optionally build with Kerberos 4 support
401+ dnl
402+ AC_MSG_CHECKING(whether to build with Kerberos 4 support)
403+ AC_ARG_WITH(krb4, [ --with-krb4[=DIR] use Kerberos 4 [/usr/athena]],
404+ [if test x"$withval" != x"no"; then
405+ # If the user didn't give an argument, we take the Kerberos 4 default
406+ # path /usr/athena. We look into lib/ and include/ for the Kerberos
407+ # libraries and includes. If the user has a more complicated layout
408+ # he can use --with-includes and --with-libraries.
409+ if test x"$withval" = x"yes"; then
410+ krb4dir=/usr/athena
411+ else
412+ krb4dir=$withval
413+ fi
414+ with_krb4=yes
415+ AC_MSG_RESULT(yes)
416+ if test -d $krb4dir; then
417+ if test -d "$krb4dir/include"; then
418+ INCLUDES="$INCLUDES -I$krb4dir/include"
419+ fi
420+ if test -d "$krb4dir/lib"; then
421+ krb_libdir="-L$krb4dir/lib"
422+ LIBS="$krb_libdir $LIBS"
423+ fi
424+ fi
425+ AC_CHECK_LIB(des, main, [], [AC_MSG_ERROR([library \`des' is required for Kerberos 4])])
426+ AC_CHECK_LIB(krb, main, [], [AC_MSG_ERROR([library \`krb' is required for Kerberos 4])])
427+ KRB_LIBS="$krb_libdir -lkrb -ldes"
428+ AC_DEFINE(KRB4,, [Define if you are building with Kerberos 4 support.])
429+ else
430+ AC_MSG_RESULT(no)
431+ fi],
432+ [AC_MSG_RESULT(no)])
433+ AC_SUBST(with_krb4)
434+
435+
436+ dnl
437+ dnl Optionally build with Kerberos 5 support
438+ dnl
439+ AC_MSG_CHECKING(whether to build with Kerberos 5 support)
440+ AC_ARG_WITH(krb5, [ --with-krb5[=DIR] use Kerberos 5 [/usr/athena]],
441+ [if test x"$withval" != x"no"; then
442+ if test x"$withval" = x"yes"; then
443+ krb5dir=/usr/athena
444+ else
445+ krb5dir=$withval
446+ fi
447+ with_krb5=yes
448+ AC_MSG_RESULT(yes)
449+ if test -d $krb5dir; then
450+ if test -d "$krb5dir/include"; then
451+ INCLUDES="$INCLUDES -I$krb5dir/include"
452+ fi
453+ if test -d "$krb5dir/lib"; then
454+ krb_libdir="-L$krb5dir/lib"
455+ LIBS="$krb_libdir $LIBS"
456+ fi
457+ fi
458+ AC_CHECK_LIB(com_err, main, [], [AC_MSG_ERROR([library \`com_err' is required for Kerberos 5])])
459+ AC_CHECK_LIB(crypto, main, [], [AC_MSG_ERROR([library \`crypto' is required for Kerberos 5])])
460+ AC_CHECK_LIB(krb5, main, [], [AC_MSG_ERROR([library \`krb5' is required for Kerberos 5])])
461+ KRB_LIBS="$krb_libdir -lkrb5 -lcrypto -lcom_err"
462+ AC_DEFINE(KRB5,, [Define if you are building with Kerberos 5 support.])
463+ else
464+ AC_MSG_RESULT(no)
465+ fi],
466+ [AC_MSG_RESULT(no)])
467+ AC_SUBST(with_krb5)
468+
469+ dnl Necessary for special libpq link
470+ AC_SUBST(KRB_LIBS)
471+
472+
473+ dnl
474+ dnl Kerberos configuration parameters
475+ dnl
476+ AC_ARG_WITH(krb-srvnam, [ --with-krb-srvnam=NAME name of the Postgres service principal in Kerberos],
477+ [if test x"$withval" = x"yes"; then
478+ AC_MSG_ERROR([argument required for --with-krb-srvnam])
479+ else
480+ krb_srvnam=$withval
481+ fi],
482+ [krb_srvnam="postgres"])
483+ AC_DEFINE_UNQUOTED(PG_KRB_SRVNAM, ["$krb_srvnam"], [The name of the Postgres service principal])
484+
485+ AC_ARG_WITH(krb-srvtab, [ --with-krb-srvtab=FILE location of Kerberos server's keytab file],
486+ [if test x"$withval" = x"yes"; then
487+ AC_MSG_ERROR([argument required for --with-krb-srvtab])
488+ else
489+ krb_srvtab=$withval
490+ fi],
491+ [if test x"$with_krb5" = x"yes"; then
492+ krb_srvtab="FILE:/usr/local/postgres/krb5.keytab"
493+ else
494+ krb_srvtab="/etc/srvtab"
495+ fi])
496+ AC_DEFINE_UNQUOTED(PG_KRB_SRVTAB, ["$krb_srvtab"], [The location of the Kerberos server's keytab file])
497+
498+
499+
397500dnl We include odbc support unless we disable it with --with-odbc=false
398501AC_MSG_CHECKING(setting USE_ODBC)
399502AC_ARG_WITH(
467570 unixODBC_libs="$unixODBC/lib"
468571 unixODBC_includes="$unixODBC/include"
469572
470- CPPFLAGS ="$CPPFLAGS -I$unixODBC_includes"
573+ INCLUDES ="$INCLUDES -I$unixODBC_includes"
471574 AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
472575 unixODBC_ok=yes;
473576 odbc_headers="$odbc_headers $ac_hdr",
@@ -499,7 +602,7 @@ AC_ARG_ENABLE(
499602 AC_MSG_RESULT(disabled)
500603)
501604
502- CPPFLAGS="$CPPFLAGS $PGSQL_INCLUDES "
605+ CPPFLAGS="$CPPFLAGS $INCLUDES "
503606echo "- setting CPPFLAGS=$CPPFLAGS"
504607
505608LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
@@ -547,8 +650,6 @@ AC_SUBST(PORTNAME)
547650AC_SUBST(CPU)
548651AC_SUBST(SRCDIR)
549652AC_SUBST(LDFLAGS)
550- AC_SUBST(CPPFLAGS)
551- AC_SUBST(PGSQL_INCLUDES)
552653AC_SUBST(AROPT)
553654AC_SUBST(SHARED_LIB)
554655AC_SUBST(CFLAGS)
@@ -636,10 +737,7 @@ AC_SUBST(YFLAGS)
636737
637738
638739AC_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
740+ AC_CHECK_LIB(ncurses, main, [], [AC_CHECK_LIB(curses, main)])
643741AC_CHECK_LIB(termcap, main)
644742AC_CHECK_LIB(readline, main)
645743AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),