configure.ac revision 191771
1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(file, 5.00, christos@astron.com)
3AM_INIT_AUTOMAKE
4AM_CONFIG_HEADER(config.h)
5
6AC_MSG_CHECKING(for builtin ELF support)
7AC_ARG_ENABLE(elf,
8[  --disable-elf            disable builtin ELF support],
9[if test "${enableval}" = yes; then
10  AC_MSG_RESULT(yes)
11  AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
12else
13  AC_MSG_RESULT(no)
14fi], [
15  # enable by default
16  AC_MSG_RESULT(yes)
17  AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
18])
19
20AC_MSG_CHECKING(for ELF core file support)
21AC_ARG_ENABLE(elf-core,
22[  --disable-elf-core       disable ELF core file support],
23[if test "${enableval}" = yes; then
24  AC_MSG_RESULT(yes)
25  AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
26else
27  AC_MSG_RESULT(no)
28fi], [
29  # enable by default
30  AC_MSG_RESULT(yes)
31  AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
32])
33
34AC_MSG_CHECKING(for file formats in man section 5)
35AC_ARG_ENABLE(fsect-man5,
36[  --enable-fsect-man5      enable file formats in man section 5],
37[if test "${enableval}" = yes; then
38  AC_MSG_RESULT(yes)
39  fsect=5
40else
41  AC_MSG_RESULT(no)
42  fsect=4
43fi], [
44  # disable by default
45  AC_MSG_RESULT(no)
46  fsect=4
47])
48
49AC_SUBST(fsect)
50AM_CONDITIONAL(FSECT5, test x$fsect = x5)
51
52AC_SUBST(WARNINGS)
53AC_GNU_SOURCE
54
55dnl Checks for programs.
56AC_PROG_CC
57AM_PROG_CC_C_O
58AC_PROG_INSTALL
59AC_PROG_LN_S
60AC_PROG_LIBTOOL
61
62dnl Checks for headers
63AC_HEADER_STDC
64AC_HEADER_MAJOR
65AC_HEADER_SYS_WAIT
66AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
67AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
68AC_CHECK_HEADERS(getopt.h err.h)
69AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
70AC_CHECK_HEADERS(zlib.h)
71
72dnl Checks for typedefs, structures, and compiler characteristics.
73AC_C_CONST
74AC_TYPE_OFF_T
75AC_TYPE_SIZE_T
76AC_CHECK_MEMBERS([struct stat.st_rdev])
77
78AC_STRUCT_TM
79AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
80AC_STRUCT_TIMEZONE_DAYLIGHT
81AC_SYS_LARGEFILE
82AC_FUNC_FSEEKO
83AC_TYPE_MBSTATE_T
84
85AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
86AC_CHECK_SIZEOF(long long)
87AH_BOTTOM([
88#ifndef HAVE_UINT8_T
89typedef unsigned char uint8_t;
90#endif
91#ifndef HAVE_UINT16_T
92typedef unsigned short uint16_t;
93#endif
94#ifndef HAVE_UINT32_T
95typedef unsigned int uint32_t;
96#endif
97#ifndef HAVE_INT32_T
98typedef int int32_t;
99#endif
100#ifndef HAVE_UINT64_T
101#if SIZEOF_LONG_LONG == 8
102typedef unsigned long long uint64_t;
103#else
104typedef unsigned long uint64_t;
105#endif
106#endif
107#ifndef HAVE_INT64_T
108#if SIZEOF_LONG_LONG == 8
109typedef long long int64_t;
110#else
111typedef long int64_t;
112#endif
113#endif
114])
115
116AC_MSG_CHECKING(for gcc compiler warnings)
117AC_ARG_ENABLE(warnings,
118[  --disable-warnings	disable compiler warnings],
119[if test "${enableval}" = no -o $GCC = no; then
120   AC_MSG_RESULT(no)
121   WARNINGS=
122else
123   AC_MSG_RESULT(yes)
124   WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
125       -Wmissing-declarations -Wredundant-decls -Wnested-externs \
126       -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
127       -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
128fi], [
129if test $GCC = no; then
130   WARNINGS=
131   AC_MSG_RESULT(no)
132else
133   AC_MSG_RESULT(yes)
134   WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
135       -Wmissing-declarations -Wredundant-decls -Wnested-externs \
136       -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
137       -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
138fi])
139
140dnl Checks for functions
141AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
142
143dnl Provide implementation of some required functions if necessary
144AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat)
145
146dnl Checks for libraries
147AC_CHECK_LIB(z,gzopen)
148
149dnl See if we are cross-compiling
150AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
151
152AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
153AC_OUTPUT
154