]> diplodocus.org Git - nmh/blob - m4/mimetype.m4
b97c49d463c702becf94cb08ff6674ffb82aa499
[nmh] / m4 / mimetype.m4
1 dnl
2 dnl Try to see if we have a program that can determine the MIME type
3 dnl of a particular file
4 dnl
5 dnl Assume that if file(1) doesn't support --mime-type, then it's
6 dnl unusable. The --mime option to file 4.17 on CentOS 5.9, for
7 dnl example, prints out a long description after the mime type. We
8 dnl don't want that.
9
10 AC_DEFUN([NMH_MIMETYPEPROC],
11 [AC_CACHE_CHECK([for a program to provide a MIME type string],
12 [nmh_cv_mimetype_proc],
13 [nmh_cv_mimetype_proc=
14 for mprog in 'file --brief --mime-type' 'file --mime-type'
15 do
16 AS_IF([$mprog "${srcdir}/configure" > /dev/null 2>&1],
17 [nmh_cv_mimetype_proc="$mprog"; break])
18 done])
19 AS_IF([test X"$nmh_cv_mimetype_proc" != X],
20 [mimetype_proc="\"${nmh_cv_mimetype_proc}\""
21 AC_DEFINE_UNQUOTED([MIMETYPEPROC], [$mimetype_proc],
22 [Program, with arguments, to provides MIME type.])])])
23
24 AC_DEFUN([NMH_MIMEENCODINGPROC],
25 [AC_CACHE_CHECK([for a program to provide a MIME encoding string],
26 [nmh_cv_mimeencoding_proc],
27 [nmh_cv_mimeencoding_proc=
28 for mprog in 'file --brief --mime-encoding' 'file --mime-encoding'
29 do
30 AS_IF([$mprog "${srcdir}/configure" > /dev/null 2>&1],
31 [nmh_cv_mimeencoding_proc="$mprog"; break])
32 done])
33 AS_IF([test X"$nmh_cv_mimeencoding_proc" != X],
34 [mimeencoding_proc="\"${nmh_cv_mimeencoding_proc}\""
35 AC_DEFINE_UNQUOTED([MIMEENCODINGPROC], [$mimeencoding_proc],
36 [Program, with arguments, to provides MIME encoding.])])])