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