php-src/ext/recode/config.m4
Peter Kokot 4371945b8b Replace obsolete AC_TRY_FOO with AC_FOO_IFELSE
Autoconf 2.50 released in 2001 made several macros obsolete including
the AC_TRY_RUN, AC_TRY_COMPILE and AC_TRY_LINK:
http://git.savannah.gnu.org/cgit/autoconf.git/tree/ChangeLog.2

These macros should be replaced with the current AC_FOO_IFELSE instead:
- AC_TRY_RUN with AC_RUN_IFELSE and AC_LANG_SOURCE
- AC_TRY_LINK with AC_LINK_IFELSE and AC_LANG_PROGRAM
- AC_TRY_COMPILE with AC_COMPILE_IFELSE and AC_LANG_PROGRAM

PHP 5.4 to 7.1 require Autoconf 2.59+ version, PHP 7.2 and above require
2.64+ version, and the PHP 7.2 phpize script requires 2.59+ version which
are all greater than above mentioned 2.50 version therefore systems
should be well supported by now.

This patch was created with the help of autoupdate script:
autoupdate <file>

Reference docs:
- https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
- https://www.gnu.org/software/autoconf/manual/autoconf-2.59/autoconf.pdf
2018-07-30 02:36:38 +02:00

61 lines
1.7 KiB
Text

dnl config.m4 for extension recode
PHP_ARG_WITH(recode,for recode support,
[ --with-recode[=DIR] Include recode support])
if test "$PHP_RECODE" != "no"; then
RECODE_LIST="$PHP_RECODE /usr/local /usr /opt"
for i in $RECODE_LIST; do
if test -f $i/include/recode.h; then
RECODE_DIR=$i
RECODE_INC=include
RECODE_LIB=$PHP_LIBDIR
fi
if test -f $i/include/recode/recode.h; then
RECODE_DIR=$i
RECODE_INC=include/recode
RECODE_LIB=$PHP_LIBDIR/recode
fi
if test -f $i/recode/include/recode.h; then
RECODE_DIR=$i/recode
RECODE_INC=include
RECODE_LIB=$PHP_LIBDIR
fi
test -n "$RECODE_DIR" && break
done
if test -z "$RECODE_DIR"; then
AC_MSG_ERROR([Can not find recode.h anywhere under $RECODE_LIST.])
fi
PHP_CHECK_LIBRARY(recode, recode_format_table,
[
PHP_ADD_LIBRARY_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
], [
old_LDFLAGS=$LDFLAGS
old_LIBS=$LIBS
LDFLAGS="$LDFLAGS -L$RECODE_DIR/$RECODE_LIB"
LIBS="$LIBS -lrecode"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
char *program_name;
]],[[
recode_format_table();
]])],[
PHP_ADD_LIBRARY_DEFER_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
AC_DEFINE(HAVE_BROKEN_RECODE, 1, [Whether we have librecode 3.5])
],[
AC_MSG_ERROR(I cannot link librecode (-L$RECODE_DIR/$RECODE_LIB -lrecode). Is it installed?)
])
LIBS=$old_LIBS
LDFLAGS=$old_LDFLAGS
], [
-L$RECODE_DIR/$RECODE_LIB
])
AC_DEFINE(HAVE_LIBRECODE, 1, [Whether we have librecode 3.5 or higher])
PHP_ADD_INCLUDE($RECODE_DIR/$RECODE_INC)
PHP_SUBST(RECODE_SHARED_LIBADD)
AC_CHECK_HEADERS(stdbool.h)
PHP_NEW_EXTENSION(recode, recode.c, $ext_shared)
fi