1 # Copyright © 2004 Scott James Remnant <scott@netsplit.com>
2 # Copyright © 2007 Nicolas François <nicolas.francois@centraliens.net>
3 # Copyright © 2006, 2009 Guillem Jover <guillem@debian.org>
5 # DPKG_WITH_COMPRESS_LIB(NAME, HEADER, FUNC, LINK)
6 # -------------------------------------------------
7 # Check for availability of a compression library.
8 AC_DEFUN([DPKG_WITH_COMPRESS_LIB], [
9 AC_ARG_VAR(AS_TR_CPP($1)[_LIBS], [linker flags for $1 library])
11 AS_HELP_STRING([--with-$1],
12 [use $1 library for compression and decompression]))
13 if test "x$with_$1" != "xno"; then
14 AC_CHECK_LIB([$4], [$3], [
15 AC_DEFINE([WITH_]AS_TR_CPP($1), 1,
16 [Define to 1 to use $1 rather than console tool])
17 if test "x$with_$1" = "xstatic"; then
18 dpkg_$1_libs="-Wl,-Bstatic -l$4 -Wl,-Bdynamic"
22 AS_TR_CPP($1)_LIBS="${AS_TR_CPP($1)_LIBS:+$AS_TR_CPP($1)_LIBS }$dpkg_$1_libs"
25 if test -n "$with_$1"; then
26 AC_MSG_FAILURE([$1 library not found])
30 AC_CHECK_HEADER([$2], [], [
31 if test -n "$with_$1"; then
32 AC_MSG_FAILURE([$1 header not found])
36 ])# DPKG_WITH_COMPRESS_LIB
40 # Check for zlib library.
41 AC_DEFUN([DPKG_LIB_ZLIB], [
42 DPKG_WITH_COMPRESS_LIB([zlib], [zlib.h], [gzdopen], [z])
47 # Check for lzma library.
48 AC_DEFUN([DPKG_LIB_LZMA], [
49 DPKG_WITH_COMPRESS_LIB([liblzma], [lzma.h], [lzma_alone_decoder], [lzma])
54 # Check for bz2 library.
55 AC_DEFUN([DPKG_LIB_BZ2], [
56 DPKG_WITH_COMPRESS_LIB([bz2], [bzlib.h], [BZ2_bzdopen], [bz2])
61 # Check for selinux library.
62 AC_DEFUN([DPKG_LIB_SELINUX], [
63 AC_REQUIRE([PKG_PROG_PKG_CONFIG])
64 m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([missing pkg-config macros])])
65 AC_ARG_VAR([SELINUX_LIBS], [linker flags for selinux library])dnl
67 AS_HELP_STRING([--with-selinux],
68 [use selinux library to set security contexts]))
69 if test "x$with_selinux" != "xno"; then
70 AC_CHECK_LIB([selinux], [is_selinux_enabled],
71 [AC_DEFINE(WITH_SELINUX, 1,
72 [Define to 1 to compile in SELinux support])
73 PKG_CHECK_EXISTS([libselinux], [
74 if test "x$with_selinux" = "xstatic"; then
75 dpkg_selinux_libs="-Wl,-Bstatic "$($PKG_CONFIG --static --libs libselinux)" -Wl,-Bdynamic"
77 dpkg_selinux_libs=$($PKG_CONFIG --libs libselinux)
80 if test "x$with_selinux" = "xstatic"; then
81 dpkg_selinux_libs="-Wl,-Bstatic -lselinux -lsepol -Wl,-Bdynamic"
83 dpkg_selinux_libs="-lselinux"
86 SELINUX_LIBS="${SELINUX_LIBS:+$SELINUX_LIBS }$dpkg_selinux_libs"
88 [if test -n "$with_selinux"; then
89 AC_MSG_FAILURE([selinux library not found])
92 AC_CHECK_HEADER([selinux/selinux.h],,
93 [if test -n "$with_selinux"; then
94 AC_MSG_FAILURE([selinux header not found])
99 # _DPKG_CHECK_LIB_CURSES_NARROW
100 # -----------------------------
101 # Check for narrow curses library.
102 AC_DEFUN([_DPKG_CHECK_LIB_CURSES_NARROW], [
103 AC_CHECK_LIB([ncurses], [initscr],
104 [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncurses"],
105 [AC_CHECK_LIB([curses], [initscr],
106 [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lcurses"],
107 [AC_MSG_ERROR([no curses library found])])])])
108 ])# DPKG_CHECK_LIB_CURSES_NARROW
112 # Check for curses library.
113 AC_DEFUN([DPKG_LIB_CURSES], [
114 AC_REQUIRE([DPKG_UNICODE])
115 AC_ARG_VAR([CURSES_LIBS], [linker flags for curses library])dnl
116 AC_CHECK_HEADERS([ncurses/ncurses.h ncurses.h curses.h ncurses/term.h term.h],
117 [have_curses_header=yes])
118 if test "x$USE_UNICODE" = "xyes"; then
119 AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/term.h],
120 [have_curses_header=yes])
121 AC_CHECK_LIB([ncursesw], [initscr],
122 [CURSES_LIBS="${CURSES_LIBS:+$CURSES_LIBS }-lncursesw"],
123 [_DPKG_CHECK_LIB_CURSES_NARROW()])
125 _DPKG_CHECK_LIB_CURSES_NARROW()
127 if test "x$have_curses_header" != "xyes"; then
128 AC_MSG_FAILURE([curses header not found])
134 # Check for start-stop-daemon libraries.
135 AC_DEFUN([DPKG_LIB_SSD],
136 [AC_ARG_VAR([SSD_LIBS], [linker flags for start-stop-daemon])dnl
137 AC_CHECK_LIB([ihash], [ihash_create], [SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lihash"])
138 AC_CHECK_LIB([ps], [proc_stat_list_create], [SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lps"])
139 AC_CHECK_LIB([shouldbeinlibc], [fmt_past_time], [SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lshouldbeinlibc"])
140 AC_CHECK_LIB([kvm], [kvm_openfiles], [SSD_LIBS="${SSD_LIBS:+$SSD_LIBS }-lkvm"])