Merge from Trond
[m6w6/libmemcached] / m4 / pandora_with_php.m4
1 dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 dnl
4 dnl pandora-build: A pedantic build system
5 dnl Copyright (C) 2009 Sun Microsystems, Inc.
6 dnl This file is free software; Sun Microsystems
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
9 dnl
10 dnl From Monty Taylor
11
12
13 AC_DEFUN([PANDORA_WITH_PHP],[
14
15 AC_ARG_WITH([php],
16 [AS_HELP_STRING([--with-php],
17 [Build NDB/PHP @<:@default=no@:>@])],
18 [with_php=$withval],
19 [with_php=no])
20
21 AS_IF([test "x$with_php" != "xno"],[
22 dnl We explicitly requested PHP build. Fail on too-young SWIG.
23 AS_IF([test "x$SWIG_CAN_BUILD_PHP" != "xyes"],
24 [AC_MSG_ERROR("Your version of SWIG is too young to build NDB/PHP. >=1.3.33 is required!")])
25 AS_IF([test "x$with_php" != "xyes"],
26 [ac_check_php_config=$with_php],
27 [ac_check_php_config="php-config php-config5"])
28 AC_CHECK_PROGS(PHP_CONFIG, [$ac_check_php_config])
29 ])
30
31 AS_IF([test "x$PHP_CONFIG" != "x"],[
32 PHP_CFLAGS=`$PHP_CONFIG --includes`
33 PHP_CPPFLAGS=`$PHP_CONFIG --includes`
34 PHP_LDFLAGS=`$PHP_CONFIG --ldflags`
35 PHP_EXTDIR=`$PHP_CONFIG --extension-dir`
36 strip_php_prefix=`$PHP_CONFIG --prefix | sed 's/\//./g'`
37 PHP_ARCH_DIR=`echo $PHP_EXTDIR | sed "s/$strip_php_prefix//"`
38 ],[
39 PHP_CFLAGS=
40 PHP_CPPFLAGS=
41 PHP_LDFLAGS=
42 PHP_EXTDIR=
43 PHP_ARCH_DIR=
44 with_php=no
45 ])
46
47 AC_SUBST(PHP_CFLAGS)
48 AC_SUBST(PHP_CPPFLAGS)
49 AC_SUBST(PHP_LDFLAGS)
50 AC_SUBST(PHP_EXTDIR)
51 AC_SUBST(PHP_ARCH_DIR)
52
53 AM_CONDITIONAL(BUILD_PHP, test "$with_php" = "yes")
54
55 ])
56