configure.ac revision 1.19
1dnl Process this file with autoconf to produce a configure script. 2AC_INIT([file],[5.39],[christos@astron.com]) 3AM_INIT_AUTOMAKE([subdir-objects foreign]) 4AM_MAINTAINER_MODE(disable) 5m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 6 7AC_CONFIG_HEADERS([config.h]) 8AC_CONFIG_MACRO_DIR([m4]) 9 10AC_MSG_CHECKING(for builtin ELF support) 11AC_ARG_ENABLE(elf, 12[ --disable-elf disable builtin ELF support], 13[if test "${enableval}" = yes; then 14 AC_MSG_RESULT(yes) 15 AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used]) 16else 17 AC_MSG_RESULT(no) 18fi], [ 19 # enable by default 20 AC_MSG_RESULT(yes) 21 AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used]) 22]) 23 24AC_MSG_CHECKING(for ELF core file support) 25AC_ARG_ENABLE(elf-core, 26[ --disable-elf-core disable ELF core file support], 27[if test "${enableval}" = yes; then 28 AC_MSG_RESULT(yes) 29 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 30else 31 AC_MSG_RESULT(no) 32fi], [ 33 # enable by default 34 AC_MSG_RESULT(yes) 35 AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 36]) 37 38AC_MSG_CHECKING(for zlib support) 39AC_ARG_ENABLE([zlib], 40[AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])]) 41AC_MSG_RESULT($enable_zlib) 42 43AC_MSG_CHECKING(for bzlib support) 44AC_ARG_ENABLE([bzlib], 45[AS_HELP_STRING([--disable-bzlib], [disable bz2lib compression support @<:@default=auto@:>@])]) 46AC_MSG_RESULT($enable_bzlib) 47 48AC_MSG_CHECKING(for xzlib support) 49AC_ARG_ENABLE([xzlib], 50[AS_HELP_STRING([--disable-xzlib], [disable liblzma/xz compression support @<:@default=auto@:>@])]) 51AC_MSG_RESULT($enable_xzlib) 52 53AC_MSG_CHECKING(for libseccomp support) 54AC_ARG_ENABLE([libseccomp], 55[AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])]) 56AC_MSG_RESULT($enable_libseccomp) 57 58AC_MSG_CHECKING(for file formats in man section 5) 59AC_ARG_ENABLE(fsect-man5, 60[ --enable-fsect-man5 enable file formats in man section 5], 61[if test "${enableval}" = yes; then 62 AC_MSG_RESULT(yes) 63 fsect=5 64else 65 AC_MSG_RESULT(no) 66 fsect=4 67fi], [ 68 # disable by default 69 AC_MSG_RESULT(no) 70 fsect=4 71]) 72 73AC_CANONICAL_HOST 74case "$host_os" in 75 mingw32*) 76 MINGW=1 77 ;; 78 *) 79 MINGW=0 80 ;; 81esac 82AC_SUBST(MINGW) 83AM_CONDITIONAL(MINGW, test "$MINGW" = 1) 84 85AC_SUBST([pkgdatadir], ['$(datadir)/misc']) 86AC_SUBST(fsect) 87AM_CONDITIONAL(FSECT5, test x$fsect = x5) 88 89AC_SUBST(WARNINGS) 90 91dnl Checks for programs. 92AC_PROG_CC_STDC 93AC_USE_SYSTEM_EXTENSIONS 94AM_PROG_CC_C_O 95AC_C_BIGENDIAN 96AC_PROG_INSTALL 97AC_PROG_LN_S 98LT_INIT([disable-static pic-only]) 99gl_VISIBILITY 100dnl Checks for headers 101AC_HEADER_STDC 102AC_HEADER_MAJOR 103AC_HEADER_SYS_WAIT 104AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h) 105AC_CHECK_HEADERS(utime.h wchar.h wctype.h) 106AC_CHECK_HEADERS(getopt.h err.h xlocale.h) 107AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h) 108if test "$enable_zlib" != "no"; then 109 AC_CHECK_HEADERS(zlib.h) 110fi 111if test "$enable_bzlib" != "no"; then 112 AC_CHECK_HEADERS(bzlib.h) 113fi 114if test "$enable_xzlib" != "no"; then 115 AC_CHECK_HEADERS(lzma.h) 116fi 117AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>]) 118 119dnl Checks for typedefs, structures, and compiler characteristics. 120AC_TYPE_OFF_T 121AC_TYPE_SIZE_T 122AC_CHECK_MEMBERS([struct stat.st_rdev]) 123 124AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>]) 125AC_STRUCT_TIMEZONE 126AC_STRUCT_TIMEZONE_DAYLIGHT 127AC_SYS_LARGEFILE 128AC_FUNC_FSEEKO 129AC_TYPE_MBSTATE_T 130 131AC_STRUCT_OPTION_GETOPT_H 132AC_TYPE_PID_T 133AC_TYPE_UINT8_T 134AC_TYPE_UINT16_T 135AC_TYPE_UINT32_T 136AC_TYPE_INT32_T 137AC_TYPE_UINT64_T 138AC_TYPE_INT64_T 139AC_TYPE_INTPTR_T 140AC_TYPE_UINTPTR_T 141AC_FUNC_MMAP 142AC_FUNC_FORK 143AC_FUNC_MBRTOWC 144 145AC_MSG_CHECKING(for gcc compiler warnings) 146AC_ARG_ENABLE(warnings, 147[ --disable-warnings disable compiler warnings], 148[if test "${enableval}" = no -o "$GCC" = no; then 149 AC_MSG_RESULT(no) 150 WARNINGS= 151else 152 AC_MSG_RESULT(yes) 153 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 154 -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 155 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 156 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 157fi], [ 158if test "$GCC" = yes; then 159 AC_MSG_RESULT(yes) 160 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 161 -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 162 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 163 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 164else 165 WARNINGS= 166 AC_MSG_RESULT(no) 167fi]) 168 169dnl Checks for functions 170AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem) 171 172dnl Provide implementation of some required functions if necessary 173AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) 174 175dnl Checks for libraries 176if test "$enable_zlib" != "no"; then 177 AC_CHECK_LIB(z, gzopen) 178fi 179if test "$enable_bzlib" != "no"; then 180 AC_CHECK_LIB(bz2, BZ2_bzCompressInit) 181fi 182if test "$enable_xzlib" != "no"; then 183 AC_CHECK_LIB(lzma, lzma_stream_decoder) 184fi 185if test "$enable_libseccomp" != "no"; then 186 AC_CHECK_LIB(seccomp, seccomp_init) 187fi 188if test "$MINGW" = 1; then 189 AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW])) 190fi 191 192dnl See if we are cross-compiling 193AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes) 194 195dnl Final sanity checks 196if test "$enable_zlib" = "yes"; then 197 if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then 198 AC_MSG_ERROR([zlib support requested but not found]) 199 fi 200fi 201if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then 202 AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) 203fi 204if test "$enable_bzlib" = "yes"; then 205 if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" != "yesyes"; then 206 AC_MSG_ERROR([bzlib support requested but not found]) 207 fi 208fi 209if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yesyes"; then 210 AC_DEFINE([BZLIBSUPPORT], 1, [Enable bzlib compression support]) 211fi 212if test "$enable_xzlib" = "yes"; then 213 if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" != "yesyes"; then 214 AC_MSG_ERROR([xzlib support requested but not found]) 215 fi 216fi 217if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" = "yesyes"; then 218 AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support]) 219fi 220 221AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile libmagic.pc]) 222AC_OUTPUT 223