1186690Sobriendnl Process this file with autoconf to produce a configure script. 2284193SdelphijAC_INIT([file],[5.22],[christos@astron.com]) 3268515SdelphijAM_INIT_AUTOMAKE([subdir-objects foreign]) 4234449Sobrienm4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 5234449Sobrien 6268515SdelphijAC_CONFIG_HEADERS([config.h]) 7234449SobrienAC_CONFIG_MACRO_DIR([m4]) 8186690Sobrien 9186690SobrienAC_MSG_CHECKING(for builtin ELF support) 10186690SobrienAC_ARG_ENABLE(elf, 11186690Sobrien[ --disable-elf disable builtin ELF support], 12186690Sobrien[if test "${enableval}" = yes; then 13186690Sobrien AC_MSG_RESULT(yes) 14186690Sobrien AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used]) 15186690Sobrienelse 16186690Sobrien AC_MSG_RESULT(no) 17186690Sobrienfi], [ 18186690Sobrien # enable by default 19186690Sobrien AC_MSG_RESULT(yes) 20186690Sobrien AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used]) 21186690Sobrien]) 22186690Sobrien 23186690SobrienAC_MSG_CHECKING(for ELF core file support) 24186690SobrienAC_ARG_ENABLE(elf-core, 25186690Sobrien[ --disable-elf-core disable ELF core file support], 26186690Sobrien[if test "${enableval}" = yes; then 27186690Sobrien AC_MSG_RESULT(yes) 28186690Sobrien AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 29186690Sobrienelse 30186690Sobrien AC_MSG_RESULT(no) 31186690Sobrienfi], [ 32186690Sobrien # enable by default 33186690Sobrien AC_MSG_RESULT(yes) 34186690Sobrien AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 35186690Sobrien]) 36186690Sobrien 37186690SobrienAC_MSG_CHECKING(for file formats in man section 5) 38186690SobrienAC_ARG_ENABLE(fsect-man5, 39186690Sobrien[ --enable-fsect-man5 enable file formats in man section 5], 40186690Sobrien[if test "${enableval}" = yes; then 41186690Sobrien AC_MSG_RESULT(yes) 42186690Sobrien fsect=5 43186690Sobrienelse 44186690Sobrien AC_MSG_RESULT(no) 45186690Sobrien fsect=4 46186690Sobrienfi], [ 47186690Sobrien # disable by default 48186690Sobrien AC_MSG_RESULT(no) 49186690Sobrien fsect=4 50186690Sobrien]) 51186690Sobrien 52234449SobrienAC_CANONICAL_HOST 53234449Sobriencase "$host_os" in 54234449Sobrien mingw32*) 55234449Sobrien MINGW=1 56234449Sobrien ;; 57234449Sobrien *) 58234449Sobrien MINGW=0 59234449Sobrien ;; 60234449Sobrienesac 61234449SobrienAC_SUBST(MINGW) 62234449SobrienAM_CONDITIONAL(MINGW, test "$MINGW" = 1) 63234449Sobrien 64192350SdelphijAC_SUBST([pkgdatadir], ['$(datadir)/misc']) 65186690SobrienAC_SUBST(fsect) 66186690SobrienAM_CONDITIONAL(FSECT5, test x$fsect = x5) 67186690Sobrien 68186690SobrienAC_SUBST(WARNINGS) 69186690Sobrien 70186690Sobriendnl Checks for programs. 71268515SdelphijAC_PROG_CC_STDC 72268515SdelphijAC_USE_SYSTEM_EXTENSIONS 73186690SobrienAM_PROG_CC_C_O 74268515SdelphijAC_C_BIGENDIAN 75186690SobrienAC_PROG_INSTALL 76186690SobrienAC_PROG_LN_S 77268515SdelphijLT_INIT([disable-static pic-only]) 78268515Sdelphijgl_VISIBILITY 79186690Sobriendnl Checks for headers 80186690SobrienAC_HEADER_STDC 81186690SobrienAC_HEADER_MAJOR 82186690SobrienAC_HEADER_SYS_WAIT 83186690SobrienAC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) 84268515SdelphijAC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) 85284193SdelphijAC_CHECK_HEADERS(getopt.h err.h xlocale.h) 86186690SobrienAC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) 87186690SobrienAC_CHECK_HEADERS(zlib.h) 88186690Sobrien 89186690Sobriendnl Checks for typedefs, structures, and compiler characteristics. 90186690SobrienAC_C_CONST 91186690SobrienAC_TYPE_OFF_T 92186690SobrienAC_TYPE_SIZE_T 93186690SobrienAC_CHECK_MEMBERS([struct stat.st_rdev]) 94186690Sobrien 95268515SdelphijAC_CHECK_MEMBERS([struct tm.tm_gmtoff]) 96268515SdelphijAC_STRUCT_TIMEZONE 97186690SobrienAC_STRUCT_TIMEZONE_DAYLIGHT 98186690SobrienAC_SYS_LARGEFILE 99186690SobrienAC_FUNC_FSEEKO 100186690SobrienAC_TYPE_MBSTATE_T 101186690Sobrien 102192350SdelphijAC_STRUCT_OPTION_GETOPT_H 103268515SdelphijAC_TYPE_PID_T 104268515SdelphijAC_TYPE_UINT8_T 105268515SdelphijAC_TYPE_UINT16_T 106268515SdelphijAC_TYPE_UINT32_T 107268515SdelphijAC_TYPE_INT32_T 108268515SdelphijAC_TYPE_UINT64_T 109268515SdelphijAC_TYPE_INT64_T 110268515SdelphijAC_TYPE_INTPTR_T 111268515SdelphijAC_TYPE_UINTPTR_T 112268515SdelphijAC_FUNC_MMAP 113268515SdelphijAC_FUNC_FORK 114268515SdelphijAC_FUNC_MBRTOWC 115192350Sdelphij 116186690SobrienAC_MSG_CHECKING(for gcc compiler warnings) 117186690SobrienAC_ARG_ENABLE(warnings, 118186690Sobrien[ --disable-warnings disable compiler warnings], 119192350Sdelphij[if test "${enableval}" = no -o "$GCC" = no; then 120186690Sobrien AC_MSG_RESULT(no) 121186690Sobrien WARNINGS= 122186690Sobrienelse 123186690Sobrien AC_MSG_RESULT(yes) 124186690Sobrien WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 125186690Sobrien -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 126186690Sobrien -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 127234449Sobrien -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 128186690Sobrienfi], [ 129234449Sobrienif test "$GCC" = yes; then 130186690Sobrien AC_MSG_RESULT(yes) 131186690Sobrien WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 132186690Sobrien -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 133186690Sobrien -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 134234449Sobrien -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 135234449Sobrienelse 136234449Sobrien WARNINGS= 137234449Sobrien AC_MSG_RESULT(no) 138186690Sobrienfi]) 139186690Sobrien 140186690Sobriendnl Checks for functions 141284193SdelphijAC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) 142186690Sobrien 143186690Sobriendnl Provide implementation of some required functions if necessary 144268515SdelphijAC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r pread strcasestr fmtcheck) 145186690Sobrien 146186690Sobriendnl Checks for libraries 147186690SobrienAC_CHECK_LIB(z,gzopen) 148234449Sobrienif test "$MINGW" = 1; then 149234449Sobrien AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW])) 150234449Sobrienfi 151186690Sobrien 152186690Sobriendnl See if we are cross-compiling 153186690SobrienAM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes) 154186690Sobrien 155186690SobrienAC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile]) 156186690SobrienAC_OUTPUT 157