|
| 1 | +dnl |
1 | 2 | dnl $Id$
|
2 |
| -dnl config.m4 for extension mime_magic |
| 3 | +dnl |
3 | 4 |
|
4 |
| -PHP_ARG_ENABLE(mime-magic, whether to enable mime_magic support, |
5 |
| -[ --enable-mime-magic Enable mime_magic support]) |
| 5 | +PHP_ARG_WITH(mime-magic, whether to include mime_magic support, |
| 6 | +[ --with-mime-magic[=FILE] Include mime_magic support. FILE is the optional |
| 7 | + pathname to the magic.mime file.]) |
6 | 8 |
|
7 |
| -if test "$PHP_MIME_MAGIC" = "yes"; then |
8 |
| - dnl PHP_SUBST(MIME_MAGIC_SHARED_LIBADD) |
| 9 | +if test "$PHP_MIME_MAGIC" != "no"; then |
9 | 10 |
|
10 | 11 | PHP_NEW_EXTENSION(mime_magic, mime_magic.c, $ext_shared)
|
11 | 12 |
|
12 |
| - # Try to see if we can find the path of the magic file in its |
13 |
| - # default locations. |
14 |
| - if test -f /usr/share/magic.mime ; then |
15 |
| - PHP_MIME_MAGIC_FILE_PATH=/usr/share/magic.mime |
16 |
| - elif test -f /usr/share/magic ; then |
17 |
| - PHP_MIME_MAGIC_FILE_PATH=/usr/share/magic |
18 |
| - elif test -f /usr/share/misc/magic.mime ; then |
19 |
| - PHP_MIME_MAGIC_FILE_PATH=/usr/share/misc/magic.mime |
20 |
| - elif test -f /etc/magic ; then |
21 |
| - PHP_MIME_MAGIC_FILE_PATH=/etc/magic.mime |
| 13 | + PHP_MIME_MAGIC_FILE_PATH= |
| 14 | + |
| 15 | + dnl |
| 16 | + dnl Try to see if we can find the path of the magic file in its default locations. |
| 17 | + dnl |
| 18 | + if test "$PHP_MIME_MAGIC" = "yes"; then |
| 19 | + if test -f $PHP_MIME_MAGIC; then |
| 20 | + PHP_MIME_MAGIC_FILE_PATH=$PHP_MIME_MAGIC |
| 21 | + else |
| 22 | + AC_MSG_ERROR([File '$PHP_MIME_MAGIC' not found!]) |
| 23 | + fi |
22 | 24 | else
|
23 |
| - PHP_MIME_MAGIC_FILE_PATH="" |
24 |
| - fi |
| 25 | + MAGIC_MIME_LOCATIONS="/usr/share/magic.mime /usr/share/misc/magic.mime /etc/magic.mime" |
25 | 26 |
|
| 27 | + for i in $MAGIC_MIME_LOCATIONS; do |
| 28 | + if test -f $i; then |
| 29 | + PHP_MIME_MAGIC_FILE_PATH=$i |
| 30 | + break |
| 31 | + fi |
| 32 | + done |
| 33 | + fi |
| 34 | + |
26 | 35 | AC_DEFINE_UNQUOTED(PHP_MIME_MAGIC_FILE_PATH,"$PHP_MIME_MAGIC_FILE_PATH",[magic file path])
|
27 | 36 |
|
28 | 37 | fi
|
0 commit comments