configure.in 12 KB

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