xref: /PHP-8.4/ext/pdo_firebird/config.m4 (revision 96840072)
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  AC_PATH_PROG([FB_CONFIG], [fb_config], [no])
9
10  if test -x "$FB_CONFIG" && test "$PHP_PDO_FIREBIRD" = "yes"; then
11    AC_MSG_CHECKING([for libfbconfig])
12    FB_CFLAGS=$($FB_CONFIG --cflags)
13    FB_LIBDIR=$($FB_CONFIG --libs)
14    FB_VERSION=$($FB_CONFIG --version)
15    AC_MSG_RESULT([version $FB_VERSION])
16    AS_VERSION_COMPARE([$FB_VERSION], [3.0],
17      [AC_MSG_ERROR([Firebird required version is at least 3.0])])
18    PHP_EVAL_LIBLINE([$FB_LIBDIR], [PDO_FIREBIRD_SHARED_LIBADD])
19    PHP_EVAL_INCLINE([$FB_CFLAGS])
20  else
21    AS_VAR_IF([PHP_PDO_FIREBIRD], [yes], [
22      FIREBIRD_INCDIR=
23      FIREBIRD_LIBDIR=
24      FIREBIRD_LIBDIR_FLAG=
25    ], [
26      FIREBIRD_INCDIR=$PHP_PDO_FIREBIRD/include
27      FIREBIRD_LIBDIR=$PHP_PDO_FIREBIRD/$PHP_LIBDIR
28      FIREBIRD_LIBDIR_FLAG=-L$FIREBIRD_LIBDIR
29    ])
30
31    PHP_CHECK_LIBRARY([fbclient], [fb_get_master_interface],
32      [],
33      [AC_MSG_FAILURE([libfbclient not found.])],
34      [$FIREBIRD_LIBDIR_FLAG])
35    PHP_ADD_LIBRARY_WITH_PATH([fbclient],
36      [$FIREBIRD_LIBDIR],
37      [PDO_FIREBIRD_SHARED_LIBADD])
38    PHP_ADD_INCLUDE([$FIREBIRD_INCDIR])
39  fi
40
41  PHP_CHECK_PDO_INCLUDES
42
43  PHP_NEW_EXTENSION([pdo_firebird],
44    [pdo_firebird.c firebird_driver.c firebird_statement.c],
45    [$ext_shared],,,
46    [cxx])
47  PHP_SUBST([PDO_FIREBIRD_SHARED_LIBADD])
48  PHP_ADD_EXTENSION_DEP(pdo_firebird, pdo)
49
50  PHP_REQUIRE_CXX()
51  PHP_CXX_COMPILE_STDCXX([11], [mandatory], [PHP_PDO_FIREBIRD_STDCXX])
52
53  PHP_PDO_FIREBIRD_CXX_SOURCES="pdo_firebird_utils.cpp"
54
55  AS_VAR_IF([ext_shared], [no],
56    [PHP_ADD_SOURCES([$ext_dir],
57      [$PHP_PDO_FIREBIRD_CXX_SOURCES],
58      [$PHP_PDO_FIREBIRD_STDCXX])],
59    [PHP_ADD_SOURCES_X([$ext_dir],
60      [$PHP_PDO_FIREBIRD_CXX_SOURCES],
61      [$PHP_PDO_FIREBIRD_STDCXX],
62      [shared_objects_pdo_firebird],
63      [yes])])
64fi
65