summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 27 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 1e2457c..946198b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([file],[5.22],[christos@astron.com])
+AC_INIT([file],[5.32],[christos@astron.com])
AM_INIT_AUTOMAKE([subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -34,6 +34,11 @@ fi], [
AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
])
+AC_MSG_CHECKING(for zlib support)
+AC_ARG_ENABLE(zlib,
+[AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])])
+AC_MSG_RESULT($enable_zlib)
+
AC_MSG_CHECKING(for file formats in man section 5)
AC_ARG_ENABLE(fsect-man5,
[ --enable-fsect-man5 enable file formats in man section 5],
@@ -82,9 +87,15 @@ AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
-AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
+AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h)
AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
-AC_CHECK_HEADERS(zlib.h)
+if test "$enable_zlib" != "no"; then
+ AC_CHECK_HEADERS(zlib.h)
+fi
+AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -141,10 +152,12 @@ dnl Checks for functions
AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale)
dnl Provide implementation of some required functions if necessary
-AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck)
+AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)
dnl Checks for libraries
-AC_CHECK_LIB(z,gzopen)
+if test "$enable_zlib" != "no"; then
+ AC_CHECK_LIB(z, gzopen)
+fi
if test "$MINGW" = 1; then
AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
fi
@@ -152,5 +165,14 @@ fi
dnl See if we are cross-compiling
AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
+dnl Final sanity checks
+if test "$enable_zlib" = "yes"; then
+ if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then
+ AC_MSG_ERROR([zlib support requested but not found])
+ fi
+elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then
+ AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support])
+fi
+
AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
AC_OUTPUT