-
Notifications
You must be signed in to change notification settings - Fork 213
Expand file tree
/
Copy pathphp_mongodb.m4
More file actions
93 lines (85 loc) · 2.93 KB
/
php_mongodb.m4
File metadata and controls
93 lines (85 loc) · 2.93 KB
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
dnl
dnl PHP_MONGODB_ADD_SOURCES(source-path, sources [, special-flags])
dnl
dnl Adds sources which are located relative to source-path. source-path should
dnl be relative to the extension directory (i.e. PHP_EXT_DIR). special-flags
dnl will be passed to the compiler.
dnl
dnl This macro will call PHP_ADD_SOURCES or PHP_ADD_SOURCES_X depending on
dnl whether the extension is being built statically or as a shared module.
dnl
AC_DEFUN([PHP_MONGODB_ADD_SOURCES],[
_src_path=PHP_EXT_DIR(mongodb)
dnl Join extension directory and source path
case $_src_path in
""[)] _src_path="$1" ;;
*/[)] _src_path="$_src_path$1" ;;
*[)] _src_path="$_src_path/$1" ;;
esac
dnl Trim trailing slash from source path
case $_src_path in
*/[)] _src_path=${_src_path%?}
esac
if test "$ext_shared" = "no"; then
PHP_ADD_SOURCES($_src_path, [$2], [$3])
else
PHP_ADD_SOURCES_X($_src_path, [$2], [$3], shared_objects_mongodb, yes)
fi
])
dnl
dnl PHP_MONGODB_ADD_INCLUDE(path)
dnl
dnl Adds an include path relative to the extension source directory (i.e.
dnl PHP_EXT_SRCDIR).
dnl
AC_DEFUN([PHP_MONGODB_ADD_INCLUDE],[
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/][$1])
])
dnl
dnl PHP_MONGODB_ADD_BUILD_INCLUDE(path)
dnl
dnl Adds an include path relative to the extension build directory (i.e.
dnl PHP_EXT_BUILDDIR). Use this for directories containing generated files
dnl (e.g. config headers written by AC_CONFIG_FILES).
dnl
dnl PHP_EXT_BUILDDIR returns a path relative to the configure invocation
dnl directory (e.g. "." for phpize builds, "ext/mongodb" for in-tree builds).
dnl The subdirectory passed as $1 does not exist at configure time (build dirs
dnl are created in AC_CONFIG_COMMANDS_PRE), so passing the full relative path
dnl to PHP_ADD_INCLUDE would cause PHP_EXPAND_PATH to silently discard it when
dnl the "cd $path && pwd" probe fails. To avoid this, we resolve only the base
dnl (PHP_EXT_BUILDDIR, which always exists at configure time) to an absolute
dnl path first, then append $1. PHP_ADD_INCLUDE skips the cd-probe for paths
dnl that already start with "/".
dnl
AC_DEFUN([PHP_MONGODB_ADD_BUILD_INCLUDE],[
PHP_EXPAND_PATH(PHP_EXT_BUILDDIR(mongodb), php_mongodb_abs_builddir)
PHP_ADD_INCLUDE([$php_mongodb_abs_builddir/$1])
])
dnl
dnl PHP_MONGODB_ADD_BUILD_DIR(path)
dnl
dnl Adds a build directory relative to the extension build directory (i.e.
dnl PHP_EXT_BUILDDIR).
dnl
AC_DEFUN([PHP_MONGODB_ADD_BUILD_DIR],[
PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/][$1])
])
dnl
dnl PHP_MONGODB_VALIDATE_ARG(arg-name, valid-values)
dnl
dnl Checks that value of arg-name is in the space-delimited list of valid-values
dnl and raises an error if not.
dnl
AC_DEFUN([PHP_MONGODB_VALIDATE_ARG], [
ac_php_mongodb_valid_arg="no"
for value in $2; do
if test "$value" = "$$1"; then
ac_php_mongodb_valid_arg="yes"
break
fi
done
if test "$ac_php_mongodb_valid_arg" = "no"; then
AC_MSG_ERROR([Expected $1 to be one of "$2", "$$1" given])
fi
])