summaryrefslogtreecommitdiff
path: root/ext/mime_magic
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2003-01-28 01:00:15 +0000
committerfoobar <sniper@php.net>2003-01-28 01:00:15 +0000
commit946032f40b68e78d9930e84f7f64c21b9dee8cca (patch)
treeca5813ebc2651c3662b99f31a9fec8e69d19a7cf /ext/mime_magic
parentb9a7918c43f7c0d84200f9202347734d102edbf5 (diff)
downloadphp-git-946032f40b68e78d9930e84f7f64c21b9dee8cca.tar.gz
- Cleaned up and made less error-prone
- Changed --enable-mime-magic -> --with-mime-magic[=FILE] to allow specifying of the file during configure.
Diffstat (limited to 'ext/mime_magic')
-rw-r--r--ext/mime_magic/config.m443
1 files changed, 26 insertions, 17 deletions
diff --git a/ext/mime_magic/config.m4 b/ext/mime_magic/config.m4
index 30dcbda58e..506c785630 100644
--- a/ext/mime_magic/config.m4
+++ b/ext/mime_magic/config.m4
@@ -1,28 +1,37 @@
+dnl
dnl $Id$
-dnl config.m4 for extension mime_magic
+dnl
-PHP_ARG_ENABLE(mime-magic, whether to enable mime_magic support,
-[ --enable-mime-magic Enable mime_magic support])
+PHP_ARG_WITH(mime-magic, whether to include mime_magic support,
+[ --with-mime-magic[=FILE] Include mime_magic support. FILE is the optional
+ pathname to the magic.mime file.])
-if test "$PHP_MIME_MAGIC" = "yes"; then
- dnl PHP_SUBST(MIME_MAGIC_SHARED_LIBADD)
+if test "$PHP_MIME_MAGIC" != "no"; then
PHP_NEW_EXTENSION(mime_magic, mime_magic.c, $ext_shared)
- # Try to see if we can find the path of the magic file in its
- # default locations.
- if test -f /usr/share/magic.mime ; then
- PHP_MIME_MAGIC_FILE_PATH=/usr/share/magic.mime
- elif test -f /usr/share/magic ; then
- PHP_MIME_MAGIC_FILE_PATH=/usr/share/magic
- elif test -f /usr/share/misc/magic.mime ; then
- PHP_MIME_MAGIC_FILE_PATH=/usr/share/misc/magic.mime
- elif test -f /etc/magic ; then
- PHP_MIME_MAGIC_FILE_PATH=/etc/magic.mime
+ PHP_MIME_MAGIC_FILE_PATH=
+
+ dnl
+ dnl Try to see if we can find the path of the magic file in its default locations.
+ dnl
+ if test "$PHP_MIME_MAGIC" = "yes"; then
+ if test -f $PHP_MIME_MAGIC; then
+ PHP_MIME_MAGIC_FILE_PATH=$PHP_MIME_MAGIC
+ else
+ AC_MSG_ERROR([File '$PHP_MIME_MAGIC' not found!])
+ fi
else
- PHP_MIME_MAGIC_FILE_PATH=""
- fi
+ MAGIC_MIME_LOCATIONS="/usr/share/magic.mime /usr/share/misc/magic.mime /etc/magic.mime"
+ for i in $MAGIC_MIME_LOCATIONS; do
+ if test -f $i; then
+ PHP_MIME_MAGIC_FILE_PATH=$i
+ break
+ fi
+ done
+ fi
+
AC_DEFINE_UNQUOTED(PHP_MIME_MAGIC_FILE_PATH,"$PHP_MIME_MAGIC_FILE_PATH",[magic file path])
fi