1
2m4_define([udisks_major_version], [2])
3m4_define([udisks_minor_version], [9])
4m4_define([udisks_micro_version], [2])
5
6m4_define([udisks_version], [udisks_major_version.udisks_minor_version.udisks_micro_version])
7
8AC_INIT([udisks],[udisks_version],[https://storaged-project.github.io],[udisks])
9
10UDISKS_MAJOR_VERSION=udisks_major_version
11UDISKS_MINOR_VERSION=udisks_minor_version
12UDISKS_MICRO_VERSION=udisks_micro_version
13UDISKS_VERSION=udisks_version
14AC_SUBST(UDISKS_MAJOR_VERSION)
15AC_SUBST(UDISKS_MINOR_VERSION)
16AC_SUBST(UDISKS_MICRO_VERSION)
17AC_SUBST(UDISKS_VERSION)
18
19AC_CONFIG_MACRO_DIR([m4])
20AC_CONFIG_SRCDIR([src])
21AC_CONFIG_HEADERS([config.h])
22AC_CONFIG_AUX_DIR([build-aux])
23
24AM_INIT_AUTOMAKE([1.11 foreign silent-rules dist-bzip2 no-dist-gzip])
25AM_MAINTAINER_MODE
26AM_SILENT_RULES([yes])
27
28AX_CHECK_ENABLE_DEBUG([no], [DEBUG], [NDEBUG])
29
30AC_PROG_CC
31AC_PROG_CC_C99
32AC_ISC_POSIX
33AC_HEADER_STDC
34AC_PROG_LIBTOOL
35
36AC_PATH_PROG([BASH], [bash])
37if test -z "$BASH"; then
38  AC_MSG_ERROR([bash is required to run Makefile])
39fi
40
41# Compilation
42#
43
44CC_CHECK_CFLAGS_APPEND([                          \
45        -Wall                                     \
46        -W                                        \
47        -Wextra                                   \
48        -Wcast-align                              \
49        -Wdeclaration-after-statement             \
50        -Wendif-labels                            \
51        -Werror=format-security                   \
52        -Werror=implicit-function-declaration     \
53        -Werror=overflow                          \
54        -Wformat-nonliteral                       \
55        -Wformat=2                                \
56        -Wimplicit                                \
57        -Winit-self                               \
58        -Wlogical-op                              \
59        -Wmissing-declarations                    \
60        -Wmissing-format-attribute                \
61        -Wmissing-include-dirs                    \
62        -Wmissing-noreturn                        \
63        -Wmissing-prototypes                      \
64        -Wnested-externs                          \
65        -Wno-inline                               \
66        -Wno-long-long                            \
67        -Wno-missing-field-initializers           \
68        -Wno-overlength-strings                   \
69        -Wno-switch-enum                          \
70        -Wno-unused-parameter                     \
71        -Wno-unused-result                        \
72        -Wold-style-definition                    \
73        -Wpacked                                  \
74        -Wpointer-arith                           \
75        -Wshadow                                  \
76        -Wsign-compare                            \
77        -Wstrict-aliasing=2                       \
78        -Wstrict-prototypes                       \
79        -Wundef                                   \
80        -Wuninitialized                           \
81        -Wmaybe-uninitialized                     \
82        -Wunsafe-loop-optimizations               \
83        -Wvla                                     \
84        -Wwrite-strings                           \
85        -fdata-sections                           \
86        -fdiagnostics-show-option                 \
87        -ffast-math                               \
88        -ffunction-sections                       \
89        -fno-common                               \
90        -fno-strict-aliasing                      \
91        -D_LARGEFILE64_SOURCE                     \
92        -D_FILE_OFFSET_BITS=64                    \
93])
94
95if test -z "$enable_modules"; then
96  enable_modules=no
97fi
98if test -z "$enable_available_modules"; then
99  enable_available_modules=no
100fi
101
102GTK_DOC_CHECK([1.3],[--flavour no-tmpl])
103
104AC_ARG_ENABLE(man,
105              [AS_HELP_STRING([--enable-man],
106                              [generate man pages [default=auto]])],,
107              enable_man=maybe)
108AS_IF([test "$enable_man" != no], [
109  AC_PATH_PROG([XSLTPROC], [xsltproc])
110  AS_IF([test -z "$XSLTPROC"], [
111    AS_IF([test "$enable_man" = yes], [
112      AC_MSG_ERROR([xsltproc is required for --enable-man])
113    ])
114    enable_man=no
115  ])
116  enable_man=yes
117])
118AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
119
120AC_ARG_ENABLE(daemon,
121              [AS_HELP_STRING([--enable-daemon],
122                              [build udisks daemon [default=yes]])],,
123              enable_daemon=yes)
124AM_CONDITIONAL(ENABLE_DAEMON, test "$enable_daemon" != no)
125
126GOBJECT_INTROSPECTION_CHECK([0.6.2])
127
128# Behavior
129#
130
131fhs_media=no
132AC_ARG_ENABLE(fhs-media,
133              [AS_HELP_STRING([--enable-fhs-media],
134                              [Mount devices in /media instead of /run/media [default=no]])],
135              AS_IF([test "x$enable_fhs_media" == "xyes"], [fhs_media=yes]),
136              fhs_media=no)
137AM_CONDITIONAL(HAVE_FHS_MEDIA, test "x$fhs_media" = "xyes")
138if test "x$fhs_media" = "xyes"; then
139  AC_DEFINE([HAVE_FHS_MEDIA], 1, [Define to 1 to use /media for mounting])
140fi
141
142# Libraries
143#
144
145PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.50])
146AC_SUBST(GLIB_CFLAGS)
147AC_SUBST(GLIB_LIBS)
148
149PKG_CHECK_MODULES(GIO, [gio-unix-2.0 >= 2.50])
150AC_SUBST(GIO_CFLAGS)
151AC_SUBST(GIO_LIBS)
152
153PKG_CHECK_MODULES(POLKIT_GOBJECT_1, [polkit-gobject-1 >= 0.102])
154AC_SUBST(POLKIT_GOBJECT_1_CFLAGS)
155AC_SUBST(POLKIT_GOBJECT_1_LIBS)
156
157PKG_CHECK_MODULES(POLKIT_AGENT_1, [polkit-agent-1 >= 0.102])
158AC_SUBST(POLKIT_AGENT_1_CFLAGS)
159AC_SUBST(POLKIT_AGENT_1_LIBS)
160
161if test "x$enable_daemon" = "xyes"; then
162  PKG_CHECK_MODULES(GUDEV, [gudev-1.0 >= 165])
163  AC_SUBST(GUDEV_CFLAGS)
164  AC_SUBST(GUDEV_LIBS)
165
166  PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
167  AC_SUBST(GMODULE_CFLAGS)
168  AC_SUBST(GMODULE_LIBS)
169
170  PKG_CHECK_MODULES(BLOCKDEV, [blockdev >= 2.25])
171  AC_SUBST(BLOCKDEV_CFLAGS)
172  AC_SUBST(BLOCKDEV_LIBS)
173
174  PKG_CHECK_MODULES(LIBATASMART, [libatasmart >= 0.17])
175  AC_SUBST(LIBATASMART_CFLAGS)
176  AC_SUBST(LIBATASMART_LIBS)
177
178  PKG_CHECK_MODULES(LIBMOUNT, [mount >= 2.18])
179  AC_SUBST(LIBMOUNT_CFLAGS)
180  AC_SUBST(LIBMOUNT_LIBS)
181
182  PKG_CHECK_MODULES(LIBMOUNT_UTAB, [mount >= 2.30],
183                    [have_libmount_utab=yes],
184                    [have_libmount_utab=no])
185  if test "x$have_libmount_utab" = "xyes"; then
186    AC_DEFINE([HAVE_LIBMOUNT_UTAB], 1, [Define to 1 if libmount utab functionality is available])
187  fi
188  AC_SUBST(HAVE_LIBMOUNT_UTAB)
189
190  PKG_CHECK_MODULES(LIBUUID, [uuid])
191  AC_SUBST(LIBUUID_CFLAGS)
192  AC_SUBST(LIBUUID_LIBS)
193
194  # UUID_STR_LEN is only available since util-linux-2.31
195  AC_CHECK_DECL([UUID_STR_LEN],
196                [],
197                [AC_DEFINE([UUID_STR_LEN], 37, [compat UUID_STR_LEN define])],
198                [[#include <uuid/uuid.h>]])
199
200  PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd >= 209], [have_libsystemd_login=yes],
201                    [PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN, [libsystemd-login >= 44 libsystemd-daemon],
202                    [have_libsystemd_login=yes],
203                    [have_libsystemd_login=no])])
204  if test "x$have_libsystemd_login" = "xyes"; then
205    AC_DEFINE([HAVE_LIBSYSTEMD_LOGIN], 1, [Define to 1 if libsystemd-login is available])
206  fi
207  AC_SUBST(HAVE_LIBSYSTEMD_LOGIN)
208  AC_SUBST(LIBSYSTEMD_LOGIN_CFLAGS)
209  AC_SUBST(LIBSYSTEMD_LOGIN_LIBS)
210
211  PKG_CHECK_MODULES(LIBELOGIND, [libelogind >= 219],
212                    [have_libelogind=yes],
213                    [have_libelogind=no])
214  if test "x$have_libelogind" = "xyes"; then
215    AC_DEFINE([HAVE_LIBELOGIND], 1, [Define to 1 if libelogind is available])
216  fi
217  AC_SUBST(HAVE_LIBELOGIND)
218  AC_SUBST(LIBELOGIND_CFLAGS)
219  AC_SUBST(LIBELOGIND_LIBS)
220else
221  have_libmount_utab=no
222  have_libsystemd_login=no
223  have_libelogind=no
224fi
225AM_CONDITIONAL(HAVE_LIBMOUNT_UTAB, test x$have_libmount_utab = xyes)
226AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, test x$have_libsystemd_login = xyes)
227AM_CONDITIONAL(HAVE_LIBELOGIND, test x$have_libelogind = xyes)
228
229# udevdir
230AC_ARG_WITH([udevdir],
231            AS_HELP_STRING([--with-udevdir=DIR], [Directory for udev]),
232            [],
233            [with_udevdir=$($PKG_CONFIG --variable=udevdir udev)])
234AC_SUBST([udevdir], [$with_udevdir])
235
236# systemd
237AC_ARG_WITH([systemdsystemunitdir],
238            AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
239            [],
240            [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
241if test "x$with_systemdsystemunitdir" != "xno"; then
242  AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
243fi
244AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
245
246AC_ARG_WITH([tmpfilesdir],
247            AS_HELP_STRING([--with-tmpfilesdir=DIR], [Directory for configuring creation of files at boot]),
248            [],
249            [with_tmpfilesdir=$($PKG_CONFIG --variable=tmpfilesdir systemd)])
250if test "x$with_tmpfilesdir" != "xno"; then
251  AC_SUBST([tmpfilesdir], [$with_tmpfilesdir])
252fi
253
254# kernel modules
255AC_ARG_WITH([modloaddir],
256  [AS_HELP_STRING([--with-modloaddir=DIR], [Directory for configuring kernel modules to load at boot])],
257  [modloaddir=$withval],
258  [modloaddir="$($PKG_CONFIG --variable=modulesloaddir systemd || echo "$prefix/lib/modules-load.d")"])
259AC_SUBST([modloaddir], [$modloaddir])
260
261AC_ARG_WITH([modprobedir],
262  [AS_HELP_STRING([--with-modprobedir=DIR], [Directory for modprobe configuration])],
263  [modprobedir=$withval],
264  [modprobedir="/usr/lib/modprobe.d"])
265AC_SUBST([modprobedir], [$modprobedir])
266
267have_acl=no
268AC_ARG_ENABLE(acl, AS_HELP_STRING([--disable-acl], [disable acl support]))
269if test "x$enable_acl" != "xno"; then
270  AC_CHECK_HEADERS(
271          [sys/acl.h acl/libacl.h],
272          [
273            AC_CHECK_LIB(
274                [acl],
275                [acl_get_file],
276                [AC_DEFINE(HAVE_ACL, 1, [Define if libacl is available]) have_acl=yes],
277                have_acl=no)
278          ],
279          have_acl=no)
280  if test "x$have_acl" = "xyes"; then
281    ACL_CFLAGS=""
282    ACL_LIBS="-lacl"
283  fi
284  AC_SUBST(ACL_CFLAGS)
285  AC_SUBST(ACL_LIBS)
286  if test "x$have_acl" = xno -a "x$enable_acl" = xyes; then
287    AC_MSG_ERROR([acl support requested but libraries not found])
288  fi
289fi
290AM_CONDITIONAL(HAVE_ACL, [test "$have_acl" = "yes"])
291
292
293# LVM2 module
294have_lvm2=no
295AC_ARG_ENABLE(lvm2, AS_HELP_STRING([--enable-lvm2], [enable LVM2 support]))
296if test "x$enable_lvm2" = "xyes" \
297     -o "x$enable_modules" = "xyes" \
298     -o "x$enable_available_modules" = "xyes"; then
299
300  SAVE_CFLAGS=$CFLAGS
301  SAVE_LDFLAGS=$LDFLAGS
302
303  CFLAGS="$GLIB_CFLAGS"
304  LDFLAGS="$GLIB_LIBS"
305  AC_MSG_CHECKING([libblockdev-lvm presence])
306  AC_TRY_COMPILE([#include <blockdev/lvm.h>], [],
307                 [AC_MSG_RESULT([yes])
308                 have_lvm2=yes],
309                 [AC_MSG_RESULT([no])
310                 have_lvm2=no])
311  CFLAGS=$SAVE_CFLAGS
312  LDFLAGS=$SAVE_LDFLAGS
313
314  if test "x$have_lvm2" = "xno"; then
315     if test "x$enable_lvm2" = "xyes" -o "x$enable_modules" = "xyes"; then
316         AC_MSG_ERROR([lvm2 support requested but libraries not found])
317     fi
318  fi
319fi
320AM_CONDITIONAL(HAVE_LVM2, [test "$have_lvm2" = "yes"])
321
322# LVMCache
323have_lvmcache=no
324AC_ARG_ENABLE(lvmcache, AS_HELP_STRING([--enable-lvmcache], [enable LVMCache support]))
325if test "x$enable_lvmcache" = "xyes" \
326     -o "x$enable_modules" = "xyes" \
327     -o "x$enable_available_modules" = "xyes"; then
328
329  if test "x$have_lvm2" = "xno"; then
330     if test "x$enable_lvmcache" = "xyes" -o "x$enable_modules" = "xyes"; then
331         AC_MSG_ERROR([lvmcache support requested, but lvm2 module not enabled])
332     fi
333  fi
334  have_lvmcache=yes
335  AC_DEFINE(HAVE_LVMCACHE, 1, [Define if lvmcache is available])
336fi
337AM_CONDITIONAL(HAVE_LVMCACHE, [test "$have_lvmcache" = "yes"])
338
339# iSCSI module
340have_iscsi=no
341have_libiscsi_session_info="no"
342have_libiscsi_session_info_msg=""
343AC_ARG_ENABLE(iscsi, AS_HELP_STRING([--enable-iscsi], [enable iSCSI support]))
344if test "x$enable_iscsi" = "xyes" \
345     -o "x$enable_modules" = "xyes" \
346     -o "x$enable_available_modules" = "xyes"; then
347  # libiscsi.h
348  AC_CHECK_HEADER([libiscsi.h],
349                  [AC_DEFINE(HAVE_ISCSI, 1, [Define if libiscsi from iscsi-initiator-utils is available])
350                   have_iscsi=yes],
351                  [have_iscsi=no])
352  if test "x$have_iscsi" = "xyes"; then
353    AC_MSG_CHECKING([whether libiscsi.h defines iscsi_err])
354    AC_TRY_COMPILE([#include <libiscsi.h>],
355                   [int err = ISCSI_SUCCESS;],
356                   [AC_MSG_RESULT([yes])
357                    AC_DEFINE([HAVE_LIBISCSI_ERR], [1], [libiscsi error states])],
358                   [AC_MSG_RESULT([no])])
359  fi
360
361  # libiscsi
362  AC_CHECK_LIB([iscsi],
363               [libiscsi_init],
364               [ISCSI_LIBS="-liscsi"],
365               [have_iscsi="no"])
366  if test "x$have_iscsi" = "xyes"; then
367    AC_CHECK_LIB([iscsi],
368                 [libiscsi_get_session_info_by_id],
369                 [have_libiscsi_session_info="yes"
370                  have_libiscsi_session_info_msg=", with iscsi sessions"
371                  AC_DEFINE([HAVE_LIBISCSI_GET_SESSION_INFOS], [1],
372                            [libiscsi can retrieve session information])],
373                 [have_libiscsi_session_info_msg=", without iscsi sessions"])
374  fi
375
376  if test "x$have_iscsi" = "xno"; then
377     if test "x$enable_iscsi" = "xyes" -o "x$enable_modules" = "xyes"; then
378         AC_MSG_ERROR([iSCSI support requested but libraries not found])
379     fi
380  fi
381  AC_SUBST([ISCSI_LIBS])
382fi
383AM_CONDITIONAL(HAVE_ISCSI, [test "x$have_iscsi" = "xyes"])
384AM_CONDITIONAL(BUILD_ISCSI_SESSION_OBJECT, [test "x$have_libiscsi_session_info" = "xyes"])
385
386# BTRFS module
387have_btrfs=no
388AC_ARG_ENABLE(btrfs, AS_HELP_STRING([--enable-btrfs], [enable BTRFS support]))
389if test "x$enable_btrfs" = "xyes" \
390     -o "x$enable_modules" = "xyes" \
391     -o "x$enable_available_modules" = "xyes"; then
392    # libblockdev
393    SAVE_CFLAGS=$CFLAGS
394    SAVE_LDFLAGS=$LDFLAGS
395    CFLAGS="$GLIB_CFLAGS"
396    LDFLAGS="$GLIB_LIBS"
397    # We don't use AC_CHECK_HEADER to avoid these warnings:
398    #   - accepted by the compiler, rejected by the preprocessor!
399    #   - proceeding with the compiler's result
400    AC_MSG_CHECKING(["libblockdev-btrfs presence"])
401    AC_TRY_COMPILE([#include <blockdev/btrfs.h>], [],
402                   [AC_MSG_RESULT([yes])
403                    AC_DEFINE(HAVE_BTRFS, 1, [Define, if libblockdev-btrfs is available])
404                    have_btrfs=yes],
405                   [AC_MSG_RESULT([no])
406                    have_btrfs=no])
407    CFLAGS=$SAVE_CFLAGS
408    LDFLAGS=$SAVE_LDFLAGS
409
410    if test "x$have_btrfs" = "xno"; then
411     if test "x$enable_btrfs" = "xyes" -o "x$enable_modules" = "xyes"; then
412         AC_MSG_ERROR([BTRFS support requested but header or library not found])
413     fi
414    fi
415fi
416AM_CONDITIONAL(HAVE_BTRFS, [test "x$have_btrfs" = "xyes"])
417
418# ZRAM module
419have_kbd="no"
420have_swap="no"
421have_zram="no"
422AC_ARG_ENABLE(zram, AS_HELP_STRING([--enable-zram], [enable ZRAM support]))
423if test "x$enable_zram" = "xyes" \
424     -o "x$enable_modules" = "xyes" \
425     -o "x$enable_available_modules" = "xyes"; then
426    # libblockdev
427    SAVE_CFLAGS=$CFLAGS
428    SAVE_LDFLAGS=$LDFLAGS
429    CFLAGS="$GLIB_CFLAGS"
430    LDFLAGS="$GLIB_LIBS"
431
432    # libblockdev-kbd
433    AC_MSG_CHECKING([libblockdev-kbd presence])
434    AC_TRY_COMPILE([#include <blockdev/kbd.h>], [],
435                   [AC_MSG_RESULT([yes])
436                    have_kbd=yes],
437                   [AC_MSG_RESULT([no])
438                    have_kbd=no])
439
440    if test "x$have_kbd" = "xno"; then
441        if test "x$enable_zram" = "xyes" -o "x$enable_modules" = "xyes"; then
442            AC_MSG_ERROR([KBD support requested but header or library not found])
443        fi
444    fi
445
446    CFLAGS="$GLIB_CFLAGS"
447    LDFLAGS="$GLIB_LIBS"
448
449    # libblockdev-swap
450    AC_MSG_CHECKING([libblockdev-swap presence])
451    AC_TRY_COMPILE([#include <blockdev/swap.h>], [],
452                   [AC_MSG_RESULT([yes])
453                   have_swap=yes],
454                   [AC_MSG_RESULT([no])
455                   have_swap=no])
456
457    CFLAGS=$SAVE_CFLAGS
458    LDFLAGS=$SAVE_LDFLAGS
459
460    if test "x$have_swap" = "xno"; then
461        if test "x$enable_zram" = "xyes" -o "x$enable_modules" = "xyes"; then
462            AC_MSG_ERROR([SWAP support requested but header or library not found])
463        fi
464    fi
465
466    # needs systemd
467    if test -z "$systemdsystemunitdir"; then
468        AC_MSG_ERROR([systemd is required for ZRAM support])
469    fi
470
471    have_zram="yes"
472
473    if test "$have_kbd" = "yes" -a "$have_swap" = "yes"; then
474       AC_DEFINE(HAVE_ZRAM, 1, [Define, if libblockdev-kbd and libblockdev-swap are available])
475    fi
476
477    AC_ARG_WITH([zramconfdir],
478      [AS_HELP_STRING([--with-zramconfdir=DIR], [Directory for ZRAM configuration])],
479      [zramconfdir=$withval],
480      [zramconfdir="${prefix}/lib/zram.conf.d"])
481    AC_SUBST([zramconfdir], [$zramconfdir])
482fi
483AM_CONDITIONAL(HAVE_ZRAM, [test "$have_kbd" = "yes" -a "$have_swap" = "yes"])
484
485
486# LSM module
487have_lsm=no
488have_libconfig=no
489AC_ARG_ENABLE(
490    lsm, AS_HELP_STRING([--enable-lsm], [enable LibStorageMgmt support]))
491if test "x$enable_lsm" = "xyes" \
492     -o "x$enable_modules" = "xyes" \
493     -o "x$enable_available_modules" = "xyes"; then
494    PKG_CHECK_MODULES(
495        [LIBLSM], [libstoragemgmt >= 1.3.0],
496        [AC_DEFINE(HAVE_LSM, 1, [Define if liblibstoragemgmt is available])
497            have_lsm=yes],
498        [AC_MSG_WARN([libstoragemgmt 1.3.0 or newer not found.])
499            have_lsm=no])
500
501    PKG_CHECK_MODULES(
502        [LIBCONFIG], [libconfig >= 1.3.2],
503        [have_libconfig=yes],
504        [AC_MSG_WARN([libconfig 1.3.2 or newer not found.])
505            have_libconfig=no])
506
507  if test "x$have_libconfig" = "xno"; then
508      have_lsm=no
509  fi
510
511  if test "x$have_lsm" = "xno"; then
512      if test "x$enable_lsm" = "xyes" -o "x$enable_modules" = "xyes"; then
513          AC_MSG_ERROR([LibStorageMgmt support requested but libraries not found])
514      fi
515  fi
516fi
517AM_CONDITIONAL(HAVE_LSM, [test "x$have_lsm" = "xyes"])
518
519# Bcache module
520have_bcache=no
521AC_ARG_ENABLE(bcache, AS_HELP_STRING([--enable-bcache], [enable Bcache support]))
522if test "x$enable_bcache" = "xyes" \
523     -o "x$enable_modules" = "xyes" \
524     -o "x$enable_available_modules" = "xyes"; then
525    # libblockdev
526    SAVE_CFLAGS=$CFLAGS
527    SAVE_LDFLAGS=$LDFLAGS
528    CFLAGS="$GLIB_CFLAGS"
529    LDFLAGS="$GLIB_LIBS"
530
531    # libblockdev-kbd
532    AC_MSG_CHECKING([libblockdev-kbd presence])
533    AC_TRY_COMPILE([#include <blockdev/kbd.h>], [],
534                   [AC_MSG_RESULT([yes])
535                    have_bcache=yes],
536                   [AC_MSG_RESULT([no])
537                    have_bcache=no])
538    CFLAGS=$SAVE_CFLAGS
539    LDFLAGS=$SAVE_LDFLAGS
540
541    if test "x$have_bcache" = "xno"; then
542        if test "x$enable_bcache" = "xyes" -o "x$enable_modules" = "xyes"; then
543            AC_MSG_ERROR([Bcache support requested but header or library not found])
544        fi
545    fi
546fi
547AM_CONDITIONAL(HAVE_BCACHE, [test "x$have_bcache" = "xyes"])
548
549# VDO module
550have_vdo=no
551AC_ARG_ENABLE(vdo, AS_HELP_STRING([--enable-vdo], [enable VDO support]))
552if test "x$enable_vdo" = "xyes"; then
553    # libblockdev
554    SAVE_CFLAGS=$CFLAGS
555    SAVE_LDFLAGS=$LDFLAGS
556    CFLAGS="$GLIB_CFLAGS"
557    LDFLAGS="$GLIB_LIBS"
558
559    # libblockdev-vdo
560    AC_MSG_CHECKING([libblockdev-vdo presence])
561    AC_TRY_COMPILE([#include <blockdev/vdo.h>], [],
562                   [AC_MSG_RESULT([yes])
563                    have_vdo=yes],
564                   [AC_MSG_RESULT([no])
565                    have_vdo=no])
566    CFLAGS=$SAVE_CFLAGS
567    LDFLAGS=$SAVE_LDFLAGS
568
569    if test "x$have_vdo" = "xno"; then
570        if test "x$enable_vdo" = "xyes" -o "x$enable_modules" = "xyes"; then
571            AC_MSG_ERROR([VDO support requested but header or library not found])
572        fi
573    fi
574fi
575AM_CONDITIONAL(HAVE_VDO, [test "x$have_vdo" = "xyes"])
576
577if test "x$enable_daemon" = "xyes"; then
578  # libblockdev part
579  SAVE_CFLAGS=$CFLAGS
580  SAVE_LDFLAGS=$LDFLAGS
581
582  CFLAGS="$GLIB_CFLAGS"
583  LDFLAGS="$GLIB_LIBS"
584  AC_MSG_CHECKING([libblockdev-part presence])
585  AC_TRY_COMPILE([#include <blockdev/part.h>], [],
586                 [AC_MSG_RESULT([yes])
587                 have_part=yes],
588                 [AC_MSG_RESULT([no])
589                 have_part=no])
590
591  CFLAGS=$SAVE_CFLAGS
592  LDFLAGS=$SAVE_LDFLAGS
593
594  if test "x$have_part" = "xno"; then
595    AC_MSG_ERROR([BlockDev part support requested but header or library not found])
596  fi
597
598  # libblockdev loop
599  SAVE_CFLAGS=$CFLAGS
600  SAVE_LDFLAGS=$LDFLAGS
601
602  CFLAGS="$GLIB_CFLAGS"
603  LDFLAGS="$GLIB_LIBS"
604  AC_MSG_CHECKING([libblockdev-loop presence])
605  AC_TRY_COMPILE([#include <blockdev/loop.h>], [],
606                 [AC_MSG_RESULT([yes])
607                 have_loop=yes],
608                 [AC_MSG_RESULT([no])
609                 have_loop=no])
610
611  CFLAGS=$SAVE_CFLAGS
612  LDFLAGS=$SAVE_LDFLAGS
613
614  if test "x$have_loop" = "xno"; then
615    AC_MSG_ERROR([Loop support requested but header or library not found])
616  fi
617
618  # libblockdev swap
619  SAVE_CFLAGS=$CFLAGS
620  SAVE_LDFLAGS=$LDFLAGS
621
622  CFLAGS="$GLIB_CFLAGS"
623  LDFLAGS="$GLIB_LIBS"
624  AC_MSG_CHECKING([libblockdev-swap presence])
625  AC_TRY_COMPILE([#include <blockdev/swap.h>], [],
626                 [AC_MSG_RESULT([yes])
627                 have_swap=yes],
628                 [AC_MSG_RESULT([no])
629                 have_swap=no])
630
631  CFLAGS=$SAVE_CFLAGS
632  LDFLAGS=$SAVE_LDFLAGS
633
634  if test "x$have_swap" = "xno"; then
635    AC_MSG_ERROR([SWAP support requested but header or library not found])
636  fi
637
638  # libblockdev mdraid
639  SAVE_CFLAGS=$CFLAGS
640  SAVE_LDFLAGS=$LDFLAGS
641
642  CFLAGS="$GLIB_CFLAGS"
643  LDFLAGS="$GLIB_LIBS"
644  AC_MSG_CHECKING([libblockdev-mdraid presence])
645  AC_TRY_COMPILE([#include <blockdev/mdraid.h>], [],
646                 [AC_MSG_RESULT([yes])
647                 have_mdraid=yes],
648                 [AC_MSG_RESULT([no])
649                 have_mdraid=no])
650
651  CFLAGS=$SAVE_CFLAGS
652  LDFLAGS=$SAVE_LDFLAGS
653
654  if test "x$have_mdraid" = "xno"; then
655    AC_MSG_ERROR([BLOCKDEV MDRAID support requested but header or library not found])
656  fi
657
658  # libblockdev fs
659  SAVE_CFLAGS=$CFLAGS
660  SAVE_LDFLAGS=$LDFLAGS
661
662  CFLAGS="$GLIB_CFLAGS"
663  LDFLAGS="$GLIB_LIBS"
664  AC_MSG_CHECKING([libblockdev-fs presence])
665  AC_TRY_COMPILE([#include <blockdev/fs.h>], [],
666                 [AC_MSG_RESULT([yes])
667                 have_fs=yes],
668                 [AC_MSG_RESULT([no])
669                 have_fs=no])
670
671  CFLAGS=$SAVE_CFLAGS
672  LDFLAGS=$SAVE_LDFLAGS
673
674  if test "x$have_fs" = "xno"; then
675    AC_MSG_ERROR([BLOCKDEV FS support requested but header or library not found])
676  fi
677
678  # libblockdev crypto
679  SAVE_CFLAGS=$CFLAGS
680  SAVE_LDFLAGS=$LDFLAGS
681
682  CFLAGS="$GLIB_CFLAGS"
683  LDFLAGS="$GLIB_LIBS"
684  AC_MSG_CHECKING([libblockdev-crypto presence])
685  AC_TRY_COMPILE([#include <blockdev/crypto.h>], [],
686                 [AC_MSG_RESULT([yes])
687                 have_crypto=yes],
688                 [AC_MSG_RESULT([no])
689                 have_crypto=no])
690
691  CFLAGS=$SAVE_CFLAGS
692  LDFLAGS=$SAVE_LDFLAGS
693
694  if test "x$have_crypto" = "xno"; then
695    AC_MSG_ERROR([BLOCKDEV CRYPTO support requested but header or library not found])
696  fi
697fi
698
699
700# Internationalization
701#
702
703AM_GNU_GETTEXT_VERSION([0.19.8])
704AM_GNU_GETTEXT([external])
705
706GETTEXT_PACKAGE=udisks2
707AC_SUBST([GETTEXT_PACKAGE])
708AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
709
710AC_DEFINE([PROJECT_SYSCONF_DIR], ["udisks2"], [Project configuration directory])
711AC_DEFINE([PACKAGE_NAME_UDISKS2], ["udisks2"], [Full package name for UDisks2 compatibility])
712
713# Generate
714#
715
716if test "x$enable_modules" = "xyes"; then
717  enable_modules_info=yes
718elif test "x$enable_available_modules" = "xyes"; then
719    enable_modules_info=available
720else
721  enable_modules_info=no
722fi
723
724AC_OUTPUT([
725Makefile
726data/Makefile
727data/tmpfiles.d/Makefile
728udisks/Makefile
729udisks/udisks2.conf
730udisks/udisks2.pc
731udisks/modules.conf.d/Makefile
732udisks/modules.conf.d/udisks2_lsm.conf
733src/Makefile
734src/tests/Makefile
735src/tests/dbus-tests/Makefile
736tools/Makefile
737modules/Makefile
738modules/btrfs/Makefile
739modules/btrfs/data/Makefile
740modules/btrfs/data/udisks2-btrfs.pc
741modules/iscsi/Makefile
742modules/iscsi/data/Makefile
743modules/iscsi/data/udisks2-iscsi.pc
744modules/lvm2/Makefile
745modules/lvm2/data/Makefile
746modules/lvm2/data/udisks2-lvm2.pc
747modules/zram/Makefile
748modules/zram/data/Makefile
749modules/zram/data/udisks2-zram.pc
750modules/lsm/Makefile
751modules/lsm/data/Makefile
752modules/lsm/data/udisks2-lsm.pc
753modules/bcache/Makefile
754modules/bcache/data/Makefile
755modules/bcache/data/udisks2-bcache.pc
756modules/vdo/Makefile
757modules/vdo/data/Makefile
758modules/vdo/data/udisks2-vdo.pc
759doc/Makefile
760doc/udisks2-docs.xml.in
761doc/udisks2-sections.txt.in
762doc/udisks2.types.in
763doc/version.xml
764doc/man/Makefile
765doc/man/udisks.xml
766doc/man/udisksd.xml
767doc/man/udisksctl.xml
768doc/man/umount.udisks2.xml
769doc/man/udisks2.conf.5.xml.in
770doc/man/udisks2_lsm.conf.5.xml.in
771doc/udisks2-docs.xml.daemon.man
772doc/udisks2-docs.xml.daemon.part
773doc/udisks2-sections.txt.daemon.sections
774doc/udisks2.types.daemon
775doc/udisks2-docs.xml.iscsi.dbus
776doc/udisks2-docs.xml.iscsi.generated
777doc/udisks2-sections.txt.iscsi.sections
778doc/udisks2.types.iscsi
779doc/udisks2-docs.xml.lsm.man
780doc/udisks2-docs.xml.lsm.dbus
781doc/udisks2-docs.xml.lsm.generated
782doc/udisks2-sections.txt.lsm.sections
783doc/udisks2.types.lsm
784doc/udisks2-docs.xml.lvm2.dbus
785doc/udisks2-docs.xml.lvm2.generated
786doc/udisks2-sections.txt.lvm2.sections
787doc/udisks2.types.lvm2
788doc/udisks2-docs.xml.btrfs.dbus
789doc/udisks2-docs.xml.btrfs.generated
790doc/udisks2-sections.txt.btrfs.sections
791doc/udisks2.types.btrfs
792doc/udisks2-docs.xml.zram.dbus
793doc/udisks2-docs.xml.zram.generated
794doc/udisks2-docs.xml.zram.block_devices
795doc/udisks2-sections.txt.zram.sections
796doc/udisks2.types.zram
797doc/udisks2-docs.xml.bcache.dbus
798doc/udisks2-docs.xml.bcache.generated
799doc/udisks2-sections.txt.bcache.sections
800doc/udisks2.types.bcache
801doc/udisks2-docs.xml.vdo.dbus
802doc/udisks2-docs.xml.vdo.generated
803doc/udisks2-sections.txt.vdo.sections
804doc/udisks2.types.vdo
805po/Makefile.in
806])
807
808dnl ==========================================================================
809echo "
810               udisks $VERSION
811             ================
812
813        prefix:                     ${prefix}
814        libdir:                     ${libdir}
815        libexecdir:                 ${libexecdir}
816        bindir:                     ${bindir}
817        sbindir:                    ${sbindir}
818        datadir:                    ${datadir}
819        sysconfdir:                 ${sysconfdir}
820        localstatedir:              ${localstatedir}
821        docdir:                     ${docdir}
822        introspection:              ${found_introspection}
823
824        udevdir:                    ${udevdir}
825        systemdsystemunitdir:       ${systemdsystemunitdir}
826        tmpfilesdir:                ${tmpfilesdir}
827        using libsystemd-login:     ${have_libsystemd_login}
828        using libelogind:           ${have_libelogind}
829        use /media for mounting:    ${fhs_media}
830        acl support:                ${have_acl}
831        using libmount/utab:        ${have_libmount_utab}
832
833        compiler:                   ${CC}
834        cflags:                     ${CFLAGS}
835        cppflags:                   ${CPPFLAGS}
836
837        Maintainer mode:            ${USE_MAINTAINER_MODE}
838        Building api docs:          ${enable_gtk_doc}
839        Building man pages:         ${enable_man}
840
841        Enable daemon:              ${enable_daemon}
842        Enable modules:             ${enable_modules_info}
843
844        BTRFS module:               ${have_btrfs}
845        iSCSI module:               ${have_iscsi}${have_libiscsi_session_info_msg}
846        LVM2  module:               ${have_lvm2}
847        LVMCache:                   ${have_lvmcache}
848        Zram module:                ${have_zram}
849        LibStorageMgmt module:      ${have_lsm}
850        Bcache module:              ${have_bcache}
851        VDO module (deprecated):    ${have_vdo}
852"
853