• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AC_PREREQ([2.68])
2AC_INIT([eudev],[3.2.10],[https://github.com/gentoo/eudev/issues])
3AC_SUBST(UDEV_VERSION, 243)
4AC_CONFIG_SRCDIR([src/udev/udevd.c])
5
6AC_USE_SYSTEM_EXTENSIONS
7AC_SYS_LARGEFILE
8AC_PREFIX_DEFAULT([/usr])
9
10AC_CONFIG_MACRO_DIR([m4])
11AC_CONFIG_HEADERS([config.h])
12
13AM_INIT_AUTOMAKE([foreign 1.11])
14AM_SILENT_RULES([yes])
15
16LT_PREREQ(2.2)
17LT_INIT
18
19# Checks for programs.
20AC_PROG_MKDIR_P
21AC_PROG_LN_S
22AC_PROG_SED
23AC_PROG_GREP
24AC_PROG_AWK
25
26AC_PROG_CC_C99
27AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
28        AC_MSG_ERROR([no C99 compiler found, $PACKAGE requires a C99 compiler.])
29])
30
31AC_PROG_CXX
32AC_PROG_CPP
33AC_PROG_INSTALL
34AC_PROG_LN_S
35AC_PROG_MAKE_SET
36
37AC_PATH_PROG([M4], [m4])
38
39# Checks for header files.
40AC_CHECK_HEADERS(
41        [arpa/inet.h fcntl.h inttypes.h limits.h locale.h \
42         netinet/in.h sys/ioctl.h sys/mount.h \
43         sys/param.h sys/socket.h sys/statvfs.h sys/time.h sys/vfs.h syslog.h \
44         termios.h unistd.h],
45        [],
46        [AC_MSG_ERROR([*** POSIX header not found])]
47)
48
49AC_CHECK_HEADERS(
50        [mtd/mtd-user.h],
51        [],
52        [AC_MSG_ERROR([*** KERNEL header not found])]
53)
54
55AC_CHECK_HEADERS(
56        [linux/btrfs.h],
57        [],
58        [AC_MSG_WARN([*** KERNEL header not found])]
59)
60
61# Checks for typedefs, structures, and compiler characteristics.
62AC_TYPE_UID_T
63AC_C_INLINE
64AC_TYPE_MODE_T
65AC_TYPE_PID_T
66AC_CHECK_MEMBERS([struct stat.st_rdev])
67AC_CHECK_DECLS([getrandom, gettid, name_to_handle_at, accept4, mkostemp, ppoll, strndupa], [], [],
68[[#include <fcntl.h>
69#include <linux/random.h>
70#include <poll.h>
71#include <signal.h>
72#include <stdlib.h>
73#include <string.h>
74#include <sys/mount.h>
75#include <sys/socket.h>
76#include <sys/types.h>
77#include <unistd.h>]])
78
79AC_CHECK_SIZEOF(pid_t)
80AC_CHECK_SIZEOF(uid_t)
81AC_CHECK_SIZEOF(gid_t)
82AC_CHECK_SIZEOF(dev_t)
83AC_CHECK_SIZEOF(time_t)
84AC_CHECK_SIZEOF(rlim_t,,[[
85#include <sys/time.h>
86#include <sys/resource.h>]])
87
88# Checks for library functions.
89AC_FUNC_CHOWN
90AC_FUNC_FORK
91AC_FUNC_FSEEKO
92AC_FUNC_GETGROUPS
93AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
94AC_HEADER_MAJOR
95AC_FUNC_MMAP
96
97AC_CHECK_FUNCS(
98        [alarm dup2 ftruncate localtime_r mempcpy \
99         mkdir munmap nl_langinfo rmdir setlocale socket stpcpy \
100         uname],
101        [],
102        [AC_MSG_ERROR([*** POSIX function not found])]
103)
104AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX librt not found])])
105LT_LIB_M
106
107# ------------------------------------------------------------------------------
108
109# TODO: the old python checks are irrelevant, but we do need python and perl for tests
110
111# ------------------------------------------------------------------------------
112# Set paths here
113
114AC_ARG_WITH(
115        [rootprefix],
116        [AS_HELP_STRING(
117                [--with-rootprefix=DIR],
118                [rootfs directory prefix for config files and kernel modules])],
119        [],
120        [with_rootprefix="\${prefix}"]
121)
122
123AC_ARG_WITH(
124        [rootlibdir],
125        [AS_HELP_STRING(
126                [--with-rootlibdir=DIR],
127                [Root directory for libraries necessary for boot])],
128        [],
129        [with_rootlibdir=${libdir}]
130)
131
132AC_ARG_WITH(
133        [rootlibexecdir],
134        [AS_HELP_STRING(
135                [--with-rootlibexecdir=DIR],
136                [Root directory for libexecs necessary for boot])],
137        [],
138        [with_rootlibexecdir=${with_rootlibdir}/udev]
139)
140
141AC_ARG_WITH(
142        [rootrundir],
143        [AS_HELP_STRING(
144                [--with-rootrundir=DIR],
145                [Configurable path for /run])],
146        [],
147        [with_rootrundir=/run]
148)
149
150AC_ARG_ENABLE(
151        [split-usr],
152        [AS_HELP_STRING(
153                [--enable-split-usr],
154                [Include hard-coded default search paths in / and /usr])],
155        [],
156        [AS_IF(
157                [test "x${ac_default_prefix}" != "x${with_rootprefix}" && test "x${with_rootprefix}" != "x\${prefix}"],
158                [enable_split_usr=yes],
159                [enable_split_usr=no])]
160)
161
162AS_IF(
163        [test "x${enable_split_usr}" = "xyes"],
164        [AC_DEFINE(HAVE_SPLIT_USR, 1, [Define to include hard-coded default search paths in / and /usr])]
165)
166
167# Configured paths
168AC_SUBST([rootprefix], [${with_rootprefix}])
169AC_SUBST([rootlibdir], [${with_rootlibdir}])
170AC_SUBST([rootlibexecdir], [${with_rootlibexecdir}])
171AC_SUBST([udevlibexecdir], [${rootlibexecdir}])
172
173# sysconfdir paths
174AC_SUBST([udevconfdir],[${sysconfdir}/udev])
175AC_SUBST([udevconffile],[${udevconfdir}/udev.conf])
176AC_SUBST([udevhwdbdir],[${udevconfdir}/hwdb.d])
177AC_SUBST([udevhwdbbin],[${udevconfdir}/hwdb.bin])
178
179# udevlibexecdir paths
180AC_SUBST([udevkeymapdir],[${udevlibexecdir}/keymaps])
181AC_SUBST([udevkeymapforceredir],[${udevkeymapdir}/force-release])
182AC_SUBST([udevrulesdir],[${udevlibexecdir}/rules.d])
183
184# pkgconfigdir paths
185AC_SUBST([pkgconfiglibdir], [${libdir}/pkgconfig])
186AC_SUBST([sharepkgconfigdir],[${datadir}/pkgconfig])
187
188# introspection paths
189AC_SUBST([girdir], [${datadir}/gir-1.0])
190AC_SUBST([typelibsdir], [${libdir}/girepository-1.0])
191
192AC_SUBST([rootrundir],[${with_rootrundir}])
193
194# ------------------------------------------------------------------------------
195
196GOBJECT_INTROSPECTION_CHECK([1.31.1])
197AM_CONDITIONAL([HAVE_INTROSPECTION], [test "$enable_introspection" = "yes"])
198
199# ------------------------------------------------------------------------------
200AC_ARG_ENABLE([programs],
201        AS_HELP_STRING([--disable-programs], [disable programs (udevd, udevadm and helpers)]),
202        [], [enable_programs="yes"])
203AM_CONDITIONAL([ENABLE_PROGRAMS], [test "x$enable_programs" = "xyes"])
204
205# ------------------------------------------------------------------------------
206have_blkid=no
207AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [Disable optional blkid support]))
208if test "x$enable_blkid" != "xno"; then
209        PKG_CHECK_MODULES([BLKID], [blkid >= 2.20],
210                [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
211        if test "x$have_blkid" = xno && test "x$enable_blkid" = xyes; then
212                AC_MSG_ERROR([*** blkid support requested but not found])
213        fi
214fi
215AM_CONDITIONAL(HAVE_BLKID, [test "x$have_blkid" = "xyes"])
216
217# ------------------------------------------------------------------------------
218have_selinux=no
219AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
220if test "x$enable_selinux" != "xno"; then
221        PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.1.9],
222                [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
223        if test "x$have_selinux" = xno && test "x$enable_selinux" = xyes; then
224                AC_MSG_ERROR([*** SELinux support requested but libraries not found])
225        fi
226fi
227AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
228if test "x${have_selinux}" != xno ; then
229        sushell=/sbin/sushell
230else
231        sushell=/bin/bash
232fi
233AC_SUBST(sushell)
234
235# selinux-util.c uses struct mallinfo which is not available for all C libraries (musl).
236AC_CHECK_FUNCS([mallinfo])
237
238# ------------------------------------------------------------------------------
239
240AC_CHECK_DECL([unshare],
241        [AC_DEFINE(HAVE_UNSHARE, 1, [Define if unshare is declared])],
242        [AC_CHECK_DECL([SYS_unshare],
243                [ ] ,
244                [AC_MSG_ERROR([*** unshare nor SYS_unshare found.])],
245                [#include <syscall.h>])],
246        [#include <sched.h>])
247
248# ------------------------------------------------------------------------------
249AC_PATH_TOOL(GPERF, gperf)
250if test -z "$GPERF" ; then
251        AC_MSG_ERROR([*** gperf not found])
252fi
253
254# ------------------------------------------------------------------------------
255AC_ARG_ENABLE([manpages], AS_HELP_STRING([--disable-manpages],[disable manpages]),[],[enable_manpages=no])
256AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$enable_manpages" = "xyes"])
257
258# ------------------------------------------------------------------------------
259have_kmod=no
260AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules support]))
261if test "x$enable_kmod" != "xno"; then
262        PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
263        if test "x$have_kmod" = "xyes"; then
264                PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
265                        [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
266                        AC_MSG_ERROR([*** kmod version >= 15 not found]))
267        fi
268        if test "x$have_kmod" = xno && test "x$enable_kmod" = xyes; then
269                AC_MSG_ERROR([*** kmod support requested, but libraries not found])
270        fi
271fi
272AM_CONDITIONAL(HAVE_KMOD, [test "$have_kmod" = "yes"])
273
274# ------------------------------------------------------------------------------
275
276AC_ARG_ENABLE([hwdb], AS_HELP_STRING([--enable-hwdb],[install hwdb.d files]),[],[enable_hwdb=yes])
277AM_CONDITIONAL(ENABLE_HWDB, [test "x$enable_hwdb" = "xyes"])
278
279# ------------------------------------------------------------------------------
280# rule-generator - persistent network and optical device rule generator
281# ------------------------------------------------------------------------------
282AC_ARG_ENABLE([rule-generator],
283        AS_HELP_STRING([--enable-rule-generator], [enable legacy persistent network, cdrom support]),
284        [], [enable_rule_generator=no])
285
286if test "x${enable_rule_generator}" != xno; then
287        AC_DEFINE([ENABLE_RULE_GENERATOR], [1], [Define if we are enabling rule generator])
288fi
289
290AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes])
291
292# ------------------------------------------------------------------------------
293# mtd_probe - autoloads FTL module for mtd devices
294# ------------------------------------------------------------------------------
295AC_ARG_ENABLE([mtd_probe],
296        AS_HELP_STRING([--disable-mtd_probe], [disable MTD support]),
297        [], [enable_mtd_probe=yes])
298AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes])
299
300# ------------------------------------------------------------------------------
301
302AC_CONFIG_FILES([Makefile
303                 hwdb/Makefile
304                 man/Makefile
305                 rule_generator/Makefile
306                 rule_generator/write_net_rules
307                 rules/Makefile
308                 src/Makefile
309                 src/ata_id/Makefile
310                 src/cdrom_id/Makefile
311                 src/collect/Makefile
312                 src/mtd_probe/Makefile
313                 src/scsi_id/Makefile
314                 src/v4l_id/Makefile
315                 src/shared/Makefile
316                 src/libudev/Makefile
317                 src/libudev/libudev.pc
318                 src/udev/Makefile
319                 src/udev/udev.pc
320                 test/Makefile])
321
322AC_OUTPUT
323
324# ------------------------------------------------------------------------------
325
326AC_MSG_RESULT([
327        prefix:                  ${prefix}
328        exec_prefix:             ${exec_prefix}
329        sysconfdir:              ${sysconfdir}
330        datadir:                 ${datadir}
331        includedir:              ${includedir}
332        bindir:                  ${bindir}
333        libdir:                  ${libdir}
334
335        rootprefix:              ${rootprefix}
336        rootlibdir:              ${rootlibdir}
337        rootlibexecdir:          ${rootlibexecdir}
338        datarootdir:             ${datarootdir}
339        rootrundir:              ${rootrundir}
340
341        udevconfdir:             ${udevconfdir}
342        udevconffile:            ${udevconffile}
343        udevhwdbdir:             ${udevhwdbdir}
344        udevhwdbbin:             ${udevhwdbbin}
345        udevlibexecdir:          ${udevlibexecdir}
346        udevkeymapdir:           ${udevkeymapdir}
347        udevkeymapforceredir:    ${udevkeymapforceredir}
348        udevrulesdir:            ${udevrulesdir}
349
350        pkgconfiglibdir:         ${libdir}/pkgconfig
351        sharepkgconfigdir        ${datadir}/pkgconfig
352
353        girdir                   ${datadir}/gir-1.0
354        typelibsdir              ${libdir}/girepository-1.0
355])
356
357# ------------------------------------------------------------------------------
358
359dnl Set configured scripts executable
360if test -f  src/keymap/check-keymaps.sh; then
361        chmod +x src/keymap/check-keymaps.sh
362fi
363
364if test -f src/keymap/keyboard-force-release.sh; then
365        chmod +x src/keymap/keyboard-force-release.sh
366fi
367
368