configure.ac revision 192350
1186690Sobriendnl Process this file with autoconf to produce a configure script.
2192350SdelphijAC_INIT(file, 5.03, christos@astron.com)
3186690SobrienAM_INIT_AUTOMAKE
4186690SobrienAM_CONFIG_HEADER(config.h)
5192350Sdelphij#AC_CONFIG_MACRO_DIR([m4])
6186690Sobrien
7186690SobrienAC_MSG_CHECKING(for builtin ELF support)
8186690SobrienAC_ARG_ENABLE(elf,
9186690Sobrien[  --disable-elf            disable builtin ELF support],
10186690Sobrien[if test "${enableval}" = yes; then
11186690Sobrien  AC_MSG_RESULT(yes)
12186690Sobrien  AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
13186690Sobrienelse
14186690Sobrien  AC_MSG_RESULT(no)
15186690Sobrienfi], [
16186690Sobrien  # enable by default
17186690Sobrien  AC_MSG_RESULT(yes)
18186690Sobrien  AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
19186690Sobrien])
20186690Sobrien
21186690SobrienAC_MSG_CHECKING(for ELF core file support)
22186690SobrienAC_ARG_ENABLE(elf-core,
23186690Sobrien[  --disable-elf-core       disable ELF core file support],
24186690Sobrien[if test "${enableval}" = yes; then
25186690Sobrien  AC_MSG_RESULT(yes)
26186690Sobrien  AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
27186690Sobrienelse
28186690Sobrien  AC_MSG_RESULT(no)
29186690Sobrienfi], [
30186690Sobrien  # enable by default
31186690Sobrien  AC_MSG_RESULT(yes)
32186690Sobrien  AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
33186690Sobrien])
34186690Sobrien
35186690SobrienAC_MSG_CHECKING(for file formats in man section 5)
36186690SobrienAC_ARG_ENABLE(fsect-man5,
37186690Sobrien[  --enable-fsect-man5      enable file formats in man section 5],
38186690Sobrien[if test "${enableval}" = yes; then
39186690Sobrien  AC_MSG_RESULT(yes)
40186690Sobrien  fsect=5
41186690Sobrienelse
42186690Sobrien  AC_MSG_RESULT(no)
43186690Sobrien  fsect=4
44186690Sobrienfi], [
45186690Sobrien  # disable by default
46186690Sobrien  AC_MSG_RESULT(no)
47186690Sobrien  fsect=4
48186690Sobrien])
49186690Sobrien
50192350SdelphijAC_SUBST([pkgdatadir], ['$(datadir)/misc'])
51186690SobrienAC_SUBST(fsect)
52186690SobrienAM_CONDITIONAL(FSECT5, test x$fsect = x5)
53186690Sobrien
54186690SobrienAC_SUBST(WARNINGS)
55186690SobrienAC_GNU_SOURCE
56186690Sobrien
57186690Sobriendnl Checks for programs.
58186690SobrienAC_PROG_CC
59186690SobrienAM_PROG_CC_C_O
60186690SobrienAC_PROG_INSTALL
61186690SobrienAC_PROG_LN_S
62186690SobrienAC_PROG_LIBTOOL
63186690Sobrien
64186690Sobriendnl Checks for headers
65186690SobrienAC_HEADER_STDC
66186690SobrienAC_HEADER_MAJOR
67186690SobrienAC_HEADER_SYS_WAIT
68186690SobrienAC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
69186690SobrienAC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
70186690SobrienAC_CHECK_HEADERS(getopt.h err.h)
71186690SobrienAC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
72186690SobrienAC_CHECK_HEADERS(zlib.h)
73186690Sobrien
74186690Sobriendnl Checks for typedefs, structures, and compiler characteristics.
75186690SobrienAC_C_CONST
76186690SobrienAC_TYPE_OFF_T
77186690SobrienAC_TYPE_SIZE_T
78186690SobrienAC_CHECK_MEMBERS([struct stat.st_rdev])
79186690Sobrien
80191771SobrienAC_STRUCT_TM
81191771SobrienAC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
82186690SobrienAC_STRUCT_TIMEZONE_DAYLIGHT
83186690SobrienAC_SYS_LARGEFILE
84186690SobrienAC_FUNC_FSEEKO
85186690SobrienAC_TYPE_MBSTATE_T
86186690Sobrien
87192350SdelphijAC_STRUCT_OPTION_GETOPT_H
88192350Sdelphij
89186690SobrienAC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
90186690SobrienAC_CHECK_SIZEOF(long long)
91186690SobrienAH_BOTTOM([
92186690Sobrien#ifndef HAVE_UINT8_T
93186690Sobrientypedef unsigned char uint8_t;
94186690Sobrien#endif
95186690Sobrien#ifndef HAVE_UINT16_T
96186690Sobrientypedef unsigned short uint16_t;
97186690Sobrien#endif
98186690Sobrien#ifndef HAVE_UINT32_T
99186690Sobrientypedef unsigned int uint32_t;
100186690Sobrien#endif
101186690Sobrien#ifndef HAVE_INT32_T
102186690Sobrientypedef int int32_t;
103186690Sobrien#endif
104186690Sobrien#ifndef HAVE_UINT64_T
105186690Sobrien#if SIZEOF_LONG_LONG == 8
106186690Sobrientypedef unsigned long long uint64_t;
107186690Sobrien#else
108186690Sobrientypedef unsigned long uint64_t;
109186690Sobrien#endif
110186690Sobrien#endif
111186690Sobrien#ifndef HAVE_INT64_T
112186690Sobrien#if SIZEOF_LONG_LONG == 8
113186690Sobrientypedef long long int64_t;
114186690Sobrien#else
115186690Sobrientypedef long int64_t;
116186690Sobrien#endif
117186690Sobrien#endif
118186690Sobrien])
119186690Sobrien
120186690SobrienAC_MSG_CHECKING(for gcc compiler warnings)
121186690SobrienAC_ARG_ENABLE(warnings,
122186690Sobrien[  --disable-warnings	disable compiler warnings],
123192350Sdelphij[if test "${enableval}" = no -o "$GCC" = no; then
124186690Sobrien   AC_MSG_RESULT(no)
125186690Sobrien   WARNINGS=
126186690Sobrienelse
127186690Sobrien   AC_MSG_RESULT(yes)
128186690Sobrien   WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
129186690Sobrien       -Wmissing-declarations -Wredundant-decls -Wnested-externs \
130186690Sobrien       -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
131186690Sobrien       -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
132186690Sobrienfi], [
133192350Sdelphijif test "$GCC" = no; then
134186690Sobrien   WARNINGS=
135186690Sobrien   AC_MSG_RESULT(no)
136186690Sobrienelse
137186690Sobrien   AC_MSG_RESULT(yes)
138186690Sobrien   WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
139186690Sobrien       -Wmissing-declarations -Wredundant-decls -Wnested-externs \
140186690Sobrien       -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
141186690Sobrien       -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
142186690Sobrienfi])
143186690Sobrien
144186690Sobriendnl Checks for functions
145186690SobrienAC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
146186690Sobrien
147186690Sobriendnl Provide implementation of some required functions if necessary
148191771SobrienAC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat)
149186690Sobrien
150186690Sobriendnl Checks for libraries
151186690SobrienAC_CHECK_LIB(z,gzopen)
152186690Sobrien
153186690Sobriendnl See if we are cross-compiling
154186690SobrienAM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
155186690Sobrien
156186690SobrienAC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
157186690SobrienAC_OUTPUT
158