Skip to content
Snippets Groups Projects
Commit b45ea422 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Back out old unixodbc patches and apply new ones. Nick Gorham

parent b0929c82
No related branches found
No related tags found
No related merge requests found
...@@ -409,6 +409,23 @@ AC_ARG_WITH( ...@@ -409,6 +409,23 @@ AC_ARG_WITH(
) )
export USE_ODBC export USE_ODBC
dnl check if we want to use unixODBC to provide access to the odbc.ini
dnl files
use_unixODBC=no
AC_MSG_CHECKING(setting USE_UNIXODBC)
AC_ARG_WITH(
unixODBC,
[ --with-unixODBC[=DIR] Use unixODBC located in DIR],
[
use_unixODBC=yes;
unixODBC="$withval";
USE_ODBC=true;
AC_MSG_RESULT(enabled);
],
[ USE_ODBC=false; use_unixODBC=no; AC_MSG_RESULT(disabled) ]
)
export USE_ODBC
dnl Allow for overriding the default location of the odbcinst.ini dnl Allow for overriding the default location of the odbcinst.ini
dnl file which is normally ${prefix}/share or ${prefix} if this is dnl file which is normally ${prefix}/share or ${prefix} if this is
...@@ -436,38 +453,95 @@ then ...@@ -436,38 +453,95 @@ then
fi fi
AC_SUBST(ODBCINSTDIR) AC_SUBST(ODBCINSTDIR)
# check for unixODBC #check for unixODBC libs
use_unixODBC=no if test "x$use_unixODBC" = "xyes"
AC_ARG_WITH(unixODBC, then
[ --with-unixODBC[=DIR] Use unixODBC located in DIR],
[use_unixODBC=yes; unixODBC="$withval"], # default to /usr/local if not specified
use_unixODBC=no) if test "x$unixODBC" = "x"
then
unixODBC="/usr/local";
fi
unixODBC_libs="$unixODBC/lib"
unixODBC_includes="$unixODBC/include"
CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
unixODBC_ok=yes;
odbc_headers="$odbc_headers $ac_hdr",
unixODBC_ok=no )
if test "x$unixODBC_ok" != "xyes"
then
AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
fi
save_LIBS="$LIBS"
LIBS="-L$unixODBC_libs $LIBS"
AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
[AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
[LIBS="$save_LIBS"] )
fi
export SHLIB_ODBC
#check for unixODBC libs
if test "x$use_unixODBC" = "xyes" if test "x$use_unixODBC" = "xyes"
then then
# default to /usr if not specified # default to /usr/local if not specified
if test "x$unixODBC" = "x" if test "x$unixODBC" = "x"
then then
unixODBC="/usr"; unixODBC="/usr/local";
fi fi
AC_ARG_WITH(unixODBC-includes, unixODBC_libs="$unixODBC/lib"
[ --with-unixODBC-includes=DIR Find unixODBC headers in DIR], unixODBC_includes="$unixODBC/include"
unixODBC_includes="$withval",
unixODBC_includes="$unixODBC/include")
AC_ARG_WITH(unixODBC-libs, CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
[ --with-unixODBC-libs=DIR Find unixODBC libraries in DIR], AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
unixODBC_libs="$withval", unixODBC_ok=yes;
unixODBC_libs="$unixODBC/lib") odbc_headers="$odbc_headers $ac_hdr",
unixODBC_ok=no )
PGSQL_INCLUDES="$PGSQL_INCLUDES -I$unixODBC_includes" if test "x$unixODBC_ok" != "xyes"
then
AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
fi
save_LIBS="$LIBS"
LIBS="-L$unixODBC_libs $LIBS"
AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
[AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
[LIBS="$save_LIBS"] )
fi
export SHLIB_ODBC
#check for unixODBC libs
if test "x$use_unixODBC" = "xyes"
then
# default to /usr/local if not specified
if test "x$unixODBC" = "x"
then
unixODBC="/usr/local";
fi
unixODBC_libs="$unixODBC/lib"
unixODBC_includes="$unixODBC/include"
CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h, AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
[unixODBC_ok=yes; odbc_headers="$odbc_headers $ac_hdr"], unixODBC_ok=yes;
[unixODBC_ok=no; break]) odbc_headers="$odbc_headers $ac_hdr",
unixODBC_ok=no )
if test "x$unixODBC_ok" != "xyes" if test "x$unixODBC_ok" != "xyes"
then then
...@@ -475,14 +549,49 @@ then ...@@ -475,14 +549,49 @@ then
fi fi
save_LIBS="$LIBS" save_LIBS="$LIBS"
LIBS="$LIBS -L$unixODBC_libs" LIBS="-L$unixODBC_libs $LIBS"
AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString, AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
[AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING) [AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
LIBS="$LIBS -lodbcinst"], SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
[LIBS="$save_LIBS"] ) [LIBS="$save_LIBS"] )
fi
export SHLIB_ODBC
#check for unixODBC libs
if test "x$use_unixODBC" = "xyes"
then
# default to /usr/local if not specified
if test "x$unixODBC" = "x"
then
unixODBC="/usr/local";
fi
unixODBC_libs="$unixODBC/lib"
unixODBC_includes="$unixODBC/include"
CPPFLAGS="$CPPFLAGS -I$unixODBC_includes"
AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
unixODBC_ok=yes;
odbc_headers="$odbc_headers $ac_hdr",
unixODBC_ok=no )
if test "x$unixODBC_ok" != "xyes"
then
AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
fi
save_LIBS="$LIBS"
LIBS="-L$unixODBC_libs $LIBS"
AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
[AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
SHLIB_ODBC="$LDFLAGS_ODBC -L$unixODBC_libs -lodbcinst" ],
[LIBS="$save_LIBS"] )
fi fi
export SHLIB_ODBC
dnl Unless we specify the command line options dnl Unless we specify the command line options
dnl --enable cassert to explicitly enable it dnl --enable cassert to explicitly enable it
...@@ -554,6 +663,7 @@ AC_SUBST(USE_TCL) ...@@ -554,6 +663,7 @@ AC_SUBST(USE_TCL)
AC_SUBST(USE_TK) AC_SUBST(USE_TK)
AC_SUBST(WISH) AC_SUBST(WISH)
AC_SUBST(USE_ODBC) AC_SUBST(USE_ODBC)
AC_SUBST(SHLIB_ODBC)
AC_SUBST(MULTIBYTE) AC_SUBST(MULTIBYTE)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile.in,v 1.13 2000/06/06 22:01:09 petere Exp $ # $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile.in,v 1.14 2000/06/12 17:58:20 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@SET_MAKE@ @SET_MAKE@
...@@ -38,12 +38,11 @@ OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \ ...@@ -38,12 +38,11 @@ OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX) gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX)
SHLIB_LINK= $(LD_FLAGS) SHLIB_LINK= $(LD_FLAGS)
SHLIB_LINK+= $(SHLIB_ODBC)
# Shared library stuff, also default 'all' target # Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib include $(SRCDIR)/Makefile.shlib
LDFLAGS_SL+= $(LDFLAGS_ODBC)
.PHONY: install install-ini beforeinstall-headers install-headers .PHONY: install install-ini beforeinstall-headers install-headers
install: $(HEADERDIR) $(LIBDIR) $(ODBCINST) install-headers \ install: $(HEADERDIR) $(LIBDIR) $(ODBCINST) install-headers \
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifndef WIN32 #ifndef WIN32
#include <string.h> #include <string.h>
#include "gpps.h" #include "gpps.h"
#ifndef HAVE_SQLGETPRIVATEPROFILESTRING #ifdef HAVE_SQLGETPRIVATEPROFILESTRING
#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f) #define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
#define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d) #define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
#endif #endif
......
...@@ -15,7 +15,8 @@ ...@@ -15,7 +15,8 @@
#endif #endif
#ifndef WIN32 #ifndef WIN32
#ifndef HAVE_SQLGETPRIVATEPROFILESTRING #include "gpps.h"
#ifdef HAVE_SQLGETPRIVATEPROFILESTRING
#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f) #define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
#endif #endif
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment