1
# Process this file with autoconf to produce a configure script.
2
AC_INIT(psqlodbc, 09.01.0200, [pgsql-odbc@postgresql.org])
4
AC_CONFIG_AUX_DIR(config)
6
AC_CONFIG_SRCDIR([bind.c])
7
AM_CONFIG_HEADER([config.h])
11
# 0. Options processing
15
# Whether unixODBC driver manager is used
17
AC_ARG_WITH(unixodbc, [ --with-unixodbc=DIR odbc_config installation of unixODBC (default)],
19
if test "$withval" != no; then
20
if test "$withval" = yes; then
21
AC_PATH_PROGS(ODBC_CONFIG, odbc_config)
25
if test ! -f "${ODBC_CONFIG}/bin/odbc_config"; then
26
if test ! -f "${ODBC_CONFIG}"; then
27
AC_MSG_ERROR([odbc_config not found (required for unixODBC build)])
30
ODBC_CONFIG=${ODBC_CONFIG}/bin/odbc_config
39
# Whether iODBC driver manager is used
41
AC_ARG_WITH(iodbc, [ --with-iodbc=DIR iodbc_config installation of iODBC],
43
if test "$withval" != no; then
44
if test "$withval" = yes; then
45
AC_PATH_PROGS(ODBC_CONFIG, iodbc-config)
49
if test ! -f "${ODBC_CONFIG}/bin/iodbc-config"; then
50
if test ! -f "${ODBC_CONFIG}"; then
51
AC_MSG_ERROR([iodbc-config not found (required for iODBC build)])
54
ODBC_CONFIG=${ODBC_CONFIG}/bin/iodbc-config
62
if test "$with_iodbc" = yes; then
64
AC_DEFINE(WITH_IODBC, 1, [Define to 1 to build with iODBC support])
67
if test "$with_unixodbc" = yes; then
68
AC_DEFINE(WITH_UNIXODBC, 1,
69
[Define to 1 to build with unixODBC support])
73
# ODBC include and library
76
if test "$ODBC_CONFIG" != ""; then
77
if test "$with_iodbc" = yes; then
78
ODBC_INCLUDE=`${ODBC_CONFIG} --cflags`
79
CPPFLAGS="$CPPFLAGS ${ODBC_INCLUDE}"
80
ODBC_LIBS=`${ODBC_CONFIG} --libs`
81
LIBS="$LIBS ${ODBC_LIBS}"
83
ODBC_INCLUDE=`${ODBC_CONFIG} --include-prefix`
84
CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
85
ODBC_LIBS=`${ODBC_CONFIG} --libs`
86
LIBS="$LIBS ${ODBC_LIBS}"
88
AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBS])
92
# SQLCOLATTRIBUTE_SQLLEN check
94
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
96
SQLRETURN SQL_API SQLColAttribute
97
(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,
98
SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
99
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
100
SQLLEN *NumercAttribute);]],[[]])],
101
AC_DEFINE(SQLCOLATTRIBUTE_SQLLEN, 1,
102
[Define to 1 if SQLColAttribute use SQLLEN]))
106
# Whether libpq functionalities are used
108
AC_ARG_WITH(libpq, [ --with-libpq[[=DIR]] [[default=yes]] DIR is the PostgreSQL base install
109
directory or the path to pg_config
110
--without-libpq specify when PostgreSQL package isn't installed],
112
if test "$withval" = no; then
113
AC_DEFINE(NOT_USE_LIBPQ, 1,
114
[Define to 1 to build without libpq])
117
if test "$withval" != yes; then
118
if test -d "$withval"; then
119
PATH="$PATH:$withval/bin"
120
CPPFLAGS="$CPPFLAGS -I$withval/include"
121
LDFLAGS="$LDFLAGS -L$withval/lib"
123
if test -x "$withval"; then
126
AC_MSG_ERROR([specified pg_config not found])
137
# Default odbc version number (--with-odbcver), default 0x0351
140
PGAC_ARG_REQ(with, odbcver,
141
[ --with-odbcver=VERSION change default ODBC version number [[0x0351]]],
143
[with_odbcver=0x0351])
144
AC_DEFINE_UNQUOTED(ODBCVER, [$with_odbcver],
145
[Define to ODBC version (--with-odbcver)])
152
PGAC_ARG_BOOL(enable, unicode, yes,
153
[ --disable-unicode do not build Unicode support],
154
[AC_DEFINE(UNICODE_SUPPORT, 1,
155
[Define to 1 to build with Unicode support (--enable-unicode)])])
157
AM_CONDITIONAL(enable_unicode, [test x"$enable_unicode" = xyes])
164
PGAC_ARG_BOOL(enable, openssl, yes,
165
[ --disable-openssl do not build OpenSSL support],
166
[AC_DEFINE(USE_SSL, 1,
167
[Define to 1 to build with OpenSSL support (--enable-openssl)])])
169
AM_CONDITIONAL(enable_openssl, [test x"$enable_openssl" = xyes])
175
PGAC_ARG_BOOL(enable, gss, no,
176
[ --disable-gss do not build GSSAPI support],
177
[AC_DEFINE(USE_GSS, 1,
178
[Define to 1 to build with GSSAPI support (--enable-gss)])])
180
AM_CONDITIONAL(enable_gss, [test x"$enable_gss" = xyes])
183
# GKerberos 5 support
186
PGAC_ARG_BOOL(enable, krb5, no,
187
[ --disable-krb5 do not build Kerberos5 support],
188
[AC_DEFINE(USE_KRB5, 1,
189
[Define to 1 to build with Kerberos 5 support (--enable-krb5)])])
191
AM_CONDITIONAL(enable_krb5, [test x"$enable_krb5" = xyes])
197
PGAC_ARG_BOOL(enable, pthreads, yes,
198
[ --disable-pthreads do not build with POSIX threads],
199
[AC_DEFINE(POSIX_MULTITHREAD_SUPPORT, 1,
200
[Define to 1 to build with pthreads support (--enable-pthreads)])
201
AC_DEFINE(_REENTRANT, 1, [Define _REENTRANT for several plaforms])])
205
# Find libpq headers and libraries
208
if test "$with_libpq" = yes; then
209
if test -z "$PG_CONFIG"; then
210
AC_PATH_PROGS(PG_CONFIG, pg_config)
213
if test -n "$PG_CONFIG"; then
214
pg_includedir=`"$PG_CONFIG" --includedir`
215
pg_libdir=`"$PG_CONFIG" --libdir`
216
CPPFLAGS="$CPPFLAGS -I$pg_includedir"
217
LDFLAGS="$LDFLAGS -L$pg_libdir"
227
AM_CONDITIONAL([GCC], [test -n "$GCC"])
236
if test "$with_unixodbc" = yes; then
237
AC_SEARCH_LIBS(SQLGetPrivateProfileString, odbcinst, [],
238
[AC_MSG_ERROR([unixODBC library "odbcinst" not found])])
241
if test "$with_iodbc" = yes; then
242
AC_SEARCH_LIBS(SQLGetPrivateProfileString, iodbcinst, [],
243
[AC_MSG_ERROR([iODBC library "iodbcinst" not found])])
246
if test "$enable_pthreads" = yes; then
247
AC_CHECK_LIB(pthreads, pthread_create,
249
[AC_CHECK_LIB(pthread, pthread_create)])
252
if test "$with_libpq" = yes; then
253
AC_CHECK_LIB(pq, PQconnectdb, [],
254
[AC_MSG_ERROR([libpq library not found])])
257
if test "$enable_openssl" = yes; then
258
AC_CHECK_LIB(ssl, SSL_read, [], [AC_MSG_ERROR([ssl library not found])])
261
if test "$enable_gss" = yes; then
262
AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [], [AC_MSG_ERROR([gssapi library not found])])
265
if test "$enable_krb5" = yes; then
266
AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [], [AC_MSG_ERROR([krb5 library not found])])
267
AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' comerr 'comerr -lssl -lcrypto'], [], [AC_MSG_ERROR([comerr library not found])])
272
AC_CHECK_HEADERS(locale.h sys/un.h sys/time.h)
273
if test "$with_libpq" = yes; then
274
AC_CHECK_HEADER(libpq-fe.h,,[AC_MSG_ERROR([libpq header not found])])
276
if test "$enable_openssl" = yes; then
277
AC_CHECK_HEADER([openssl/ssl.h],,[AC_MSG_ERROR([ssl header not found])])
279
if test "$enable_gss" = yes; then
280
AC_CHECK_HEADERS([gssapi/gssapi.h], [],
281
[AC_CHECK_HEADERS([gssapi.h], [], [AC_MSG_ERROR([gssapi header not found])])])
283
if test "$enable_krb5" = yes; then
284
AC_CHECK_HEADER([krb5.h],,[AC_MSG_ERROR([krb5 header not found])])
291
# unixODBC wants the following to get sane behavior for ODBCINT64
292
AC_CHECK_SIZEOF(long)
293
AC_CHECK_SIZEOF(void *)
294
AC_CHECK_TYPES(long long)
295
AC_CHECK_TYPES(signed char)
297
AC_CHECK_TYPES(ssize_t)
306
# 6. Compiler characteristics
311
# 7. Functions, global variables
314
AC_CHECK_FUNCS(strtoul strtoll strlcat strlcpy poll)
316
if test x"$enable_unicode" = xyes; then
317
AC_CHECK_FUNCS(iswascii)
320
if test "$enable_pthreads" = yes; then
321
AC_CHECK_FUNCS(localtime_r strtok_r pthread_mutexattr_settype)
323
if test x"$ac_cv_func_pthread_mutexattr_settype" = xyes; then
324
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <pthread.h>]],
325
[[int i = PTHREAD_MUTEX_RECURSIVE;]]),
326
[AC_DEFINE(PG_RECURSIVE_MUTEXATTR, PTHREAD_MUTEX_RECURSIVE,
327
[Define if you have PTHREAD_MUTEX_RECURSIVE])],
328
[AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <pthread.h>]],
329
[[int i = PTHREAD_MUTEX_RECURSIVE_NP;]]),
330
[AC_DEFINE(PG_RECURSIVE_MUTEXATTR, PTHREAD_MUTEX_RECURSIVE_NP,
331
[Define if you have PTHREAD_MUTEX_RECURSIVE_NP])])])
334
if test "$enable_krb5" = yes; then
335
AC_CHECK_MEMBERS(krb5_error.text.data, [],
336
[AC_CHECK_MEMBERS(krb5_error.e_data, [],
337
[AC_MSG_ERROR([could not determine how to extract Kerberos 5 error messages])],
338
[#include <krb5.h>])],
340
AC_MSG_CHECKING(for krb5_free_unparsed_name)
341
AC_TRY_LINK([#include <krb5.h>],
342
[krb5_free_unparsed_name(NULL,NULL);],
343
[AC_DEFINE(HAVE_KRB5_FREE_UNPARSED_NAME, 1, [Define to 1 if you have krb5_free_unparsed_name])
349
AC_CHECK_LIB(ltdl, lt_dlopen)
352
AC_CONFIG_FILES([Makefile])
1
# Process this file with autoconf to produce a configure script.
2
AC_INIT(psqlodbc, 09.02.0100, [pgsql-odbc@postgresql.org])
4
AC_CONFIG_AUX_DIR(config)
6
AC_CONFIG_SRCDIR([bind.c])
7
AM_CONFIG_HEADER([config.h])
11
# 0. Options processing
15
# Whether unixODBC driver manager is used
17
AC_ARG_WITH(unixodbc, [ --with-unixodbc=DIR odbc_config installation of unixODBC (default)],
19
if test "$withval" != no; then
20
if test "$withval" = yes; then
21
AC_PATH_PROGS(ODBC_CONFIG, odbc_config)
25
if test ! -f "${ODBC_CONFIG}/bin/odbc_config"; then
26
if test ! -f "${ODBC_CONFIG}"; then
27
AC_MSG_ERROR([odbc_config not found (required for unixODBC build)])
30
ODBC_CONFIG=${ODBC_CONFIG}/bin/odbc_config
39
# Whether iODBC driver manager is used
41
AC_ARG_WITH(iodbc, [ --with-iodbc=DIR iodbc_config installation of iODBC],
43
if test "$withval" != no; then
44
if test "$withval" = yes; then
45
AC_PATH_PROGS(ODBC_CONFIG, iodbc-config)
49
if test ! -f "${ODBC_CONFIG}/bin/iodbc-config"; then
50
if test ! -f "${ODBC_CONFIG}"; then
51
AC_MSG_ERROR([iodbc-config not found (required for iODBC build)])
54
ODBC_CONFIG=${ODBC_CONFIG}/bin/iodbc-config
62
if test "$with_iodbc" = yes; then
64
AC_DEFINE(WITH_IODBC, 1, [Define to 1 to build with iODBC support])
67
if test "$with_unixodbc" = yes; then
68
AC_DEFINE(WITH_UNIXODBC, 1,
69
[Define to 1 to build with unixODBC support])
73
# ODBC include and library
76
if test "$ODBC_CONFIG" != ""; then
77
if test "$with_iodbc" = yes; then
78
ODBC_INCLUDE=`${ODBC_CONFIG} --cflags`
79
CPPFLAGS="$CPPFLAGS ${ODBC_INCLUDE}"
80
ODBC_LIBS=`${ODBC_CONFIG} --libs`
81
LIBS="$LIBS ${ODBC_LIBS}"
83
ODBC_INCLUDE=`${ODBC_CONFIG} --include-prefix`
84
CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
85
ODBC_LIBS=`${ODBC_CONFIG} --libs`
86
LIBS="$LIBS ${ODBC_LIBS}"
88
AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBS])
92
# SQLCOLATTRIBUTE_SQLLEN check
94
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
96
SQLRETURN SQL_API SQLColAttribute
97
(SQLHSTMT StatementHandle,SQLUSMALLINT ColumnNumber,
98
SQLUSMALLINT FieldIdentifier, SQLPOINTER CharacterAttribute,
99
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength,
100
SQLLEN *NumercAttribute);]],[[]])],
101
AC_DEFINE(SQLCOLATTRIBUTE_SQLLEN, 1,
102
[Define to 1 if SQLColAttribute use SQLLEN]))
106
# Whether libpq functionalities are used
108
AC_ARG_WITH(libpq, [ --with-libpq[[=DIR]] [[default=yes]] DIR is the PostgreSQL base install
109
directory or the path to pg_config
110
--without-libpq specify when PostgreSQL package isn't installed],
112
if test "$withval" = no; then
113
AC_DEFINE(NOT_USE_LIBPQ, 1,
114
[Define to 1 to build without libpq])
117
if test "$withval" != yes; then
118
if test -d "$withval"; then
119
PATH="$PATH:$withval/bin"
120
CPPFLAGS="$CPPFLAGS -I$withval/include"
121
LDFLAGS="$LDFLAGS -L$withval/lib"
123
if test -x "$withval"; then
126
AC_MSG_ERROR([specified pg_config not found])
137
# Default odbc version number (--with-odbcver), default 0x0351
140
PGAC_ARG_REQ(with, odbcver,
141
[ --with-odbcver=VERSION change default ODBC version number [[0x0351]]],
143
[with_odbcver=0x0351])
144
AC_DEFINE_UNQUOTED(ODBCVER, [$with_odbcver],
145
[Define to ODBC version (--with-odbcver)])
152
PGAC_ARG_BOOL(enable, unicode, yes,
153
[ --disable-unicode do not build Unicode support],
154
[AC_DEFINE(UNICODE_SUPPORT, 1,
155
[Define to 1 to build with Unicode support (--enable-unicode)])])
157
AM_CONDITIONAL(enable_unicode, [test x"$enable_unicode" = xyes])
164
PGAC_ARG_BOOL(enable, openssl, yes,
165
[ --disable-openssl do not build OpenSSL support],
166
[AC_DEFINE(USE_SSL, 1,
167
[Define to 1 to build with OpenSSL support (--enable-openssl)])])
169
AM_CONDITIONAL(enable_openssl, [test x"$enable_openssl" = xyes])
175
PGAC_ARG_BOOL(enable, gss, no,
176
[ --disable-gss do not build GSSAPI support],
177
[AC_DEFINE(USE_GSS, 1,
178
[Define to 1 to build with GSSAPI support (--enable-gss)])])
180
AM_CONDITIONAL(enable_gss, [test x"$enable_gss" = xyes])
183
# GKerberos 5 support
186
PGAC_ARG_BOOL(enable, krb5, no,
187
[ --disable-krb5 do not build Kerberos5 support],
188
[AC_DEFINE(USE_KRB5, 1,
189
[Define to 1 to build with Kerberos 5 support (--enable-krb5)])])
191
AM_CONDITIONAL(enable_krb5, [test x"$enable_krb5" = xyes])
197
PGAC_ARG_BOOL(enable, pthreads, yes,
198
[ --disable-pthreads do not build with POSIX threads],
199
[AC_DEFINE(POSIX_MULTITHREAD_SUPPORT, 1,
200
[Define to 1 to build with pthreads support (--enable-pthreads)])
201
AC_DEFINE(_REENTRANT, 1, [Define _REENTRANT for several plaforms])])
205
# Find libpq headers and libraries
208
if test "$with_libpq" = yes; then
209
if test -z "$PG_CONFIG"; then
210
AC_PATH_PROGS(PG_CONFIG, pg_config)
213
if test -n "$PG_CONFIG"; then
214
pg_includedir=`"$PG_CONFIG" --includedir`
215
pg_libdir=`"$PG_CONFIG" --libdir`
216
CPPFLAGS="$CPPFLAGS -I$pg_includedir"
217
LDFLAGS="$LDFLAGS -L$pg_libdir"
227
AM_CONDITIONAL([GCC], [test -n "$GCC"])
236
if test "$with_unixodbc" = yes; then
237
AC_SEARCH_LIBS(SQLGetPrivateProfileString, odbcinst, [],
238
[AC_MSG_ERROR([unixODBC library "odbcinst" not found])])
241
if test "$with_iodbc" = yes; then
242
AC_SEARCH_LIBS(SQLGetPrivateProfileString, iodbcinst, [],
243
[AC_MSG_ERROR([iODBC library "iodbcinst" not found])])
246
if test "$enable_pthreads" = yes; then
247
AC_CHECK_LIB(pthreads, pthread_create,
249
[AC_CHECK_LIB(pthread, pthread_create)])
252
if test "$with_libpq" = yes; then
253
AC_CHECK_LIB(pq, PQconnectdb, [],
254
[AC_MSG_ERROR([libpq library not found])])
257
if test "$enable_openssl" = yes; then
258
AC_CHECK_LIB(ssl, SSL_read, [], [AC_MSG_ERROR([ssl library not found])])
261
if test "$enable_gss" = yes; then
262
AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [], [AC_MSG_ERROR([gssapi library not found])])
265
if test "$enable_krb5" = yes; then
266
AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [], [AC_MSG_ERROR([krb5 library not found])])
267
AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' comerr 'comerr -lssl -lcrypto'], [], [AC_MSG_ERROR([comerr library not found])])
272
AC_CHECK_HEADERS(locale.h sys/un.h sys/time.h)
273
if test "$with_libpq" = yes; then
274
AC_CHECK_HEADER(libpq-fe.h,,[AC_MSG_ERROR([libpq header not found])])
276
if test "$enable_openssl" = yes; then
277
AC_CHECK_HEADER([openssl/ssl.h],,[AC_MSG_ERROR([ssl header not found])])
279
if test "$enable_gss" = yes; then
280
AC_CHECK_HEADERS([gssapi/gssapi.h], [],
281
[AC_CHECK_HEADERS([gssapi.h], [], [AC_MSG_ERROR([gssapi header not found])])])
283
if test "$enable_krb5" = yes; then
284
AC_CHECK_HEADER([krb5.h],,[AC_MSG_ERROR([krb5 header not found])])
291
# unixODBC wants the following to get sane behavior for ODBCINT64
292
AC_CHECK_SIZEOF(long)
293
AC_CHECK_SIZEOF(void *)
294
AC_CHECK_TYPES(long long)
295
AC_CHECK_TYPES(signed char)
297
AC_CHECK_TYPES(ssize_t)
306
# 6. Compiler characteristics
311
# 7. Functions, global variables
314
AC_CHECK_FUNCS(strtoul strtoll strlcat strlcpy poll)
316
if test x"$enable_unicode" = xyes; then
317
AC_CHECK_FUNCS(iswascii)
320
if test "$enable_pthreads" = yes; then
321
AC_CHECK_FUNCS(localtime_r strtok_r pthread_mutexattr_settype)
323
if test x"$ac_cv_func_pthread_mutexattr_settype" = xyes; then
324
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <pthread.h>]],
325
[[int i = PTHREAD_MUTEX_RECURSIVE;]]),
326
[AC_DEFINE(PG_RECURSIVE_MUTEXATTR, PTHREAD_MUTEX_RECURSIVE,
327
[Define if you have PTHREAD_MUTEX_RECURSIVE])],
328
[AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include <pthread.h>]],
329
[[int i = PTHREAD_MUTEX_RECURSIVE_NP;]]),
330
[AC_DEFINE(PG_RECURSIVE_MUTEXATTR, PTHREAD_MUTEX_RECURSIVE_NP,
331
[Define if you have PTHREAD_MUTEX_RECURSIVE_NP])])])
334
if test "$enable_krb5" = yes; then
335
AC_CHECK_MEMBERS(krb5_error.text.data, [],
336
[AC_CHECK_MEMBERS(krb5_error.e_data, [],
337
[AC_MSG_ERROR([could not determine how to extract Kerberos 5 error messages])],
338
[#include <krb5.h>])],
340
AC_MSG_CHECKING(for krb5_free_unparsed_name)
341
AC_TRY_LINK([#include <krb5.h>],
342
[krb5_free_unparsed_name(NULL,NULL);],
343
[AC_DEFINE(HAVE_KRB5_FREE_UNPARSED_NAME, 1, [Define to 1 if you have krb5_free_unparsed_name])
349
AC_CHECK_LIB(ltdl, lt_dlopen)
352
AC_CONFIG_FILES([Makefile])