configure.ac 4.0 KB

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