chiark / gitweb /
c7885b01624b14113f39193cf3c18ec4ee2eb8e8
[elogind.git] / configure.ac
1 AC_INIT([udev], [166], [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_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])])
16
17 AC_ARG_WITH([rootlibdir],
18         AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
19         [], [with_rootlibdir=$libdir])
20 AC_SUBST([rootlib_execdir], [$with_rootlibdir])
21
22 AC_ARG_WITH([selinux],
23         AS_HELP_STRING([--with-selinux], [enable SELinux support]),
24         [], [with_selinux=no])
25 if test "x$with_selinux" = xyes; then
26         LIBS_save=$LIBS
27         AC_CHECK_LIB(selinux, getprevcon,
28                 [],
29                 AC_MSG_ERROR([SELinux selected but libselinux not found]))
30         LIBS=$LIBS_save
31         SELINUX_LIBS="-lselinux -lsepol"
32         AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.])
33 fi
34 AC_SUBST([SELINUX_LIBS])
35 AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = xyes])
36
37 AC_ARG_ENABLE([debug],
38         AS_HELP_STRING([--enable-debug], [enable debug messages]),
39         [], [enable_debug=no])
40 if test "x$enable_debug" = "xyes"; then
41         AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
42 fi
43
44 AC_ARG_ENABLE([logging],
45         AS_HELP_STRING([--disable-logging], [disable system logging]),
46         [], enable_logging=yes)
47 if test "x$enable_logging" = "xyes"; then
48         AC_DEFINE(ENABLE_LOGGING, [1], [System logging.])
49 fi
50
51 AC_ARG_WITH(firmware-path,
52         AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
53            [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
54         [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"])
55 OLD_IFS=$IFS
56 IFS=:
57 for i in $with_firmware_path
58 do
59         if test "x${FIRMWARE_PATH}" = "x"; then
60                 FIRMWARE_PATH="\\\"${i}/\\\""
61         else
62                 FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
63         fi
64 done
65 IFS=$OLD_IFS
66 AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
67
68 AC_ARG_WITH([systemdsystemunitdir],
69         AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
70         [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
71 if test "x$with_systemdsystemunitdir" != xno; then
72     AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
73 fi
74 AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
75
76 AC_ARG_ENABLE([extras],
77         AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]),
78         [], [enable_extras=yes])
79 if test "x$enable_extras" = xyes; then
80         AC_PATH_PROG([GPERF], [gperf])
81         if test -z "$GPERF"; then
82                 AC_MSG_ERROR([gperf is needed])
83         fi
84
85         PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0])
86         AC_SUBST([GLIB_CFLAGS])
87         AC_SUBST([GLIB_LIBS])
88
89         AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
90         AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
91
92         PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12)
93         AC_SUBST(LIBUSB_CFLAGS)
94         AC_SUBST(LIBUSB_LIBS)
95
96         PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
97         AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
98
99         if test "x$cross_compiling" = "xno" ; then
100                 AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
101                 AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
102                 AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
103         fi
104         AC_ARG_WITH(pci-ids-path,
105                 [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])],
106                 [PCI_DATABASE=${withval}],
107                 [if test -n "$pciids" ; then
108                         PCI_DATABASE="$pciids"
109                 else
110                         AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
111                 fi])
112         AC_MSG_CHECKING([for PCI database location])
113         AC_MSG_RESULT([$PCI_DATABASE])
114         AC_SUBST(PCI_DATABASE)
115
116         AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
117         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}')])
118 fi
119 AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes])
120
121 AC_CHECK_HEADER([linux/videodev.h], [have_videodev_h=yes], [])
122 AM_CONDITIONAL(HAVE_V4L1, [test "x$have_videodev_h" = "xyes"])
123
124 AC_ARG_ENABLE([introspection],
125         AS_HELP_STRING([--disable-introspection], [disable GObject introspection]),
126         [], [enable_introspection=yes])
127 if test "x$enable_introspection" = xyes; then
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 fi
136 AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes])
137
138 AC_CONFIG_HEADERS(config.h)
139 AC_CONFIG_FILES([
140         Makefile
141         udev/udev.pc
142         init/udev.service
143         init/udev-settle.service
144         init/udev-retry.service
145         libudev/libudev.pc
146         libudev/docs/Makefile
147         libudev/docs/version.xml
148         extras/gudev/gudev-1.0.pc
149         extras/gudev/docs/Makefile
150         extras/gudev/docs/version.xml
151 ])
152
153 AC_OUTPUT
154 AC_MSG_RESULT([
155         udev $VERSION
156         ========
157
158         prefix:                 ${prefix}
159         sysconfdir:             ${sysconfdir}
160         sbindir:                ${sbindir}
161         libdir:                 ${libdir}
162         rootlibdir:             ${rootlib_execdir}
163         libexecdir:             ${libexecdir}
164
165         datarootdir:            ${datarootdir}
166         mandir:                 ${mandir}
167         includedir:             ${includedir}
168
169         include_prefix:         ${INCLUDE_PREFIX}
170
171         systemdsystemunitdir:   ${systemdsystemunitdir}
172
173         logging:                ${enable_logging}
174         debug:                  ${enable_debug}
175         selinux:                ${with_selinux}
176
177         compiler:               ${CC}
178         cflags:                 ${CFLAGS}
179         ldflags:                ${LDFLAGS}
180
181         extras:                 ${enable_extras}
182         gintrospection:         ${enable_introspection}
183
184         usb.ids:                ${USB_DATABASE}
185         pci.ids:                ${PCI_DATABASE}
186         firmware path:          ${FIRMWARE_PATH}
187
188         xsltproc:               ${XSLTPROC}
189         gperf:                  ${GPERF}
190 ])