configure.in 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ([2.53])
  3. AC_INIT(include/dpkg.h.in)
  4. AC_CONFIG_HEADER(config.h)
  5. ALSO_STATIC=
  6. AC_ARG_WITH(static-progs,
  7. [ --with-static-progs compile static versions of certain binaries as well],
  8. [case "$withval" in
  9. "true" | "yes" )
  10. ALSO_STATIC=1
  11. ;;
  12. esac])
  13. AC_SUBST(ALSO_STATIC)
  14. DSELECTDIR="dselect"
  15. AC_ARG_WITH(dselect,
  16. [ --with-dselect the dselect package-management frontend],
  17. [case "$withval" in
  18. "false" | "no" )
  19. DSELECTDIR=""
  20. ;;
  21. esac])
  22. AC_SUBST(DSELECTDIR)
  23. USE_START_STOP_DAEMON="true"
  24. AC_ARG_WITH(start-stop-daemon,
  25. [ --with-start-stop-daemon
  26. start and stop system daemons],
  27. [case "$withval" in
  28. "false" | "no" )
  29. USE_START_STOP_DAEMON=""
  30. ;;
  31. esac])
  32. AC_SUBST(USE_START_STOP_DAEMON)
  33. if test "$USE_START_STOP_DAEMON" != ""; then
  34. AC_DEFINE(USE_START_STOP_DAEMON,,[Define if start-stop-daemon is compiled.])
  35. fi
  36. USE_SGML_DOC="true"
  37. AC_ARG_WITH(sgml-doc,
  38. [ --with-sgml-doc SGML documentation converted to HTML],
  39. [case "$withval" in
  40. "false" | "no" )
  41. USE_SGML_DOC=""
  42. ;;
  43. esac])
  44. AC_SUBST(USE_SGML_DOC)
  45. admindir="$libdir/db"
  46. AC_ARG_WITH(admindir,
  47. [ --with-admindir=DIR store dpkg database in DIR [LIBDIR/db]],
  48. [case "$withval" in
  49. "" )
  50. AC_MSG_ERROR(invalid admindir specified)
  51. ;;
  52. * )
  53. admindir="$withval"
  54. ;;
  55. esac])
  56. AC_CHECK_TOOL_PREFIX
  57. AC_CANONICAL_SYSTEM
  58. AC_CHECK_TOOL(CC, gcc)
  59. AC_PROG_CC
  60. AC_PROG_CXX
  61. AM_CONDITIONAL(HAVE_CPLUSPLUS, [test "$CXX" != ""])
  62. AC_CHECK_TOOL(LD, ld, ld)
  63. PACKAGE=dpkg
  64. AC_SUBST(PACKAGE)
  65. VERSION=`cat $srcdir/version-nr`
  66. AC_SUBST(VERSION)
  67. AC_SYS_LARGEFILE
  68. dnl test to see if srcdir already configured
  69. if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
  70. AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
  71. fi
  72. AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
  73. AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])
  74. AC_ARG_PROGRAM
  75. AC_PROG_MAKE_SET
  76. AC_MSG_CHECKING(dpkg version)
  77. AC_MSG_RESULT($VERSION)
  78. AC_PREFIX_DEFAULT(/usr)
  79. dpkg_archset=''
  80. AC_MSG_CHECKING(Debian architecture)
  81. dpkg_archset="`awk '$1 == "'$target_cpu-$target_os'" { print $2 }' $srcdir/archtable`"
  82. # Finish off
  83. if test "x$dpkg_archset" = "x"; then
  84. AC_MSG_RESULT([$target_cpu-$target_os, but not found in archtable])
  85. dpkg_archset=$target_cpu-$target_os
  86. else
  87. AC_MSG_RESULT($dpkg_archset)
  88. fi
  89. AC_DEFINE_UNQUOTED(ARCHITECTURE, "${dpkg_archset}", [Set this to the canonical Debian architecture string for this CPU type.])
  90. dnl gettext
  91. ALL_LINGUAS="ca cs da de en es fr gl it nl ja pl pt_BR ru sv"
  92. AM_GNU_GETTEXT
  93. dnl Other stuff
  94. AC_STDC_HEADERS
  95. AC_PROG_RANLIB
  96. AC_PROG_LN_S
  97. AC_CHECK_PROG(RM,rm,rm -f)
  98. AC_CHECK_PROG(SED,sed,sed)
  99. AC_PROG_INSTALL
  100. AC_PATH_PROG(PERL,perl,/usr/bin/perl)
  101. AC_MODE_T
  102. AC_PID_T
  103. AC_SIZE_T
  104. AC_VPRINTF
  105. AC_C_CONST
  106. AC_C_BIGENDIAN
  107. AC_C_INLINE
  108. AC_CHECK_SIZEOF(unsigned long)
  109. AC_CHECK_SIZEOF(unsigned int)
  110. AC_CHECK_TYPE(ptrdiff_t,int)
  111. AC_CHECK_FUNCS(unsetenv alphasort scandir strerror strsignal strtoul setsid)
  112. AC_CHECK_FUNCS(vsnprintf lchown snprintf)
  113. AC_CHECK_HEADERS(sys/cdefs.h syslog.h stddef.h)
  114. AC_CHECK_HEADERS(error.h)
  115. AC_SYS_SIGLIST_DECLARED
  116. AC_CHECK_LIB(ihash, ihash_create, SSD_LIBS="-lihash $SSD_LIBS")
  117. AC_CHECK_LIB(ps, proc_stat_list_create, SSD_LIBS="-lps $SSD_LIBS")
  118. AC_CHECK_LIB(shouldbeinlibc, fmt_past_time, SSD_LIBS="-lshouldbeinlibc $SSD_LIBS")
  119. AC_CHECK_LIB(kvm, kvm_openfiles, SSD_LIBS="-lkvm $SSD_LIBS")
  120. AC_SUBST(SSD_LIBS)
  121. DPKG_CHECK_DEFINE(TIOCNOTTY,sys/ioctl.h)
  122. ZLIB_CFLAGS=
  123. ZLIB_LIBS=
  124. ZLIB_LIBS_ALSO_STATIC=
  125. AC_ARG_WITH(zlib,
  126. [ --with-zlib use zlib for decompression of some gzip files],
  127. [use_zlib=$withval],
  128. [uze_zlib=no])
  129. if test "$use_zlib" != "no" ; then
  130. ZLIB_CFLAGS=-DUSE_ZLIB
  131. if test "$use_zlib" = "static" ; then
  132. ZLIB_LIBS="-Wl,-Bstatic -lz -Wl,-Bdynamic"
  133. if test "$ALSO_STATIC"; then
  134. ZLIB_LIBS_ALSO_STATIC="-lz"
  135. fi
  136. else
  137. ZLIB_LIBS=-lz
  138. ZLIB_LIBS_ALSO_STATIC="-lz"
  139. fi
  140. fi
  141. AC_SUBST(ZLIB_CFLAGS)
  142. AC_SUBST(ZLIB_LIBS)
  143. AC_SUBST(ZLIB_LIBS_ALSO_STATIC)
  144. AC_TRY_COMPILE([
  145. #include <sys/types.h>
  146. #include <dirent.h>
  147. ], alphasort, AC_DEFINE(HAVE_ALPHASORT_DECLARATION,,[Define if alphasort is declared.]))
  148. AC_TRY_COMPILE(,[
  149. } inline int foo (int x) {], AC_DEFINE(HAVE_INLINE,,[Define if inline functions a la GCC are available.]))
  150. AC_MSG_CHECKING([for __va_copy])
  151. AC_TRY_COMPILE([
  152. #include <stdarg.h>
  153. ],[
  154. va_list v1,v2;
  155. __va_copy(v1, v2);
  156. ], [AC_MSG_RESULT(yes)
  157. AC_DEFINE(HAVE_VA_COPY,,[Define if you have the __va_copy macro])],[AC_MSG_RESULT(no)
  158. AC_MSG_CHECKING([for va_list assignment copy])
  159. AC_TRY_COMPILE([
  160. #include <stdarg.h>
  161. ],[
  162. va_list v1,v2;
  163. v1 = v2;
  164. ], AC_MSG_RESULT(yes),AC_MSG_ERROR(no))])
  165. DPKG_C_GCC_ATTRIBUTE([,,],supported,[int x],[,,],ATTRIB,[Define if function attributes a la GCC 2.5 and higher are available.],
  166. DPKG_C_GCC_ATTRIBUTE(noreturn,noreturn,[int x],noreturn,NORETURN,[Define if nonreturning functions a la GCC 2.5 and higher are available.])
  167. DPKG_C_GCC_ATTRIBUTE(const,const,[int x],const,CONST,[Define if constant functions a la GCC 2.5 and higher are available.])
  168. DPKG_C_GCC_ATTRIBUTE(unused,unused,[int x],unused,UNUSED,[Define if unused variables la GCC 2.5 and higher are available.])
  169. DPKG_C_GCC_ATTRIBUTE(format...,format,[char *y, ...],[format(printf,1,2)],PRINTFFORMAT,[Define if printf-format argument lists a la GCC are available.]))
  170. AC_MSG_CHECKING(whether to use -Werror)
  171. AC_ARG_WITH(Werror,
  172. [ --with-Werror use -Werror when compiling],
  173. [warn=-Werror]
  174. AC_MSG_RESULT(yes)
  175. DPKG_C_GCC_TRY_WARNS(-Werror, dpkg_cv_c_gcc_warn_error),
  176. [warn=all]
  177. AC_MSG_RESULT(no))
  178. DPKG_C_GCC_TRY_WARNS(-Wall , dpkg_cv_c_gcc_warn_all)
  179. DPKG_C_GCC_TRY_WARNS(-Wwrite-strings, dpkg_cv_c_gcc_warn_writestrings)
  180. DPKG_C_GCC_TRY_WARNS(-Wpointer-arith, dpkg_cv_c_gcc_warn_pointerarith)
  181. DPKG_C_GCC_TRY_WARNS(-Wimplicit -Wnested-externs, dpkg_cv_c_gcc_warn_implicit)
  182. DPKG_C_GCC_TRY_WARNS(-Wstrict-prototypes, dpkg_cv_c_gcc_strict_prototypes)
  183. DPKG_C_GCC_TRY_WARNS(-Wmissing-prototypes, dpkg_cv_c_gcc_missing_prototypes)
  184. DPKG_C_GCC_TRY_WARNS(-Wmissing-declarations, dpkg_cv_c_gcc_missing_declarations)
  185. DPKG_C_GCC_TRY_WARNS(-Wbad-function-cast, dpkg_cv_c_gcc_func_cast)
  186. DPKG_C_GCC_TRY_WARNS(-Wcast-qual -Wcast-align, dpkg_cv_c_gcc_cast_qual)
  187. DPKG_C_GCC_TRY_WARNS(-Winline, dpkg_cv_c_gcc_inline)
  188. DPKG_C_GCC_TRY_WARNS(-Wmissing-noreturn, dpkg_cv_c_gcc_noreturn)
  189. DPKG_C_GCC_TRY_WARNS(-Wsign-compare, dpkg_cv_c_gcc_comp_conv)
  190. AC_SUBST(CWARNS)
  191. dnl fix up patchs. We can not use variable references paths since
  192. dnl that breaks DocBook
  193. expandvar() { echo $(eval echo $1) ; }
  194. test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  195. test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
  196. LLIBDIR=`eval echo $libdir`
  197. LLIBDIR=`eval echo $LLIBDIR`
  198. LOCALSTATEDIR="$(expandvar $localstatedir)"
  199. AC_DEFINE_UNQUOTED(LLIBDIR, "$LLIBDIR", [Defined to the $(libdir) location])
  200. AC_DEFINE_UNQUOTED(LOCALSTATEDIR, "$LOCALSTATEDIR", [Defined to $(localstatedir) dir location])
  201. admindir=$(expandvar "$admindir")
  202. bindir=$(expandvar "$bindir")
  203. datadir=$(expandvar "$datadir")
  204. includedirdir=$(expandvar "$includedirdir")
  205. libdir=$(expandvar "$libdir")
  206. libexecdir=$(expandvar "$libexecdir")
  207. localstatedir=$(expandvar "$localstatedir")
  208. mandir=$(expandvar "$mandir")
  209. sbindir=$(expandvar "$sbindir")
  210. sharedstatedir=$(expandvar "$sharedstatedir")
  211. sysconfdir=$(expandvar "$sysconfdir")
  212. infodir=$(expandvar "$infodir")
  213. AC_SUBST(admindir)
  214. AH_BOTTOM([#ifdef HAVE_SYS_CDEFS_H
  215. #include <sys/cdefs.h>
  216. #endif
  217. #ifdef HAVE_STDDEF_H
  218. #include <stddef.h>
  219. #endif
  220. /* Use the definitions: */
  221. /* Give us an unsigned 32-bit data type. */
  222. #if SIZEOF_UNSIGNED_LONG==4
  223. #define UWORD32 unsigned long
  224. #elif SIZEOF_UNSIGNED_INT==4
  225. #define UWORD32 unsigned int
  226. #else
  227. #error I do not know what to use for a UWORD32.
  228. #endif
  229. /* The maximum length of a #! interpreter displayed by dpkg-deb. */
  230. #ifdef PATH_MAX
  231. #define INTERPRETER_MAX PATH_MAX
  232. #else
  233. #define INTERPRETER_MAX 1024
  234. #endif
  235. /* GNU C attributes. */
  236. #ifndef FUNCATTR
  237. #ifdef HAVE_GNUC25_ATTRIB
  238. #define FUNCATTR(x) __attribute__(x)
  239. #else
  240. #define FUNCATTR(x)
  241. #endif
  242. #endif
  243. /* GNU C printf formats, or null. */
  244. #ifndef ATTRPRINTF
  245. #ifdef HAVE_GNUC25_PRINTFFORMAT
  246. #define ATTRPRINTF(si,tc) format(printf,si,tc)
  247. #else
  248. #define ATTRPRINTF(si,tc)
  249. #endif
  250. #endif
  251. #ifndef PRINTFFORMAT
  252. #define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc)))
  253. #endif
  254. /* GNU C nonreturning functions, or null. */
  255. #ifndef ATTRNORETURN
  256. #ifdef HAVE_GNUC25_NORETURN
  257. #define ATTRNORETURN noreturn
  258. #else /* ! HAVE_GNUC25_NORETURN */
  259. #define ATTRNORETURN
  260. #endif /* HAVE_GNUC25_NORETURN */
  261. #endif /* ATTRNORETURN */
  262. #ifndef NONRETURNING
  263. #define NONRETURNING FUNCATTR((ATTRNORETURN))
  264. #endif /* NONRETURNING */
  265. /* Combination of both the above. */
  266. #ifndef NONRETURNPRINTFFORMAT
  267. #define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN))
  268. #endif
  269. /* GNU C constant functions, or null. */
  270. #ifndef ATTRCONST
  271. #ifdef HAVE_GNUC25_CONST
  272. #define ATTRCONST const
  273. #else
  274. #define ATTRCONST
  275. #endif
  276. #endif
  277. #ifndef CONSTANT
  278. #define CONSTANT FUNCATTR((ATTRCONST))
  279. #endif
  280. /* GNU C unused functions, or null. */
  281. #ifndef ATTRUNUSED
  282. #ifdef HAVE_GNUC25_UNUSED
  283. #define ATTRUNUSED
  284. #else
  285. #define ATTRUNUSED
  286. #endif
  287. #endif
  288. #ifndef UNUSED
  289. #define UNUSED FUNCATTR((ATTRUNUSED))
  290. #endif
  291. /* Declare strerror if we don't have it already. */
  292. #ifndef HAVE_STRERROR
  293. const char *strerror(int);
  294. #endif
  295. /* Declare strsignal if we don't have it already. */
  296. #ifndef HAVE_STRSIGNAL
  297. const char *strsignal(int);
  298. #endif
  299. /* Declare scandir if we don't have it already. */
  300. #ifndef HAVE_SCANDIR
  301. struct dirent;
  302. int scandir(const char *dir, struct dirent ***namelist,
  303. int (*select)(const struct dirent *),
  304. int (*compar)(const void*, const void*));
  305. #endif
  306. /* Declare alphasort if we don't have it already. */
  307. #if !defined(HAVE_ALPHASORT) || !defined(HAVE_ALPHASORT_DECLARATION)
  308. struct dirent;
  309. int alphasort(const struct dirent *a, const struct dirent *b);
  310. #endif
  311. /* Declare unsetenv if we don't have it already. */
  312. #ifndef HAVE_UNSETENV
  313. void unsetenv(const char *x);
  314. #endif
  315. /* Define strtoul if we don't have it already. */
  316. #ifndef HAVE_STRTOUL
  317. #define strtoul strtol
  318. #endif
  319. #ifndef HAVE_VA_COPY
  320. #define __va_copy(dest,src) (dest) = (src)
  321. #endif
  322. /* Define WCOREDUMP if we don't have it already - coredumps won't be
  323. * detected, though.
  324. */
  325. #ifndef WCOREDUMP
  326. #define WCOREDUMP(x) 0
  327. #endif
  328. /* Set BUILDOLDPKGFORMAT to 1 to build old-format archives by default.
  329. */
  330. #ifndef BUILDOLDPKGFORMAT
  331. #define BUILDOLDPKGFORMAT 0
  332. #endif
  333. ])
  334. AC_OUTPUT(
  335. Makefile.conf
  336. Makefile
  337. intl/Makefile
  338. include/Makefile
  339. dpkg-deb/Makefile
  340. split/Makefile
  341. lib/Makefile
  342. optlib/Makefile
  343. doc/Makefile
  344. man/Makefile
  345. man/paths.ent
  346. man/de/Makefile
  347. man/en/Makefile
  348. man/fr/Makefile
  349. man/ja/Makefile
  350. man/ru/Makefile
  351. man/sv/Makefile
  352. man/pt_BR/Makefile
  353. scripts/Makefile
  354. main/Makefile
  355. dselect/Makefile
  356. methods/Makefile
  357. utils/Makefile
  358. po/Makefile:po/Makefile.in.in)