|
1 | 1 | PHP_ARG_ENABLE(decimal, whether to enable decimal support, |
2 | | -[ --enable-decimal Enable decimal support]) |
| 2 | +[ --enable-decimal Enable decimal support]) |
| 3 | + |
| 4 | +PHP_ARG_WITH(libmpdec-path, for libmpdec custom path, |
| 5 | +[ --with-libmpdec-path libmpdec path], no, no) |
3 | 6 |
|
4 | 7 | if test "$PHP_DECIMAL" != "no"; then |
5 | 8 |
|
6 | | - AC_MSG_CHECKING([for libmpdec files in default path]) |
7 | | - for i in /usr/$PHP_LIBDIR $(locate -e /usr/**/libmpdec.so); do |
8 | | - if test -r $i; then |
9 | | - LIBMPDEC_DIR=$(dirname $i) |
| 9 | + MACHINE_INCLUDES=$($CC -dumpmachine) |
| 10 | + AC_MSG_CHECKING([for libmpdec library in default path]) |
| 11 | + for i in $PHP_LIBMPDEC_PATH /usr /usr/local/; do |
| 12 | + if test -r $i/$PHP_LIBDIR/libmpdec.$SHLIB_SUFFIX_NAME || test -r $i/$PHP_LIBDIR/libmpdec.a; then |
| 13 | + LIBMPDEC_DIR=$i/$PHP_LIBDIR |
| 14 | + LIBMPDEC_INC=$i/include |
| 15 | + AC_MSG_RESULT(found in $LIBMPDEC_DIR) |
| 16 | + break |
| 17 | + elif test -r $i/lib/libmpdec.$SHLIB_SUFFIX_NAME || test -r $i/lib/libmpdec.a; then |
| 18 | + LIBMPDEC_DIR=$i/lib |
| 19 | + LIBMPDEC_INC=$i/include |
| 20 | + AC_MSG_RESULT(found in $LIBMPDEC_DIR) |
| 21 | + break |
| 22 | + elif test -r $i/lib/$MACHINE_INCLUDES/libmpdec.so ; then |
| 23 | + LIBMPDEC_DIR=$i/lib/$MACHINE_INCLUDES |
| 24 | + LIBMPDEC_INC=$i/include/$MACHINE_INCLUDES |
10 | 25 | AC_MSG_RESULT(found in $LIBMPDEC_DIR) |
11 | 26 | break |
12 | 27 | fi |
13 | 28 | done |
14 | 29 |
|
| 30 | + |
15 | 31 | if test -z "$LIBMPDEC_DIR"; then |
16 | 32 | AC_MSG_RESULT([Could not find libmpdec]) |
17 | 33 | AC_MSG_ERROR([Please reinstall the libmpdec distribution from http://www.bytereef.org/mpdecimal/]) |
| 34 | + |
| 35 | + else |
| 36 | + AC_MSG_CHECKING([for libmpdec headers in default path]) |
| 37 | + if test -r $LIBMPDEC_INC/mpdecimal.h; then |
| 38 | + PHP_ADD_INCLUDE(LIBMPDEC_INC) |
| 39 | + AC_MSG_RESULT(found in $LIBMPDEC_INC) |
| 40 | + else |
| 41 | + AC_MSG_WARN(not found) |
| 42 | + fi |
18 | 43 | fi |
19 | 44 |
|
| 45 | + |
20 | 46 | PHP_CHECK_LIBRARY(mpdec, mpd_version, [ |
21 | | - PHP_ADD_LIBRARY_WITH_PATH(mpdec, $LIBMPDEC_DIR/$PHP_LIBDIR, DECIMAL_SHARED_LIBADD) |
| 47 | + PHP_ADD_LIBRARY_WITH_PATH(mpdec, $LIBMPDEC_DIR, DECIMAL_SHARED_LIBADD) |
22 | 48 | AC_DEFINE(HAVE_LIBMPDEC, 1, [ ]) |
23 | 49 | ],[ |
24 | 50 | AC_MSG_ERROR([Please check your version of libmpdec (~2.4.0)]) |
25 | 51 | ],[ |
26 | | - -L$LIBMPDEC_DIR/$PHP_LIBDIR -lm |
| 52 | + -L$LIBMPDEC_DIR -lm |
27 | 53 | ]) |
28 | 54 |
|
29 | 55 | PHP_NEW_EXTENSION(decimal, php_decimal.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) |
|
0 commit comments