1
1
PHP_ARG_ENABLE([ embed] ,,
2
2
[ AS_HELP_STRING ( [ [ --enable-embed[ =TYPE] ] ] ,
3
3
[ Enable building of embedded SAPI library TYPE is either
4
- 'shared' or 'static'. [ TYPE=shared] ] ) ] ,
4
+ 'shared' or 'static' or 'main'. [ TYPE=shared] ] ) ] ,
5
+ [ no] ,
6
+ [ no] )
7
+
8
+ PHP_ARG_WITH([ embed-main] ,,
9
+ [ AS_HELP_STRING ( [ [ --enable-embed-main[ =FILE] ] ] ,
10
+ [ Enable building of embedded SAPI as a program with embedded main
11
+ [ TYPE=no] ] ) ] ,
5
12
[ no] ,
6
13
[ no] )
7
14
8
15
AC_MSG_CHECKING ( [ for embedded SAPI library support] )
9
16
10
- if test "$PHP_EMBED" != "no"; then
17
+ if test "$PHP_EMBED" != "no" || test "$PHP_EMBED_MAIN" != "no"; then
18
+
19
+ if test "$PHP_EMBED" == "main"; then
20
+ if test "$PHP_EMBED_MAIN" == "no"; then
21
+ AC_MSG_ERROR ( [ --with-embed-main is required for --enable-embed=main] )
22
+ fi
23
+ elif test "$PHP_EMBED_MAIN" != "no"; then
24
+ PHP_EMBED=main
25
+ fi
26
+
11
27
AS_CASE ( [ $PHP_EMBED] ,
12
28
[ yes|shared] , [
13
29
LIBPHP_CFLAGS="-shared"
@@ -22,6 +38,43 @@ if test "$PHP_EMBED" != "no"; then
22
38
PHP_EMBED_TYPE=static
23
39
INSTALL_IT="\$(mkinstalldirs) \$(INSTALL_ROOT)\$(orig_libdir); \$(INSTALL) -m 0644 $SAPI_STATIC \$(INSTALL_ROOT)\$(orig_libdir)"
24
40
] ,
41
+ [ main] , [
42
+ AC_MSG_RESULT ( [ main] )
43
+ AC_PATH_PROG ( [ XXD] , [ xxd] )
44
+ if test ! -x "$XXD"; then
45
+ AC_MSG_ERROR ( [ xxd not found, required for --with-embed-main] )
46
+ fi
47
+ AC_MSG_CHECKING ( [ for access to $PHP_EMBED_MAIN] )
48
+ if test ! -f "$PHP_EMBED_MAIN"; then
49
+ AC_MSG_ERROR ( [ --with-embed-main argument "$PHP_EMBED_MAIN" not found] )
50
+ else
51
+ AC_MSG_RESULT ( [ ok] )
52
+ fi
53
+
54
+ AC_MSG_CHECKING ( [ generating sapi/embed/php_embed_main.h] )
55
+ $XXD -i -n php_embed_main "$PHP_EMBED_MAIN" sapi/embed/php_embed_main.h
56
+ if test $? -ne 0; then
57
+ AC_MSG_ERROR ( [ failed] )
58
+ else
59
+ AC_MSG_RESULT ( [ ok] )
60
+ fi
61
+
62
+ AC_MSG_CHECKING ( [ proceeding to final configure of embed] )
63
+ LIBPHP_CFLAGS="-static"
64
+ PHP_EMBED_TYPE=static
65
+ INSTALL_IT="\
66
+ \$(mkinstalldirs) \$(INSTALL_ROOT)\$(orig_libdir); \
67
+ \$(INSTALL) -m 0644 \$(SAPI_STATIC) \$(INSTALL_ROOT)\$(orig_libdir); \
68
+ \$(mkinstalldirs) \$(INSTALL_ROOT)\$(bindir); \
69
+ \$(LIBTOOL) --tag=CC --mode=compile \$(CC) \
70
+ \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(INCLUDES) -DHAVE_EMBED_MAIN \
71
+ -c sapi/embed/php_embed.c -o sapi/embed/php_embed_main.lo; \
72
+ \$(LIBTOOL) --tag=CC --mode=link \$(CC) \
73
+ -export-dynamic \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
74
+ sapi/embed/php_embed_main.lo \
75
+ \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) \
76
+ -o \$(INSTALL_ROOT)\$(bindir)/php-embed-main"
77
+ ] ,
25
78
[ PHP_EMBED_TYPE=] )
26
79
27
80
AS_VAR_IF ( [ PHP_EMBED_TYPE] ,, [ AC_MSG_RESULT ( [ no] ) ] , [
@@ -31,7 +84,7 @@ if test "$PHP_EMBED" != "no"; then
31
84
PHP_SELECT_SAPI([ embed] ,
32
85
[ $PHP_EMBED_TYPE] ,
33
86
[ php_embed.c] ,
34
- [ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1] )
87
+ [ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 $LIBPHP_CFLAGS ] )
35
88
PHP_INSTALL_HEADERS([ sapi/embed] , [ php_embed.h] )
36
89
] )
37
90
else
0 commit comments