configure.ac revision 191771
1186690Sobriendnl Process this file with autoconf to produce a configure script. 2191771SobrienAC_INIT(file, 5.00, christos@astron.com) 3186690SobrienAM_INIT_AUTOMAKE 4186690SobrienAM_CONFIG_HEADER(config.h) 5186690Sobrien 6186690SobrienAC_MSG_CHECKING(for builtin ELF support) 7186690SobrienAC_ARG_ENABLE(elf, 8186690Sobrien[ --disable-elf disable builtin ELF support], 9186690Sobrien[if test "${enableval}" = yes; then 10186690Sobrien AC_MSG_RESULT(yes) 11186690Sobrien AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used]) 12186690Sobrienelse 13186690Sobrien AC_MSG_RESULT(no) 14186690Sobrienfi], [ 15186690Sobrien # enable by default 16186690Sobrien AC_MSG_RESULT(yes) 17186690Sobrien AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used]) 18186690Sobrien]) 19186690Sobrien 20186690SobrienAC_MSG_CHECKING(for ELF core file support) 21186690SobrienAC_ARG_ENABLE(elf-core, 22186690Sobrien[ --disable-elf-core disable ELF core file support], 23186690Sobrien[if test "${enableval}" = yes; then 24186690Sobrien AC_MSG_RESULT(yes) 25186690Sobrien AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 26186690Sobrienelse 27186690Sobrien AC_MSG_RESULT(no) 28186690Sobrienfi], [ 29186690Sobrien # enable by default 30186690Sobrien AC_MSG_RESULT(yes) 31186690Sobrien AC_DEFINE([ELFCORE], 1, [Define for ELF core file support]) 32186690Sobrien]) 33186690Sobrien 34186690SobrienAC_MSG_CHECKING(for file formats in man section 5) 35186690SobrienAC_ARG_ENABLE(fsect-man5, 36186690Sobrien[ --enable-fsect-man5 enable file formats in man section 5], 37186690Sobrien[if test "${enableval}" = yes; then 38186690Sobrien AC_MSG_RESULT(yes) 39186690Sobrien fsect=5 40186690Sobrienelse 41186690Sobrien AC_MSG_RESULT(no) 42186690Sobrien fsect=4 43186690Sobrienfi], [ 44186690Sobrien # disable by default 45186690Sobrien AC_MSG_RESULT(no) 46186690Sobrien fsect=4 47186690Sobrien]) 48186690Sobrien 49186690SobrienAC_SUBST(fsect) 50186690SobrienAM_CONDITIONAL(FSECT5, test x$fsect = x5) 51186690Sobrien 52186690SobrienAC_SUBST(WARNINGS) 53186690SobrienAC_GNU_SOURCE 54186690Sobrien 55186690Sobriendnl Checks for programs. 56186690SobrienAC_PROG_CC 57186690SobrienAM_PROG_CC_C_O 58186690SobrienAC_PROG_INSTALL 59186690SobrienAC_PROG_LN_S 60186690SobrienAC_PROG_LIBTOOL 61186690Sobrien 62186690Sobriendnl Checks for headers 63186690SobrienAC_HEADER_STDC 64186690SobrienAC_HEADER_MAJOR 65186690SobrienAC_HEADER_SYS_WAIT 66186690SobrienAC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) 67186690SobrienAC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h) 68186690SobrienAC_CHECK_HEADERS(getopt.h err.h) 69186690SobrienAC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) 70186690SobrienAC_CHECK_HEADERS(zlib.h) 71186690Sobrien 72186690Sobriendnl Checks for typedefs, structures, and compiler characteristics. 73186690SobrienAC_C_CONST 74186690SobrienAC_TYPE_OFF_T 75186690SobrienAC_TYPE_SIZE_T 76186690SobrienAC_CHECK_MEMBERS([struct stat.st_rdev]) 77186690Sobrien 78191771SobrienAC_STRUCT_TM 79191771SobrienAC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone]) 80186690SobrienAC_STRUCT_TIMEZONE_DAYLIGHT 81186690SobrienAC_SYS_LARGEFILE 82186690SobrienAC_FUNC_FSEEKO 83186690SobrienAC_TYPE_MBSTATE_T 84186690Sobrien 85186690SobrienAC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t]) 86186690SobrienAC_CHECK_SIZEOF(long long) 87186690SobrienAH_BOTTOM([ 88186690Sobrien#ifndef HAVE_UINT8_T 89186690Sobrientypedef unsigned char uint8_t; 90186690Sobrien#endif 91186690Sobrien#ifndef HAVE_UINT16_T 92186690Sobrientypedef unsigned short uint16_t; 93186690Sobrien#endif 94186690Sobrien#ifndef HAVE_UINT32_T 95186690Sobrientypedef unsigned int uint32_t; 96186690Sobrien#endif 97186690Sobrien#ifndef HAVE_INT32_T 98186690Sobrientypedef int int32_t; 99186690Sobrien#endif 100186690Sobrien#ifndef HAVE_UINT64_T 101186690Sobrien#if SIZEOF_LONG_LONG == 8 102186690Sobrientypedef unsigned long long uint64_t; 103186690Sobrien#else 104186690Sobrientypedef unsigned long uint64_t; 105186690Sobrien#endif 106186690Sobrien#endif 107186690Sobrien#ifndef HAVE_INT64_T 108186690Sobrien#if SIZEOF_LONG_LONG == 8 109186690Sobrientypedef long long int64_t; 110186690Sobrien#else 111186690Sobrientypedef long int64_t; 112186690Sobrien#endif 113186690Sobrien#endif 114186690Sobrien]) 115186690Sobrien 116186690SobrienAC_MSG_CHECKING(for gcc compiler warnings) 117186690SobrienAC_ARG_ENABLE(warnings, 118186690Sobrien[ --disable-warnings disable compiler warnings], 119186690Sobrien[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 \ 127186690Sobrien -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter" 128186690Sobrienfi], [ 129186690Sobrienif test $GCC = no; then 130186690Sobrien WARNINGS= 131186690Sobrien AC_MSG_RESULT(no) 132186690Sobrienelse 133186690Sobrien AC_MSG_RESULT(yes) 134186690Sobrien WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \ 135186690Sobrien -Wmissing-declarations -Wredundant-decls -Wnested-externs \ 136186690Sobrien -Wsign-compare -Wreturn-type -Wswitch -Wshadow \ 137186690Sobrien -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter" 138186690Sobrienfi]) 139186690Sobrien 140186690Sobriendnl Checks for functions 141186690SobrienAC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof) 142186690Sobrien 143186690Sobriendnl Provide implementation of some required functions if necessary 144191771SobrienAC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat) 145186690Sobrien 146186690Sobriendnl Checks for libraries 147186690SobrienAC_CHECK_LIB(z,gzopen) 148186690Sobrien 149186690Sobriendnl See if we are cross-compiling 150186690SobrienAM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes) 151186690Sobrien 152186690SobrienAC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile]) 153186690SobrienAC_OUTPUT 154