1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(file, 5.11, christos@astron.com)
4 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
6 AM_CONFIG_HEADER(config.h)
7 AC_CONFIG_MACRO_DIR([m4])
9 AC_MSG_CHECKING(for builtin ELF support)
11 [ --disable-elf disable builtin ELF support],
12 [if test "${enableval}" = yes; then
14 AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
20 AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
23 AC_MSG_CHECKING(for ELF core file support)
24 AC_ARG_ENABLE(elf-core,
25 [ --disable-elf-core disable ELF core file support],
26 [if test "${enableval}" = yes; then
28 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
34 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
37 AC_MSG_CHECKING(for file formats in man section 5)
38 AC_ARG_ENABLE(fsect-man5,
39 [ --enable-fsect-man5 enable file formats in man section 5],
40 [if test "${enableval}" = yes; then
62 AM_CONDITIONAL(MINGW, test "$MINGW" = 1)
64 AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
66 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
71 dnl Checks for programs.
78 dnl Checks for headers
82 AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
83 AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
84 AC_CHECK_HEADERS(getopt.h err.h)
85 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
86 AC_CHECK_HEADERS(zlib.h)
88 dnl Checks for typedefs, structures, and compiler characteristics.
92 AC_CHECK_MEMBERS([struct stat.st_rdev])
95 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
96 AC_STRUCT_TIMEZONE_DAYLIGHT
101 AC_STRUCT_OPTION_GETOPT_H
103 AC_CHECK_TYPES([pid_t, uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
104 AC_CHECK_SIZEOF(long long)
107 typedef unsigned char uint8_t;
109 #ifndef HAVE_UINT16_T
110 typedef unsigned short uint16_t;
112 #ifndef HAVE_UINT32_T
113 typedef unsigned int uint32_t;
118 #ifndef HAVE_UINT64_T
119 #if SIZEOF_LONG_LONG == 8
120 typedef unsigned long long uint64_t;
122 typedef unsigned long uint64_t;
126 #if SIZEOF_LONG_LONG == 8
127 typedef long long int64_t;
129 typedef long int64_t;
134 AC_MSG_CHECKING(for gcc compiler warnings)
135 AC_ARG_ENABLE(warnings,
136 [ --disable-warnings disable compiler warnings],
137 [if test "${enableval}" = no -o "$GCC" = no; then
142 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
143 -Wmissing-declarations -Wredundant-decls -Wnested-externs \
144 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
145 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
147 if test "$GCC" = yes; then
149 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
150 -Wmissing-declarations -Wredundant-decls -Wnested-externs \
151 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
152 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
158 dnl Checks for functions
159 AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof fork)
161 dnl Provide implementation of some required functions if necessary
162 AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline)
164 dnl Checks for libraries
165 AC_CHECK_LIB(z,gzopen)
166 if test "$MINGW" = 1; then
167 AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
170 dnl See if we are cross-compiling
171 AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
173 AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])