xref: /PHP-8.1/sapi/phpdbg/config.m4 (revision 60fbd6df)
1PHP_ARG_ENABLE([phpdbg],
2  [for phpdbg support],
3  [AS_HELP_STRING([--enable-phpdbg],
4    [Build phpdbg])],
5  [yes],
6  [yes])
7
8PHP_ARG_ENABLE([phpdbg-debug],
9  [for phpdbg debug build],
10  [AS_HELP_STRING([--enable-phpdbg-debug],
11    [Build phpdbg in debug mode])],
12  [no],
13  [no])
14
15PHP_ARG_ENABLE([phpdbg-readline],
16  [for phpdbg readline support],
17  [AS_HELP_STRING([--enable-phpdbg-readline],
18    [Enable readline support in phpdbg (depends on static ext/readline)])],
19  [no],
20  [no])
21
22if test "$BUILD_PHPDBG" = "" && test "$PHP_PHPDBG" != "no"; then
23  AC_HEADER_TIOCGWINSZ
24  AC_DEFINE(HAVE_PHPDBG, 1, [ ])
25
26  if test "$PHP_PHPDBG_DEBUG" != "no"; then
27    AC_DEFINE(PHPDBG_DEBUG, 1, [ ])
28  else
29    AC_DEFINE(PHPDBG_DEBUG, 0, [ ])
30  fi
31
32  PHP_PHPDBG_CFLAGS="-D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
33  PHP_PHPDBG_FILES="phpdbg.c phpdbg_parser.c phpdbg_lexer.c phpdbg_prompt.c phpdbg_help.c phpdbg_break.c phpdbg_print.c phpdbg_bp.c phpdbg_list.c phpdbg_utils.c phpdbg_info.c phpdbg_cmd.c phpdbg_set.c phpdbg_frame.c phpdbg_watch.c phpdbg_btree.c phpdbg_sigsafe.c phpdbg_io.c phpdbg_out.c"
34
35  AC_MSG_CHECKING([for phpdbg and readline integration])
36  if test "$PHP_PHPDBG_READLINE" = "yes"; then
37    if test "$PHP_READLINE" != "no" -o  "$PHP_LIBEDIT" != "no"; then
38  	  AC_DEFINE(HAVE_PHPDBG_READLINE, 1, [ ])
39  	  PHPDBG_EXTRA_LIBS="$PHP_READLINE_LIBS"
40  	  AC_MSG_RESULT([ok])
41  	else
42  	  AC_MSG_RESULT([readline is not available])
43    fi
44  else
45    AC_MSG_RESULT([disabled])
46  fi
47
48  PHP_SUBST(PHP_PHPDBG_CFLAGS)
49  PHP_SUBST(PHP_PHPDBG_FILES)
50  PHP_SUBST(PHPDBG_EXTRA_LIBS)
51
52  PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/phpdbg/Makefile.frag], [$abs_srcdir/sapi/phpdbg], [$abs_builddir/sapi/phpdbg])
53  PHP_SELECT_SAPI(phpdbg, program, $PHP_PHPDBG_FILES, $PHP_PHPDBG_CFLAGS, [$(SAPI_PHPDBG_PATH)])
54
55  BUILD_BINARY="sapi/phpdbg/phpdbg"
56  BUILD_SHARED="sapi/phpdbg/libphpdbg.la"
57
58  BUILD_PHPDBG="\$(LIBTOOL) --mode=link \
59        \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
60                \$(PHP_GLOBAL_OBJS:.lo=.o) \
61                \$(PHP_BINARY_OBJS:.lo=.o) \
62                \$(PHP_PHPDBG_OBJS:.lo=.o) \
63                \$(EXTRA_LIBS) \
64                \$(PHPDBG_EXTRA_LIBS) \
65                \$(ZEND_EXTRA_LIBS) \
66                \$(PHP_FRAMEWORKS) \
67         -o \$(BUILD_BINARY)"
68
69  BUILD_PHPDBG_SHARED="\$(LIBTOOL) --mode=link \
70        \$(CC) -shared -Wl,-soname,libphpdbg.so -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \
71                \$(PHP_GLOBAL_OBJS) \
72                \$(PHP_BINARY_OBJS) \
73                \$(PHP_PHPDBG_OBJS) \
74                \$(EXTRA_LIBS) \
75                \$(PHPDBG_EXTRA_LIBS) \
76                \$(ZEND_EXTRA_LIBS) \
77                \-DPHPDBG_SHARED \
78         -o \$(BUILD_SHARED)"
79
80  PHP_SUBST(BUILD_BINARY)
81  PHP_SUBST(BUILD_SHARED)
82  PHP_SUBST(BUILD_PHPDBG)
83  PHP_SUBST(BUILD_PHPDBG_SHARED)
84
85  PHP_OUTPUT(sapi/phpdbg/phpdbg.1)
86fi
87