chiark / gitweb /
udevd: always create runtime dir
[elogind.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT([udev],
3         [175],
4         [linux-hotplug@vger.kernel.org],
5         [udev],
6         [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html])
7 AC_CONFIG_SRCDIR([udev/udevd.c])
8 AC_CONFIG_AUX_DIR([build-aux])
9 AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
10 AC_USE_SYSTEM_EXTENSIONS
11 AC_SYS_LARGEFILE
12 AC_CONFIG_MACRO_DIR([m4])
13 AM_SILENT_RULES([yes])
14 LT_INIT([disable-static])
15 AC_PROG_AWK
16 AC_PROG_SED
17 AC_PROG_MKDIR_P
18 GTK_DOC_CHECK(1.10)
19 AC_PREFIX_DEFAULT([/usr])
20 AC_PATH_PROG([XSLTPROC], [xsltproc])
21
22 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])])
23 PKG_CHECK_MODULES(BLKID, blkid >= 2.20)
24 PKG_CHECK_MODULES(KMOD, libkmod >= 2)
25
26 AC_ARG_WITH([rootprefix],
27         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
28         [], [with_rootprefix=$prefix])
29 AC_SUBST([rootprefix], [$with_rootprefix])
30
31 AC_ARG_WITH([rootlibdir],
32         AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
33         [], [with_rootlibdir=$libdir])
34 AC_SUBST([rootlib_execdir], [$with_rootlibdir])
35
36 AC_ARG_WITH([selinux],
37         AS_HELP_STRING([--with-selinux], [enable SELinux support]),
38         [], [with_selinux=no])
39 AS_IF([test "x$with_selinux" = "xyes"], [
40         LIBS_save=$LIBS
41         AC_CHECK_LIB(selinux, getprevcon,
42                 [],
43                 AC_MSG_ERROR([SELinux selected but libselinux not found]))
44         LIBS=$LIBS_save
45         SELINUX_LIBS="-lselinux -lsepol"
46         AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.])
47 ])
48 AC_SUBST([SELINUX_LIBS])
49 AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = "xyes"])
50
51 AC_ARG_ENABLE([debug],
52         AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
53         [], [enable_debug=no])
54 AS_IF([test "x$enable_debug" = "xyes"], [ AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) ])
55
56 AC_ARG_ENABLE([logging],
57         AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
58         [], enable_logging=yes)
59 AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) ])
60
61 AC_ARG_WITH(firmware-path,
62         AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
63            [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
64         [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
65 OLD_IFS=$IFS
66 IFS=:
67 for i in $with_firmware_path; do
68         if test "x${FIRMWARE_PATH}" = "x"; then
69                 FIRMWARE_PATH="\\\"${i}/\\\""
70         else
71                 FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
72         fi
73 done
74 IFS=$OLD_IFS
75 AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
76
77 AC_ARG_WITH([systemdsystemunitdir],
78         AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
79         [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
80 AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ])
81 AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
82
83 # ------------------------------------------------------------------------------
84 # GUdev - libudev gobject interface
85 # ------------------------------------------------------------------------------
86 AC_ARG_ENABLE([gudev],
87         AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
88         [], [enable_gudev=yes])
89 AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
90
91 AC_ARG_ENABLE([introspection],
92         AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]),
93         [], [enable_introspection=yes])
94 AS_IF([test "x$enable_introspection" = "xyes"], [
95         PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
96         AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
97         AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
98         AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
99         AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
100         AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)])
101         AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)])
102 ])
103 AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
104 AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
105
106 # ------------------------------------------------------------------------------
107 # usb/pci-db - read vendor/device string database
108 # ------------------------------------------------------------------------------
109 AC_ARG_ENABLE([hwdb],
110         AS_HELP_STRING([--disable-hwdb], [disable hardware database support @<:@default=enabled@:>@]),
111         [], [enable_hwdb=yes])
112 AS_IF([test "x$enable_hwdb" = "xyes"], [
113         if test "x$cross_compiling" = "xno" ; then
114                 AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
115                 AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
116                 AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
117         fi
118
119         AC_ARG_WITH(usb-ids-path,
120                 [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])],
121                 [USB_DATABASE=${withval}],
122                 [if test -n "$usbids" ; then
123                         USB_DATABASE="$usbids"
124                 else
125                         PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
126                         AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
127                 fi])
128         AC_MSG_CHECKING([for USB database location])
129         AC_MSG_RESULT([$USB_DATABASE])
130         AC_SUBST(USB_DATABASE)
131
132         AC_ARG_WITH(pci-ids-path,
133                 [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])],
134                 [PCI_DATABASE=${withval}],
135                 [if test -n "$pciids" ; then
136                         PCI_DATABASE="$pciids"
137                 else
138                         AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
139                 fi])
140         AC_MSG_CHECKING([for PCI database location])
141         AC_MSG_RESULT([$PCI_DATABASE])
142         AC_SUBST(PCI_DATABASE)
143 ])
144 AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = "xyes"])
145
146 # ------------------------------------------------------------------------------
147 # keymap - map custom hardware's multimedia keys
148 # ------------------------------------------------------------------------------
149 AC_ARG_ENABLE([keymap],
150         AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
151         [], [enable_keymap=yes])
152 AS_IF([test "x$enable_keymap" = "xyes"], [
153         AC_PATH_PROG([GPERF], [gperf])
154         if test -z "$GPERF"; then
155                 AC_MSG_ERROR([gperf is needed])
156         fi
157
158         AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
159         AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
160 ])
161 AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"])
162
163 # ------------------------------------------------------------------------------
164 # mtd_probe - autoloads FTL module for mtd devices
165 # ------------------------------------------------------------------------------
166 AC_ARG_ENABLE([mtd_probe],
167         AS_HELP_STRING([--disable-mtd_probe], [disable MTD support @<:@default=enabled@:>@]),
168         [], [enable_mtd_probe=yes])
169 AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = "xyes"])
170
171 # ------------------------------------------------------------------------------
172 # rule_generator - persistent network and optical device rule generator
173 # ------------------------------------------------------------------------------
174 AC_ARG_ENABLE([rule_generator],
175         AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support @<:@default=disabled@:>@]),
176         [], [enable_rule_generator=no])
177 AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = "xyes"])
178
179 # ------------------------------------------------------------------------------
180 # udev_acl - apply ACLs for users with local forground sessions
181 # ------------------------------------------------------------------------------
182 AC_ARG_ENABLE([udev_acl],
183         AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]),
184         [], [enable_udev_acl=no])
185 AS_IF([test "x$enable_udev_acl" = "xyes"], [
186         AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
187         AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
188
189         PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0])
190 ])
191 AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"])
192
193 # ------------------------------------------------------------------------------
194 # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...)
195 # ------------------------------------------------------------------------------
196 AC_ARG_ENABLE([floppy],
197         AS_HELP_STRING([--enable-floppy], [enable legacy floppy support @<:@default=disabled@:>@]),
198         [], [enable_floppy=no])
199 AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = "xyes"])
200
201 # ------------------------------------------------------------------------------
202 # edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data
203 # ------------------------------------------------------------------------------
204 AC_ARG_ENABLE([edd],
205         AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]),
206         [], [enable_edd=no])
207 AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"])
208
209 my_CFLAGS="-Wall \
210 -Wmissing-declarations -Wmissing-prototypes \
211 -Wnested-externs -Wpointer-arith \
212 -Wpointer-arith -Wsign-compare -Wchar-subscripts \
213 -Wstrict-prototypes -Wshadow \
214 -Wformat-security -Wtype-limits"
215 AC_SUBST([my_CFLAGS])
216
217 AC_CONFIG_HEADERS(config.h)
218 AC_CONFIG_FILES([
219         Makefile
220         libudev/docs/Makefile
221         libudev/docs/version.xml
222         extras/gudev/docs/Makefile
223         extras/gudev/docs/version.xml
224 ])
225
226 AC_OUTPUT
227 AC_MSG_RESULT([
228         $PACKAGE $VERSION
229         ========
230
231         prefix:                 ${prefix}
232         rootprefix:             ${rootprefix}
233         sysconfdir:             ${sysconfdir}
234         bindir:                 ${bindir}
235         libdir:                 ${libdir}
236         rootlibdir:             ${rootlib_execdir}
237         libexecdir:             ${libexecdir}
238         datarootdir:            ${datarootdir}
239         mandir:                 ${mandir}
240         includedir:             ${includedir}
241         include_prefix:         ${INCLUDE_PREFIX}
242         systemdsystemunitdir:   ${systemdsystemunitdir}
243         firmware path:          ${FIRMWARE_PATH}
244
245         compiler:               ${CC}
246         cflags:                 ${CFLAGS}
247         ldflags:                ${LDFLAGS}
248         xsltproc:               ${XSLTPROC}
249         gperf:                  ${GPERF}
250
251         logging:                ${enable_logging}
252         debug:                  ${enable_debug}
253         selinux:                ${with_selinux}
254
255         gudev:                  ${enable_gudev}
256         gintrospection:         ${enable_introspection}
257         keymap:                 ${enable_keymap}
258         hwdb:                   ${enable_hwdb}
259           usb.ids:              ${USB_DATABASE}
260           pci.ids:              ${PCI_DATABASE}
261         mtd_probe:              ${enable_mtd_probe}
262         rule_generator:         ${enable_rule_generator}
263         udev_acl:               ${enable_udev_acl}
264         floppy:                 ${enable_floppy}
265         edd:                    ${enable_edd}
266 ])