File: dbd.m4

package info (click to toggle)
apr-util 1.6.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 4,716 kB
  • sloc: ansic: 31,678; sh: 3,347; makefile: 222; perl: 154; xml: 36
file content (524 lines) | stat: -rw-r--r-- 17,862 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
dnl -------------------------------------------------------- -*- autoconf -*-
dnl Licensed to the Apache Software Foundation (ASF) under one or more
dnl contributor license agreements.  See the NOTICE file distributed with
dnl this work for additional information regarding copyright ownership.
dnl The ASF licenses this file to You under the Apache License, Version 2.0
dnl (the "License"); you may not use this file except in compliance with
dnl the License.  You may obtain a copy of the License at
dnl
dnl     http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.

dnl
dnl DBD module
dnl

dnl
dnl APU_CHECK_DBD: compile backends for apr_dbd.
dnl
AC_DEFUN([APU_CHECK_DBD], [
  apu_have_pgsql=0

  old_libs="$LIBS"
  old_cppflags="$CPPFLAGS"
  old_ldflags="$LDFLAGS"

  AC_ARG_WITH([pgsql], APR_HELP_STRING([--with-pgsql=DIR], [specify PostgreSQL location]),
  [
    if test "$withval" = "yes"; then
      AC_PATH_PROG([PGSQL_CONFIG],[pg_config])
      if test "x$PGSQL_CONFIG" != 'x'; then
        pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
        pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"

        APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
        APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
      fi

      AC_CHECK_HEADERS(libpq-fe.h, [
        AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
        if test "x$PGSQL_CONFIG" != 'x'; then
          unset ac_cv_lib_pq_PQsendQueryPrepared
          pgsql_LIBS="-lpq"
          APR_ADDTO(LIBS, [$pgsql_LIBS])
          AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
        fi
        ])
      ])
      if test "$apu_have_pgsql" = "0"; then
        AC_CHECK_HEADERS(postgresql/libpq-fe.h, [
          AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
          if test "x$PGSQL_CONFIG" != 'x'; then
            unset ac_cv_lib_pq_PQsendQueryPrepared
            pgsql_LIBS="-lpq"
            APR_ADDTO(LIBS, [$pgsql_LIBS])
            AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
          fi
          ])
        ])
      fi
      if test "$apu_have_pgsql" != "0" && test "x$PGSQL_CONFIG" != 'x'; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
      fi
    elif test "$withval" = "no"; then
      :
    else
      AC_PATH_PROG([PGSQL_CONFIG],[pg_config],,[$withval/bin])
      if test "x$PGSQL_CONFIG" != 'x'; then
        pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
        pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
      else
        pgsql_CPPFLAGS="-I$withval/include"
        pgsql_LDFLAGS="-L$withval/lib "
      fi

      APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])

      AC_MSG_NOTICE(checking for pgsql in $withval)
      AC_CHECK_HEADERS(libpq-fe.h, [
        AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
        if test "x$PGSQL_CONFIG" != 'x'; then
          unset ac_cv_lib_pq_PQsendQueryPrepared
          pgsql_LIBS="-lpq"
          APR_ADDTO(LIBS, [$pgsql_LIBS])
          AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
        fi
        ])
      ])
      if test "$apu_have_pgsql" != "1"; then
        AC_CHECK_HEADERS(postgresql/libpq-fe.h, [
          AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
          if test "x$PGSQL_CONFIG" != 'x'; then
            unset ac_cv_lib_pq_PQsendQueryPrepared
            pgsql_LIBS="-lpq"
            APR_ADDTO(LIBS, [$pgsql_LIBS])
            AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
          fi
          ])
        ])
      fi
      if test "$apu_have_pgsql" != "0"; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
      fi
    fi
  ], [
    AC_PATH_PROG([PGSQL_CONFIG],[pg_config])
    if test "x$PGSQL_CONFIG" != 'x'; then
      pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
      pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"

      APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
    fi

    AC_CHECK_HEADERS(libpq-fe.h, [
      AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
      if test "x$PGSQL_CONFIG" != 'x'; then
        unset ac_cv_lib_pq_PQsendQueryPrepared
        pgsql_LIBS="-lpq"
        APR_ADDTO(LIBS, [$pgsql_LIBS])
        AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
      fi
      ])
    ])
    if test "$apu_have_pgsql" = "0"; then
      AC_CHECK_HEADERS(postgresql/libpq-fe.h, [
        AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1],[
        if test "x$PGSQL_CONFIG" != 'x'; then
          unset ac_cv_lib_pq_PQsendQueryPrepared
          pgsql_LIBS="-lpq"
          APR_ADDTO(LIBS, [$pgsql_LIBS])
          AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1])
        fi
        ])
      ])
    fi
    if test "$apu_have_pgsql" != "0" && test "x$PGSQL_CONFIG" != 'x'; then
      APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$pgsql_CPPFLAGS])
    fi
  ])
  AC_SUBST(apu_have_pgsql)
  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  dnl we know the library is there.
  if test "$apu_have_pgsql" = "1"; then
    APR_ADDTO(LDADD_dbd_pgsql, [$pgsql_LDFLAGS -lpq $pgsql_LIBS])
  fi
  AC_SUBST(LDADD_dbd_pgsql)

  LIBS="$old_libs"
  CPPFLAGS="$old_cppflags"
  LDFLAGS="$old_ldflags"
])
dnl
AC_DEFUN([APU_CHECK_DBD_MYSQL], [
  apu_have_mysql=0

  old_libs="$LIBS"
  old_cppflags="$CPPFLAGS"
  old_ldflags="$LDFLAGS"

  my_library="mysqlclient"

  AC_ARG_WITH([mysql], APR_HELP_STRING([--with-mysql=DIR], [enable MySQL DBD driver]),
  [
    if test "$withval" = "yes"; then
      AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
      if test "x$MYSQL_CONFIG" = "x"; then
        AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config])
      fi
      if test "x$MYSQL_CONFIG" != 'x'; then
        mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
        mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
        mysql_LIBS="`$MYSQL_CONFIG --libs_r`"

        APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
        APR_ADDTO(LIBS, [$mysql_LIBS])

	if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
	  my_library="mariadb"
	fi
      fi

      AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
      if test "$apr_have_mysql" = "0"; then
	AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
      fi
      if test "$apr_have_mysql" = "1"; then
	AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
	AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
      fi
      if test "$apu_have_mysql" = "1" && test "x$MYSQL_CONFIG" != 'x'; then
	APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
      fi
    elif test "$withval" = "no"; then
      :
    else
      AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
      if test "x$MYSQL_CONFIG" = "x"; then
	AC_PATH_PROG([MYSQL_CONFIG],[mariadb_config],,[$withval/bin])
      fi
      if test "x$MYSQL_CONFIG" != 'x'; then
	mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
	mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r | sed -e 's/-l[[^ ]]\+//g'`"
	mysql_LIBS="`$MYSQL_CONFIG --libs_r`"
	if $MYSQL_CONFIG --libs_r | grep -q mariadb; then
	  my_library="mariadb"
	fi
      else
	mysql_CPPFLAGS="-I$withval/include"
	mysql_LDFLAGS="-L$withval/lib "
      fi

      APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
      APR_ADDTO(LIBS, [$mysql_LIBS])

      AC_MSG_NOTICE(checking for mysql in $withval)
      AC_CHECK_HEADERS([mysql.h errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
      if test "$apr_have_mysql" = "0"; then
	AC_CHECK_HEADERS([mysql/mysql.h mysql/errmsg.h], [apu_have_mysql=1], [apu_have_mysql=0; break])
      fi
      if test "$apr_have_mysql" = "1"; then
	AC_CHECK_HEADERS([my_global.h my_sys.h mysql/my_global.h mysql/my_sys.h])
	AC_CHECK_LIB($my_library, mysql_init,, [apu_have_mysql=0])
      fi
      if test "$apu_have_mysql" = "1"; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$mysql_CPPFLAGS])
      fi
    fi
  ])

  AC_SUBST(apu_have_mysql)

  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  dnl we know the library is there.
  if test "$apu_have_mysql" = "1"; then
    APR_ADDTO(LDADD_dbd_mysql, [$mysql_LDFLAGS -l$my_library $mysql_LIBS])
  fi
  AC_SUBST(LDADD_dbd_mysql)

  LIBS="$old_libs"
  CPPFLAGS="$old_cppflags"
  LDFLAGS="$old_ldflags"
])
dnl
AC_DEFUN([APU_CHECK_DBD_SQLITE3], [
  apu_have_sqlite3=0

  old_libs="$LIBS"
  old_cppflags="$CPPFLAGS"
  old_ldflags="$LDFLAGS"

  AC_ARG_WITH([sqlite3], APR_HELP_STRING([--with-sqlite3=DIR], [enable sqlite3 DBD driver]),
  [
    if test "$withval" = "yes"; then
      AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
    elif test "$withval" = "no"; then
      :
    else
      sqlite3_CPPFLAGS="-I$withval/include"
      sqlite3_LDFLAGS="-L$withval/lib "

      APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS])

      AC_MSG_NOTICE(checking for sqlite3 in $withval)
      AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
      if test "$apu_have_sqlite3" != "0"; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
      fi
    fi
  ], [
    AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
  ])

  AC_SUBST(apu_have_sqlite3)

  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  dnl we know the library is there.
  if test "$apu_have_sqlite3" = "1"; then
    APR_ADDTO(LDADD_dbd_sqlite3, [$sqlite3_LDFLAGS -lsqlite3])
  fi
  AC_SUBST(LDADD_dbd_sqlite3)

  LIBS="$old_libs"
  CPPFLAGS="$old_cppflags"
  LDFLAGS="$old_ldflags"
])
dnl
AC_DEFUN([APU_CHECK_DBD_SQLITE2], [
  apu_have_sqlite2=0

  old_libs="$LIBS"
  old_cppflags="$CPPFLAGS"
  old_ldflags="$LDFLAGS"

  AC_ARG_WITH([sqlite2], APR_HELP_STRING([--with-sqlite2=DIR], [enable sqlite2 DBD driver]),
  [
    if test "$withval" = "yes"; then
      AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
    elif test "$withval" = "no"; then
      :
    else
      sqlite2_CPPFLAGS="-I$withval/include"
      sqlite2_LDFLAGS="-L$withval/lib "

      APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS])

      AC_MSG_NOTICE(checking for sqlite2 in $withval)
      AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
      if test "$apu_have_sqlite2" != "0"; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/include])
      fi
    fi
  ], [
    AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
  ])

  AC_SUBST(apu_have_sqlite2)

  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  dnl we know the library is there.
  if test "$apu_have_sqlite2" = "1"; then
    APR_ADDTO(LDADD_dbd_sqlite2, [$sqlite2_LDFLAGS -lsqlite])
  fi
  AC_SUBST(LDADD_dbd_sqlite2)

  LIBS="$old_libs"
  CPPFLAGS="$old_cppflags"
  LDFLAGS="$old_ldflags"
])
dnl
AC_DEFUN([APU_CHECK_DBD_ORACLE], [
  apu_have_oracle=0

  old_libs="$LIBS"
  old_cppflags="$CPPFLAGS"
  old_ldflags="$LDFLAGS"

  AC_ARG_WITH([oracle-include],
    APR_HELP_STRING([--with-oracle-include=DIR], [path to Oracle include files]))
  AC_ARG_WITH([oracle], 
    APR_HELP_STRING([--with-oracle=DIR], [enable Oracle DBD driver; giving ORACLE_HOME as DIR]),
  [
    if test "$withval" = "yes"; then
      if test -n "$with_oracle_include"; then
        oracle_CPPFLAGS="$CPPFLAGS -I$with_oracle_include"
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$with_oracle_include])
      fi

      APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])

      AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
        unset ac_cv_lib_clntsh_OCIEnvCreate
        oracle_LIBS="-lnnz11"
        APR_ADDTO(LIBS, [$oracle_LIBS])
        AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
          unset ac_cv_lib_clntsh_OCIEnvCreate
          APR_REMOVEFROM(LIBS, [$oracle_LIBS])
          oracle_LIBS="-lnnz10"
          APR_ADDTO(LIBS, [$oracle_LIBS])
          AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1])
        ])
      ]))
    elif test "$withval" = "no"; then
      :
    else
      if test -n "$with_oracle_include"; then
        oracle_CPPFLAGS="$CPPFLAGS -I$with_oracle_include"
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$with_oracle_include])
      else
        oracle_CPPFLAGS="-I$withval/rdbms/demo -I$withval/rdbms/public"
      fi
      oracle_LDFLAGS="-L$withval/lib "

      APR_ADDTO(CPPFLAGS, [$oracle_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$oracle_LDFLAGS])

      AC_MSG_NOTICE(checking for oracle in $withval)
      AC_CHECK_HEADERS(oci.h, AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
        unset ac_cv_lib_clntsh_OCIEnvCreate
        oracle_LIBS="-lnnz11"
        APR_ADDTO(LIBS, [$oracle_LIBS])
        AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1],[
          unset ac_cv_lib_clntsh_OCIEnvCreate
          APR_REMOVEFROM(LIBS, [$oracle_LIBS])
          oracle_LIBS="-lnnz10"
          APR_ADDTO(LIBS, [$oracle_LIBS])
          AC_CHECK_LIB(clntsh, OCIEnvCreate, [apu_have_oracle=1])
        ])
      ]))
      if test "$apu_have_oracle" != "0"; then
        oracle_LDFLAGS="$oracle_LDFLAGS -R$withval/lib"
        if test -z "$with_oracle_include"; then
          APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/rdbms/demo])
          APR_ADDTO(APRUTIL_PRIV_INCLUDES, [-I$withval/rdbms/public])
        fi
      fi
    fi
  ])

  AC_SUBST(apu_have_oracle)

  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  dnl we know the library is there.
  if test "$apu_have_oracle" = "1"; then
    APR_ADDTO(LDADD_dbd_oracle, [$oracle_LDFLAGS -lclntsh $oracle_LIBS])
  fi
  AC_SUBST(LDADD_dbd_oracle)

  LIBS="$old_libs"
  CPPFLAGS="$old_cppflags"
  LDFLAGS="$old_ldflags"
])

dnl

AC_DEFUN([APU_CHECK_DBD_ODBC], [
  apu_have_odbc=0

  old_libs="$LIBS"
  old_cppflags="$CPPFLAGS"
  old_ldflags="$LDFLAGS"

  AC_ARG_WITH([odbc], APR_HELP_STRING([--with-odbc=DIR], [specify ODBC location]),
  [
    if test "$withval" = "yes"; then
      AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
      if test "x$ODBC_CONFIG" != 'x'; then
        odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
        odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
        odbc_LIBS="`$ODBC_CONFIG --libs`"

        APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
        APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
        APR_ADDTO(LIBS, [$odbc_LIBS])
      fi

      AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
      if test "$apu_have_odbc" = "0"; then
        AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
      fi
      if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
      fi
    elif test "$withval" = "no"; then
      :
    else
      AC_PATH_PROG([ODBC_CONFIG],[odbc_config],,[$withval/bin])
      if test "x$ODBC_CONFIG" != 'x'; then
        odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
        odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
        odbc_LIBS="`$ODBC_CONFIG --libs`"
      else
        if test -f "$withval" && test -x "$withval"; then 
          odbc_CPPFLAGS="-I`$withval --include-prefix`"
          odbc_LDFLAGS="-L`$withval --lib-prefix`"
          odbc_LIBS="`$withval --libs`"
        else
          odbc_CPPFLAGS="-I$withval/include"
          odbc_LDFLAGS="-L$withval/lib "
        fi
      fi

      APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
      APR_ADDTO(LIBS, [$odbc_LIBS])

      AC_MSG_NOTICE(checking for odbc in $withval)
      AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
      if test "$apu_have_odbc" = "0"; then
        AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
      fi
      if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
        APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
      fi
    fi
  ], [
    AC_PATH_PROG([ODBC_CONFIG],[odbc_config])
    if test "x$ODBC_CONFIG" != 'x'; then
      odbc_CPPFLAGS="-I`$ODBC_CONFIG --include-prefix`"
      odbc_LDFLAGS="-L`$ODBC_CONFIG --lib-prefix`"
      odbc_LIBS="`$ODBC_CONFIG --libs`"

      APR_ADDTO(CPPFLAGS, [$odbc_CPPFLAGS])
      APR_ADDTO(LDFLAGS, [$odbc_LDFLAGS])
      APR_ADDTO(LIBS, [$odbc_LIBS])
    fi

    AC_CHECK_HEADERS(sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
    if test "$apu_have_odbc" = "0"; then
      AC_CHECK_HEADERS(odbc/sql.h, AC_CHECK_LIB(odbc, SQLAllocHandle, [apu_have_odbc=1]))
    fi
    if test "$apu_have_odbc" != "0" && test "x$ODBC_CONFIG" != 'x'; then
      APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$odbc_CPPFLAGS])
    fi
  ])
  AC_SUBST(apu_have_odbc)
  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
  dnl we know the library is there.
  if test "$apu_have_odbc" = "1"; then
    APR_ADDTO(LDADD_dbd_odbc, [$odbc_LDFLAGS -lodbc $odbc_LIBS])
  fi
  AC_SUBST(LDADD_dbd_odbc)

  LIBS="$old_libs"
  CPPFLAGS="$old_cppflags"
  LDFLAGS="$old_ldflags"

  apu_dbd_tests=""
  test $apu_have_oracle = 1 &&  apu_dbd_tests="$apu_dbd_tests oracle"
  test $apu_have_pgsql = 1 &&   apu_dbd_tests="$apu_dbd_tests pgsql"
  test $apu_have_mysql = 1 &&   apu_dbd_tests="$apu_dbd_tests mysql"
  test $apu_have_sqlite2 = 1 && apu_dbd_tests="$apu_dbd_tests sqlite2"
  test $apu_have_sqlite3 = 1 && apu_dbd_tests="$apu_dbd_tests sqlite3"
  test $apu_have_odbc = 1 &&    apu_dbd_tests="$apu_dbd_tests odbc"
  AC_SUBST(apu_dbd_tests)
])