1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(file, 5.03, christos@astron.com)
4 AM_CONFIG_HEADER(config.h)
5 #AC_CONFIG_MACRO_DIR([m4])
7 AC_MSG_CHECKING(for builtin ELF support)
9 [ --disable-elf disable builtin ELF support],
10 [if test "${enableval}" = yes; then
12 AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
18 AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
21 AC_MSG_CHECKING(for ELF core file support)
22 AC_ARG_ENABLE(elf-core,
23 [ --disable-elf-core disable ELF core file support],
24 [if test "${enableval}" = yes; then
26 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
32 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
35 AC_MSG_CHECKING(for file formats in man section 5)
36 AC_ARG_ENABLE(fsect-man5,
37 [ --enable-fsect-man5 enable file formats in man section 5],
38 [if test "${enableval}" = yes; then
50 AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
52 AM_CONDITIONAL(FSECT5, test x$fsect = x5)
57 dnl Checks for programs.
64 dnl Checks for headers
68 AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
69 AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
70 AC_CHECK_HEADERS(getopt.h err.h)
71 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
72 AC_CHECK_HEADERS(zlib.h)
74 dnl Checks for typedefs, structures, and compiler characteristics.
78 AC_CHECK_MEMBERS([struct stat.st_rdev])
81 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
82 AC_STRUCT_TIMEZONE_DAYLIGHT
87 AC_STRUCT_OPTION_GETOPT_H
89 AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
90 AC_CHECK_SIZEOF(long long)
93 typedef unsigned char uint8_t;
96 typedef unsigned short uint16_t;
99 typedef unsigned int uint32_t;
104 #ifndef HAVE_UINT64_T
105 #if SIZEOF_LONG_LONG == 8
106 typedef unsigned long long uint64_t;
108 typedef unsigned long uint64_t;
112 #if SIZEOF_LONG_LONG == 8
113 typedef long long int64_t;
115 typedef long int64_t;
120 AC_MSG_CHECKING(for gcc compiler warnings)
121 AC_ARG_ENABLE(warnings,
122 [ --disable-warnings disable compiler warnings],
123 [if test "${enableval}" = no -o "$GCC" = no; then
128 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
129 -Wmissing-declarations -Wredundant-decls -Wnested-externs \
130 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
131 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
133 if test "$GCC" = no; then
138 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
139 -Wmissing-declarations -Wredundant-decls -Wnested-externs \
140 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
141 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
144 dnl Checks for functions
145 AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
147 dnl Provide implementation of some required functions if necessary
148 AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat)
150 dnl Checks for libraries
151 AC_CHECK_LIB(z,gzopen)
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])