chiark / gitweb /
release 158
[elogind.git] / configure.ac
1 AC_INIT([udev], [158], [linux-hotplug@vger.kernel.org])
2 AC_PREREQ(2.60)
3 AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects])
4 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
5 AC_DISABLE_STATIC
6 AC_USE_SYSTEM_EXTENSIONS
7 AC_SYS_LARGEFILE
8 AC_CONFIG_MACRO_DIR([m4])
9 LT_INIT
10 AC_PROG_AWK
11 GTK_DOC_CHECK(1.10)
12 AC_PREFIX_DEFAULT([/usr])
13 AC_PATH_PROG([XSLTPROC], [xsltproc])
14
15 AC_ARG_WITH([rootlibdir],
16         AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
17         [], [with_rootlibdir=$libdir])
18 AC_SUBST([rootlib_execdir], [$with_rootlibdir])
19
20 AC_ARG_WITH([selinux],
21         AS_HELP_STRING([--with-selinux], [enable SELinux support]),
22         [], [with_selinux=no])
23 if test "x$with_selinux" = xyes; then
24         LIBS_save=$LIBS
25         AC_CHECK_LIB(selinux, getprevcon,
26                 [],
27                 AC_MSG_ERROR([SELinux selected but libselinux not found]))
28         LIBS=$LIBS_save
29         SELINUX_LIBS="-lselinux -lsepol"
30         AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.])
31 fi
32 AC_SUBST([SELINUX_LIBS])
33 AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = xyes])
34
35 AC_ARG_ENABLE([debug],
36         AS_HELP_STRING([--enable-debug], [enable debug messages]),
37         [], [enable_debug=no])
38 if test "x$enable_debug" = "xyes"; then
39         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
40 fi
41
42 AC_ARG_ENABLE([logging],
43         AS_HELP_STRING([--disable-logging], [disable system logging]),
44         [], enable_logging=yes)
45 if test "x$enable_logging" = "xyes"; then
46         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
47 fi
48
49 AC_ARG_WITH(firmware-path,
50         AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
51            [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
52         [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"]
53         )
54 OLD_IFS=$IFS
55 IFS=:
56 for i in $with_firmware_path
57 do
58         if test "x${FIRMWARE_PATH}" = "x"; then
59                 FIRMWARE_PATH="\\\"${i}/\\\""
60         else
61                 FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
62         fi
63 done
64 IFS=$OLD_IFS
65 AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
66
67 AC_ARG_ENABLE([extras],
68         AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]),
69         [], [enable_extras=yes])
70 if test "x$enable_extras" = xyes; then
71         AC_PATH_PROG([GPERF], [gperf])
72         if test -z "$GPERF"; then
73                 AC_MSG_ERROR([gperf is needed])
74         fi
75
76         PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0])
77         AC_SUBST([GLIB_CFLAGS])
78         AC_SUBST([GLIB_LIBS])
79
80         AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
81         AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
82
83         PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12)
84         AC_SUBST(LIBUSB_CFLAGS)
85         AC_SUBST(LIBUSB_LIBS)
86
87         PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
88         AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
89
90         if test "x$cross_compiling" = "xno" ; then
91                 AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
92                 AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
93                 AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
94         fi
95         AC_ARG_WITH(pci-ids-path,
96                 [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])],
97                 [PCI_DATABASE=${withval}],
98                 [if test -n "$pciids" ; then
99                         PCI_DATABASE="$pciids"
100                 else
101                         AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
102                 fi])
103         AC_MSG_CHECKING([for PCI database location])
104         AC_MSG_RESULT([$PCI_DATABASE])
105         AC_SUBST(PCI_DATABASE)
106
107         AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
108         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}')])
109 fi
110 AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes])
111
112 AC_ARG_ENABLE([introspection],
113         AS_HELP_STRING([--disable-introspection], [disable GObject introspection]),
114         [], [enable_introspection=yes])
115 if test "x$enable_introspection" = xyes; then
116         PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
117         AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
118         AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
119         AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
120         AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
121         AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)])
122         AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)])
123 fi
124 AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes])
125
126 AC_CONFIG_HEADERS(config.h)
127 AC_CONFIG_FILES([
128         Makefile
129         libudev/libudev.pc
130         libudev/docs/Makefile
131         libudev/docs/version.xml
132         udev/udev.pc
133         extras/gudev/gudev-1.0.pc
134         extras/gudev/docs/Makefile
135         extras/gudev/docs/version.xml
136 ])
137
138 AC_OUTPUT
139 AC_MSG_RESULT([
140         udev $VERSION
141         ========
142
143         prefix:                 ${prefix}
144         sysconfdir:             ${sysconfdir}
145         sbindir:                ${sbindir}
146         libdir:                 ${libdir}
147         rootlibdir:             ${rootlib_execdir}
148         libexecdir:             ${libexecdir}
149
150         datarootdir:            ${datarootdir}
151         mandir:                 ${mandir}
152         includedir:             ${includedir}
153
154         include_prefix:         ${INCLUDE_PREFIX}
155
156         logging:                ${enable_logging}
157         debug:                  ${enable_debug}
158         selinux:                ${with_selinux}
159
160         compiler:               ${CC}
161         cflags:                 ${CFLAGS}
162         ldflags:                ${LDFLAGS}
163
164         extras:                 ${enable_extras}
165         gintrospection:         ${enable_introspection}
166
167         usb.ids:                ${USB_DATABASE}
168         pci.ids:                ${PCI_DATABASE}
169         firmware path:          ${FIRMWARE_PATH}
170
171         xsltproc:               ${XSLTPROC}
172         gperf:                  ${GPERF}
173 ])