Skip to content

Commit 34f4ad6

Browse files
committed
Fix detection of gmp on clang
Split the default and custom path case. If the default is used, assume that the library must be on the default include and lib path. Only check that the version is appropriate. Something similar is needed for ldap, but the checking code is much more complex there, so I'm only adding a workaround for now.
1 parent e81751c commit 34f4ad6

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

ext/gmp/config.m4

+18-16
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,29 @@ PHP_ARG_WITH([gmp],
44
[Include GNU MP support])])
55

66
if test "$PHP_GMP" != "no"; then
7+
if test "$PHP_GMP" = "yes"; then
8+
PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
9+
[],[
10+
AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
11+
])
712

8-
MACHINE_INCLUDES=$($CC -dumpmachine)
13+
PHP_ADD_LIBRARY(gmp, GMP_SHARED_LIBADD)
14+
else
15+
if test ! -f $PHP_GMP/include/gmp.h; then
16+
AC_MSG_ERROR(Unable to locate gmp.h)
17+
fi
918

10-
for i in $PHP_GMP /usr/local /usr; do
11-
test -f $i/include/gmp.h && GMP_DIR=$i && break
12-
test -f $i/include/$MACHINE_INCLUDES/gmp.h && GMP_DIR=$i && break
13-
done
19+
PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
20+
[],[
21+
AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
22+
],[
23+
-L$PHP_GMP/$PHP_LIBDIR
24+
])
1425

15-
if test -z "$GMP_DIR"; then
16-
AC_MSG_ERROR(Unable to locate gmp.h)
26+
PHP_ADD_LIBRARY_WITH_PATH(gmp, $PHP_GMP/$PHP_LIBDIR, GMP_SHARED_LIBADD)
27+
PHP_ADD_INCLUDE($PHP_GMP/include)
1728
fi
1829

19-
PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
20-
[],[
21-
AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
22-
],[
23-
-L$GMP_DIR/$PHP_LIBDIR
24-
])
25-
26-
PHP_ADD_LIBRARY_WITH_PATH(gmp, $GMP_DIR/$PHP_LIBDIR, GMP_SHARED_LIBADD)
27-
PHP_ADD_INCLUDE($GMP_DIR/include)
2830
PHP_INSTALL_HEADERS([ext/gmp/php_gmp_int.h])
2931

3032
PHP_NEW_EXTENSION(gmp, gmp.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)

ext/ldap/config.m4

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ if test "$PHP_LDAP" != "no"; then
7979
LDAP_PTHREAD=
8080
fi
8181

82-
MACHINE_INCLUDES=$($CC -dumpmachine)
82+
dnl -pc removal is a hack for clang
83+
MACHINE_INCLUDES=$($CC -dumpmachine | $SED 's/-pc//')
8384

8485
if test -f $LDAP_LIBDIR/liblber.a || test -f $LDAP_LIBDIR/liblber.$SHLIB_SUFFIX_NAME || test -f $LDAP_LIBDIR/$MACHINE_INCLUDES/liblber.a || test -f $LDAP_LIBDIR/$MACHINE_INCLUDES/liblber.$SHLIB_SUFFIX_NAME; then
8586
PHP_ADD_LIBRARY_WITH_PATH(lber, $LDAP_LIBDIR, LDAP_SHARED_LIBADD)

0 commit comments

Comments
 (0)