2009-01-02 02:57:16 +00:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
2015-09-23 05:39:20 +00:00
|
|
|
AC_INIT([file],[5.25],[christos@astron.com])
|
2014-06-24 21:24:48 +00:00
|
|
|
AM_INIT_AUTOMAKE([subdir-objects foreign])
|
2011-10-06 06:01:12 +00:00
|
|
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
|
|
|
2014-06-24 21:24:48 +00:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2011-10-06 06:01:12 +00:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2009-01-02 02:57:16 +00: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])
|
|
|
|
])
|
|
|
|
|
|
|
|
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
|
|
|
|
])
|
|
|
|
|
2011-10-06 06:01:12 +00:00
|
|
|
AC_CANONICAL_HOST
|
|
|
|
case "$host_os" in
|
|
|
|
mingw32*)
|
|
|
|
MINGW=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
MINGW=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
AC_SUBST(MINGW)
|
|
|
|
AM_CONDITIONAL(MINGW, test "$MINGW" = 1)
|
|
|
|
|
2009-05-18 22:27:42 +00:00
|
|
|
AC_SUBST([pkgdatadir], ['$(datadir)/misc'])
|
2009-01-02 02:57:16 +00:00
|
|
|
AC_SUBST(fsect)
|
|
|
|
AM_CONDITIONAL(FSECT5, test x$fsect = x5)
|
|
|
|
|
|
|
|
AC_SUBST(WARNINGS)
|
|
|
|
|
|
|
|
dnl Checks for programs.
|
2014-06-24 21:24:48 +00:00
|
|
|
AC_PROG_CC_STDC
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2009-01-02 02:57:16 +00:00
|
|
|
AM_PROG_CC_C_O
|
2014-06-24 21:24:48 +00:00
|
|
|
AC_C_BIGENDIAN
|
2009-01-02 02:57:16 +00:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_LN_S
|
2014-06-24 21:24:48 +00:00
|
|
|
LT_INIT([disable-static pic-only])
|
|
|
|
gl_VISIBILITY
|
2009-01-02 02:57:16 +00:00
|
|
|
dnl Checks for headers
|
|
|
|
AC_HEADER_STDC
|
|
|
|
AC_HEADER_MAJOR
|
|
|
|
AC_HEADER_SYS_WAIT
|
|
|
|
AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
|
2014-06-24 21:24:48 +00:00
|
|
|
AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
|
2015-06-10 19:06:05 +00:00
|
|
|
AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h)
|
2009-01-02 02:57:16 +00:00
|
|
|
AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
|
|
|
|
AC_CHECK_HEADERS(zlib.h)
|
2015-06-10 19:06:05 +00:00
|
|
|
AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[
|
|
|
|
#ifdef HAVE_SIGNAL_H
|
|
|
|
#include <signal.h>
|
|
|
|
#endif])
|
2009-01-02 02:57:16 +00:00
|
|
|
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_CONST
|
|
|
|
AC_TYPE_OFF_T
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
AC_CHECK_MEMBERS([struct stat.st_rdev])
|
|
|
|
|
2014-06-24 21:24:48 +00:00
|
|
|
AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
|
|
|
|
AC_STRUCT_TIMEZONE
|
2009-01-02 02:57:16 +00:00
|
|
|
AC_STRUCT_TIMEZONE_DAYLIGHT
|
|
|
|
AC_SYS_LARGEFILE
|
|
|
|
AC_FUNC_FSEEKO
|
|
|
|
AC_TYPE_MBSTATE_T
|
|
|
|
|
2009-05-18 22:27:42 +00:00
|
|
|
AC_STRUCT_OPTION_GETOPT_H
|
2014-06-24 21:24:48 +00: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
|
|
|
|
AC_TYPE_INTPTR_T
|
|
|
|
AC_TYPE_UINTPTR_T
|
|
|
|
AC_FUNC_MMAP
|
|
|
|
AC_FUNC_FORK
|
|
|
|
AC_FUNC_MBRTOWC
|
2009-01-02 02:57:16 +00:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(for gcc compiler warnings)
|
|
|
|
AC_ARG_ENABLE(warnings,
|
|
|
|
[ --disable-warnings disable compiler warnings],
|
2009-05-18 22:27:42 +00:00
|
|
|
[if test "${enableval}" = no -o "$GCC" = no; then
|
2009-01-02 02:57:16 +00: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-10-06 06:01:12 +00:00
|
|
|
-Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
|
2009-01-02 02:57:16 +00:00
|
|
|
fi], [
|
2011-10-06 06:01:12 +00:00
|
|
|
if test "$GCC" = yes; then
|
2009-01-02 02:57:16 +00: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-10-06 06:01:12 +00:00
|
|
|
-Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter -Wformat=2"
|
|
|
|
else
|
|
|
|
WARNINGS=
|
|
|
|
AC_MSG_RESULT(no)
|
2009-01-02 02:57:16 +00:00
|
|
|
fi])
|
|
|
|
|
|
|
|
dnl Checks for functions
|
2014-12-11 06:00:53 +00:00
|
|
|
AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale)
|
2009-01-02 02:57:16 +00:00
|
|
|
|
|
|
|
dnl Provide implementation of some required functions if necessary
|
2015-06-10 19:06:05 +00:00
|
|
|
AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck)
|
2009-01-02 02:57:16 +00:00
|
|
|
|
|
|
|
dnl Checks for libraries
|
|
|
|
AC_CHECK_LIB(z,gzopen)
|
2011-10-06 06:01:12 +00:00
|
|
|
if test "$MINGW" = 1; then
|
|
|
|
AC_CHECK_LIB(gnurx,regexec,,AC_MSG_ERROR([libgnurx is required to build file(1) with MinGW]))
|
|
|
|
fi
|
2009-01-02 02:57:16 +00:00
|
|
|
|
|
|
|
dnl See if we are cross-compiling
|
|
|
|
AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
|
|
|
|
|
|
|
|
AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
|
|
|
|
AC_OUTPUT
|