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