]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] fixed some dlz configure options
authorEvan Hunt <each@isc.org>
Sun, 16 Feb 2014 05:10:07 +0000 (21:10 -0800)
committerEvan Hunt <each@isc.org>
Sun, 16 Feb 2014 05:10:07 +0000 (21:10 -0800)
3740. [contrib] Minor fixes to configure --with-dlz-bdb,
--with-dlz-postgres and --with-dlz-odbc. [RT #35340]

CHANGES
configure
configure.in
contrib/dlz/config.dlz.in

diff --git a/CHANGES b/CHANGES
index 1f92e05e97d0251af961e6ca9af4483d56e5364a..75b15e552db7a418ebc6ac49cd25e1ac8e7ba9dd 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3740.  [contrib]       Minor fixes to configure --with-dlz-bdb,
+                       --with-dlz-postgres and --with-dlz-odbc. [RT #35340]
+
 3739.  [func]          Added per-zone stats counters to track TCP and
                        UDP queries. [RT #35375]
 
index 0a98b429530871fd0fc89565202e12cf27cd5ed5..02be74a94dfa707b95a922b28c5d6f160f1a691a 100755 (executable)
--- a/configure
+++ b/configure
@@ -1705,19 +1705,19 @@ Optional Packages:
   --with-atf=ARG          Automated Test Framework support
   --with-dlopen=ARG       Support dynamically loadable DLZ drivers
   --with-dlz-postgres=PATH   Build with Postgres DLZ driver yes|no|path.
-                               (Required to use Postgres with DLZ)
+                              (Required to use Postgres with DLZ)
   --with-dlz-mysql=PATH   Build with MySQL DLZ driver yes|no|path.
-                               (Required to use MySQL with DLZ)
+                              (Required to use MySQL with DLZ)
   --with-dlz-bdb=PATH   Build with Berkeley DB DLZ driver yes|no|path.
-                               (Required to use Berkeley DB with DLZ)
+                              (Required to use Berkeley DB with DLZ)
   --with-dlz-filesystem=PATH   Build with filesystem DLZ driver yes|no.
-                               (Required to use file system driver with DLZ)
+                              (Required to use file system driver with DLZ)
   --with-dlz-ldap=PATH   Build with LDAP DLZ driver yes|no|path.
-                               (Required to use LDAP with DLZ)
+                              (Required to use LDAP with DLZ)
   --with-dlz-odbc=PATH   Build with ODBC DLZ driver yes|no|path.
-                               (Required to use ODBC with DLZ)
+                              (Required to use ODBC with DLZ)
   --with-dlz-stub=PATH   Build with stub DLZ driver yes|no.
-                               (Required to use stub driver with DLZ)
+                              (Required to use stub driver with DLZ)
   --with-make-clean      Run "make clean" at end of configure [yes|no].
 
 Some influential environment variables:
@@ -15882,7 +15882,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5
 $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
 if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then :
-  have_clock_gt=ye
+  have_clock_gt=yes
 fi
 
 fi
@@ -20059,12 +20059,58 @@ else
 fi
 
 
-if test "$use_dlz_postgres" = "yes"
+if test "$use_dlz_postgres" != "no"
 then
-       # User did not specify a path - guess it
-       # Ask Postgres to tell us where it is
+       if test "$use_dlz_postgres" != "yes"
+        then
+                for ac_prog in pg_config
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PG_CONFIG="$PG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $use_dlz_postgres/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-       for ac_prog in pg_config
+  ;;
+esac
+fi
+PG_CONFIG=$ac_cv_path_PG_CONFIG
+if test -n "$PG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PG_CONFIG" >&5
+$as_echo "$PG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PG_CONFIG" && break
+done
+test -n "$PG_CONFIG" || PG_CONFIG="not found"
+
+       else
+                for ac_prog in pg_config
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 done
 test -n "$PG_CONFIG" || PG_CONFIG="not found"
 
+       fi
 
        if test "$PG_CONFIG" != "not found"
        then
                use_dlz_postgres=`$PG_CONFIG --includedir`
                use_dlz_postgres_lib=`$PG_CONFIG --libdir`
+       else
+               pgprefix="$use_dlz_postgres"
+               use_dlz_postgres="$pgprefix/include"
+               use_dlz_postgres_lib="$pgprefix/lib"
        fi
 fi
 
 if test "$use_dlz_postgres" = "yes"
 then
        # User did not specify path and Postgres didn't say - guess it
-
        pgdirs="/usr /usr/local /usr/local/pgsql /usr/pkg"
        for d in $pgdirs
        do
@@ -20283,8 +20333,8 @@ esac
 # Was --with-dlz-bdb specified?
 #
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Berkeley DB DLZ driver" >&5
-$as_echo_n "checking for Berkeley DB DLZ driver... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Berkeley DB DLZ driver..." >&5
+$as_echo_n "checking for Berkeley DB DLZ driver...... " >&6; }
 
 # Check whether --with-dlz_bdb was given.
 if test "${with_dlz_bdb+set}" = set; then :
@@ -20324,6 +20374,8 @@ $as_echo "not found" >&6; }
                dlz_bdb_inc="yes"
                dlz_bdb_libs="yes"
 
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
+$as_echo "" >&6; }
                for dd in $bdbdirs
                do
                        # Skip nonexistant directories
@@ -20335,10 +20387,11 @@ $as_echo "not found" >&6; }
                        # Check other locations for includes.
                        # Order is important (sigh).
 
-                       bdb_incdirs="/ /db48/ /db47/ /db46/ /db45/ /db44/ /db43/ /db42/ /db41/ /db4/ /db/"
-                       for d in $bdb_incdirs
+                       bdb_incdirs="/db53 /db51 /db48 /db47 /db46 /db45 /db44 /db43 /db42 /db41 /db4 /db"
+                       # include a blank element first
+                       for d in "" $bdb_incdirs
                        do
-                               if test -f "$dd/include${d}db.h"
+                               if test -f "$dd/include${d}/db.h"
                                then
                                        dlz_bdb_inc="-I$dd/include${d}"
                                        break
@@ -20356,18 +20409,60 @@ $as_echo "not found" >&6; }
                        # Look for libname other than libdb.so.
                        # Order is important (sigh).
 
-                       bdb_libnames="db48 db-4.8 db47 db-4.7 db46 db-4.6 db45 db-4.5 db44 db-4.4 db43 db-4.3 db42 db-4.2 db41 db-4.1 db"
+                       bdb_libnames="db53 db-5.3 db51 db-5.1 db48 db-4.8 db47 db-4.7 db46 db-4.6 db45 db-4.5 db44 db-4.4 db43 db-4.3 db42 db-4.2 db41 db-4.1 db"
                        for d in $bdb_libnames
                        do
-                               if test -f "$dd/lib/lib${d}.so"
+                               if test "$dd" = "/usr"
                                then
-                                       if test "$dd" != "/usr"
+                                       as_ac_Lib=`$as_echo "ac_cv_lib_$d''_db_create" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for db_create in -l$d" >&5
+$as_echo_n "checking for db_create in -l$d... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$d  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char db_create ();
+int
+main ()
+{
+return db_create ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  dlz_bdb_libs="-l${d}"
+fi
+
+                                       if test $dlz_bdb_libs != "yes"
                                        then
-                                               dlz_bdb_libs="-L${dd}/lib "
-                                       else
-                                               dlz_bdb_libs=""
+                                               break
                                        fi
-                                       dlz_bdb_libs="${dlz_bdb_libs}-l${d}"
+                               elif test -f "$dd/lib/lib${d}.so"
+                               then
+                                       dlz_bdb_libs="-L${dd}/lib -l${d}"
                                        break
                                fi
                        done
@@ -20388,8 +20483,6 @@ $as_echo "not found" >&6; }
 
                if test "$dlz_bdb_inc" = "yes"
                then
-                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
-$as_echo "not found" >&6; }
                        as_fn_error $? "could not find Berkeley DB include directory" "$LINENO" 5
                fi
 
 if test "$use_dlz_odbc" = "yes"
 then
        # User did not specify a path - guess it
-       odbcdirs="/usr /usr/local /usr/pkg"
-       for d in $odbcdirs
-       do
-               if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
-               then
-                       use_dlz_odbc=$d
-                       break
-               fi
-       done
+       libodbc_found=no
+       sql_h_found=no
+       ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
+if test "x$ac_cv_header_sql_h" = xyes; then :
+  sql_h_found=yes
+fi
+
+
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SQLConnect in -lodbc" >&5
+$as_echo_n "checking for SQLConnect in -lodbc... " >&6; }
+if ${ac_cv_lib_odbc_SQLConnect+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lodbc  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SQLConnect ();
+int
+main ()
+{
+return SQLConnect ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_odbc_SQLConnect=yes
+else
+  ac_cv_lib_odbc_SQLConnect=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_odbc_SQLConnect" >&5
+$as_echo "$ac_cv_lib_odbc_SQLConnect" >&6; }
+if test "x$ac_cv_lib_odbc_SQLConnect" = xyes; then :
+  libodbc_found=yes
+fi
+
+
+       if test $libodbc_found = "yes" -o $sql_h_found = "yes"
+       then
+               use_dlz_odbc=system
+               dlz_odbc_include=""
+               dlz_odbc_libs="-lodbc"
+       else
+               odbcdirs="/usr /usr/local /usr/pkg"
+               for d in $odbcdirs
+               do
+                       if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
+                       then
+                               use_dlz_odbc=$d
+                               dlz_odbc_include="-I$use_dlz_odbc/include"
+                               dlz_odbc_libs="-L$use_dlz_odbc/lib -lodbc"
+                               break
+                       fi
+               done
+       fi
 fi
 
 case "$use_dlz_odbc" in
@@ -20582,13 +20733,13 @@ $as_echo "not found" >&6; }
                DLZ_DRIVER_SRCS="$DLZ_DRIVER_SRCS $dlzdir/$i.c"
                DLZ_DRIVER_OBJS="$DLZ_DRIVER_OBJS $i.$O"
        done
-       if test -n "-I$use_dlz_odbc/include"
+       if test -n "$dlz_odbc_include"
        then
-               DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES -I$use_dlz_odbc/include"
+               DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $dlz_odbc_include"
        fi
-       if test -n "-L$use_dlz_odbc/lib -lodbc"
+       if test -n "$dlz_odbc_libs"
        then
-               DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS -L$use_dlz_odbc/lib -lodbc"
+               DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $dlz_odbc_libs"
        fi
 
 
@@ -20650,7 +20801,7 @@ esac
 #
 if test -n "$CONTRIB_DLZ"
 then
-        CONTRIB_DLZ="-DCONTRIB_DLZ $CONTRIB_DLZ"
+       CONTRIB_DLZ="-DCONTRIB_DLZ $CONTRIB_DLZ"
 
        #
        # Where to find DLZ driver header files.
@@ -23317,7 +23468,7 @@ test "$use_dlz_ldap" = "no" || \
 test "$use_dlz_mysql" = "no" || \
     echo "        MySQL (--with-dlz-mysql)"
 test "$use_dlz_odbc" = "no" || \
-    echo "        ODBC (--with-dlz-bdb)"
+    echo "        ODBC (--with-dlz-odbc)"
 test "$use_dlz_postgres" = "no" || \
     echo "        Postgres (--with-dlz-postgres)"
 test "$use_dlz_filesystem" = "no" || \
index 60d75fe9848a07004d001809502a27842490021b..5b5ed52ed790ff159846d3c4464adb7cbaa97264 100644 (file)
@@ -1708,7 +1708,7 @@ AC_MSG_CHECKING(clock_gettime)
 have_clock_gt=no
 AC_CHECK_FUNC(clock_gettime,have_clock_gt=yes,)
 if test "$have_clock_gt" = "no"; then
-       AC_CHECK_LIB(rt,clock_gettime,have_clock_gt=ye,,)
+       AC_CHECK_LIB(rt,clock_gettime,have_clock_gt=yes,)
 fi
 
 if test "$have_clock_gt" = "yes"; then
@@ -4245,7 +4245,7 @@ test "$use_dlz_ldap" = "no" || \
 test "$use_dlz_mysql" = "no" || \
     echo "        MySQL (--with-dlz-mysql)"
 test "$use_dlz_odbc" = "no" || \
-    echo "        ODBC (--with-dlz-bdb)"
+    echo "        ODBC (--with-dlz-odbc)"
 test "$use_dlz_postgres" = "no" || \
     echo "        Postgres (--with-dlz-postgres)"
 test "$use_dlz_filesystem" = "no" || \
index 9d5b8c3498654b9f0ccf43c8d17b9d08d55986b3..006c4d3390292a538e856422c8ddc21aac427bd1 100644 (file)
@@ -56,27 +56,32 @@ AC_DEFUN(DLZ_ADD_DRIVER, [
 AC_MSG_CHECKING(for Postgres DLZ driver)
 AC_ARG_WITH(dlz_postgres,
 [  --with-dlz-postgres[=PATH]   Build with Postgres DLZ driver [yes|no|path].
-                               (Required to use Postgres with DLZ)],
+                              (Required to use Postgres with DLZ)],
     use_dlz_postgres="$withval", use_dlz_postgres="no")
 
-if test "$use_dlz_postgres" = "yes"
+if test "$use_dlz_postgres" != "no"
 then
-       # User did not specify a path - guess it
-       # Ask Postgres to tell us where it is
-
-       AC_PATH_PROGS(PG_CONFIG, pg_config, [not found])
+       if test "$use_dlz_postgres" != "yes"
+        then
+                AC_PATH_PROGS(PG_CONFIG, pg_config, [not found], $use_dlz_postgres/bin)
+       else
+                AC_PATH_PROGS(PG_CONFIG, pg_config, [not found])
+       fi
 
        if test "$PG_CONFIG" != "not found"
        then
                use_dlz_postgres=`$PG_CONFIG --includedir`
                use_dlz_postgres_lib=`$PG_CONFIG --libdir`
+       else
+               pgprefix="$use_dlz_postgres"
+               use_dlz_postgres="$pgprefix/include"
+               use_dlz_postgres_lib="$pgprefix/lib"
        fi
 fi
 
 if test "$use_dlz_postgres" = "yes"
 then
        # User did not specify path and Postgres didn't say - guess it
-
        pgdirs="/usr /usr/local /usr/local/pgsql /usr/pkg"
        for d in $pgdirs
        do
@@ -120,7 +125,7 @@ esac
 AC_MSG_CHECKING(for MySQL DLZ driver)
 AC_ARG_WITH(dlz_mysql,
 [  --with-dlz-mysql[=PATH]   Build with MySQL DLZ driver [yes|no|path].
-                               (Required to use MySQL with DLZ)],
+                              (Required to use MySQL with DLZ)],
     use_dlz_mysql="$withval", use_dlz_mysql="no")
 
 mysql_include=""
@@ -205,10 +210,10 @@ esac
 # Was --with-dlz-bdb specified?
 #
 
-AC_MSG_CHECKING(for Berkeley DB DLZ driver)
+AC_MSG_CHECKING(for Berkeley DB DLZ driver...)
 AC_ARG_WITH(dlz_bdb,
 [  --with-dlz-bdb[=PATH]   Build with Berkeley DB DLZ driver [yes|no|path].
-                               (Required to use Berkeley DB with DLZ)],
+                              (Required to use Berkeley DB with DLZ)],
     use_dlz_bdb="$withval", use_dlz_bdb="no")
 
 case "$use_dlz_bdb" in
@@ -239,6 +244,7 @@ case "$use_dlz_bdb" in
                dlz_bdb_inc="yes"
                dlz_bdb_libs="yes"
 
+                AC_MSG_RESULT( )
                for dd in $bdbdirs
                do
                        # Skip nonexistant directories
@@ -250,10 +256,11 @@ case "$use_dlz_bdb" in
                        # Check other locations for includes.
                        # Order is important (sigh).
 
-                       bdb_incdirs="/ /db48/ /db47/ /db46/ /db45/ /db44/ /db43/ /db42/ /db41/ /db4/ /db/"
-                       for d in $bdb_incdirs
+                       bdb_incdirs="/db53 /db51 /db48 /db47 /db46 /db45 /db44 /db43 /db42 /db41 /db4 /db"
+                       # include a blank element first
+                       for d in "" $bdb_incdirs
                        do
-                               if test -f "$dd/include${d}db.h"
+                               if test -f "$dd/include${d}/db.h"
                                then
                                        dlz_bdb_inc="-I$dd/include${d}"
                                        break
@@ -271,18 +278,19 @@ case "$use_dlz_bdb" in
                        # Look for libname other than libdb.so.
                        # Order is important (sigh).
 
-                       bdb_libnames="db48 db-4.8 db47 db-4.7 db46 db-4.6 db45 db-4.5 db44 db-4.4 db43 db-4.3 db42 db-4.2 db41 db-4.1 db"
+                       bdb_libnames="db53 db-5.3 db51 db-5.1 db48 db-4.8 db47 db-4.7 db46 db-4.6 db45 db-4.5 db44 db-4.4 db43 db-4.3 db42 db-4.2 db41 db-4.1 db"
                        for d in $bdb_libnames
                        do
-                               if test -f "$dd/lib/lib${d}.so"
+                               if test "$dd" = "/usr"
                                then
-                                       if test "$dd" != "/usr"
+                                       AC_CHECK_LIB($d, db_create, dlz_bdb_libs="-l${d}")
+                                       if test $dlz_bdb_libs != "yes"
                                        then
-                                               dlz_bdb_libs="-L${dd}/lib "
-                                       else
-                                               dlz_bdb_libs=""
+                                               break
                                        fi
-                                       dlz_bdb_libs="${dlz_bdb_libs}-l${d}"
+                               elif test -f "$dd/lib/lib${d}.so"
+                               then
+                                       dlz_bdb_libs="-L${dd}/lib -l${d}"
                                        break
                                fi
                        done
@@ -303,7 +311,6 @@ case "$use_dlz_bdb" in
 
                if test "$dlz_bdb_inc" = "yes"
                then
-                       AC_MSG_RESULT(not found)
                        AC_MSG_ERROR([could not find Berkeley DB include directory])
                fi
 
@@ -330,7 +337,7 @@ esac
 AC_MSG_CHECKING(for file system DLZ driver)
 AC_ARG_WITH(dlz_filesystem,
 [  --with-dlz-filesystem[=PATH]   Build with filesystem DLZ driver [yes|no].
-                               (Required to use file system driver with DLZ)],
+                              (Required to use file system driver with DLZ)],
     use_dlz_filesystem="$withval", use_dlz_filesystem="no")
 
 case "$use_dlz_filesystem" in
@@ -352,7 +359,7 @@ esac
 AC_MSG_CHECKING(for LDAP DLZ driver)
 AC_ARG_WITH(dlz_ldap,
 [  --with-dlz-ldap[=PATH]   Build with LDAP DLZ driver [yes|no|path].
-                               (Required to use LDAP with DLZ)],
+                              (Required to use LDAP with DLZ)],
     use_dlz_ldap="$withval", use_dlz_ldap="no")
 
 if test "$use_dlz_ldap" = "yes"
@@ -398,21 +405,35 @@ esac
 AC_MSG_CHECKING(for ODBC DLZ driver)
 AC_ARG_WITH(dlz_odbc,
 [  --with-dlz-odbc[=PATH]   Build with ODBC DLZ driver [yes|no|path].
-                               (Required to use ODBC with DLZ)],
+                              (Required to use ODBC with DLZ)],
     use_dlz_odbc="$withval", use_dlz_odbc="no")
 
 if test "$use_dlz_odbc" = "yes"
 then
        # User did not specify a path - guess it
-       odbcdirs="/usr /usr/local /usr/pkg"
-       for d in $odbcdirs
-       do
-               if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
-               then
-                       use_dlz_odbc=$d
-                       break
-               fi
-       done
+       libodbc_found=no
+       sql_h_found=no
+       AC_CHECK_HEADER(sql.h, sql_h_found=yes)
+       AC_CHECK_LIB(odbc, SQLConnect, libodbc_found=yes)
+
+       if test $libodbc_found = "yes" -o $sql_h_found = "yes"
+       then
+               use_dlz_odbc=system
+               dlz_odbc_include=""
+               dlz_odbc_libs="-lodbc"
+       else
+               odbcdirs="/usr /usr/local /usr/pkg"
+               for d in $odbcdirs
+               do
+                       if test -f $d/include/sql.h -a -f $d/lib/libodbc.a
+                       then
+                               use_dlz_odbc=$d
+                               dlz_odbc_include="-I$use_dlz_odbc/include"
+                               dlz_odbc_libs="-L$use_dlz_odbc/lib -lodbc"
+                               break
+                       fi
+               done
+       fi
 fi
 
 case "$use_dlz_odbc" in
@@ -426,8 +447,8 @@ case "$use_dlz_odbc" in
                ;;
        *)
                DLZ_ADD_DRIVER(ODBC, dlz_odbc_driver,
-                               [-I$use_dlz_odbc/include],
-                               [-L$use_dlz_odbc/lib -lodbc])
+                               [$dlz_odbc_include],
+                               [$dlz_odbc_libs])
 
                AC_MSG_RESULT([using ODBC from $use_dlz_odbc])
                ;;
@@ -441,7 +462,7 @@ esac
 AC_MSG_CHECKING(for stub DLZ driver)
 AC_ARG_WITH(dlz_stub,
 [  --with-dlz-stub[=PATH]   Build with stub DLZ driver [yes|no].
-                               (Required to use stub driver with DLZ)],
+                              (Required to use stub driver with DLZ)],
     use_dlz_stub="$withval", use_dlz_stub="no")
 
 case "$use_dlz_stub" in
@@ -464,7 +485,7 @@ esac
 #
 if test -n "$CONTRIB_DLZ"
 then
-        CONTRIB_DLZ="-DCONTRIB_DLZ $CONTRIB_DLZ"
+       CONTRIB_DLZ="-DCONTRIB_DLZ $CONTRIB_DLZ"
 
        #
        # Where to find DLZ driver header files.