2008-03-23 05:39:43 +08:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
2023-07-28 03:46:14 +08:00
|
|
|
AC_INIT([file],[5.45],[christos@astron.com])
|
2012-06-21 06:33:43 +08:00
|
|
|
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
2010-07-22 00:47:17 +08:00
|
|
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
|
|
|
2012-06-21 06:33:43 +08:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2010-07-22 00:47:17 +08:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2008-03-23 05:39:43 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(for builtin ELF support)
|
|
|
|
AC_ARG_ENABLE(elf,
|
|
|
|
[ --disable-elf disable builtin ELF support],
|
|
|
|
[if test "${enableval}" = yes; then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi], [
|
|
|
|
# enable by default
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
|
|
|
|
])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for ELF core file support)
|
|
|
|
AC_ARG_ENABLE(elf-core,
|
|
|
|
[ --disable-elf-core disable ELF core file support],
|
|
|
|
[if test "${enableval}" = yes; then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi], [
|
|
|
|
# enable by default
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
|
|
|
|
])
|
|
|
|
|
2016-05-14 07:02:28 +08:00
|
|
|
AC_MSG_CHECKING(for zlib support)
|
2019-04-08 02:04:58 +08:00
|
|
|
AC_ARG_ENABLE([zlib],
|
2019-04-11 19:52:26 +08:00
|
|
|
[AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])])
|
2016-05-14 07:02:28 +08:00
|
|
|
AC_MSG_RESULT($enable_zlib)
|
|
|
|
|
2019-07-19 04:32:06 +08:00
|
|
|
AC_MSG_CHECKING(for bzlib support)
|
|
|
|
AC_ARG_ENABLE([bzlib],
|
|
|
|
[AS_HELP_STRING([--disable-bzlib], [disable bz2lib compression support @<:@default=auto@:>@])])
|
|
|
|
AC_MSG_RESULT($enable_bzlib)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for xzlib support)
|
|
|
|
AC_ARG_ENABLE([xzlib],
|
|
|
|
[AS_HELP_STRING([--disable-xzlib], [disable liblzma/xz compression support @<:@default=auto@:>@])])
|
|
|
|
AC_MSG_RESULT($enable_xzlib)
|
|
|
|
|
2022-09-14 22:37:07 +08:00
|
|
|
AC_MSG_CHECKING(for zstdlib support)
|
|
|
|
AC_ARG_ENABLE([zstdlib],
|
|
|
|
[AS_HELP_STRING([--disable-zstdlib], [disable zstdlib compression support @<:@default=auto@:>@])])
|
|
|
|
AC_MSG_RESULT($enable_zstdlib)
|
|
|
|
|
2022-09-15 22:45:31 +08:00
|
|
|
AC_MSG_CHECKING(for lzlib support)
|
|
|
|
AC_ARG_ENABLE([lzlib],
|
|
|
|
[AS_HELP_STRING([--disable-lzlib], [disable liblz (lzip) compression support @<:@default=auto@:>@])])
|
|
|
|
AC_MSG_RESULT($enable_lzlib)
|
|
|
|
|
2017-09-25 00:04:55 +08:00
|
|
|
AC_MSG_CHECKING(for libseccomp support)
|
2019-04-08 02:04:58 +08:00
|
|
|
AC_ARG_ENABLE([libseccomp],
|
2019-04-11 19:52:26 +08:00
|
|
|
[AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])])
|
2017-09-25 00:04:55 +08:00
|
|
|
AC_MSG_RESULT($enable_libseccomp)
|
|
|
|
|
2008-03-23 05:39:43 +08:00
|
|
|
AC_MSG_CHECKING(for file formats in man section 5)
|
|
|
|
AC_ARG_ENABLE(fsect-man5,
|
|
|
|
[ --enable-fsect-man5 enable file formats in man section 5],
|
|
|
|
[if test "${enableval}" = yes; then
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
fsect=5
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fsect=4
|
|
|
|
fi], [
|
|
|
|
# disable by default
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fsect=4
|
|
|
|
])
|
2008-07-16 01:45:13 +08:00
|
|
|
|
2010-07-22 00:47:17 +08:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
case "$host_os" in
|
|
|
|
mingw32*)
|
|
|
|
MINGW=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
MINGW=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST(MINGW)
|
|
|
|
AM_CONDITIONAL(MINGW, test "$MINGW" = 1)
|
|
|
|
|
2009-02-18 00:54:04 +08:00
|
|
|
AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
|
2008-03-23 05:39:43 +08:00
|
|
|
AC_SUBST(fsect)
|
|
|
|
AM_CONDITIONAL(FSECT5, test x$fsect = x5)
|
2008-07-16 01:45:13 +08:00
|
|
|
|
|
|
|
AC_SUBST(WARNINGS)
|
2008-03-23 05:39:43 +08:00
|
|
|
|
|
|
|
dnl Checks for programs.
|
2021-07-01 14:55:35 +08:00
|
|
|
AC_PROG_CC
|
2012-06-21 06:33:43 +08:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2008-06-17 04:41:14 +08:00
|
|
|
AM_PROG_CC_C_O
|
2012-06-21 06:33:43 +08:00
|
|
|
AC_C_BIGENDIAN
|
2008-03-23 05:39:43 +08:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
2012-06-21 06:33:43 +08:00
|
|
|
LT_INIT([disable-static pic-only])
|
|
|
|
gl_VISIBILITY
|
2008-03-23 05:39:43 +08:00
|
|
|
dnl Checks for headers
|
|
|
|
AC_HEADER_MAJOR
|
|
|
|
AC_HEADER_SYS_WAIT
|
2021-10-20 21:56:15 +08:00
|
|
|
AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h byteswap.h)
|
2021-11-20 01:37:41 +08:00
|
|
|
AC_CHECK_HEADERS(spawn.h utime.h wchar.h wctype.h)
|
2018-10-02 02:43:01 +08:00
|
|
|
AC_CHECK_HEADERS(getopt.h err.h xlocale.h)
|
2021-12-06 23:33:15 +08:00
|
|
|
AC_CHECK_HEADERS(sys/bswap.h sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h sys/ioctl.h)
|
2016-05-14 07:02:28 +08:00
|
|
|
if test "$enable_zlib" != "no"; then
|
|
|
|
AC_CHECK_HEADERS(zlib.h)
|
|
|
|
fi
|
2019-07-19 04:32:06 +08:00
|
|
|
if test "$enable_bzlib" != "no"; then
|
|
|
|
AC_CHECK_HEADERS(bzlib.h)
|
|
|
|
fi
|
|
|
|
if test "$enable_xzlib" != "no"; then
|
|
|
|
AC_CHECK_HEADERS(lzma.h)
|
|
|
|
fi
|
2022-09-14 22:37:07 +08:00
|
|
|
if test "$enable_zstdlib" != "no"; then
|
|
|
|
AC_CHECK_HEADERS(zstd.h zstd_errors.h)
|
|
|
|
fi
|
2022-09-15 22:45:31 +08:00
|
|
|
if test "$enable_lzlib" != "no"; then
|
|
|
|
AC_CHECK_HEADERS(lzlib.h)
|
|
|
|
fi
|
2018-10-02 02:43:01 +08:00
|
|
|
AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include <signal.h>])
|
2008-03-23 05:39:43 +08:00
|
|
|
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_TYPE_OFF_T
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_CHECK_MEMBERS([struct stat.st_rdev])
|
|
|
|
|
2019-03-03 10:31:17 +08:00
|
|
|
AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include <time.h>])
|
2012-06-21 06:33:43 +08:00
|
|
|
AC_STRUCT_TIMEZONE
|
2008-03-23 05:39:43 +08:00
|
|
|
AC_STRUCT_TIMEZONE_DAYLIGHT
|
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
AC_FUNC_FSEEKO
|
|
|
|
AC_TYPE_MBSTATE_T
|
|
|
|
|
2009-02-14 02:48:05 +08:00
|
|
|
AC_STRUCT_OPTION_GETOPT_H
|
2012-06-21 06:33:43 +08:00
|
|
|
AC_TYPE_PID_T
|
|
|
|
AC_TYPE_UINT8_T
|
|
|
|
AC_TYPE_UINT16_T
|
|
|
|
AC_TYPE_UINT32_T
|
|
|
|
AC_TYPE_INT32_T
|
|
|
|
AC_TYPE_UINT64_T
|
|
|
|
AC_TYPE_INT64_T
|
2014-04-12 22:41:34 +08:00
|
|
|
AC_TYPE_INTPTR_T
|
|
|
|
AC_TYPE_UINTPTR_T
|
2012-06-21 06:33:43 +08:00
|
|
|
AC_FUNC_MMAP
|
|
|
|
AC_FUNC_FORK
|
|
|
|
AC_FUNC_MBRTOWC
|
2008-03-23 05:39:43 +08:00
|
|
|
|
2008-07-16 01:45:13 +08:00
|
|
|
AC_MSG_CHECKING(for gcc compiler warnings)
|
|
|
|
AC_ARG_ENABLE(warnings,
|
|
|
|
[ --disable-warnings disable compiler warnings],
|
2009-02-25 05:53:13 +08:00
|
|
|
[if test "${enableval}" = no -o "$GCC" = no; then
|
2008-07-16 01:45:13 +08:00
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
WARNINGS=
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
|
|
|
|
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
|
|
|
|
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
|
2011-09-08 05:57:15 +08:00
|
|
|
-Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
|
2008-07-16 01:45:13 +08:00
|
|
|
fi], [
|
2009-05-19 02:31:02 +08:00
|
|
|
if test "$GCC" = yes; then
|
2008-07-16 01:45:13 +08:00
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
|
|
|
|
-Wmissing-declarations -Wredundant-decls -Wnested-externs \
|
|
|
|
-Wsign-compare -Wreturn-type -Wswitch -Wshadow \
|
2011-09-08 05:57:15 +08:00
|
|
|
-Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
|
2009-05-19 02:31:02 +08:00
|
|
|
else
|
|
|
|
WARNINGS=
|
|
|
|
AC_MSG_RESULT(no)
|
2008-07-16 01:45:13 +08:00
|
|
|
fi])
|
|
|
|
|
2008-03-23 05:39:43 +08:00
|
|
|
dnl Checks for functions
|
2021-11-20 01:37:41 +08:00
|
|
|
AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem pipe2 posix_spawnp)
|
2008-03-23 05:39:43 +08:00
|
|
|
|
|
|
|
dnl Provide implementation of some required functions if necessary
|
2015-11-13 23:36:14 +08:00
|
|
|
AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf)
|
2008-03-23 05:39:43 +08:00
|
|
|
|
|
|
|
dnl Checks for libraries
|
2016-05-14 07:02:28 +08:00
|
|
|
if test "$enable_zlib" != "no"; then
|
|
|
|
AC_CHECK_LIB(z, gzopen)
|
|
|
|
fi
|
2019-07-19 04:32:06 +08:00
|
|
|
if test "$enable_bzlib" != "no"; then
|
|
|
|
AC_CHECK_LIB(bz2, BZ2_bzCompressInit)
|
|
|
|
fi
|
|
|
|
if test "$enable_xzlib" != "no"; then
|
|
|
|
AC_CHECK_LIB(lzma, lzma_stream_decoder)
|
|
|
|
fi
|
2022-09-14 22:37:07 +08:00
|
|
|
if test "$enable_zstdlib" != "no"; then
|
|
|
|
AC_CHECK_LIB(zstd, ZSTD_createDStream)
|
|
|
|
fi
|
2022-09-15 22:45:31 +08:00
|
|
|
if test "$enable_lzlib" != "no"; then
|
|
|
|
AC_CHECK_LIB(lz, LZ_decompress_open)
|
|
|
|
fi
|
2017-09-25 00:04:55 +08:00
|
|
|
if test "$enable_libseccomp" != "no"; then
|
|
|
|
AC_CHECK_LIB(seccomp, seccomp_init)
|
|
|
|
fi
|
2010-07-22 00:47:17 +08:00
|
|
|
if test "$MINGW" = 1; then
|
|
|
|
AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
|
|
|
|
fi
|
2008-03-23 05:39:43 +08:00
|
|
|
|
|
|
|
dnl See if we are cross-compiling
|
|
|
|
AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
|
|
|
|
|
2016-05-14 07:02:28 +08:00
|
|
|
dnl Final sanity checks
|
|
|
|
if test "$enable_zlib" = "yes"; then
|
|
|
|
if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then
|
|
|
|
AC_MSG_ERROR([zlib support requested but not found])
|
|
|
|
fi
|
2019-04-11 19:52:26 +08:00
|
|
|
fi
|
|
|
|
if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then
|
2016-05-14 07:02:28 +08:00
|
|
|
AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support])
|
|
|
|
fi
|
2019-07-19 04:32:06 +08:00
|
|
|
if test "$enable_bzlib" = "yes"; then
|
|
|
|
if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" != "yesyes"; then
|
|
|
|
AC_MSG_ERROR([bzlib support requested but not found])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$ac_cv_header_bzlib_h$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yesyes"; then
|
|
|
|
AC_DEFINE([BZLIBSUPPORT], 1, [Enable bzlib compression support])
|
|
|
|
fi
|
|
|
|
if test "$enable_xzlib" = "yes"; then
|
|
|
|
if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" != "yesyes"; then
|
|
|
|
AC_MSG_ERROR([xzlib support requested but not found])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$ac_cv_header_lzma_h$ac_cv_lib_lzma_lzma_stream_decoder" = "yesyes"; then
|
|
|
|
AC_DEFINE([XZLIBSUPPORT], 1, [Enable xzlib compression support])
|
|
|
|
fi
|
2022-09-14 22:37:07 +08:00
|
|
|
if test "$enable_zstdlib" = "yes"; then
|
|
|
|
if test "$ac_cv_header_zstd_h$ac_cv_lib_zstd_ZSTD_createDStream" != "yesyes"; then
|
|
|
|
AC_MSG_ERROR([zstdlib support requested but not found])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$ac_cv_header_zstd_h$ac_cv_lib_zstd_ZSTD_createDStream" = "yesyes"; then
|
|
|
|
AC_DEFINE([ZSTDLIBSUPPORT], 1, [Enable zstdlib compression support])
|
|
|
|
fi
|
2022-09-15 22:45:31 +08:00
|
|
|
if test "$enable_lzlib" = "yes"; then
|
|
|
|
if test "$ac_cv_header_lzlib_h$ac_cv_lib_lz_LZ_decompress_open" != "yesyes"; then
|
|
|
|
AC_MSG_ERROR([lzlib support requested but not found])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$ac_cv_header_lzlib_h$ac_cv_lib_lz_LZ_decompress_open" = "yesyes"; then
|
|
|
|
AC_DEFINE([LZLIBSUPPORT], 1, [Enable lzlib compression support])
|
|
|
|
fi
|
2016-05-14 07:02:28 +08:00
|
|
|
|
2020-02-13 06:30:46 +08:00
|
|
|
AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile libmagic.pc])
|
2008-03-23 05:39:43 +08:00
|
|
|
AC_OUTPUT
|