~ubuntu-branches/ubuntu/trusty/psqlodbc/trusty-proposed

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-10-24 07:21:55 UTC
  • mfrom: (16.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131024072155-xlf5odyk3iblcd51
Tags: 1:09.02.0100-2ubuntu1
* Merge with Debian unstable. Remaining Ubuntu changes:
  - debian/tests: Disable iodbc test and dependency, as in Ubuntu iodbc and
    unixodbc are not installable in parallel, and iodbc is obsolete and
    should be removed at some point.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Process this file with autoconf to produce a configure script.
2
 
AC_INIT(psqlodbc, 09.01.0200, [pgsql-odbc@postgresql.org])
3
 
AC_PREREQ(2.57)
4
 
AC_CONFIG_AUX_DIR(config)
5
 
AM_INIT_AUTOMAKE
6
 
AC_CONFIG_SRCDIR([bind.c])
7
 
AM_CONFIG_HEADER([config.h])
8
 
AM_MAINTAINER_MODE
9
 
 
10
 
 
11
 
# 0. Options processing
12
 
 
13
 
 
14
 
#
15
 
# Whether unixODBC driver manager is used
16
 
#
17
 
AC_ARG_WITH(unixodbc, [  --with-unixodbc=DIR     odbc_config installation of unixODBC (default)],
18
 
[
19
 
        if test "$withval" != no; then
20
 
                if test "$withval" = yes; then
21
 
                        AC_PATH_PROGS(ODBC_CONFIG, odbc_config)
22
 
                else
23
 
                        ODBC_CONFIG=$withval
24
 
                fi
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)])
28
 
                        fi
29
 
                else
30
 
                        ODBC_CONFIG=${ODBC_CONFIG}/bin/odbc_config
31
 
                fi
32
 
                with_unixodbc=yes
33
 
        fi
34
 
        ],
35
 
[with_unixodbc=yes])
36
 
 
37
 
 
38
 
#
39
 
# Whether iODBC driver manager is used
40
 
#
41
 
AC_ARG_WITH(iodbc, [  --with-iodbc=DIR    iodbc_config installation of iODBC],
42
 
[
43
 
        if test "$withval" != no; then
44
 
                if test "$withval" = yes; then
45
 
                        AC_PATH_PROGS(ODBC_CONFIG, iodbc-config)
46
 
                else
47
 
                        ODBC_CONFIG=$withval
48
 
                fi
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)])
52
 
                        fi
53
 
                else
54
 
                        ODBC_CONFIG=${ODBC_CONFIG}/bin/iodbc-config
55
 
                fi
56
 
                with_iodbc=yes
57
 
        fi
58
 
        ],
59
 
[with_iodbc=no])
60
 
 
61
 
 
62
 
if test "$with_iodbc" = yes; then
63
 
  with_unixodbc=no
64
 
  AC_DEFINE(WITH_IODBC, 1, [Define to 1 to build with iODBC support])
65
 
fi
66
 
 
67
 
if test "$with_unixodbc" = yes; then
68
 
  AC_DEFINE(WITH_UNIXODBC, 1,
69
 
            [Define to 1 to build with unixODBC support])
70
 
fi
71
 
 
72
 
#
73
 
# ODBC include and library
74
 
#
75
 
 
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}"
82
 
        else
83
 
                ODBC_INCLUDE=`${ODBC_CONFIG} --include-prefix`
84
 
                CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
85
 
                ODBC_LIBS=`${ODBC_CONFIG} --libs`
86
 
                LIBS="$LIBS ${ODBC_LIBS}"
87
 
        fi
88
 
        AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBS])
89
 
fi
90
 
 
91
 
#
92
 
# SQLCOLATTRIBUTE_SQLLEN check
93
 
#
94
 
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
95
 
        [[#include <sql.h>>
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]))
103
 
 
104
 
 
105
 
#
106
 
# Whether libpq functionalities are used
107
 
#
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],
111
 
[
112
 
        if test "$withval" = no; then
113
 
                AC_DEFINE(NOT_USE_LIBPQ, 1, 
114
 
                         [Define to 1 to build without libpq])
115
 
                enable_openssl=no
116
 
        else
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"
122
 
                        else
123
 
                                if test -x "$withval"; then
124
 
                                        PG_CONFIG=$withval
125
 
                                else
126
 
                                        AC_MSG_ERROR([specified pg_config not found])
127
 
                                fi
128
 
                        fi
129
 
                fi
130
 
                with_libpq=yes
131
 
        fi
132
 
        ],
133
 
[with_libpq=yes]) 
134
 
 
135
 
 
136
 
#
137
 
# Default odbc version number (--with-odbcver), default 0x0351
138
 
#
139
 
 
140
 
PGAC_ARG_REQ(with, odbcver,
141
 
             [  --with-odbcver=VERSION  change default ODBC version number [[0x0351]]],
142
 
             [],
143
 
             [with_odbcver=0x0351])
144
 
AC_DEFINE_UNQUOTED(ODBCVER, [$with_odbcver], 
145
 
                   [Define to ODBC version (--with-odbcver)])
146
 
 
147
 
 
148
 
#
149
 
# Unicode support
150
 
#
151
 
 
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)])])
156
 
 
157
 
AM_CONDITIONAL(enable_unicode, [test x"$enable_unicode" = xyes])
158
 
 
159
 
 
160
 
#
161
 
# SSL support
162
 
#
163
 
 
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)])])
168
 
 
169
 
AM_CONDITIONAL(enable_openssl, [test x"$enable_openssl" = xyes])
170
 
 
171
 
#
172
 
# GSSAPI support
173
 
#
174
 
 
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)])])
179
 
 
180
 
AM_CONDITIONAL(enable_gss, [test x"$enable_gss" = xyes])
181
 
 
182
 
#
183
 
# GKerberos 5 support
184
 
#
185
 
 
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)])])
190
 
 
191
 
AM_CONDITIONAL(enable_krb5, [test x"$enable_krb5" = xyes])
192
 
 
193
 
#
194
 
# Pthreads
195
 
#
196
 
 
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])])
202
 
 
203
 
 
204
 
#
205
 
# Find libpq headers and libraries
206
 
#
207
 
 
208
 
if test "$with_libpq" = yes; then
209
 
  if test -z "$PG_CONFIG"; then
210
 
        AC_PATH_PROGS(PG_CONFIG, pg_config)
211
 
  fi
212
 
 
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"
218
 
  fi
219
 
fi
220
 
 
221
 
 
222
 
 
223
 
# 1. Programs
224
 
 
225
 
AC_PROG_CC
226
 
 
227
 
AM_CONDITIONAL([GCC], [test -n "$GCC"])
228
 
 
229
 
# 2. Libraries
230
 
 
231
 
AC_LIBTOOL_WIN32_DLL
232
 
AC_DISABLE_STATIC
233
 
AC_LIBTOOL_DLOPEN
234
 
AC_PROG_LIBTOOL
235
 
 
236
 
if test "$with_unixodbc" = yes; then
237
 
  AC_SEARCH_LIBS(SQLGetPrivateProfileString, odbcinst, [],
238
 
                 [AC_MSG_ERROR([unixODBC library "odbcinst" not found])])
239
 
fi
240
 
 
241
 
if test "$with_iodbc" = yes; then
242
 
  AC_SEARCH_LIBS(SQLGetPrivateProfileString, iodbcinst, [],
243
 
                 [AC_MSG_ERROR([iODBC library "iodbcinst" not found])])
244
 
fi
245
 
 
246
 
if test "$enable_pthreads" = yes; then
247
 
  AC_CHECK_LIB(pthreads, pthread_create,
248
 
               [],
249
 
               [AC_CHECK_LIB(pthread, pthread_create)])
250
 
fi
251
 
 
252
 
if test "$with_libpq" = yes; then
253
 
  AC_CHECK_LIB(pq, PQconnectdb, [],
254
 
              [AC_MSG_ERROR([libpq library not found])])
255
 
fi
256
 
 
257
 
if test "$enable_openssl" = yes; then
258
 
  AC_CHECK_LIB(ssl, SSL_read, [], [AC_MSG_ERROR([ssl library not found])])
259
 
fi
260
 
 
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])])
263
 
fi
264
 
 
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])])
268
 
fi
269
 
 
270
 
# 3. Header files
271
 
 
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])])
275
 
fi
276
 
if test "$enable_openssl" = yes; then
277
 
  AC_CHECK_HEADER([openssl/ssl.h],,[AC_MSG_ERROR([ssl header not found])])
278
 
fi
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])])])
282
 
fi
283
 
if test "$enable_krb5" = yes; then
284
 
  AC_CHECK_HEADER([krb5.h],,[AC_MSG_ERROR([krb5 header not found])])
285
 
fi
286
 
AC_HEADER_TIME
287
 
 
288
 
 
289
 
# 4. Types
290
 
 
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)
296
 
 
297
 
AC_CHECK_TYPES(ssize_t)
298
 
AC_TYPE_SIZE_T
299
 
 
300
 
# 5. Structures
301
 
 
302
 
AC_STRUCT_TM
303
 
PGAC_STRUCT_ADDRINFO
304
 
 
305
 
 
306
 
# 6. Compiler characteristics
307
 
 
308
 
AC_C_CONST
309
 
 
310
 
 
311
 
# 7. Functions, global variables
312
 
 
313
 
AC_FUNC_STRERROR_R
314
 
AC_CHECK_FUNCS(strtoul strtoll strlcat strlcpy poll)
315
 
 
316
 
if test x"$enable_unicode" = xyes; then
317
 
  AC_CHECK_FUNCS(iswascii)
318
 
fi
319
 
 
320
 
if test "$enable_pthreads" = yes; then
321
 
  AC_CHECK_FUNCS(localtime_r strtok_r pthread_mutexattr_settype)
322
 
 
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])])])
332
 
  fi
333
 
fi
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>])],
339
 
                   [#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]) 
344
 
AC_MSG_RESULT(yes)],
345
 
              [AC_MSG_RESULT(no)])
346
 
fi
347
 
 
348
 
# 8. Libltdl
349
 
AC_CHECK_LIB(ltdl, lt_dlopen)
350
 
 
351
 
 
352
 
AC_CONFIG_FILES([Makefile])
353
 
AC_OUTPUT
 
1
# Process this file with autoconf to produce a configure script.
 
2
AC_INIT(psqlodbc, 09.02.0100, [pgsql-odbc@postgresql.org])
 
3
AC_PREREQ(2.57)
 
4
AC_CONFIG_AUX_DIR(config)
 
5
AM_INIT_AUTOMAKE
 
6
AC_CONFIG_SRCDIR([bind.c])
 
7
AM_CONFIG_HEADER([config.h])
 
8
AM_MAINTAINER_MODE
 
9
 
 
10
 
 
11
# 0. Options processing
 
12
 
 
13
 
 
14
#
 
15
# Whether unixODBC driver manager is used
 
16
#
 
17
AC_ARG_WITH(unixodbc, [  --with-unixodbc=DIR     odbc_config installation of unixODBC (default)],
 
18
[
 
19
        if test "$withval" != no; then
 
20
                if test "$withval" = yes; then
 
21
                        AC_PATH_PROGS(ODBC_CONFIG, odbc_config)
 
22
                else
 
23
                        ODBC_CONFIG=$withval
 
24
                fi
 
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)])
 
28
                        fi
 
29
                else
 
30
                        ODBC_CONFIG=${ODBC_CONFIG}/bin/odbc_config
 
31
                fi
 
32
                with_unixodbc=yes
 
33
        fi
 
34
        ],
 
35
[with_unixodbc=yes])
 
36
 
 
37
 
 
38
#
 
39
# Whether iODBC driver manager is used
 
40
#
 
41
AC_ARG_WITH(iodbc, [  --with-iodbc=DIR    iodbc_config installation of iODBC],
 
42
[
 
43
        if test "$withval" != no; then
 
44
                if test "$withval" = yes; then
 
45
                        AC_PATH_PROGS(ODBC_CONFIG, iodbc-config)
 
46
                else
 
47
                        ODBC_CONFIG=$withval
 
48
                fi
 
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)])
 
52
                        fi
 
53
                else
 
54
                        ODBC_CONFIG=${ODBC_CONFIG}/bin/iodbc-config
 
55
                fi
 
56
                with_iodbc=yes
 
57
        fi
 
58
        ],
 
59
[with_iodbc=no])
 
60
 
 
61
 
 
62
if test "$with_iodbc" = yes; then
 
63
  with_unixodbc=no
 
64
  AC_DEFINE(WITH_IODBC, 1, [Define to 1 to build with iODBC support])
 
65
fi
 
66
 
 
67
if test "$with_unixodbc" = yes; then
 
68
  AC_DEFINE(WITH_UNIXODBC, 1,
 
69
            [Define to 1 to build with unixODBC support])
 
70
fi
 
71
 
 
72
#
 
73
# ODBC include and library
 
74
#
 
75
 
 
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}"
 
82
        else
 
83
                ODBC_INCLUDE=`${ODBC_CONFIG} --include-prefix`
 
84
                CPPFLAGS="$CPPFLAGS -I${ODBC_INCLUDE}"
 
85
                ODBC_LIBS=`${ODBC_CONFIG} --libs`
 
86
                LIBS="$LIBS ${ODBC_LIBS}"
 
87
        fi
 
88
        AC_MSG_NOTICE([using $ODBC_INCLUDE $ODBC_LIBS])
 
89
fi
 
90
 
 
91
#
 
92
# SQLCOLATTRIBUTE_SQLLEN check
 
93
#
 
94
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
 
95
        [[#include <sql.h>>
 
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]))
 
103
 
 
104
 
 
105
#
 
106
# Whether libpq functionalities are used
 
107
#
 
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],
 
111
[
 
112
        if test "$withval" = no; then
 
113
                AC_DEFINE(NOT_USE_LIBPQ, 1, 
 
114
                         [Define to 1 to build without libpq])
 
115
                enable_openssl=no
 
116
        else
 
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"
 
122
                        else
 
123
                                if test -x "$withval"; then
 
124
                                        PG_CONFIG=$withval
 
125
                                else
 
126
                                        AC_MSG_ERROR([specified pg_config not found])
 
127
                                fi
 
128
                        fi
 
129
                fi
 
130
                with_libpq=yes
 
131
        fi
 
132
        ],
 
133
[with_libpq=yes]) 
 
134
 
 
135
 
 
136
#
 
137
# Default odbc version number (--with-odbcver), default 0x0351
 
138
#
 
139
 
 
140
PGAC_ARG_REQ(with, odbcver,
 
141
             [  --with-odbcver=VERSION  change default ODBC version number [[0x0351]]],
 
142
             [],
 
143
             [with_odbcver=0x0351])
 
144
AC_DEFINE_UNQUOTED(ODBCVER, [$with_odbcver], 
 
145
                   [Define to ODBC version (--with-odbcver)])
 
146
 
 
147
 
 
148
#
 
149
# Unicode support
 
150
#
 
151
 
 
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)])])
 
156
 
 
157
AM_CONDITIONAL(enable_unicode, [test x"$enable_unicode" = xyes])
 
158
 
 
159
 
 
160
#
 
161
# SSL support
 
162
#
 
163
 
 
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)])])
 
168
 
 
169
AM_CONDITIONAL(enable_openssl, [test x"$enable_openssl" = xyes])
 
170
 
 
171
#
 
172
# GSSAPI support
 
173
#
 
174
 
 
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)])])
 
179
 
 
180
AM_CONDITIONAL(enable_gss, [test x"$enable_gss" = xyes])
 
181
 
 
182
#
 
183
# GKerberos 5 support
 
184
#
 
185
 
 
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)])])
 
190
 
 
191
AM_CONDITIONAL(enable_krb5, [test x"$enable_krb5" = xyes])
 
192
 
 
193
#
 
194
# Pthreads
 
195
#
 
196
 
 
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])])
 
202
 
 
203
 
 
204
#
 
205
# Find libpq headers and libraries
 
206
#
 
207
 
 
208
if test "$with_libpq" = yes; then
 
209
  if test -z "$PG_CONFIG"; then
 
210
        AC_PATH_PROGS(PG_CONFIG, pg_config)
 
211
  fi
 
212
 
 
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"
 
218
  fi
 
219
fi
 
220
 
 
221
 
 
222
 
 
223
# 1. Programs
 
224
 
 
225
AC_PROG_CC
 
226
 
 
227
AM_CONDITIONAL([GCC], [test -n "$GCC"])
 
228
 
 
229
# 2. Libraries
 
230
 
 
231
AC_LIBTOOL_WIN32_DLL
 
232
AC_DISABLE_STATIC
 
233
AC_LIBTOOL_DLOPEN
 
234
AC_PROG_LIBTOOL
 
235
 
 
236
if test "$with_unixodbc" = yes; then
 
237
  AC_SEARCH_LIBS(SQLGetPrivateProfileString, odbcinst, [],
 
238
                 [AC_MSG_ERROR([unixODBC library "odbcinst" not found])])
 
239
fi
 
240
 
 
241
if test "$with_iodbc" = yes; then
 
242
  AC_SEARCH_LIBS(SQLGetPrivateProfileString, iodbcinst, [],
 
243
                 [AC_MSG_ERROR([iODBC library "iodbcinst" not found])])
 
244
fi
 
245
 
 
246
if test "$enable_pthreads" = yes; then
 
247
  AC_CHECK_LIB(pthreads, pthread_create,
 
248
               [],
 
249
               [AC_CHECK_LIB(pthread, pthread_create)])
 
250
fi
 
251
 
 
252
if test "$with_libpq" = yes; then
 
253
  AC_CHECK_LIB(pq, PQconnectdb, [],
 
254
              [AC_MSG_ERROR([libpq library not found])])
 
255
fi
 
256
 
 
257
if test "$enable_openssl" = yes; then
 
258
  AC_CHECK_LIB(ssl, SSL_read, [], [AC_MSG_ERROR([ssl library not found])])
 
259
fi
 
260
 
 
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])])
 
263
fi
 
264
 
 
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])])
 
268
fi
 
269
 
 
270
# 3. Header files
 
271
 
 
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])])
 
275
fi
 
276
if test "$enable_openssl" = yes; then
 
277
  AC_CHECK_HEADER([openssl/ssl.h],,[AC_MSG_ERROR([ssl header not found])])
 
278
fi
 
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])])])
 
282
fi
 
283
if test "$enable_krb5" = yes; then
 
284
  AC_CHECK_HEADER([krb5.h],,[AC_MSG_ERROR([krb5 header not found])])
 
285
fi
 
286
AC_HEADER_TIME
 
287
 
 
288
 
 
289
# 4. Types
 
290
 
 
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)
 
296
 
 
297
AC_CHECK_TYPES(ssize_t)
 
298
AC_TYPE_SIZE_T
 
299
 
 
300
# 5. Structures
 
301
 
 
302
AC_STRUCT_TM
 
303
PGAC_STRUCT_ADDRINFO
 
304
 
 
305
 
 
306
# 6. Compiler characteristics
 
307
 
 
308
AC_C_CONST
 
309
 
 
310
 
 
311
# 7. Functions, global variables
 
312
 
 
313
AC_FUNC_STRERROR_R
 
314
AC_CHECK_FUNCS(strtoul strtoll strlcat strlcpy poll)
 
315
 
 
316
if test x"$enable_unicode" = xyes; then
 
317
  AC_CHECK_FUNCS(iswascii)
 
318
fi
 
319
 
 
320
if test "$enable_pthreads" = yes; then
 
321
  AC_CHECK_FUNCS(localtime_r strtok_r pthread_mutexattr_settype)
 
322
 
 
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])])])
 
332
  fi
 
333
fi
 
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>])],
 
339
                   [#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]) 
 
344
AC_MSG_RESULT(yes)],
 
345
              [AC_MSG_RESULT(no)])
 
346
fi
 
347
 
 
348
# 8. Libltdl
 
349
AC_CHECK_LIB(ltdl, lt_dlopen)
 
350
 
 
351
 
 
352
AC_CONFIG_FILES([Makefile])
 
353
AC_OUTPUT