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