Skip to content

Commit b45ea42

Browse files
committed
Back out old unixodbc patches and apply new ones. Nick Gorham
1 parent b0929c8 commit b45ea42

File tree

4 files changed

+146
-36
lines changed

4 files changed

+146
-36
lines changed

configure.in

Lines changed: 141 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,23 @@ AC_ARG_WITH(
409409
)
410410
export 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

413430
dnl Allow for overriding the default location of the odbcinst.ini
414431
dnl file which is normally ${prefix}/share or ${prefix} if this is
@@ -436,53 +453,145 @@ then
436453
fi
437454
AC_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

447458
if test "x$use_unixODBC" = "xyes"
448459
then
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"] )
454488
fi
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"
473529
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"] )
475558
fi
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"] )
485593
fi
594+
export SHLIB_ODBC
486595

487596
dnl Unless we specify the command line options
488597
dnl --enable cassert to explicitly enable it
@@ -554,6 +663,7 @@ AC_SUBST(USE_TCL)
554663
AC_SUBST(USE_TK)
555664
AC_SUBST(WISH)
556665
AC_SUBST(USE_ODBC)
666+
AC_SUBST(SHLIB_ODBC)
557667
AC_SUBST(MULTIBYTE)
558668

559669

src/interfaces/odbc/GNUmakefile.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
#
99
# IDENTIFICATION
10-
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile.in,v 1.13 2000/06/06 22:01:09 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile.in,v 1.14 2000/06/12 17:58:20 momjian Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313
@SET_MAKE@
@@ -38,12 +38,11 @@ OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
3838
gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX)
3939

4040
SHLIB_LINK= $(LD_FLAGS)
41+
SHLIB_LINK+= $(SHLIB_ODBC)
4142

4243
# Shared library stuff, also default 'all' target
4344
include $(SRCDIR)/Makefile.shlib
4445

45-
LDFLAGS_SL+= $(LDFLAGS_ODBC)
46-
4746
.PHONY: install install-ini beforeinstall-headers install-headers
4847

4948
install: $(HEADERDIR) $(LIBDIR) $(ODBCINST) install-headers \

src/interfaces/odbc/dlg_specific.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#ifndef WIN32
2424
#include <string.h>
2525
#include "gpps.h"
26-
#ifndef HAVE_SQLGETPRIVATEPROFILESTRING
26+
#ifdef HAVE_SQLGETPRIVATEPROFILESTRING
2727
#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
2828
#define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
2929
#endif

src/interfaces/odbc/misc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#endif
1616

1717
#ifndef WIN32
18-
#ifndef HAVE_SQLGETPRIVATEPROFILESTRING
18+
#include "gpps.h"
19+
#ifdef HAVE_SQLGETPRIVATEPROFILESTRING
1920
#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
2021
#endif
2122
#endif

0 commit comments

Comments
 (0)