configure.in 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. DPKG_C_GCC_TRY_WARNS(-ffunction-sections -fdata-sections, dpkg_cv_func_data_sections)
  191. AC_SUBST(CWARNS)
  192. dnl fix up patchs. We can not use variable references paths since
  193. dnl that breaks DocBook
  194. expandvar() { echo $(eval echo $1) ; }
  195. test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  196. test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
  197. LLIBDIR=`eval echo $libdir`
  198. LLIBDIR=`eval echo $LLIBDIR`
  199. LOCALSTATEDIR="$(expandvar $localstatedir)"
  200. AC_DEFINE_UNQUOTED(LLIBDIR, "$LLIBDIR", [Defined to the $(libdir) location])
  201. AC_DEFINE_UNQUOTED(LOCALSTATEDIR, "$LOCALSTATEDIR", [Defined to $(localstatedir) dir location])
  202. admindir=$(expandvar "$admindir")
  203. bindir=$(expandvar "$bindir")
  204. datadir=$(expandvar "$datadir")
  205. includedirdir=$(expandvar "$includedirdir")
  206. libdir=$(expandvar "$libdir")
  207. libexecdir=$(expandvar "$libexecdir")
  208. localstatedir=$(expandvar "$localstatedir")
  209. mandir=$(expandvar "$mandir")
  210. sbindir=$(expandvar "$sbindir")
  211. sharedstatedir=$(expandvar "$sharedstatedir")
  212. sysconfdir=$(expandvar "$sysconfdir")
  213. infodir=$(expandvar "$infodir")
  214. AC_SUBST(admindir)
  215. AH_BOTTOM([#ifdef HAVE_SYS_CDEFS_H
  216. #include <sys/cdefs.h>
  217. #endif
  218. #ifdef HAVE_STDDEF_H
  219. #include <stddef.h>
  220. #endif
  221. /* Use the definitions: */
  222. /* Give us an unsigned 32-bit data type. */
  223. #if SIZEOF_UNSIGNED_LONG==4
  224. #define UWORD32 unsigned long
  225. #elif SIZEOF_UNSIGNED_INT==4
  226. #define UWORD32 unsigned int
  227. #else
  228. #error I do not know what to use for a UWORD32.
  229. #endif
  230. /* The maximum length of a #! interpreter displayed by dpkg-deb. */
  231. #ifdef PATH_MAX
  232. #define INTERPRETER_MAX PATH_MAX
  233. #else
  234. #define INTERPRETER_MAX 1024
  235. #endif
  236. /* GNU C attributes. */
  237. #ifndef FUNCATTR
  238. #ifdef HAVE_GNUC25_ATTRIB
  239. #define FUNCATTR(x) __attribute__(x)
  240. #else
  241. #define FUNCATTR(x)
  242. #endif
  243. #endif
  244. /* GNU C printf formats, or null. */
  245. #ifndef ATTRPRINTF
  246. #ifdef HAVE_GNUC25_PRINTFFORMAT
  247. #define ATTRPRINTF(si,tc) format(printf,si,tc)
  248. #else
  249. #define ATTRPRINTF(si,tc)
  250. #endif
  251. #endif
  252. #ifndef PRINTFFORMAT
  253. #define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc)))
  254. #endif
  255. /* GNU C nonreturning functions, or null. */
  256. #ifndef ATTRNORETURN
  257. #ifdef HAVE_GNUC25_NORETURN
  258. #define ATTRNORETURN noreturn
  259. #else /* ! HAVE_GNUC25_NORETURN */
  260. #define ATTRNORETURN
  261. #endif /* HAVE_GNUC25_NORETURN */
  262. #endif /* ATTRNORETURN */
  263. #ifndef NONRETURNING
  264. #define NONRETURNING FUNCATTR((ATTRNORETURN))
  265. #endif /* NONRETURNING */
  266. /* Combination of both the above. */
  267. #ifndef NONRETURNPRINTFFORMAT
  268. #define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN))
  269. #endif
  270. /* GNU C constant functions, or null. */
  271. #ifndef ATTRCONST
  272. #ifdef HAVE_GNUC25_CONST
  273. #define ATTRCONST const
  274. #else
  275. #define ATTRCONST
  276. #endif
  277. #endif
  278. #ifndef CONSTANT
  279. #define CONSTANT FUNCATTR((ATTRCONST))
  280. #endif
  281. /* GNU C unused functions, or null. */
  282. #ifndef ATTRUNUSED
  283. #ifdef HAVE_GNUC25_UNUSED
  284. #define ATTRUNUSED
  285. #else
  286. #define ATTRUNUSED
  287. #endif
  288. #endif
  289. #ifndef UNUSED
  290. #define UNUSED FUNCATTR((ATTRUNUSED))
  291. #endif
  292. /* Declare strerror if we don't have it already. */
  293. #ifndef HAVE_STRERROR
  294. const char *strerror(int);
  295. #endif
  296. /* Declare strsignal if we don't have it already. */
  297. #ifndef HAVE_STRSIGNAL
  298. const char *strsignal(int);
  299. #endif
  300. /* Declare scandir if we don't have it already. */
  301. #ifndef HAVE_SCANDIR
  302. struct dirent;
  303. int scandir(const char *dir, struct dirent ***namelist,
  304. int (*select)(const struct dirent *),
  305. int (*compar)(const void*, const void*));
  306. #endif
  307. /* Declare alphasort if we don't have it already. */
  308. #if !defined(HAVE_ALPHASORT) || !defined(HAVE_ALPHASORT_DECLARATION)
  309. struct dirent;
  310. int alphasort(const struct dirent *a, const struct dirent *b);
  311. #endif
  312. /* Declare unsetenv if we don't have it already. */
  313. #ifndef HAVE_UNSETENV
  314. void unsetenv(const char *x);
  315. #endif
  316. /* Define strtoul if we don't have it already. */
  317. #ifndef HAVE_STRTOUL
  318. #define strtoul strtol
  319. #endif
  320. #ifndef HAVE_VA_COPY
  321. #define __va_copy(dest,src) (dest) = (src)
  322. #endif
  323. /* Define WCOREDUMP if we don't have it already - coredumps won't be
  324. * detected, though.
  325. */
  326. #ifndef WCOREDUMP
  327. #define WCOREDUMP(x) 0
  328. #endif
  329. /* Set BUILDOLDPKGFORMAT to 1 to build old-format archives by default.
  330. */
  331. #ifndef BUILDOLDPKGFORMAT
  332. #define BUILDOLDPKGFORMAT 0
  333. #endif
  334. ])
  335. AC_OUTPUT(
  336. Makefile.conf
  337. Makefile
  338. intl/Makefile
  339. include/Makefile
  340. dpkg-deb/Makefile
  341. split/Makefile
  342. lib/Makefile
  343. optlib/Makefile
  344. doc/Makefile
  345. man/Makefile
  346. man/paths.ent
  347. man/de/Makefile
  348. man/en/Makefile
  349. man/fr/Makefile
  350. man/ja/Makefile
  351. man/ru/Makefile
  352. man/sv/Makefile
  353. man/pt_BR/Makefile
  354. scripts/Makefile
  355. main/Makefile
  356. dselect/Makefile
  357. methods/Makefile
  358. utils/Makefile
  359. po/Makefile:po/Makefile.in.in)