chiark / gitweb /
libudev: add udev_device_new_from_environment()
[elogind.git] / configure.ac
1 AC_INIT([udev], [152], [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_ENABLE([extras],
50         AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]),
51         [], [enable_extras=yes])
52 if test "x$enable_extras" = xyes; then
53         AC_PATH_PROG([GPERF], [gperf])
54         if test -z "$GPERF"; then
55                 AC_MSG_ERROR([gperf is needed])
56         fi
57
58         PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0])
59         AC_SUBST([GLIB_CFLAGS])
60         AC_SUBST([GLIB_LIBS])
61
62         AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
63         AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
64
65         PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12)
66         AC_SUBST(LIBUSB_CFLAGS)
67         AC_SUBST(LIBUSB_LIBS)
68
69         PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
70         AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
71
72         AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
73         AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
74         AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
75         AC_ARG_WITH(pci-ids-path,
76                 AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]),
77                 [PCI_DATABASE=${withval}],
78                 [if test -n "$pciids" ; then
79                         PCI_DATABASE="$pciids"
80                 else
81                         AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
82                 fi])
83         AC_SUBST(PCI_DATABASE)
84
85         AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
86         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}')])
87 fi
88 AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes])
89
90 AC_ARG_ENABLE([introspection],
91         AS_HELP_STRING([--disable-introspection], [disable GObject introspection]),
92         [], [enable_introspection=yes])
93 if test "x$enable_introspection" = xyes; then
94         PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
95         AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
96         AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
97         AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
98         AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
99         AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)])
100         AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)])
101 fi
102 AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes])
103
104 AC_CONFIG_HEADERS(config.h)
105 AC_CONFIG_FILES([
106         Makefile
107         libudev/libudev.pc
108         libudev/docs/Makefile
109         libudev/docs/version.xml
110         udev/udev.pc
111         extras/gudev/gudev-1.0.pc
112         extras/gudev/docs/Makefile
113         extras/gudev/docs/version.xml
114 ])
115
116 AC_OUTPUT
117 AC_MSG_RESULT([
118         udev $VERSION
119         ========
120
121         prefix:                 ${prefix}
122         sysconfdir:             ${sysconfdir}
123         sbindir:                ${sbindir}
124         libdir:                 ${libdir}
125         rootlibdir:             ${rootlib_execdir}
126         libexecdir:             ${libexecdir}
127
128         datarootdir:            ${datarootdir}
129         mandir:                 ${mandir}
130         includedir:             ${includedir}
131
132         include_prefix:         ${INCLUDE_PREFIX}
133
134         logging:                ${enable_logging}
135         debug:                  ${enable_debug}
136         selinux:                ${with_selinux}
137
138         compiler:               ${CC}
139         cflags:                 ${CFLAGS}
140         ldflags:                ${LDFLAGS}
141
142         extras:                 ${enable_extras}
143         gintrospection:         ${enable_introspection}
144
145         usb.ids:                ${USB_DATABASE}
146         pci.ids:                ${PCI_DATABASE}
147
148         xsltproc:               ${XSLTPROC}
149         gperf:                  ${GPERF}
150 ])