configure.in 13 KB

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