1PHP_ARG_WITH([pdo-firebird],
2  [for Firebird support for PDO],
3  [AS_HELP_STRING([[--with-pdo-firebird[=DIR]]],
4    [PDO: Firebird support. DIR is the Firebird base install directory
5    [/opt/firebird]])])
6
7if test "$PHP_PDO_FIREBIRD" != "no"; then
8
9  if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
10    AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
11  fi
12
13  AC_PATH_PROG(FB_CONFIG, fb_config, no)
14
15  if test -x "$FB_CONFIG" && test "$PHP_PDO_FIREBIRD" = "yes"; then
16    AC_MSG_CHECKING(for libfbconfig)
17    FB_CFLAGS=`$FB_CONFIG --cflags`
18    FB_LIBDIR=`$FB_CONFIG --libs`
19    FB_VERSION=`$FB_CONFIG --version`
20    AC_MSG_RESULT(version $FB_VERSION)
21    PHP_EVAL_LIBLINE($FB_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD)
22    PHP_EVAL_INCLINE($FB_CFLAGS)
23
24  else
25    if test "$PHP_PDO_FIREBIRD" = "yes"; then
26      FIREBIRD_INCDIR=
27      FIREBIRD_LIBDIR=
28      FIREBIRD_LIBDIR_FLAG=
29    else
30      FIREBIRD_INCDIR=$PHP_PDO_FIREBIRD/include
31      FIREBIRD_LIBDIR=$PHP_PDO_FIREBIRD/$PHP_LIBDIR
32      FIREBIRD_LIBDIR_FLAG=-L$FIREBIRD_LIBDIR
33    fi
34
35    PHP_CHECK_LIBRARY(fbclient, isc_detach_database,
36    [
37      FIREBIRD_LIBNAME=fbclient
38    ], [
39      PHP_CHECK_LIBRARY(gds, isc_detach_database,
40      [
41        FIREBIRD_LIBNAME=gds
42      ], [
43        PHP_CHECK_LIBRARY(ib_util, isc_detach_database,
44        [
45          FIREBIRD_LIBNAME=ib_util
46        ], [
47          AC_MSG_ERROR([libfbclient, libgds or libib_util not found! Check config.log for more information.])
48        ], [
49          $FIREBIRD_LIBDIR_FLAG
50        ])
51      ], [
52        $FIREBIRD_LIBDIR_FLAG
53      ])
54    ], [
55      $FIREBIRD_LIBDIR_FLAG
56    ])
57    PHP_ADD_LIBRARY_WITH_PATH($FIREBIRD_LIBNAME, $FIREBIRD_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD)
58    PHP_ADD_INCLUDE($FIREBIRD_INCDIR)
59  fi
60
61  PHP_CHECK_PDO_INCLUDES
62
63  AC_DEFINE(HAVE_PDO_FIREBIRD,1,[ ])
64  PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared,,-I$pdo_cv_inc_path)
65  PHP_SUBST(PDO_FIREBIRD_SHARED_LIBADD)
66  PHP_ADD_EXTENSION_DEP(pdo_firebird, pdo)
67fi
68