configure.ac 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(file, 4.26, 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_TIMEZONE_DAYLIGHT
  70. AC_SYS_LARGEFILE
  71. AC_FUNC_FSEEKO
  72. AC_TYPE_MBSTATE_T
  73. AC_CHECK_TYPES([uint8_t, uint16_t, uint32_t, int32_t, uint64_t, int64_t])
  74. AC_CHECK_SIZEOF(long long)
  75. AH_BOTTOM([
  76. #ifndef HAVE_UINT8_T
  77. typedef unsigned char uint8_t;
  78. #endif
  79. #ifndef HAVE_UINT16_T
  80. typedef unsigned short uint16_t;
  81. #endif
  82. #ifndef HAVE_UINT32_T
  83. typedef unsigned int uint32_t;
  84. #endif
  85. #ifndef HAVE_INT32_T
  86. typedef int int32_t;
  87. #endif
  88. #ifndef HAVE_UINT64_T
  89. #if SIZEOF_LONG_LONG == 8
  90. typedef unsigned long long uint64_t;
  91. #else
  92. typedef unsigned long uint64_t;
  93. #endif
  94. #endif
  95. #ifndef HAVE_INT64_T
  96. #if SIZEOF_LONG_LONG == 8
  97. typedef long long int64_t;
  98. #else
  99. typedef long int64_t;
  100. #endif
  101. #endif
  102. ])
  103. AC_MSG_CHECKING(for gcc compiler warnings)
  104. AC_ARG_ENABLE(warnings,
  105. [ --disable-warnings disable compiler warnings],
  106. [if test "${enableval}" = no -o $GCC = no; then
  107. AC_MSG_RESULT(no)
  108. WARNINGS=
  109. else
  110. AC_MSG_RESULT(yes)
  111. WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
  112. -Wmissing-declarations -Wredundant-decls -Wnested-externs \
  113. -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
  114. -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
  115. fi], [
  116. if test $GCC = no; then
  117. WARNINGS=
  118. AC_MSG_RESULT(no)
  119. else
  120. AC_MSG_RESULT(yes)
  121. WARNINGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
  122. -Wmissing-declarations -Wredundant-decls -Wnested-externs \
  123. -Wsign-compare -Wreturn-type -Wswitch -Wshadow \
  124. -Wcast-qual -Wwrite-strings -Wextra -Wunused-parameter"
  125. fi])
  126. dnl Checks for functions
  127. AC_CHECK_FUNCS(mmap strerror strndup strtoul mbrtowc mkstemp utimes utime wcwidth strtof)
  128. dnl Provide implementation of some required functions if necessary
  129. AC_REPLACE_FUNCS(getopt_long asprintf vasprintf)
  130. dnl Checks for libraries
  131. AC_CHECK_LIB(z,gzopen)
  132. dnl See if we are cross-compiling
  133. AM_CONDITIONAL(IS_CROSS_COMPILE, test "$cross_compiling" = yes)
  134. AC_CONFIG_FILES([Makefile src/Makefile magic/Makefile tests/Makefile doc/Makefile python/Makefile])
  135. AC_OUTPUT