configure.in 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ([2.12])
  3. AC_INIT(include/dpkg.h.in)
  4. AM_CONFIG_HEADER(config.h)
  5. AC_CHECK_TOOL_PREFIX
  6. AC_PROG_CC
  7. AC_CANONICAL_SYSTEM
  8. AC_CHECK_TOOL_PREFIX
  9. dnl tl_PROG_CXX
  10. AC_PROG_CXX
  11. AM_CONDITIONAL(HAVE_CPLUSPLUS, [test "$CXX" != ""])
  12. AC_CHECK_TOOL(LD, ld, ld)
  13. AM_INIT_AUTOMAKE(dpkg,[`sed -n '1s/dpkg (\([0-9.]\+\)).*/\1/p' ${srcdir}/debian/changelog`])
  14. ACLOCAL="$ACLOCAL -I automake"
  15. AC_MSG_CHECKING(dpkg version)
  16. AC_MSG_RESULT($VERSION)
  17. AC_PREFIX_DEFAULT(/usr)
  18. dpkg_archset=''
  19. AC_ARG_WITH(arch,
  20. [ --with-arch=value set/override (Debian) architecture value (deprecated)],
  21. [
  22. if test "x$with_arch" = x; then
  23. AC_MSG_ERROR(--with-arch requires an architecture name)
  24. fi
  25. dpkg_archset="${with_arch}"
  26. dpkg_tmp="`awk '$1 == "'$target_cpu'" { print $2 }' $srcdir/archtable`"
  27. if test "x$dpkg_tmp" = "x"; then
  28. AC_MSG_WARN([unable to find specified architecture $dpkg_archset in archtable])
  29. elif test "x$dpkg_tmp" != "x$dpkg_archset"; then
  30. AC_MSG_WARN([canonical architecture is $dpkg_tmp (from archtable)])
  31. fi
  32. ],[
  33. AC_MSG_CHECKING(system architecture)
  34. dpkg_archset="`awk '$1 == "'$target_cpu'" { print $2 }' $srcdir/archtable`"
  35. # Finish off
  36. if test "x$dpkg_archset" = "x"; then
  37. AC_MSG_ERROR(failed: use --with-arch= or --target=)
  38. fi
  39. AC_MSG_RESULT($dpkg_archset)
  40. ])
  41. if test "x$dpkg_archset" != x
  42. then
  43. AC_DEFINE_UNQUOTED(ARCHITECTURE, "${dpkg_archset}")
  44. fi
  45. if test "x${dpkg_archset}" = xi386; then
  46. AC_MSG_CHECKING(target i386 system/binary format)
  47. case "${target_os}" in
  48. linuxaout|linux-gnuaout)
  49. AC_MSG_RESULT(Linux a.out)
  50. dpkg_cc_binfmt=a.out
  51. ;;
  52. linuxcoff|linux-gnucoff)
  53. AC_MSG_RESULT(Linux COFF)
  54. dpkg_cc_binfmt=coff
  55. ;;
  56. linux|linuxelf|linux-gnu*)
  57. AC_MSG_RESULT(Linux ELF)
  58. dpkg_cc_binfmt=elf
  59. ;;
  60. *)
  61. AC_MSG_RESULT([other (${target_os})])
  62. dpkg_cc_binfmt=""
  63. ;;
  64. esac
  65. if test "x$dpkg_cc_binfmt" != "x"; then
  66. AC_DEFINE_UNQUOTED(ARCHBINFMT," $dpkg_cc_binfmt")
  67. fi
  68. fi
  69. AC_ARG_WITH(newdeb,
  70. [ --with-newdeb make dpkg-deb default to new archives],
  71. [AC_DEFINE(BUILDOLDPKGFORMAT, 0)])
  72. AC_ARG_WITH(olddeb,
  73. [ --with-olddeb make dpkg-deb default to old archives],
  74. [AC_DEFINE(BUILDOLDPKGFORMAT, 1)])
  75. dnl gettext
  76. ALL_LINGUAS="en fr es ja_JP.ujis"
  77. AM_GNU_GETTEXT
  78. dnl Other stuff
  79. AC_MSG_CHECKING(for /usr/bin/perl)
  80. if test -f /usr/bin/perl
  81. then
  82. AC_MSG_RESULT(yes)
  83. perlpath=/usr/bin/perl
  84. AC_SUBST(perlpath)
  85. else
  86. AC_MSG_RESULT(no)
  87. AC_PATH_PROG(perlpath,perl)
  88. fi
  89. AC_STDC_HEADERS
  90. AC_PROG_INSTALL
  91. AM_PROG_LIBTOOL
  92. dnl Default in case EMACS == no
  93. lispdir="\$(datadir)/emacs/site-lisp"
  94. AM_PATH_LISPDIR
  95. AC_MODE_T
  96. AC_PID_T
  97. AC_SIZE_T
  98. AC_VPRINTF
  99. AC_C_CONST
  100. AC_C_BIGENDIAN
  101. AC_CHECK_SIZEOF(unsigned long)
  102. AC_CHECK_SIZEOF(unsigned int)
  103. AC_CHECK_FUNCS(unsetenv alphasort scandir strerror strsignal strtoul vsnprintf lchown)
  104. AC_CHECK_HEADERS(sys/cdefs.h sys/sysinfo.h)
  105. AC_CHECK_FUNC(sysinfo,
  106. AC_DEFINE(HAVE_SYSINFO),
  107. AC_MSG_CHECKING(__NR_sysinfo)
  108. AC_EGREP_CPP(yes, [
  109. #include <linux/sys.h>
  110. #include <linux/kernel.h>
  111. #include <linux/unistd.h>
  112. #ifdef __NR_sysinfo
  113. yes
  114. #endif
  115. ],
  116. AC_MSG_RESULT([yes; tsk tsk - get your libc fixed.])
  117. AC_DEFINE(HAVE_NRSYSINFO),
  118. AC_MSG_RESULT(no)
  119. AC_MSG_WARN([sysinfo missing; compilation of dpkg proper may fail.])))
  120. AC_SUBST(OPTCFLAGS)
  121. if test "${GCC-no}" = yes; then
  122. CFLAGS="-D_REENTRANT -D_GNU_SOURCE -O2"
  123. CXXFLAGS="-D_REENTRANT -D_GNU_SOURCE -O2"
  124. OPTCFLAGS="-O3"
  125. else
  126. CFLAGS="-D_REENTRANT -D_GNU_SOURCE -O"
  127. CXXFLAGS="-D_REENTRANT -D_GNU_SOURCE -O"
  128. fi
  129. DPKG_CACHED_TRY_COMPILE(your C compiler,dpkg_cv_c_works,
  130. [#include <string.h>], [strcmp("a","b")],
  131. AC_MSG_RESULT(works),
  132. AC_MSG_RESULT(broken)
  133. AC_MSG_ERROR(C compiler is broken))
  134. DPKG_CACHED_TRY_COMPILE(alphasort declaration,dpkg_cv_header_alphasort,[
  135. #include <sys/types.h>
  136. #include <sys/dir.h>
  137. ], alphasort,
  138. AC_MSG_RESULT(yes)
  139. AC_DEFINE(HAVE_ALPHASORT_DECLARATION),
  140. AC_MSG_RESULT(no))
  141. DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
  142. [} inline int foo (int x) {],
  143. AC_MSG_RESULT(yes)
  144. AC_DEFINE(HAVE_INLINE),
  145. AC_MSG_RESULT(no))
  146. DPKG_CACHED_TRY_COMPILE(__attribute__((,,)),dpkg_cv_c_attribute_supported,,
  147. [extern int testfunction(int x) __attribute__((,,))],
  148. AC_MSG_RESULT(yes)
  149. AC_DEFINE(HAVE_GNUC25_ATTRIB)
  150. DPKG_CACHED_TRY_COMPILE(__attribute__((noreturn)),dpkg_cv_c_attribute_noreturn,,
  151. [extern int testfunction(int x) __attribute__((noreturn))],
  152. AC_MSG_RESULT(yes)
  153. AC_DEFINE(HAVE_GNUC25_NORETURN),
  154. AC_MSG_RESULT(no))
  155. DPKG_CACHED_TRY_COMPILE(__attribute__((const)),dpkg_cv_c_attribute_const,,
  156. [extern int testfunction(int x) __attribute__((const))],
  157. AC_MSG_RESULT(yes)
  158. AC_DEFINE(HAVE_GNUC25_CONST),
  159. AC_MSG_RESULT(no))
  160. DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),dpkg_cv_attribute_format,,
  161. [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))],
  162. AC_MSG_RESULT(yes)
  163. AC_DEFINE(HAVE_GNUC25_PRINTFFORMAT),
  164. AC_MSG_RESULT(no)),
  165. AC_MSG_RESULT(no))
  166. AC_SUBST(CWARNS)
  167. CWARNS=""
  168. DPKG_C_GCC_TRY_WARNS(-Wall -Wno-implicit, dpkg_cv_c_gcc_warn_all)
  169. DPKG_C_GCC_TRY_WARNS(-Wwrite-strings, dpkg_cv_c_gcc_warn_writestrings)
  170. DPKG_C_GCC_TRY_WARNS(-Wpointer-arith, dpkg_cv_c_gcc_warn_pointerarith)
  171. DPKG_C_GCC_TRY_WARNS(-Wimplicit -Wnested-externs, dpkg_cv_c_gcc_warn_implicit)
  172. if test "${GCC-no}" = yes; then
  173. CWARNS="${CWARNS} -Wmissing-prototypes -Wstrict-prototypes"
  174. fi
  175. echo "#define DPKG_VERSION \"$VERSION\" /* This line modified by configure */" > version.h.new
  176. cmp -s version.h.new version.h || mv version.h.new version.h
  177. AC_CONFIG_SUBDIRS(utils)
  178. AC_OUTPUT([Makefile intl/Makefile dpkg-deb/Makefile lib/Makefile
  179. include/Makefile dselect/Makefile split/Makefile methods/Makefile
  180. md5sum/Makefile main/Makefile doc/Makefile doc/ja/Makefile scripts/Makefile
  181. utils/Makefile po/Makefile.in])