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