1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([file],[5.22],[christos@astron.com])
3 AM_INIT_AUTOMAKE([subdir-objects foreign])
4 AM_MAINTAINER_MODE(disable)
5 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
7 AC_CONFIG_HEADERS([config.h])
8 AC_CONFIG_MACRO_DIR([m4])
10 AC_MSG_CHECKING(for builtin ELF support)
12 [ --disable-elf disable builtin ELF support],
13 [if test "${enableval}" = yes; then
15 AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
21 AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
24 AC_MSG_CHECKING(for ELF core file support)
25 AC_ARG_ENABLE(elf-core,
26 [ --disable-elf-core disable ELF core file support],
27 [if test "${enableval}" = yes; then
29 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
35 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
38 AC_MSG_CHECKING(for file formats in man section 5)
39 AC_ARG_ENABLE(fsect-man5,
40 [ --enable-fsect-man5 enable file formats in man section 5],
41 [if test "${enableval}" = yes; then
63 AM_CONDITIONAL(MINGW, test "$MINGW" = 1)
65 AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
67 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
71 dnl Checks for programs.
73 AC_USE_SYSTEM_EXTENSIONS
78 LT_INIT([disable-static pic-only])
80 dnl Checks for headers
84 AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
85 AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
86 AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
87 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
88 AC_CHECK_HEADERS(zlib.h)
90 dnl Checks for typedefs, structures, and compiler characteristics.
94 AC_CHECK_MEMBERS([struct stat.st_rdev])
96 AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
98 AC_STRUCT_TIMEZONE_DAYLIGHT
103 AC_STRUCT_OPTION_GETOPT_H
117 AC_MSG_CHECKING(for gcc compiler warnings)
118 AC_ARG_ENABLE(warnings,
119 [ --disable-warnings disable compiler warnings],
120 [if test "${enableval}" = no -o "$GCC" = no; then
125 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
126 -Wmissing-declarations -Wredundant-decls -Wnested-externs \
127 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
128 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
130 if test "$GCC" = yes; then
132 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
133 -Wmissing-declarations -Wredundant-decls -Wnested-externs \
134 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
135 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
141 dnl Checks for functions
142 AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale)
144 dnl Provide implementation of some required functions if necessary
145 AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck)
147 dnl Checks for libraries
148 AC_CHECK_LIB(z,gzopen)
149 if test "$MINGW" = 1; then
150 AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
153 dnl See if we are cross-compiling
154 AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
156 AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])