xref: /PHP-7.3/ext/skeleton/config.m4.in (revision 3362620b)
1dnl config.m4 for extension %EXTNAME%
2
3dnl Comments in this file start with the string 'dnl'.
4dnl Remove where necessary.
5
6dnl If your extension references something external, use with:
7
8dnl PHP_ARG_WITH(%EXTNAME%, for %EXTNAME% support,
9dnl Make sure that the comment is aligned:
10dnl [  --with-%EXTNAME%             Include %EXTNAME% support])
11
12dnl Otherwise use enable:
13
14PHP_ARG_ENABLE(%EXTNAME%, whether to enable %EXTNAME% support,
15dnl Make sure that the comment is aligned:
16[  --enable-%EXTNAME%          Enable %EXTNAME% support], no)
17
18if test "$PHP_%EXTNAMECAPS%" != "no"; then
19  dnl Write more examples of tests here...
20
21  dnl # get library FOO build options from pkg-config output
22  dnl AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
23  dnl AC_MSG_CHECKING(for libfoo)
24  dnl if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists foo; then
25  dnl   if $PKG_CONFIG foo --atleast-version 1.2.3; then
26  dnl     LIBFOO_CFLAGS=\`$PKG_CONFIG foo --cflags\`
27  dnl     LIBFOO_LIBDIR=\`$PKG_CONFIG foo --libs\`
28  dnl     LIBFOO_VERSON=\`$PKG_CONFIG foo --modversion\`
29  dnl     AC_MSG_RESULT(from pkgconfig: version $LIBFOO_VERSON)
30  dnl   else
31  dnl     AC_MSG_ERROR(system libfoo is too old: version 1.2.3 required)
32  dnl   fi
33  dnl else
34  dnl   AC_MSG_ERROR(pkg-config not found)
35  dnl fi
36  dnl PHP_EVAL_LIBLINE($LIBFOO_LIBDIR, %EXTNAMECAPS%_SHARED_LIBADD)
37  dnl PHP_EVAL_INCLINE($LIBFOO_CFLAGS)
38
39  dnl # --with-%EXTNAME% -> check with-path
40  dnl SEARCH_PATH="/usr/local /usr"     # you might want to change this
41  dnl SEARCH_FOR="/include/%EXTNAME%.h"  # you most likely want to change this
42  dnl if test -r $PHP_%EXTNAMECAPS%/$SEARCH_FOR; then # path given as parameter
43  dnl   %EXTNAMECAPS%_DIR=$PHP_%EXTNAMECAPS%
44  dnl else # search default path list
45  dnl   AC_MSG_CHECKING([for %EXTNAME% files in default path])
46  dnl   for i in $SEARCH_PATH ; do
47  dnl     if test -r $i/$SEARCH_FOR; then
48  dnl       %EXTNAMECAPS%_DIR=$i
49  dnl       AC_MSG_RESULT(found in $i)
50  dnl     fi
51  dnl   done
52  dnl fi
53  dnl
54  dnl if test -z "$%EXTNAMECAPS%_DIR"; then
55  dnl   AC_MSG_RESULT([not found])
56  dnl   AC_MSG_ERROR([Please reinstall the %EXTNAME% distribution])
57  dnl fi
58
59  dnl # --with-%EXTNAME% -> add include path
60  dnl PHP_ADD_INCLUDE($%EXTNAMECAPS%_DIR/include)
61
62  dnl # --with-%EXTNAME% -> check for lib and symbol presence
63  dnl LIBNAME=%EXTNAMECAPS% # you may want to change this
64  dnl LIBSYMBOL=%EXTNAMECAPS% # you most likely want to change this
65
66  dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
67  dnl [
68  dnl   PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $%EXTNAMECAPS%_DIR/$PHP_LIBDIR, %EXTNAMECAPS%_SHARED_LIBADD)
69  dnl   AC_DEFINE(HAVE_%EXTNAMECAPS%LIB,1,[ ])
70  dnl ],[
71  dnl   AC_MSG_ERROR([wrong %EXTNAME% lib version or lib not found])
72  dnl ],[
73  dnl   -L$%EXTNAMECAPS%_DIR/$PHP_LIBDIR -lm
74  dnl ])
75  dnl
76  dnl PHP_SUBST(%EXTNAMECAPS%_SHARED_LIBADD)
77
78  dnl # In case of no dependencies
79  AC_DEFINE(HAVE_%EXTNAMECAPS%, 1, [ Have %EXTNAME% support ])
80
81  PHP_NEW_EXTENSION(%EXTNAME%, %EXTNAME%.c, $ext_shared)
82fi
83