summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 2950e2af32cf128013b843ccb83cd14d05d9854a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360

AC_PREREQ([2.68])
AC_INIT([eudev],[3.1.2],[https://github.com/gentoo/eudev/issues])
AC_SUBST(UDEV_VERSION, 220)
AC_CONFIG_SRCDIR([src/udev/udevd.c])

AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_PREFIX_DEFAULT([/usr])

AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])

AM_INIT_AUTOMAKE([foreign 1.13])
AM_SILENT_RULES([yes])

LT_PREREQ(2.2)
LT_INIT

# Checks for programs.
AC_PROG_MKDIR_P
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_GREP
AC_PROG_AWK

AC_PROG_CC_C99
AS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
        AC_MSG_ERROR([no C99 compiler found, $PACKAGE requires a C99 compiler.])
])

AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

AC_PATH_PROG([M4], [m4])
AC_PATH_PROG([XSLTPROC], [xsltproc])

# Checks for header files.
AC_CHECK_HEADERS(
        [arpa/inet.h fcntl.h inttypes.h langinfo.h limits.h locale.h \
         netinet/in.h sys/ioctl.h sys/mount.h \
         sys/param.h sys/socket.h sys/statvfs.h sys/time.h sys/vfs.h syslog.h \
         termios.h unistd.h],
        [],
        [AC_MSG_ERROR([*** POSIX header not found])]
)

AC_CHECK_HEADERS(
	[mtd/mtd-user.h],
	[],
	[AC_MSG_ERROR([*** KERNEL header not found])]
)

AC_CHECK_HEADERS(
	[linux/btrfs.h],
	[],
	[AC_MSG_WARN([*** KERNEL header not found])]
)

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_CHECK_DECLS([getrandom, gettid, name_to_handle_at, accept4, mkostemp], [], [], [[#include <sys/types.h>
#include <unistd.h>
#include <sys/mount.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <linux/random.h>]])

AC_CHECK_SIZEOF(pid_t)
AC_CHECK_SIZEOF(uid_t)
AC_CHECK_SIZEOF(gid_t)
AC_CHECK_SIZEOF(dev_t)
AC_CHECK_SIZEOF(time_t)
AC_CHECK_SIZEOF(rlim_t,,[[
#include <sys/time.h>
#include <sys/resource.h>]])

# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_FUNC_GETGROUPS
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_HEADER_MAJOR
AC_FUNC_MMAP

AC_CHECK_FUNCS(
        [alarm dup2 ftruncate localtime_r mempcpy \
         mkdir munmap nl_langinfo rmdir setlocale socket stpcpy \
         uname],
        [],
        [AC_MSG_ERROR([*** POSIX function not found])]
)
AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX librt not found])])
LT_LIB_M

# ------------------------------------------------------------------------------

# TODO: the old python checks are irrelevant, but we do need python and perl for tests

# ------------------------------------------------------------------------------
# Set paths here

AC_ARG_WITH(
        [rootprefix],
        [AS_HELP_STRING(
                [--with-rootprefix=DIR],
                [rootfs directory prefix for config files and kernel modules])],
        [],
        [with_rootprefix="\${prefix}"]
)

AC_ARG_WITH(
        [rootlibdir],
        [AS_HELP_STRING(
                [--with-rootlibdir=DIR],
                [Root directory for libraries necessary for boot])],
        [],
        [with_rootlibdir=${libdir}]
)

AC_ARG_WITH(
        [rootlibexecdir],
        [AS_HELP_STRING(
                [--with-rootlibexecdir=DIR],
                [Root directory for libexecs necessary for boot])],
        [],
        [with_rootlibexecdir=${with_rootlibdir}/udev]
)

AC_ARG_WITH(
        [rootrundir],
        [AS_HELP_STRING(
                [--with-rootrundir=DIR],
                [Configurable path for /run])],
        [],
        [with_rootrundir=/run]
)

AC_ARG_ENABLE(
        [split-usr],
        [AS_HELP_STRING(
                [--enable-split-usr],
                [Include hard-coded default search paths in / and /usr])],
        [],
        [AS_IF(
                [test "x${ac_default_prefix}" != "x${with_rootprefix}" && test "x${with_rootprefix}" != "x\${prefix}"],
                [enable_split_usr=yes],
                [enable_split_usr=no])]
)

AS_IF(
        [test "x${enable_split_usr}" = "xyes"],
        [AC_DEFINE(HAVE_SPLIT_USR, 1, [Define to include hard-coded default search paths in / and /usr])]
)

# Configured paths
AC_SUBST([rootprefix], [$with_rootprefix])
AC_SUBST([rootlibdir], [$with_rootlibdir])
AC_SUBST([rootlibexecdir], [${with_rootlibexecdir}])
AC_SUBST([udevlibexecdir], [${rootlibexecdir}])

# sysconfdir paths
AC_SUBST([udevconfdir],[${sysconfdir}/udev])
AC_SUBST([udevconffile],[${udevconfdir}/udev.conf])
AC_SUBST([udevhwdbdir],[${udevconfdir}/hwdb.d])
AC_SUBST([udevhwdbbin],[${udevconfdir}/hwdb.bin])

# udevlibexecdir paths
AC_SUBST([udevkeymapdir],[${udevlibexecdir}/keymaps])
AC_SUBST([udevkeymapforceredir],[${udevkeymapdir}/force-release])
AC_SUBST([udevrulesdir],[${udevlibexecdir}/rules.d])

# pkgconfigdir paths
AC_SUBST([pkgconfiglibdir], [${libdir}/pkgconfig])
AC_SUBST([sharepkgconfigdir],[${datadir}/pkgconfig])

# gudev paths
AC_SUBST([libgudev_includedir],[${includedir}/gudev-1.0/gudev])

# introspection paths
AC_SUBST([girdir], [${datadir}/gir-1.0])
AC_SUBST([typelibsdir], [${libdir}/girepository-1.0])

AC_SUBST([rootrundir],[${with_rootrundir}])

# ------------------------------------------------------------------------------

GOBJECT_INTROSPECTION_CHECK([1.31.1])
AM_CONDITIONAL([HAVE_INTROSPECTION], [test "$enable_introspection" = "yes"])

# ------------------------------------------------------------------------------
have_blkid=no
AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [Disable optional blkid support]))
if test "x$enable_blkid" != "xno"; then
        PKG_CHECK_MODULES([BLKID], [blkid >= 2.20],
                [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
        if test "x$have_blkid" = xno -a "x$enable_blkd" = xyes; then
                AC_MSG_ERROR([*** blkid support requested but not found])
        fi
fi
AM_CONDITIONAL(HAVE_BLKID, [test "x$have_blkid" = "xyes"])

# ------------------------------------------------------------------------------
have_selinux=no
AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
if test "x$enable_selinux" != "xno"; then
        PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.1.9],
                [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
        if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
                AC_MSG_ERROR([*** SELinux support requested but libraries not found])
        fi
fi
AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
if test "x${have_selinux}" != xno ; then
        sushell=/sbin/sushell
else
        sushell=/bin/bash
fi
AC_SUBST(sushell)

# ------------------------------------------------------------------------------

AC_CHECK_DECL([unshare],
        [AC_DEFINE(HAVE_UNSHARE, 1, [Define if unshare is declared])],
        [AC_CHECK_DECL([SYS_unshare],
                [ ] ,
                [AC_MSG_ERROR([*** unshare nor SYS_unshare found.])],
                [#include <syscall.h>])],
        [#include <sched.h>])

# ------------------------------------------------------------------------------
AC_ARG_ENABLE([gudev],
        AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
        [], [enable_gudev=yes])
AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])

# ------------------------------------------------------------------------------
AC_PATH_TOOL(GPERF, gperf)
if test -z "$GPERF" ; then
        AC_MSG_ERROR([*** gperf not found])
fi

# ------------------------------------------------------------------------------
GTK_DOC_CHECK([1.18],[--flavour no-tmpl])
AM_CONDITIONAL([ENABLE_GTK_DOC],[test "x$enable_gtk_doc" = "xyes"])

AS_IF([test "x$enable_gtk_doc" = "xyes" -a "x$XSLTPROC" = x], [
        AC_MSG_ERROR([*** GTK doc requested but xsltproc not found])
])
AC_SUBST(XSLTPROC_FLAGS)

# ------------------------------------------------------------------------------

AC_ARG_ENABLE([manpages], AS_HELP_STRING([--disable-manpages],[disable manpages]),[],[enable_manpages=no])
AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$enable_manpages" = "xyes"])

# ------------------------------------------------------------------------------
have_kmod=no
AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules support]))
if test "x$enable_kmod" != "xno"; then
        PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
        if test "x$have_kmod" = "xyes"; then
                PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
                        [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
                        AC_MSG_ERROR([*** kmod version >= 15 not found]))
        fi
        if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
                AC_MSG_ERROR([*** kmod support requested, but libraries not found])
        fi
fi
AM_CONDITIONAL(HAVE_KMOD, [test "$have_kmod" = "yes"])

# ------------------------------------------------------------------------------

AC_ARG_ENABLE([hwdb], AS_HELP_STRING([--enable-hwdb],[install hwdb.d files]),[],[enable_hwdb=yes])
AM_CONDITIONAL(ENABLE_HWDB, [test "x$enable_hwdb" = "xyes"])

# ------------------------------------------------------------------------------

AC_CONFIG_FILES([Makefile
                 docs/Makefile
                 docs/gudev/Makefile
                 docs/gudev/version.xml
                 docs/libudev/Makefile
                 docs/libudev/version.xml
                 hwdb/Makefile
                 man/Makefile
                 rules/Makefile
                 src/Makefile
                 src/ata_id/Makefile
                 src/cdrom_id/Makefile
                 src/collect/Makefile
                 src/mtd_probe/Makefile
                 src/scsi_id/Makefile
                 src/v4l_id/Makefile
                 src/gudev/Makefile
                 src/gudev/gudev-1.0.pc
                 src/shared/Makefile
                 src/libudev/Makefile
                 src/libudev/libudev.pc
                 src/udev/Makefile
                 src/udev/udev.pc
                 test/Makefile])

AC_OUTPUT

# ------------------------------------------------------------------------------

AC_MSG_RESULT([
        prefix:                  ${prefix}
        exec_prefix:             ${exec_prefix}
        sysconfdir:              ${sysconfdir}
        datadir:                 ${datadir}
        includedir:              ${includedir}
        libdir:                  ${libdir}

        rootprefix:              ${rootprefix}
        rootlibdir:              ${rootlibdir}
        rootlibexecdir:          ${rootlibexecdir}
        datarootdir:             ${datarootdir}
        rootrundir:              ${rootrundir}

        udevconfdir:             ${udevconfdir}
        udevconffile:            ${udevconffile}
        udevhwdbdir:             ${udevhwdbdir}
        udevhwdbbin:             ${udevhwdbbin}
        udevlibexecdir:          ${udevlibexecdir}
        udevkeymapdir:           ${udevkeymapdir}
        udevkeymapforceredir:    ${udevkeymapforceredir}
        udevrulesdir:            ${udevrulesdir}

        pkgconfiglibdir:         ${libdir}/pkgconfig
        sharepkgconfigdir        ${datadir}/pkgconfig

        libgudev_includedir      ${includedir}/gudev-1.0/gudev

        girdir                   ${datadir}/gir-1.0
        typelibsdir              ${libdir}/girepository-1.0
])

# ------------------------------------------------------------------------------

dnl Set configured scripts executable
if test -f  src/keymap/check-keymaps.sh; then
        chmod +x src/keymap/check-keymaps.sh
fi

if test -f src/keymap/keyboard-force-release.sh; then
        chmod +x src/keymap/keyboard-force-release.sh
fi