configure.in 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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. # OpenBSD has decided to be odd and includ a version number
  80. # in the final field of the GNU system type.
  81. # This code strips it out in a generic way.
  82. os_type=''
  83. AC_MSG_CHECKING(Operating system type)
  84. case $target_os in
  85. *linux-gnu* )
  86. os_type="linux-gnu";;
  87. *linux* )
  88. os_type="linux-gnu";;
  89. *openbsd* )
  90. os_type="openbsd";;
  91. *knetbsd*-gnu* )
  92. os_type="knetbsd-gnu";;
  93. *netbsd* )
  94. os_type="netbsd";;
  95. *kfreebsd*-gnu* )
  96. os_type="kfreebsd-gnu";;
  97. *freebsd* )
  98. os_type="freebsd";;
  99. gnu )
  100. os_type="hurd";;
  101. esac
  102. if test "x$os_type" = "x"; then
  103. os_type=$target_os
  104. fi
  105. AC_MSG_RESULT([$os_type])
  106. AC_SUBST(os_type)
  107. dpkg_archset=''
  108. AC_MSG_CHECKING(Debian architecture)
  109. dpkg_archset="`awk '$1 == "'$target_cpu-$os_type'" { print $2 }' $srcdir/archtable`"
  110. # Finish off
  111. if test "x$dpkg_archset" = "x"; then
  112. AC_MSG_RESULT([$target_cpu-$os_type, but not found in archtable])
  113. dpkg_archset=$target_cpu-$os_type
  114. else
  115. AC_MSG_RESULT($dpkg_archset)
  116. fi
  117. AC_DEFINE_UNQUOTED(ARCHITECTURE, "${dpkg_archset}", [Set this to the canonical Debian architecture string for this CPU type.])
  118. dnl gettext
  119. ALL_LINGUAS="bs ca cs da de el es eu fr gl he id it ja ko nb nl nn pl pt pt_BR ro ru sk sv tl zh_CN zh_TW"
  120. AM_GNU_GETTEXT([external])
  121. AM_PO_SUBDIRS
  122. if test "x$HAVE_LOCALE_H" = "x"; then
  123. AC_MSG_CHECKING([whether setlocale() is available])
  124. HAVE_SETLOCALE=''
  125. AC_TRY_COMPILE([#include <locale.h>],[ setlocale(0, "bar");], HAVE_SETLOCALE=1;
  126. AC_DEFINE(HAVE_SETLOCALE,1,[Define if setlocale is available.])
  127. )
  128. if test "x$HAVE_SETLOCALE" = x; then
  129. AC_MSG_RESULT(no)
  130. else
  131. AC_MSG_RESULT(yes)
  132. fi
  133. fi
  134. dnl Other stuff
  135. AC_STDC_HEADERS
  136. AC_PROG_RANLIB
  137. AC_PROG_LN_S
  138. AC_CHECK_PROG(RM,rm,rm -f)
  139. AC_CHECK_PROG(SED,sed,sed)
  140. AC_PROG_INSTALL
  141. AC_PATH_PROG(PERL,perl,/usr/bin/perl)
  142. AC_MODE_T
  143. AC_PID_T
  144. AC_SIZE_T
  145. AC_VPRINTF
  146. AC_C_CONST
  147. AC_C_BIGENDIAN
  148. AC_C_INLINE
  149. AC_CHECK_SIZEOF(unsigned long)
  150. AC_CHECK_SIZEOF(unsigned int)
  151. AC_CHECK_TYPE(ptrdiff_t,int)
  152. AC_CHECK_FUNCS(unsetenv alphasort scandir strerror strsignal strtoul setsid)
  153. AC_CHECK_FUNCS(vsnprintf lchown snprintf)
  154. AC_CHECK_HEADERS(sys/cdefs.h syslog.h stddef.h)
  155. AC_CHECK_HEADERS(error.h locale.h)
  156. AC_DECL_SYS_SIGLIST
  157. AC_CHECK_LIB(ihash, ihash_create, SSD_LIBS="-lihash $SSD_LIBS")
  158. AC_CHECK_LIB(ps, proc_stat_list_create, SSD_LIBS="-lps $SSD_LIBS")
  159. AC_CHECK_LIB(shouldbeinlibc, fmt_past_time, SSD_LIBS="-lshouldbeinlibc $SSD_LIBS")
  160. AC_CHECK_LIB(kvm, kvm_openfiles, SSD_LIBS="-lkvm $SSD_LIBS")
  161. AC_SUBST(SSD_LIBS)
  162. # check for the proper curses library. This can be either
  163. # -lcurses or -lncurses, we need to check for either one.
  164. AC_CHECK_LIB(ncurses,initscr, CURSES_LIBS="-lncurses $CURSES_LIBS", AC_CHECK_LIB(curses,initscr, CURSES_LIBS="-lcurses $CURSES_LIBS"))
  165. if test "x$CURSES_LIBS" = "x"; then
  166. AC_MSG_WARN(no curses library found)
  167. fi
  168. AC_SUBST(CURSES_LIBS)
  169. DPKG_CHECK_DEFINE(TIOCNOTTY,sys/ioctl.h)
  170. ZLIB_CFLAGS=
  171. ZLIB_LIBS=
  172. ZLIB_LIBS_ALSO_STATIC=
  173. AC_ARG_WITH(zlib,
  174. [ --with-zlib use zlib for decompression of some gzip files],
  175. [use_zlib=$withval],
  176. [uze_zlib=no])
  177. if test "$use_zlib" != "no" ; then
  178. ZLIB_CFLAGS=-DUSE_ZLIB
  179. if test "$use_zlib" = "static" ; then
  180. ZLIB_LIBS="-Wl,-Bstatic -lz -Wl,-Bdynamic"
  181. if test "$ALSO_STATIC"; then
  182. ZLIB_LIBS_ALSO_STATIC="-lz"
  183. fi
  184. else
  185. ZLIB_LIBS=-lz
  186. ZLIB_LIBS_ALSO_STATIC="-lz"
  187. fi
  188. fi
  189. AC_SUBST(ZLIB_CFLAGS)
  190. AC_SUBST(ZLIB_LIBS)
  191. AC_SUBST(ZLIB_LIBS_ALSO_STATIC)
  192. BZ2LIB_CFLAGS=
  193. BZ2LIB_LIBS=
  194. BZ2LIB_LIBS_ALSO_STATIC=
  195. AC_ARG_WITH(bz2lib,
  196. [ --with-bz2lib use bz2lib for decompression of some bzip2 files],
  197. [use_bz2lib=$withval],
  198. [uze_bz2lib=no])
  199. if test "$use_bz2lib" != "no" ; then
  200. BZ2LIB_CFLAGS=-DUSE_BZ2LIB
  201. if test "$use_bz2lib" = "static" ; then
  202. BZ2LIB_LIBS="-Wl,-Bstatic -lbz2 -Wl,-Bdynamic"
  203. if test "$ALSO_STATIC"; then
  204. BZ2LIB_LIBS_ALSO_STATIC="-lbz2"
  205. fi
  206. else
  207. BZ2LIB_LIBS=-lbz2
  208. BZ2LIB_LIBS_ALSO_STATIC="-lbz2"
  209. fi
  210. fi
  211. AC_SUBST(BZ2LIB_CFLAGS)
  212. AC_SUBST(BZ2LIB_LIBS)
  213. AC_SUBST(BZ2LIB_LIBS_ALSO_STATIC)
  214. AC_TRY_COMPILE([
  215. #include <sys/types.h>
  216. #include <dirent.h>
  217. ], alphasort, AC_DEFINE(HAVE_ALPHASORT_DECLARATION,,[Define if alphasort is declared.]))
  218. AC_TRY_COMPILE(,[
  219. } inline int foo (int x) {], AC_DEFINE(HAVE_INLINE,,[Define if inline functions a la GCC are available.]))
  220. AC_MSG_CHECKING([for va_copy])
  221. # OpenBSD passes AC_TRY_COMPILE for va_copy even though
  222. # it doesn't seem to exist, which is odd. We need to use
  223. # AC_TRY_RUN.
  224. AC_TRY_RUN([
  225. #include <stdarg.h>
  226. main(){
  227. va_list v1,v2;
  228. va_copy(v1, v2);
  229. exit(0);}
  230. ], [AC_MSG_RESULT(yes)
  231. AC_DEFINE(HAVE_VA_COPY,,[Whether the va_copy macro exists])],[AC_MSG_RESULT(no)
  232. AC_MSG_CHECKING([for va_list assignment copy])
  233. AC_TRY_COMPILE([
  234. #include <stdarg.h>
  235. ],[
  236. va_list v1,v2;
  237. v1 = v2;
  238. ], AC_MSG_RESULT(yes),AC_MSG_ERROR(no))])
  239. DPKG_C_GCC_ATTRIBUTE([,,],supported,[int x],[,,],ATTRIB,[Define if function attributes a la GCC 2.5 and higher are available.],
  240. DPKG_C_GCC_ATTRIBUTE(noreturn,noreturn,[int x],noreturn,NORETURN,[Define if nonreturning functions a la GCC 2.5 and higher are available.])
  241. DPKG_C_GCC_ATTRIBUTE(const,const,[int x],const,CONST,[Define if constant functions a la GCC 2.5 and higher are available.])
  242. DPKG_C_GCC_ATTRIBUTE(unused,unused,[int x],unused,UNUSED,[Define if unused variables la GCC 2.5 and higher are available.])
  243. DPKG_C_GCC_ATTRIBUTE(format...,format,[char *y, ...],[format(printf,1,2)],PRINTFFORMAT,[Define if printf-format argument lists a la GCC are available.]))
  244. AC_MSG_CHECKING(whether to use -Werror)
  245. AC_ARG_WITH(Werror,
  246. [ --with-Werror use -Werror when compiling],
  247. [warn=-Werror]
  248. AC_MSG_RESULT(yes)
  249. DPKG_C_GCC_TRY_WARNS(-Werror, dpkg_cv_c_gcc_warn_error),
  250. [warn=all]
  251. AC_MSG_RESULT(no))
  252. DPKG_C_GCC_TRY_WARNS(-Wall , dpkg_cv_c_gcc_warn_all)
  253. DPKG_C_GCC_TRY_WARNS(-Wwrite-strings, dpkg_cv_c_gcc_warn_writestrings)
  254. DPKG_C_GCC_TRY_WARNS(-Wpointer-arith, dpkg_cv_c_gcc_warn_pointerarith)
  255. DPKG_C_GCC_TRY_WARNS(-Wimplicit -Wnested-externs, dpkg_cv_c_gcc_warn_implicit)
  256. DPKG_C_GCC_TRY_WARNS(-Wstrict-prototypes, dpkg_cv_c_gcc_strict_prototypes)
  257. DPKG_C_GCC_TRY_WARNS(-Wmissing-prototypes, dpkg_cv_c_gcc_missing_prototypes)
  258. DPKG_C_GCC_TRY_WARNS(-Wmissing-declarations, dpkg_cv_c_gcc_missing_declarations)
  259. DPKG_C_GCC_TRY_WARNS(-Wbad-function-cast, dpkg_cv_c_gcc_func_cast)
  260. DPKG_C_GCC_TRY_WARNS(-Wcast-qual -Wcast-align, dpkg_cv_c_gcc_cast_qual)
  261. DPKG_C_GCC_TRY_WARNS(-Winline, dpkg_cv_c_gcc_inline)
  262. DPKG_C_GCC_TRY_WARNS(-Wmissing-noreturn, dpkg_cv_c_gcc_noreturn)
  263. DPKG_C_GCC_TRY_WARNS(-Wsign-compare, dpkg_cv_c_gcc_comp_conv)
  264. AC_SUBST(CWARNS)
  265. dnl fix up patchs. We can not use variable references paths since
  266. dnl that breaks DocBook
  267. expandvar() { echo $(eval echo $1) ; }
  268. test "x$prefix" = xNONE && prefix="$ac_default_prefix"
  269. test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
  270. LLIBDIR=`eval echo $libdir`
  271. LLIBDIR=`eval echo $LLIBDIR`
  272. LOCALSTATEDIR="$(expandvar $localstatedir)"
  273. AC_DEFINE_UNQUOTED(LLIBDIR, "$LLIBDIR", [Defined to the $(libdir) location])
  274. AC_DEFINE_UNQUOTED(LOCALSTATEDIR, "$LOCALSTATEDIR", [Defined to $(localstatedir) dir location])
  275. admindir=$(expandvar "$admindir")
  276. bindir=$(expandvar "$bindir")
  277. datadir=$(expandvar "$datadir")
  278. includedirdir=$(expandvar "$includedirdir")
  279. libdir=$(expandvar "$libdir")
  280. libexecdir=$(expandvar "$libexecdir")
  281. localstatedir=$(expandvar "$localstatedir")
  282. mandir=$(expandvar "$mandir")
  283. sbindir=$(expandvar "$sbindir")
  284. sharedstatedir=$(expandvar "$sharedstatedir")
  285. sysconfdir=$(expandvar "$sysconfdir")
  286. infodir=$(expandvar "$infodir")
  287. AC_SUBST(admindir)
  288. AH_BOTTOM([#ifdef HAVE_SYS_CDEFS_H
  289. #include <sys/cdefs.h>
  290. #endif
  291. #ifdef HAVE_STDDEF_H
  292. #include <stddef.h>
  293. #endif
  294. /* Use the definitions: */
  295. /* Give us an unsigned 32-bit data type. */
  296. #if SIZEOF_UNSIGNED_LONG==4
  297. #define UWORD32 unsigned long
  298. #elif SIZEOF_UNSIGNED_INT==4
  299. #define UWORD32 unsigned int
  300. #else
  301. #error I do not know what to use for a UWORD32.
  302. #endif
  303. /* The maximum length of a #! interpreter displayed by dpkg-deb. */
  304. #ifdef PATH_MAX
  305. #define INTERPRETER_MAX PATH_MAX
  306. #else
  307. #define INTERPRETER_MAX 1024
  308. #endif
  309. /* GNU C attributes. */
  310. #ifndef FUNCATTR
  311. #ifdef HAVE_GNUC25_ATTRIB
  312. #define FUNCATTR(x) __attribute__(x)
  313. #else
  314. #define FUNCATTR(x)
  315. #endif
  316. #endif
  317. /* GNU C printf formats, or null. */
  318. #ifndef ATTRPRINTF
  319. #ifdef HAVE_GNUC25_PRINTFFORMAT
  320. #define ATTRPRINTF(si,tc) format(printf,si,tc)
  321. #else
  322. #define ATTRPRINTF(si,tc)
  323. #endif
  324. #endif
  325. #ifndef PRINTFFORMAT
  326. #define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc)))
  327. #endif
  328. /* GNU C nonreturning functions, or null. */
  329. #ifndef ATTRNORETURN
  330. #ifdef HAVE_GNUC25_NORETURN
  331. #define ATTRNORETURN noreturn
  332. #else /* ! HAVE_GNUC25_NORETURN */
  333. #define ATTRNORETURN
  334. #endif /* HAVE_GNUC25_NORETURN */
  335. #endif /* ATTRNORETURN */
  336. #ifndef NONRETURNING
  337. #define NONRETURNING FUNCATTR((ATTRNORETURN))
  338. #endif /* NONRETURNING */
  339. /* Combination of both the above. */
  340. #ifndef NONRETURNPRINTFFORMAT
  341. #define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN))
  342. #endif
  343. /* GNU C constant functions, or null. */
  344. #ifndef ATTRCONST
  345. #ifdef HAVE_GNUC25_CONST
  346. #define ATTRCONST const
  347. #else
  348. #define ATTRCONST
  349. #endif
  350. #endif
  351. #ifndef CONSTANT
  352. #define CONSTANT FUNCATTR((ATTRCONST))
  353. #endif
  354. /* GNU C unused functions, or null. */
  355. #ifndef ATTRUNUSED
  356. #ifdef HAVE_GNUC25_UNUSED
  357. #define ATTRUNUSED
  358. #else
  359. #define ATTRUNUSED
  360. #endif
  361. #endif
  362. #ifndef UNUSED
  363. #define UNUSED FUNCATTR((ATTRUNUSED))
  364. #endif
  365. /* Declare strerror if we don't have it already. */
  366. #ifndef HAVE_STRERROR
  367. const char *strerror(int);
  368. #endif
  369. /* Declare strsignal if we don't have it already. */
  370. #ifndef HAVE_STRSIGNAL
  371. const char *strsignal(int);
  372. #endif
  373. /* Declare scandir if we don't have it already. */
  374. #ifndef HAVE_SCANDIR
  375. struct dirent;
  376. int scandir(const char *dir, struct dirent ***namelist,
  377. int (*select)(const struct dirent *),
  378. int (*compar)(const void*, const void*));
  379. #endif
  380. /* Declare alphasort if we don't have it already. */
  381. #if !defined(HAVE_ALPHASORT) || !defined(HAVE_ALPHASORT_DECLARATION)
  382. struct dirent;
  383. int alphasort(const struct dirent *a, const struct dirent *b);
  384. #endif
  385. /* Declare unsetenv if we don't have it already. */
  386. #ifndef HAVE_UNSETENV
  387. void unsetenv(const char *x);
  388. #endif
  389. /* Define strtoul if we don't have it already. */
  390. #ifndef HAVE_STRTOUL
  391. #define strtoul strtol
  392. #endif
  393. #ifndef HAVE_VA_COPY
  394. #define va_copy(dest,src) (dest) = (src)
  395. #endif
  396. /* Define WCOREDUMP if we don't have it already - coredumps won't be
  397. * detected, though.
  398. */
  399. #ifndef WCOREDUMP
  400. #define WCOREDUMP(x) 0
  401. #endif
  402. /* Set BUILDOLDPKGFORMAT to 1 to build old-format archives by default.
  403. */
  404. #ifndef BUILDOLDPKGFORMAT
  405. #define BUILDOLDPKGFORMAT 0
  406. #endif
  407. /* Take care of NLS matters. */
  408. #if HAVE_LOCALE_H
  409. # include <locale.h>
  410. #endif
  411. #if !HAVE_SETLOCALE
  412. # define setlocale(Category, Locale) /* empty */
  413. #endif
  414. #if ENABLE_NLS
  415. # include <libintl.h>
  416. # define _(Text) gettext (Text)
  417. # define N_(Text) Text
  418. #else
  419. # undef bindtextdomain
  420. # define bindtextdomain(Domain, Directory) /* empty */
  421. # undef textdomain
  422. # define textdomain(Domain) /* empty */
  423. # define _(Text) Text
  424. # define N_(Text) Text
  425. # define gettext(Text) Text
  426. #endif
  427. ])
  428. AC_OUTPUT( po/Makefile.in
  429. Makefile.conf
  430. Makefile
  431. include/Makefile
  432. dpkg-deb/Makefile
  433. split/Makefile
  434. lib/Makefile
  435. optlib/Makefile
  436. doc/Makefile
  437. man/Makefile
  438. man/paths.ent
  439. man/de/Makefile
  440. man/en/Makefile
  441. man/es/Makefile
  442. man/fr/Makefile
  443. man/ja/Makefile
  444. man/pt_BR/Makefile
  445. man/ru/Makefile
  446. man/sv/Makefile
  447. scripts/Makefile
  448. main/Makefile
  449. dselect/Makefile
  450. methods/Makefile
  451. utils/Makefile)