configure.ac revision 1.12
1dnl Process this file with autoconf to produce a configure script. 2AC_INIT([file],[5.30],[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 file formats in man section 5) 44AC_ARG_ENABLE(fsect-man5, 45[ --enable-fsect-man5 enable file formats in man section 5], 46[if test "${enableval}" = yes; then 47 AC_MSG_RESULT(yes) 48 fsect=5 49else 50 AC_MSG_RESULT(no) 51 fsect=4 52fi], [ 53 # disable by default 54 AC_MSG_RESULT(no) 55 fsect=4 56]) 57 58AC_CANONICAL_HOST 59case "$host_os" in 60 mingw32*) 61 MINGW=1 62 ;; 63 *) 64 MINGW=0 65 ;; 66esac 67AC_SUBST(MINGW) 68AM_CONDITIONAL(MINGW, test "$MINGW" = 1) 69 70AC_SUBST([pkgdatadir], ['$(datadir)/misc']) 71AC_SUBST(fsect) 72AM_CONDITIONAL(FSECT5, test x$fsect = x5) 73 74AC_SUBST(WARNINGS) 75 76dnl Checks for programs. 77AC_PROG_CC_STDC 78AC_USE_SYSTEM_EXTENSIONS 79AM_PROG_CC_C_O 80AC_C_BIGENDIAN 81AC_PROG_INSTALL 82AC_PROG_LN_S 83LT_INIT([disable-static pic-only]) 84gl_VISIBILITY 85dnl Checks for headers 86AC_HEADER_STDC 87AC_HEADER_MAJOR 88AC_HEADER_SYS_WAIT 89AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) 90AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) 91AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h) 92AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) 93if test "$enable_zlib" != "no"; then 94 AC_CHECK_HEADERS(zlib.h) 95fi 96AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[ 97#ifdef HAVE_SIGNAL_H 98#include <signal.h> 99#endif]) 100 101dnl Checks for typedefs, structures, and compiler characteristics. 102AC_C_CONST 103AC_TYPE_OFF_T 104AC_TYPE_SIZE_T 105AC_CHECK_MEMBERS([struct stat.st_rdev]) 106 107AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) 108AC_STRUCT_TIMEZONE 109AC_STRUCT_TIMEZONE_DAYLIGHT 110AC_SYS_LARGEFILE 111AC_FUNC_FSEEKO 112AC_TYPE_MBSTATE_T 113 114AC_STRUCT_OPTION_GETOPT_H 115AC_TYPE_PID_T 116AC_TYPE_UINT8_T 117AC_TYPE_UINT16_T 118AC_TYPE_UINT32_T 119AC_TYPE_INT32_T 120AC_TYPE_UINT64_T 121AC_TYPE_INT64_T 122AC_TYPE_INTPTR_T 123AC_TYPE_UINTPTR_T 124AC_FUNC_MMAP 125AC_FUNC_FORK 126AC_FUNC_MBRTOWC 127 128AC_MSG_CHECKING(for gcc compiler warnings) 129AC_ARG_ENABLE(warnings, 130[ --disable-warnings disable compiler warnings], 131[if test "${enableval}" = no -o "$GCC" = no; then 132 AC_MSG_RESULT(no) 133 WARNINGS= 134else 135 AC_MSG_RESULT(yes) 136 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 137 -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 138 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 139 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 140fi], [ 141if test "$GCC" = yes; then 142 AC_MSG_RESULT(yes) 143 WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 144 -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 145 -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 146 -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 147else 148 WARNINGS= 149 AC_MSG_RESULT(no) 150fi]) 151 152dnl Checks for functions 153AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) 154 155dnl Provide implementation of some required functions if necessary 156AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) 157 158dnl Checks for libraries 159if test "$enable_zlib" != "no"; then 160 AC_CHECK_LIB(z, gzopen) 161fi 162if test "$MINGW" = 1; then 163 AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW])) 164fi 165 166dnl See if we are cross-compiling 167AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes) 168 169dnl Final sanity checks 170if test "$enable_zlib" = "yes"; then 171 if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then 172 AC_MSG_ERROR([zlib support requested but not found]) 173 fi 174elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then 175 AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) 176fi 177 178AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile]) 179AC_OUTPUT 180