diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2002-08-22 12:21:25 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2002-08-22 12:21:25 +0000 |
commit | 848bcf75271d0640a5b604d039c1d2cbbcbad47f (patch) | |
tree | 403a4efe81279442dd59ef2d08deaff753bb04a7 | |
parent | 484d7793e0b26907193d4742190740859fe244dc (diff) | |
download | php-git-848bcf75271d0640a5b604d039c1d2cbbcbad47f.tar.gz |
Instead of hardcoding the path of magic.mime file, try to find the file
inside common paths for the file.
-rw-r--r-- | ext/mime_magic/config.m4 | 17 | ||||
-rw-r--r-- | ext/mime_magic/mime_magic.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/ext/mime_magic/config.m4 b/ext/mime_magic/config.m4 index 9342ed2306..aca9094bef 100644 --- a/ext/mime_magic/config.m4 +++ b/ext/mime_magic/config.m4 @@ -8,4 +8,21 @@ if test "$PHP_MIME_MAGIC" = "yes"; then dnl PHP_SUBST(MIME_MAGIC_SHARED_LIBADD) 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 + else + PHP_MIME_MAGIC_FILE_PATH="" + fi + + AC_DEFINE_UNQUOTED(PHP_MIME_MAGIC_FILE_PATH,"$PHP_MIME_MAGIC_FILE_PATH",[magic file path]) + fi diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c index 54a8220205..770ef2f358 100644 --- a/ext/mime_magic/mime_magic.c +++ b/ext/mime_magic/mime_magic.c @@ -235,7 +235,7 @@ ZEND_GET_MODULE(mime_magic) /* {{{ PHP_INI */ PHP_INI_BEGIN() -STD_PHP_INI_ENTRY("mime_magic.magicfile", "/usr/share/misc/magic.mime", PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals) +STD_PHP_INI_ENTRY("mime_magic.magicfile", PHP_MIME_MAGIC_FILE_PATH, PHP_INI_SYSTEM, OnUpdateString, magicfile, zend_mime_magic_globals, mime_magic_globals) PHP_INI_END() /* }}} */ |