configure.ac revision 287453
110099Sjkhdnl Process this file with autoconf to produce a configure script. 213884SacheAC_INIT([file],[5.24],[christos@astron.com]) 310099SjkhAM_INIT_AUTOMAKE([subdir-objects foreign]) 413832Sachem4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 513884Sache 613985SacheAC_CONFIG_HEADERS([config.h]) 713985SacheAC_CONFIG_MACRO_DIR([m4]) 813985Sache 913985SacheAC_MSG_CHECKING(for builtin ELF support) 1013985SacheAC_ARG_ENABLE(elf, 1113985Sache[ --disable-elf disable builtin ELF support], 1213985Sache[if test "${enableval}" = yes; then 1313985Sache AC_MSG_RESULT(yes) 1413985Sache AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used]) 1513985Sacheelse 1613985Sache AC_MSG_RESULT(no) 1713985Sachefi], [ 1813985Sache # enable by default 19180507Sgahr AC_MSG_RESULT(yes) 20180507Sgahr AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used]) 21180507Sgahr]) 22180507Sgahr 23180507SgahrAC_MSG_CHECKING(for ELF core file support) 24180507SgahrAC_ARG_ENABLE(elf-core, 25180507Sgahr[ --disable-elf-core disable ELF core file support], 26180507Sgahr[if test "${enableval}" = yes; then 27180507Sgahr AC_MSG_RESULT(yes) 28180507Sgahr AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 29180507Sgahrelse 30180507Sgahr AC_MSG_RESULT(no) 31180507Sgahrfi], [ 3210099Sjkh # enable by default 3313985Sache AC_MSG_RESULT(yes) 34114601Sobrien AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 35114601Sobrien]) 3629103Scharnier 3777168SkrisAC_MSG_CHECKING(for file formats in man section 5) 3896213SmaximAC_ARG_ENABLE(fsect-man5, 3977168Skris[ --enable-fsect-man5 enable file formats in man section 5], 4077168Skris[if test "${enableval}" = yes; then 4177168Skris AC_MSG_RESULT(yes) 4290868Smike fsect=5 4313985Sacheelse 4429103Scharnier AC_MSG_RESULT(no) 4529103Scharnier fsect=4 4677168Skrisfi], [ 4796213Smaxim # disable by default 4869793Sobrien AC_MSG_RESULT(no) 4910099Sjkh fsect=4 5010099Sjkh]) 5110099Sjkh 5210099SjkhAC_CANONICAL_HOST 5377168Skriscase "$host_os" in 5410099Sjkh mingw32*) 55180507Sgahr MINGW=1 5610099Sjkh ;; 5787573Smikeh *) 5887573Smikeh MINGW=0 5987573Smikeh ;; 6087573Smikehesac 6187573SmikehAC_SUBST(MINGW) 6287573SmikehAM_CONDITIONAL(MINGW, test "$MINGW" = 1) 6310099Sjkh 64122855SeivindAC_SUBST([pkgdatadir], ['$(datadir)/misc']) 65122855SeivindAC_SUBST(fsect) 6613985SacheAM_CONDITIONAL(FSECT5, test x$fsect = x5) 6713985Sache 6887573SmikehAC_SUBST(WARNINGS) 6987573Smikeh 7087573Smikehdnl Checks for programs. 7187573SmikehAC_PROG_CC_STDC 7287573SmikehAC_USE_SYSTEM_EXTENSIONS 7387573SmikehAM_PROG_CC_C_O 7487573SmikehAC_C_BIGENDIAN 7587573SmikehAC_PROG_INSTALL 7687573SmikehAC_PROG_LN_S 7787573SmikehLT_INIT([disable-static pic-only]) 7887573Smikehgl_VISIBILITY 7987573Smikehdnl Checks for headers 8087573SmikehAC_HEADER_STDC 8187573SmikehAC_HEADER_MAJOR 8287573SmikehAC_HEADER_SYS_WAIT 8387573SmikehAC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) 8487573SmikehAC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) 8596213SmaximAC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h) 8687573SmikehAC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) 8787573SmikehAC_CHECK_HEADERS(zlib.h) 8887573SmikehAC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[ 8913985Sache#ifdef HAVE_SIGNAL_H 90227225Sed#include <signal.h> 9110099Sjkh#endif]) 9287568Smikeh 9387568Smikehdnl Checks for typedefs, structures, and compiler characteristics. 9487568SmikehAC_C_CONST 9510099SjkhAC_TYPE_OFF_T 9687573SmikehAC_TYPE_SIZE_T 9787573SmikehAC_CHECK_MEMBERS([struct stat.st_rdev]) 9887573Smikeh 9987573SmikehAC_CHECK_MEMBERS([struct tm.tm_gmtoff]) 10087573SmikehAC_STRUCT_TIMEZONE 10187573SmikehAC_STRUCT_TIMEZONE_DAYLIGHT 10287573SmikehAC_SYS_LARGEFILE 10387573SmikehAC_FUNC_FSEEKO 10487573SmikehAC_TYPE_MBSTATE_T 10587573Smikeh 10687573SmikehAC_STRUCT_OPTION_GETOPT_H 10787573SmikehAC_TYPE_PID_T 10887573SmikehAC_TYPE_UINT8_T 10987573SmikehAC_TYPE_UINT16_T 11087573SmikehAC_TYPE_UINT32_T 11187573SmikehAC_TYPE_INT32_T 11287573SmikehAC_TYPE_UINT64_T 11387573SmikehAC_TYPE_INT64_T 11487573SmikehAC_TYPE_INTPTR_T 11587573SmikehAC_TYPE_UINTPTR_T 116180507SgahrAC_FUNC_MMAP 11787573SmikehAC_FUNC_FORK 11896213SmaximAC_FUNC_MBRTOWC 11987573Smikeh 12010099SjkhAC_MSG_CHECKING(for gcc compiler warnings) 12110099SjkhAC_ARG_ENABLE(warnings, 122227225Sed[ --disable-warnings disable compiler warnings], 12310099Sjkh[if test "${enableval}" = no -o "$GCC" = no; then 124227225Sed AC_MSG_RESULT(no) 125227225Sed WARNINGS= 126227225Sedelse 127227225Sed AC_MSG_RESULT(yes) 12810099Sjkh WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 129227225Sed -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 130227225Sed -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 131227225Sed -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 132227225Sedfi], [ 133227225Sedif test "$GCC" = yes; then 134227225Sed AC_MSG_RESULT(yes) 135227225Sed WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 136227225Sed -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 137227225Sed -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 138227225Sed -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2" 139227225Sedelse 140227225Sed WARNINGS= 141227225Sed AC_MSG_RESULT(no) 142227225Sedfi]) 143227225Sed 144227225Seddnl Checks for functions 145227225SedAC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) 146227225Sed 147227225Seddnl Provide implementation of some required functions if necessary 148227225SedAC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck) 149227225Sed 150227225Seddnl Checks for libraries 15199800SalfredAC_CHECK_LIB(z,gzopen) 152227225Sedif test "$MINGW" = 1; then 15310099Sjkh AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW])) 154227225Sedfi 155227225Sed 15610099Sjkhdnl See if we are cross-compiling 15710099SjkhAM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes) 15887568Smikeh 15987568SmikehAC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile]) 16013985SacheAC_OUTPUT 16110099Sjkh