configure.ac 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(file, 5.00, christos@astron.com)
  3. AM_INIT_AUTOMAKE
  4. AM_CONFIG_HEADER(config.h)
  5. AC_MSG_CHECKING(for builtin ELF support)
  6. AC_ARG_ENABLE(elf,
  7. [ --disable-elf disable builtin ELF support],
  8. [if test "${enableval}" = yes; then
  9. AC_MSG_RESULT(yes)
  10. AC_DEFINE([BUILTIN_ELF], 1, [Define if built-in ELF support is used])
  11. else
  12. AC_MSG_RESULT(no)
  13. fi], [
  14. # enable by default
  15. AC_MSG_RESULT(yes)
  16. AC_DEFINE([BUILTIN_ELF], 1, [Define in built-in ELF support is used])
  17. ])
  18. AC_MSG_CHECKING(for ELF core file support)
  19. AC_ARG_ENABLE(elf-core,
  20. [ --disable-elf-core disable ELF core file support],
  21. [if test "${enableval}" = yes; then
  22. AC_MSG_RESULT(yes)
  23. AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
  24. else
  25. AC_MSG_RESULT(no)
  26. fi], [
  27. # enable by default
  28. AC_MSG_RESULT(yes)
  29. AC_DEFINE([ELFCORE], 1, [Define for ELF core file support])
  30. ])
  31. AC_MSG_CHECKING(for file formats in man section 5)
  32. AC_ARG_ENABLE(fsect-man5,
  33. [ --enable-fsect-man5 enable file formats in man section 5],
  34. [if test "${enableval}" = yes; then
  35. AC_MSG_RESULT(yes)
  36. fsect=5
  37. else
  38. AC_MSG_RESULT(no)
  39. fsect=4
  40. fi], [
  41. # disable by default
  42. AC_MSG_RESULT(no)
  43. fsect=4
  44. ])
  45. AC_SUBST(fsect)
  46. AM_CONDITIONAL(FSECT5, test x$fsect = x5)
  47. AC_SUBST(WARNINGS)
  48. AC_GNU_SOURCE
  49. dnl Checks for programs.
  50. AC_PROG_CC
  51. AM_PROG_CC_C_O
  52. AC_PROG_INSTALL
  53. AC_PROG_LN_S
  54. AC_PROG_LIBTOOL
  55. dnl Checks for headers
  56. AC_HEADER_STDC
  57. AC_HEADER_MAJOR
  58. AC_HEADER_SYS_WAIT
  59. AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
  60. AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
  61. AC_CHECK_HEADERS(getopt.h err.h)
  62. AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
  63. AC_CHECK_HEADERS(zlib.h)
  64. dnl Checks for typedefs, structures, and compiler characteristics.
  65. AC_C_CONST
  66. AC_TYPE_OFF_T
  67. AC_TYPE_SIZE_T
  68. AC_CHECK_MEMBERS([struct stat.st_rdev])
  69. AC_STRUCT_TM
  70. AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.tm_zone])
  71. AC_STRUCT_TIMEZONE_DAYLIGHT
  72. AC_SYS_LARGEFILE
  73. AC_FUNC_FSEEKO
  74. AC_TYPE_MBSTATE_T
  75. AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
  76. AC_CHECK_SIZEOF(long long)
  77. AH_BOTTOM([
  78. #ifndef HAVE_UINT8_T
  79. typedef unsigned char uint8_t;
  80. #endif
  81. #ifndef HAVE_UINT16_T
  82. typedef unsigned short uint16_t;
  83. #endif
  84. #ifndef HAVE_UINT32_T
  85. typedef unsigned int uint32_t;
  86. #endif
  87. #ifndef HAVE_INT32_T
  88. typedef int int32_t;
  89. #endif
  90. #ifndef HAVE_UINT64_T
  91. #if SIZEOF_LONG_LONG == 8
  92. typedef unsigned long long uint64_t;
  93. #else
  94. typedef unsigned long uint64_t;
  95. #endif
  96. #endif
  97. #ifndef HAVE_INT64_T
  98. #if SIZEOF_LONG_LONG == 8
  99. typedef long long int64_t;
  100. #else
  101. typedef long int64_t;
  102. #endif
  103. #endif
  104. ])
  105. AC_MSG_CHECKING(for gcc compiler warnings)
  106. AC_ARG_ENABLE(warnings,
  107. [ --disable-warnings disable compiler warnings],
  108. [if test "${enableval}" = no -o $GCC = no; then
  109. AC_MSG_RESULT(no)
  110. WARNINGS=
  111. else
  112. AC_MSG_RESULT(yes)
  113. WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
  114. -Wmissing-declarations -Wredundant-decls -Wnested-externs \
  115. -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
  116. -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
  117. fi], [
  118. if test $GCC = no; then
  119. WARNINGS=
  120. AC_MSG_RESULT(no)
  121. else
  122. AC_MSG_RESULT(yes)
  123. WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
  124. -Wmissing-declarations -Wredundant-decls -Wnested-externs \
  125. -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
  126. -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
  127. fi])
  128. dnl Checks for functions
  129. AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
  130. dnl Provide implementation of some required functions if necessary
  131. AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat)
  132. dnl Checks for libraries
  133. AC_CHECK_LIB(z,gzopen)
  134. dnl See if we are cross-compiling
  135. AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
  136. AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
  137. AC_OUTPUT