summaryrefslogtreecommitdiff
path: root/ext/recode
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2002-04-29 15:40:16 +0000
committerfoobar <sniper@php.net>2002-04-29 15:40:16 +0000
commitd066ed7c0e30f3e5741b22f86ca0fd11a24f252f (patch)
tree6e80118a54df42590b8a31f37ce1559f8c8c62f2 /ext/recode
parent43d46c2c410c123e7e0a67362bd61a2377d35276 (diff)
downloadphp-git-d066ed7c0e30f3e5741b22f86ca0fd11a24f252f.tar.gz
Make it possible to use recode 3.5 too. (happy now Wez? :)
Diffstat (limited to 'ext/recode')
-rw-r--r--ext/recode/config.m425
-rw-r--r--ext/recode/recode.c2
2 files changed, 23 insertions, 4 deletions
diff --git a/ext/recode/config.m4 b/ext/recode/config.m4
index fc134ffc77..aae118a76b 100644
--- a/ext/recode/config.m4
+++ b/ext/recode/config.m4
@@ -30,16 +30,33 @@ if test "$PHP_RECODE" != "no"; then
AC_MSG_ERROR([Can not find recode.h anywhere under $RECODE_LIST.])
fi
- PHP_CHECK_LIBRARY(recode, recode_format_table, [
- AC_DEFINE(HAVE_LIBRECODE, 1, [Whether we have librecode 3.5 or higher])
+ PHP_CHECK_LIBRARY(recode, recode_format_table,
+ [
+ PHP_ADD_LIBRARY_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
], [
- AC_MSG_ERROR(I cannot link librecode (-L$RECODE_DIR/$RECODE_LIB -lrecode). Is it installed?)
+ old_LDFLAGS=$LDFLAGS
+ old_LIBS=$LIBS
+ LDFLAGS="$LDFLAGS -L$RECODE_DIR/$RECODE_LIB"
+ LIBS="$LIBS -lrecode"
+ AC_TRY_LINK(
+ [
+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_ADD_LIBRARY_WITH_PATH(recode, $RECODE_DIR/$RECODE_LIB, RECODE_SHARED_LIBADD)
PHP_SUBST(RECODE_SHARED_LIBADD)
AC_CHECK_HEADERS(stdbool.h)
PHP_NEW_EXTENSION(recode, recode.c, $ext_shared)
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
index cb91166012..9c1c837440 100644
--- a/ext/recode/recode.c
+++ b/ext/recode/recode.c
@@ -30,8 +30,10 @@
#if HAVE_LIBRECODE
/* For recode 3.5 */
+#if HAVE_BROKEN_RECODE
extern char *program_name;
char *program_name = "php";
+#endif
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>