@@ -409,6 +409,23 @@ AC_ARG_WITH(
409409)
410410export USE_ODBC
411411
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
412429
413430dnl Allow for overriding the default location of the odbcinst.ini
414431dnl file which is normally ${prefix}/share or ${prefix} if this is
@@ -436,53 +453,145 @@ then
436453fi
437454AC_SUBST(ODBCINSTDIR)
438455
439- # check for unixODBC
440-
441- use_unixODBC=no
442- AC_ARG_WITH(unixODBC,
443- [ --with-unixODBC[=DIR] Use unixODBC located in DIR],
444- [use_unixODBC=yes; unixODBC="$withval"],
445- use_unixODBC=no)
456+ #check for unixODBC libs
446457
447458if test "x$use_unixODBC" = "xyes"
448459then
449460
450- # default to /usr if not specified
451- if test "x$unixODBC" = "x"
452- then
453- unixODBC="/usr";
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"] )
454488fi
489+ export SHLIB_ODBC
455490
456- AC_ARG_WITH(unixODBC-includes,
457- [ --with-unixODBC-includes=DIR Find unixODBC headers in DIR],
458- unixODBC_includes="$withval",
459- unixODBC_includes="$unixODBC/include")
491+ #check for unixODBC libs
460492
461- AC_ARG_WITH(unixODBC-libs,
462- [ --with-unixODBC-libs=DIR Find unixODBC libraries in DIR],
463- unixODBC_libs="$withval",
464- unixODBC_libs="$unixODBC/lib")
493+ if test "x$use_unixODBC" = "xyes"
494+ then
465495
466- PGSQL_INCLUDES="$PGSQL_INCLUDES -I$unixODBC_includes"
496+ # default to /usr/local if not specified
497+ if test "x$unixODBC" = "x"
498+ then
499+ unixODBC="/usr/local";
500+ fi
501+
502+ unixODBC_libs="$unixODBC/lib"
503+ unixODBC_includes="$unixODBC/include"
504+
505+ CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
506+ AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
507+ unixODBC_ok=yes;
508+ odbc_headers="$odbc_headers $ac_hdr",
509+ unixODBC_ok=no )
510+
511+ if test "x$unixODBC_ok" != "xyes"
512+ then
513+ AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
514+ fi
515+
516+ save_LIBS="$LIBS"
517+ LIBS="-L$unixODBC_libs $LIBS"
518+
519+ AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
520+ [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
521+ SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
522+ [LIBS="$save_LIBS"] )
523+ fi
524+ export SHLIB_ODBC
467525
468- AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
469- [unixODBC_ok=yes; odbc_headers="$odbc_headers $ac_hdr"],
470- [unixODBC_ok=no; break])
526+ #check for unixODBC libs
471527
472- if test "x$unixODBC_ok" ! = "xyes"
528+ if test "x$use_unixODBC" = "xyes"
473529then
474- AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
530+
531+ # default to /usr/local if not specified
532+ if test "x$unixODBC" = "x"
533+ then
534+ unixODBC="/usr/local";
535+ fi
536+
537+ unixODBC_libs="$unixODBC/lib"
538+ unixODBC_includes="$unixODBC/include"
539+
540+ CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
541+ AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
542+ unixODBC_ok=yes;
543+ odbc_headers="$odbc_headers $ac_hdr",
544+ unixODBC_ok=no )
545+
546+ if test "x$unixODBC_ok" != "xyes"
547+ then
548+ AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
549+ fi
550+
551+ save_LIBS="$LIBS"
552+ LIBS="-L$unixODBC_libs $LIBS"
553+
554+ AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
555+ [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
556+ SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
557+ [LIBS="$save_LIBS"] )
475558fi
559+ export SHLIB_ODBC
476560
477- save_LIBS="$LIBS"
478- LIBS="$LIBS -L$unixODBC_libs"
561+ #check for unixODBC libs
479562
480- AC_CHECK_LIB(odbcinst, SQLGetPrivateProfileString,
481- [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
482- LIBS="$LIBS -lodbcinst"],
483- [LIBS="$save_LIBS"])
563+ if test "x$use_unixODBC" = "xyes"
564+ then
484565
566+ # default to /usr/local if not specified
567+ if test "x$unixODBC" = "x"
568+ then
569+ unixODBC="/usr/local";
570+ fi
571+
572+ unixODBC_libs="$unixODBC/lib"
573+ unixODBC_includes="$unixODBC/include"
574+
575+ CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
576+ AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
577+ unixODBC_ok=yes;
578+ odbc_headers="$odbc_headers $ac_hdr",
579+ unixODBC_ok=no )
580+
581+ if test "x$unixODBC_ok" != "xyes"
582+ then
583+ AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
584+ fi
585+
586+ save_LIBS="$LIBS"
587+ LIBS="-L$unixODBC_libs $LIBS"
588+
589+ AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
590+ [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
591+ SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
592+ [LIBS="$save_LIBS"] )
485593fi
594+ export SHLIB_ODBC
486595
487596dnl Unless we specify the command line options
488597dnl--enable cassertto explicitly enable it
@@ -554,6 +663,7 @@ AC_SUBST(USE_TCL)
554663AC_SUBST(USE_TK)
555664AC_SUBST(WISH)
556665AC_SUBST(USE_ODBC)
666+ AC_SUBST(SHLIB_ODBC)
557667AC_SUBST(MULTIBYTE)
558668
559669