@@ -409,6 +409,23 @@ AC_ARG_WITH(
409
409
)
410
410
export USE_ODBC
411
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
412
429
413
430
dnl Allow for overriding the default location of the odbcinst.ini
414
431
dnl file which is normally ${prefix}/share or ${prefix} if this is
@@ -436,53 +453,145 @@ then
436
453
fi
437
454
AC_SUBST(ODBCINSTDIR)
438
455
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
446
457
447
458
if test "x$use_unixODBC" = "xyes"
448
459
then
449
460
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"] )
454
488
fi
489
+ export SHLIB_ODBC
455
490
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
460
492
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
465
495
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
467
525
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
471
527
472
- if test "x$unixODBC_ok" ! = "xyes"
528
+ if test "x$use_unixODBC" = "xyes"
473
529
then
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"] )
475
558
fi
559
+ export SHLIB_ODBC
476
560
477
- save_LIBS="$LIBS"
478
- LIBS="$LIBS -L$unixODBC_libs"
561
+ #check for unixODBC libs
479
562
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
484
565
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"] )
485
593
fi
594
+ export SHLIB_ODBC
486
595
487
596
dnl Unless we specify the command line options
488
597
dnl --enable cassert to explicitly enable it
@@ -554,6 +663,7 @@ AC_SUBST(USE_TCL)
554
663
AC_SUBST(USE_TK)
555
664
AC_SUBST(WISH)
556
665
AC_SUBST(USE_ODBC)
666
+ AC_SUBST(SHLIB_ODBC)
557
667
AC_SUBST(MULTIBYTE)
558
668
559
669
0 commit comments