5 kx dnl Process this file with autoconf to produce a configure script.
5 kx AC_INIT([file],[5.39],[christos@astron.com])
5 kx AM_INIT_AUTOMAKE([subdir-objects foreign])
5 kx m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
5 kx
5 kx AC_CONFIG_HEADERS([config.h])
5 kx AC_CONFIG_MACRO_DIR([m4])
5 kx
5 kx AC_MSG_CHECKING(for builtin ELF support)
5 kx AC_ARG_ENABLE(elf,
5 kx [ --disable-elf disable builtin ELF support],
5 kx [if test "${enableval}" = yes; then
5 kx AC_MSG_RESULT(yes)
5 kx AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi], [
5 kx # enable by default
5 kx AC_MSG_RESULT(yes)
5 kx AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for ELF core file support)
5 kx AC_ARG_ENABLE(elf-core,
5 kx [ --disable-elf-core disable ELF core file support],
5 kx [if test "${enableval}" = yes; then
5 kx AC_MSG_RESULT(yes)
5 kx AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fi], [
5 kx # enable by default
5 kx AC_MSG_RESULT(yes)
5 kx AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
5 kx ])
5 kx
5 kx AC_MSG_CHECKING(for zlib support)
5 kx AC_ARG_ENABLE([zlib],
5 kx [AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])])
5 kx AC_MSG_RESULT($enable_zlib)
5 kx
5 kx AC_MSG_CHECKING(for bzlib support)
5 kx AC_ARG_ENABLE([bzlib],
5 kx [AS_HELP_STRING([--disable-bzlib], [disable bz2lib compression support @<:@default=auto@:>@])])
5 kx AC_MSG_RESULT($enable_bzlib)
5 kx
5 kx AC_MSG_CHECKING(for xzlib support)
5 kx AC_ARG_ENABLE([xzlib],
5 kx [AS_HELP_STRING([--disable-xzlib], [disable liblzma/xz compression support @<:@default=auto@:>@])])
5 kx AC_MSG_RESULT($enable_xzlib)
5 kx
5 kx AC_MSG_CHECKING(for libseccomp support)
5 kx AC_ARG_ENABLE([libseccomp],
5 kx [AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])])
5 kx AC_MSG_RESULT($enable_libseccomp)
5 kx
5 kx AC_MSG_CHECKING(for file formats in man section 5)
5 kx AC_ARG_ENABLE(fsect-man5,
5 kx [ --enable-fsect-man5 enable file formats in man section 5],
5 kx [if test "${enableval}" = yes; then
5 kx AC_MSG_RESULT(yes)
5 kx fsect=5
5 kx else
5 kx AC_MSG_RESULT(no)
5 kx fsect=4
5 kx fi], [
5 kx # disable by default
5 kx AC_MSG_RESULT(no)
5 kx fsect=4
5 kx ])
5 kx
5 kx AC_CANONICAL_HOST
5 kx case "$host_os" in
5 kx mingw32*)
5 kx MINGW=1
5 kx ;;
5 kx *)
5 kx MINGW=0
5 kx ;;
5 kx esac
5 kx AC_SUBST(MINGW)
5 kx AM_CONDITIONAL(MINGW, test "$MINGW" = 1)
5 kx
5 kx AC_SUBST([pkgdatadir], ['$(datadir)/file'])
5 kx AC_SUBST(fsect)
5 kx AM_CONDITIONAL(FSECT5, test x$fsect = x5)
5 kx
5 kx AC_SUBST(WARNINGS)
5 kx
5 kx dnl Checks for programs.
5 kx AC_PROG_CC_STDC
5 kx AC_USE_SYSTEM_EXTENSIONS
5 kx AM_PROG_CC_C_O
5 kx AC_C_BIGENDIAN
5 kx AC_PROG_INSTALL
5 kx AC_PROG_LN_S
5 kx LT_INIT([disable-static pic-only])
5 kx gl_VISIBILITY
5 kx dnl Checks for headers
5 kx AC_HEADER_STDC
5 kx AC_HEADER_MAJOR
5 kx AC_HEADER_SYS_WAIT
5 kx AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h)
5 kx AC_CHECK_HEADERS(utime.h wchar.h wctype.h)
5 kx AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
5 kx AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h)
5 kx if test "$enable_zlib" != "no"; then
5 kx AC_CHECK_HEADERS(zlib.h)
5 kx fi
5 kx if test "$enable_bzlib" != "no"; then
5 kx AC_CHECK_HEADERS(bzlib.h)
5 kx fi
5 kx if test "$enable_xzlib" != "no"; then
5 kx AC_CHECK_HEADERS(lzma.h)
5 kx fi
5 kx AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
5 kx
5 kx dnl Checks for typedefs, structures, and compiler characteristics.
5 kx AC_TYPE_OFF_T
5 kx AC_TYPE_SIZE_T
5 kx AC_CHECK_MEMBERS([struct stat.st_rdev])
5 kx
5 kx AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
5 kx AC_STRUCT_TIMEZONE
5 kx AC_STRUCT_TIMEZONE_DAYLIGHT
5 kx AC_SYS_LARGEFILE
5 kx AC_FUNC_FSEEKO
5 kx AC_TYPE_MBSTATE_T
5 kx
5 kx AC_STRUCT_OPTION_GETOPT_H
5 kx AC_TYPE_PID_T
5 kx AC_TYPE_UINT8_T
5 kx AC_TYPE_UINT16_T
5 kx AC_TYPE_UINT32_T
5 kx AC_TYPE_INT32_T
5 kx AC_TYPE_UINT64_T
5 kx AC_TYPE_INT64_T
5 kx AC_TYPE_INTPTR_T
5 kx AC_TYPE_UINTPTR_T
5 kx AC_FUNC_MMAP
5 kx AC_FUNC_FORK
5 kx AC_FUNC_MBRTOWC
5 kx
5 kx AC_MSG_CHECKING(for gcc compiler warnings)
5 kx AC_ARG_ENABLE(warnings,
5 kx [ --disable-warnings disable compiler warnings],
5 kx [if test "${enableval}" = no -o "$GCC" = no; then
5 kx AC_MSG_RESULT(no)
5 kx WARNINGS=
5 kx else
5 kx AC_MSG_RESULT(yes)
5 kx WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
5 kx -Wmissing-declarations -Wredundant-decls -Wnested-externs \
5 kx -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
5 kx -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
5 kx fi], [
5 kx if test "$GCC" = yes; then
5 kx AC_MSG_RESULT(yes)
5 kx WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
5 kx -Wmissing-declarations -Wredundant-decls -Wnested-externs \
5 kx -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
5 kx -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
5 kx else
5 kx WARNINGS=
5 kx AC_MSG_RESULT(no)
5 kx fi])
5 kx
5 kx dnl Checks for functions
5 kx AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem)
5 kx
5 kx dnl Provide implementation of some required functions if necessary
5 kx AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)
5 kx
5 kx dnl Checks for libraries
5 kx if test "$enable_zlib" != "no"; then
5 kx AC_CHECK_LIB(z, gzopen)
5 kx fi
5 kx if test "$enable_bzlib" != "no"; then
5 kx AC_CHECK_LIB(bz2, BZ2_bzCompressInit)
5 kx fi
5 kx if test "$enable_xzlib" != "no"; then
5 kx AC_CHECK_LIB(lzma, lzma_stream_decoder)
5 kx fi
5 kx if test "$enable_libseccomp" != "no"; then
5 kx AC_CHECK_LIB(seccomp, seccomp_init)
5 kx fi
5 kx if test "$MINGW" = 1; then
5 kx AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
5 kx fi
5 kx
5 kx dnl See if we are cross-compiling
5 kx AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
5 kx
5 kx dnl Final sanity checks
5 kx if test "$enable_zlib" = "yes"; then
5 kx if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then
5 kx AC_MSG_ERROR([zlib support requested but not found])
5 kx fi
5 kx fi
5 kx if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then
5 kx AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support])
5 kx fi
5 kx if test "$enable_bzlib" = "yes"; then
5 kx if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" != "yesyes"; then
5 kx AC_MSG_ERROR([bzlib support requested but not found])
5 kx fi
5 kx fi
5 kx if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yesyes"; then
5 kx AC_DEFINE([BZLIBSUPPORT], 1, [Enable bzlib compression support])
5 kx fi
5 kx if test "$enable_xzlib" = "yes"; then
5 kx if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" != "yesyes"; then
5 kx AC_MSG_ERROR([xzlib support requested but not found])
5 kx fi
5 kx fi
5 kx if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" = "yesyes"; then
5 kx AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support])
5 kx fi
5 kx
5 kx AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile libmagic.pc])
5 kx AC_OUTPUT