configure.ac 24.3 KB
Newer Older
Colin Walters's avatar
Colin Walters committed
1
AC_PREREQ([2.63])
2 3
dnl If doing a final release, remember to follow the instructions to
dnl update libostree-released.sym from libostree-devel.sym, and update the checksum
4 5
dnl in test-symbols.sh, and also set is_release_build=yes below.  Then make
dnl another post-release commit to bump the version, and set is_release_build=no.
Colin Walters's avatar
Colin Walters committed
6 7
m4_define([year_version], [2019])
m4_define([release_version], [1])
8 9
m4_define([package_version], [year_version.release_version])
AC_INIT([libostree], [package_version], [walters@verbum.org])
Colin Walters's avatar
Colin Walters committed
10
is_release_build=yes
Colin Walters's avatar
Colin Walters committed
11
AC_CONFIG_HEADER([config.h])
12
AC_CONFIG_MACRO_DIR([buildutil])
Colin Walters's avatar
Colin Walters committed
13 14
AC_CONFIG_AUX_DIR([build-aux])

15
AM_INIT_AUTOMAKE([1.13 -Wno-portability foreign no-define tar-ustar no-dist-gzip dist-xz
16
                  color-tests subdir-objects])
Colin Walters's avatar
Colin Walters committed
17 18
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
19
AC_USE_SYSTEM_EXTENSIONS
20
AC_SYS_LARGEFILE
Colin Walters's avatar
Colin Walters committed
21 22 23

AC_PROG_CC
AM_PROG_CC_C_O
24
AC_PROG_YACC
Colin Walters's avatar
Colin Walters committed
25

26 27 28 29 30
dnl Versioning information
AC_SUBST([YEAR_VERSION], [year_version])
AC_SUBST([RELEASE_VERSION], [release_version])
AC_SUBST([PACKAGE_VERSION], [package_version])

31
AS_IF([echo "$CFLAGS" | grep -q -E -e '-Werror($| )'], [], [
32
CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\
33 34 35 36 37 38 39 40 41 42 43 44 45
  -pipe \
  -Wall \
  -Werror=empty-body \
  -Werror=strict-prototypes \
  -Werror=missing-prototypes \
  -Werror=implicit-function-declaration \
  "-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \
  -Werror=pointer-arith -Werror=init-self \
  -Werror=missing-declarations \
  -Werror=return-type \
  -Werror=switch \
  -Werror=overflow \
  -Werror=int-conversion \
46
  -Werror=parentheses \
47 48 49 50
  -Werror=undef \
  -Werror=incompatible-pointer-types \
  -Werror=misleading-indentation \
  -Werror=missing-include-dirs -Werror=aggregate-return \
51
  -Wstrict-aliasing=2 \
52
  -Werror=unused-result \
53
])])
54
AC_SUBST(WARN_CFLAGS)
55

56 57 58 59 60 61 62 63
AC_MSG_CHECKING([for -fsanitize=address in CFLAGS])
if echo $CFLAGS | grep -q -e -fsanitize=address; then
  AC_MSG_RESULT([yes])
  using_asan=yes
else
  AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(BUILDOPT_ASAN, [test x$using_asan = xyes])
64 65 66 67 68 69 70 71 72 73 74 75 76
AM_COND_IF([BUILDOPT_ASAN],
  [AC_DEFINE([BUILDOPT_ASAN], 1, [Define if we are building with -fsanitize=address])])

AC_MSG_CHECKING([for -fsanitize=thread in CFLAGS])
if echo $CFLAGS | grep -q -e -fsanitize=thread; then
  AC_MSG_RESULT([yes])
  using_tsan=yes
else
  AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(BUILDOPT_TSAN, [test x$using_tsan = xyes])
AM_COND_IF([BUILDOPT_TSAN],
  [AC_DEFINE([BUILDOPT_TSAN], 1, [Define if we are building with -fsanitize=thread])])
77

Colin Walters's avatar
Colin Walters committed
78
# Initialize libtool
79 80
LT_PREREQ([2.2.4])
LT_INIT([disable-static])
Colin Walters's avatar
Colin Walters committed
81

82 83 84
OSTREE_FEATURES=""
AC_SUBST([OSTREE_FEATURES])

85
GLIB_TESTS
86
LIBGLNX_CONFIGURE
Colin Walters's avatar
Colin Walters committed
87

88 89 90
dnl These bits attempt to mirror https://github.com/coreutils/gnulib/blob/e369b04cca4da1534c98628b8ee4648bfca2bb3a/m4/parse-datetime.m4#L27
AC_CHECK_FUNCS([nanotime clock_gettime])
AC_STRUCT_TIMEZONE
91
AC_CHECK_HEADER([sys/xattr.h],,[AC_MSG_ERROR([You must have sys/xattr.h from glibc])])
92

93
AS_IF([test "$YACC" != "bison -y"], [AC_MSG_ERROR([bison not found but required])])
94

Colin Walters's avatar
Colin Walters committed
95 96
PKG_PROG_PKG_CONFIG

97 98 99 100 101 102 103 104
# PKG_CHECK_VAR added to pkg-config 0.28
m4_define_default(
    [PKG_CHECK_VAR],
    [AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])
     AS_IF([test -z "$$1"], [$1=`$PKG_CONFIG --variable="$3" "$2"`])
     AS_IF([test -n "$$1"], [$4], [$5])])

PKG_CHECK_VAR(BASH_COMPLETIONSDIR, [bash-completion], [completionsdir], ,
105
  BASH_COMPLETIONSDIR="${datadir}/bash-completion/completions")
106 107
AC_SUBST(BASH_COMPLETIONSDIR)

108
AM_PATH_GLIB_2_0(,,AC_MSG_ERROR([GLib not found]))
109

110 111 112
dnl When bumping the gio-unix-2.0 dependency (or glib-2.0 in general),
dnl remember to bump GLIB_VERSION_MIN_REQUIRED and
dnl GLIB_VERSION_MAX_ALLOWED in Makefile.am
113
GIO_DEPENDENCY="gio-unix-2.0 >= 2.40.0"
114 115
PKG_CHECK_MODULES(OT_DEP_GIO_UNIX, $GIO_DEPENDENCY)

116
dnl 5.1.0 is an arbitrary version here
117
PKG_CHECK_MODULES(OT_DEP_LZMA, liblzma >= 5.0.5)
118

119 120 121
dnl Needed for rollsum
PKG_CHECK_MODULES(OT_DEP_ZLIB, zlib)

122 123 124
dnl We're not actually linking to this, just using the header
PKG_CHECK_MODULES(OT_DEP_E2P, e2p)

Colin Walters's avatar
Colin Walters committed
125 126 127 128 129 130 131 132 133 134 135 136 137
dnl Arbitrary version that's in CentOS7.2 now
CURL_DEPENDENCY=7.29.0
AC_ARG_WITH(curl,
	    AS_HELP_STRING([--with-curl], [Use libcurl @<:@default=no@:>@]),
	    [], [with_curl=no])
AS_IF([test x$with_curl != xno ], [
    PKG_CHECK_MODULES(OT_DEP_CURL, libcurl >= $CURL_DEPENDENCY)
    with_curl=yes
    AC_DEFINE([HAVE_LIBCURL], 1, [Define if we have libcurl.pc])
    dnl Currently using libcurl requires soup for trivial-httpd for tests
    with_soup_default=yes
], [with_soup_default=check])
AM_CONDITIONAL(USE_CURL, test x$with_curl != xno)
138
if test x$with_curl = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES libcurl"; fi
139 140 141 142 143
AC_ARG_ENABLE(http2,
AS_HELP_STRING([--disable-http2],
  [Disable use of http2 (default: no)]),,
  [enable_http2=yes])
AS_IF([test x$enable_http2 != xno ], [
144
  AC_DEFINE([BUILDOPT_HTTP2], 1, [Define if we enable http2 by default])
145 146 147
], [
  OSTREE_FEATURES="$OSTREE_FEATURES no-http2"
])
Colin Walters's avatar
Colin Walters committed
148

149 150 151
dnl When bumping the libsoup-2.4 dependency, remember to bump
dnl SOUP_VERSION_MIN_REQUIRED and SOUP_VERSION_MAX_ALLOWED in
dnl Makefile.am
152 153
SOUP_DEPENDENCY="libsoup-2.4 >= 2.39.1"
AC_ARG_WITH(soup,
154
	    AS_HELP_STRING([--with-soup], [Use libsoup @<:@default=yes@:>@]),
Colin Walters's avatar
Colin Walters committed
155 156
	    [], [with_soup=$with_soup_default])
AS_IF([test x$with_soup != xno], [
157 158 159 160
  AC_ARG_ENABLE(libsoup_client_certs,
                AS_HELP_STRING([--enable-libsoup-client-certs],
                               [Require availability of new enough libsoup TLS client cert API (default: auto)]),,
                [enable_libsoup_client_certs=auto])
161 162 163
  AC_MSG_CHECKING([for $SOUP_DEPENDENCY])
  PKG_CHECK_EXISTS($SOUP_DEPENDENCY, have_soup=yes, have_soup=no)
  AC_MSG_RESULT([$have_soup])
164 165
    AS_IF([ test x$have_soup = xno && test x$with_soup != xcheck], [
       AC_MSG_ERROR([libsoup is enabled but could not be found])
166 167 168
  ])
  AS_IF([test x$have_soup = xyes], [
    PKG_CHECK_MODULES(OT_DEP_SOUP, $SOUP_DEPENDENCY)
169
    AC_DEFINE([HAVE_LIBSOUP], 1, [Define if we have libsoup.pc])
170
    with_soup=yes
171 172 173 174
    save_CFLAGS=$CFLAGS
    CFLAGS=$OT_DEP_SOUP_CFLAGS
    have_libsoup_client_certs=no
    AC_CHECK_DECL([SOUP_SESSION_TLS_INTERACTION], [
175
        AC_DEFINE([HAVE_LIBSOUP_CLIENT_CERTS], 1, [Define if we have libsoup client certs])
176 177
        have_libsoup_client_certs=yes
        ], [], [#include <libsoup/soup.h>])
178 179 180
    AS_IF([test x$enable_libsoup_client_certs = xyes && test x$have_libsoup_client_certs != xyes], [
      AC_MSG_ERROR([libsoup client certs explicitly requested but not found])
    ]) 
181
    CFLAGS=$save_CFLAGS
182 183 184 185
  ], [
    with_soup=no
  ])
], [ with_soup=no ])
186
if test x$with_soup != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libsoup"; fi
187
AM_CONDITIONAL(USE_LIBSOUP, test x$with_soup != xno)
188
AM_CONDITIONAL(HAVE_LIBSOUP_CLIENT_CERTS, test x$have_libsoup_client_certs = xyes)
189

190 191 192 193
AC_ARG_ENABLE(trivial-httpd-cmdline,
  [AS_HELP_STRING([--enable-trivial-httpd-cmdline],
  [Continue to support "ostree trivial-httpd" [default=no]])],,
  enable_trivial_httpd_cmdline=no)
194 195
AM_CONDITIONAL(BUILDOPT_TRIVIAL_HTTPD, test x$enable_trivial_httpd_cmdline = xyes)
AM_COND_IF(BUILDOPT_TRIVIAL_HTTPD,
196 197 198
  [AC_DEFINE([BUILDOPT_ENABLE_TRIVIAL_HTTPD_CMDLINE], 1, [Define if we are enabling ostree trivial-httpd entrypoint])]
)

Colin Walters's avatar
Colin Walters committed
199
AS_IF([test x$with_curl = xyes && test x$with_soup = xno], [
200
  AC_MSG_WARN([Curl enabled, but libsoup is not; libsoup is needed for tests (make check, etc.)])
Colin Walters's avatar
Colin Walters committed
201 202 203 204 205 206
])
AM_CONDITIONAL(USE_CURL_OR_SOUP, test x$with_curl != xno || test x$with_soup != xno)
AS_IF([test x$with_curl != xno || test x$with_soup != xno],
            [AC_DEFINE([HAVE_LIBCURL_OR_LIBSOUP], 1, [Define if we have soup or curl])])
AS_IF([test x$with_curl = xyes], [fetcher_backend=curl], [test x$with_soup = xyes], [fetcher_backend=libsoup], [fetcher_backend=none])

Colin Walters's avatar
Colin Walters committed
207 208 209
m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
  GOBJECT_INTROSPECTION_CHECK([1.34.0])
])
210
AM_CONDITIONAL(BUILDOPT_INTROSPECTION, test "x$found_introspection" = xyes)
Colin Walters's avatar
Colin Walters committed
211

212 213
LIBGPGME_DEPENDENCY="1.1.8"

214 215 216
PKG_CHECK_MODULES(OT_DEP_GPGME, gpgme-pthread >= $LIBGPGME_DEPENDENCY, have_gpgme=yes, [
    m4_ifdef([AM_PATH_GPGME_PTHREAD], [
       AM_PATH_GPGME_PTHREAD($LIBGPGME_DEPENDENCY, have_gpgme=yes, have_gpgme=no)
217 218
    ],[ have_gpgme=no ])
])
219
AS_IF([ test x$have_gpgme = xno ], [
220
   AC_MSG_ERROR([Need GPGME_PTHREAD version $LIBGPGME_DEPENDENCY or later])
221
])
222
OSTREE_FEATURES="$OSTREE_FEATURES gpgme"
223
PKG_CHECK_MODULES(OT_DEP_GPG_ERROR, [gpg-error], [], [
224 225
dnl This apparently doesn't ship a pkg-config file either, and we need
dnl to link to it directly.
226 227 228 229 230 231
    AC_PATH_PROG(GPG_ERROR_CONFIG, [gpg-error-config], [AC_MSG_ERROR([Missing gpg-error-config])])
    OT_DEP_GPG_ERROR_CFLAGS="$( $GPG_ERROR_CONFIG --cflags )"
    OT_DEP_GPG_ERROR_LIBS="$( $GPG_ERROR_CONFIG --libs )"
])
OT_DEP_GPGME_CFLAGS="${OT_DEP_GPGME_CFLAGS} ${OT_DEP_GPG_ERROR_CFLAGS}"
OT_DEP_GPGME_LIBS="${OT_DEP_GPGME_LIBS} ${OT_DEP_GPG_ERROR_LIBS}"
232

233
LIBARCHIVE_DEPENDENCY="libarchive >= 2.8.0"
Colin Walters's avatar
Colin Walters committed
234 235
# What's in RHEL7.2.
FUSE_DEPENDENCY="fuse >= 2.9.2"
236

237 238
# check for gtk-doc
m4_ifdef([GTK_DOC_CHECK], [
Colin Walters's avatar
Colin Walters committed
239
GTK_DOC_CHECK([1.15], [--flavour no-tmpl])
240 241 242 243 244
],[
enable_gtk_doc=no
AM_CONDITIONAL([ENABLE_GTK_DOC], false)
])

Colin Walters's avatar
Colin Walters committed
245 246 247 248 249 250 251 252 253 254 255 256
AC_ARG_ENABLE(man,
              [AS_HELP_STRING([--enable-man],
                              [generate man pages [default=auto]])],,
              enable_man=maybe)

AS_IF([test "$enable_man" != no], [
  AC_PATH_PROG([XSLTPROC], [xsltproc])
  AS_IF([test -z "$XSLTPROC"], [
    AS_IF([test "$enable_man" = yes], [
      AC_MSG_ERROR([xsltproc is required for --enable-man])
    ])
    enable_man=no
257 258
  ],[
    enable_man=yes
Colin Walters's avatar
Colin Walters committed
259 260 261
  ])
])
AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
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
AC_ARG_ENABLE(rust,
  [AS_HELP_STRING([--enable-rust],
  [Compile Rust code instead of C [default=no]])],,
   [enable_rust=no; rust_debug_release=no])

AS_IF([test "$enable_rust" = yes], [
   AC_PATH_PROG([cargo], [cargo])
   AS_IF([test -z "$cargo"], [AC_MSG_ERROR([cargo is required for --enable-rust])])
   AC_PATH_PROG([rustc], [rustc])
   AS_IF([test -z "$rustc"], [AC_MSG_ERROR([rustc is required for --enable-rust])])

   dnl These bits based on gnome:librsvg/configure.ac

   dnl By default, we build in public release mode.
   AC_ARG_ENABLE(rust-debug,
      AC_HELP_STRING([--enable-rust-debug],
       [Build Rust code with debugging information [default=no]]),
       [rust_debug_release=$enableval],
       [rust_debug_release=release])

   AC_MSG_CHECKING(whether to build Rust code with debugging information)
   if test "x$rust_debug_release" = "xyes" ; then
      rust_debug_release=debug
      AC_MSG_RESULT(yes)
   else
      AC_MSG_RESULT(no)
   fi
   RUST_TARGET_SUBDIR=${rust_debug_release}
   AC_SUBST([RUST_TARGET_SUBDIR])
])
AM_CONDITIONAL(RUST_DEBUG, [test "x$rust_debug_release" = "xdebug"])
AM_CONDITIONAL(ENABLE_RUST, [test "$enable_rust" != no])

296 297 298
AC_ARG_WITH(libarchive,
	    AS_HELP_STRING([--without-libarchive], [Do not use libarchive]),
	    :, with_libarchive=maybe)
299 300

AS_IF([ test x$with_libarchive != xno ], [
301
    AC_MSG_CHECKING([for $LIBARCHIVE_DEPENDENCY])
302
    PKG_CHECK_EXISTS($LIBARCHIVE_DEPENDENCY, have_libarchive=yes, have_libarchive=no)
303
    AC_MSG_RESULT([$have_libarchive])
304
    AS_IF([ test x$have_libarchive = xno && test x$with_libarchive != xmaybe ], [
305
       AC_MSG_ERROR([libarchive is enabled but could not be found])
306 307
    ])
    AS_IF([ test x$have_libarchive = xyes], [
308
        AC_DEFINE([HAVE_LIBARCHIVE], 1, [Define if we have libarchive.pc])
309
	PKG_CHECK_MODULES(OT_DEP_LIBARCHIVE, $LIBARCHIVE_DEPENDENCY)
310 311 312 313
        save_LIBS=$LIBS
        LIBS=$OT_DEP_LIBARCHIVE_LIBS
        AC_CHECK_FUNCS(archive_read_support_filter_all)
        LIBS=$save_LIBS
314
	with_libarchive=yes
315
    ], [
316
	with_libarchive=no
317
    ])
318
], [ with_libarchive=no ])
319
if test x$with_libarchive != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libarchive"; fi
320 321
AM_CONDITIONAL(USE_LIBARCHIVE, test $with_libarchive != no)

Colin Walters's avatar
Colin Walters committed
322
dnl This is what is in RHEL7 anyways
323
SELINUX_DEPENDENCY="libselinux >= 2.1.13"
Colin Walters's avatar
Colin Walters committed
324 325 326 327 328 329 330 331 332 333 334 335 336

AC_ARG_WITH(selinux,
	    AS_HELP_STRING([--without-selinux], [Do not use SELinux]),
	    :, with_selinux=maybe)

AS_IF([ test x$with_selinux != xno ], [
    AC_MSG_CHECKING([for $SELINUX_DEPENDENCY])
    PKG_CHECK_EXISTS($SELINUX_DEPENDENCY, have_selinux=yes, have_selinux=no)
    AC_MSG_RESULT([$have_selinux])
    AS_IF([ test x$have_selinux = xno && test x$with_selinux != xmaybe ], [
       AC_MSG_ERROR([SELinux is enabled but could not be found])
    ])
    AS_IF([ test x$have_selinux = xyes], [
337
        AC_DEFINE([HAVE_SELINUX], 1, [Define if we have libselinux.pc])
Colin Walters's avatar
Colin Walters committed
338 339 340 341 342 343
	PKG_CHECK_MODULES(OT_DEP_SELINUX, $SELINUX_DEPENDENCY)
	with_selinux=yes
    ], [
	with_selinux=no
    ])
], [ with_selinux=no ])
344
if test x$with_selinux != xno; then OSTREE_FEATURES="$OSTREE_FEATURES selinux"; fi
Colin Walters's avatar
Colin Walters committed
345 346
AM_CONDITIONAL(USE_SELINUX, test $with_selinux != no)

347 348 349 350 351 352 353 354
AC_ARG_WITH(smack,
AS_HELP_STRING([--with-smack], [Enable smack]),
:, with_smack=no)
AS_IF([ test x$with_smack = xyes], [
  AC_DEFINE([WITH_SMACK], 1, [Define if we have smack.pc])
])
AM_CONDITIONAL(USE_SMACK, test $with_smack != no)

Jussi Laako's avatar
Jussi Laako committed
355 356 357 358 359 360 361 362 363 364 365 366 367 368
dnl crypto
AC_ARG_WITH(crypto,
AS_HELP_STRING([--with-crypto], [Choose library for checksums, one of glib, openssl, gnutls (default: glib)]),
:, with_crypto=glib)

AS_IF([test $with_crypto = glib],
      [],
      [test $with_crypto = openssl],
      [with_openssl=yes],
      [test $with_crypto = gnutls],
      [],
      [AC_MSG_ERROR([Invalid --with-crypto $with_crypto])]
      )

369
dnl begin openssl (really just libcrypto right now)
Jussi Laako's avatar
Jussi Laako committed
370
dnl Note this option is now deprecated in favor of --with-crypto=openssl
371
OPENSSL_DEPENDENCY="libcrypto >= 1.0.1"
372
AC_ARG_WITH(openssl,
Jussi Laako's avatar
Jussi Laako committed
373
AS_HELP_STRING([--with-openssl], [Enable use of OpenSSL libcrypto (checksums)]),with_openssl=$withval,with_openssl=no)
374
AS_IF([ test x$with_openssl != xno ], [
Jussi Laako's avatar
Jussi Laako committed
375
      PKG_CHECK_MODULES(OT_DEP_CRYPTO, $OPENSSL_DEPENDENCY)
376
      AC_DEFINE([HAVE_OPENSSL], 1, [Define if we have openssl])
Jussi Laako's avatar
Jussi Laako committed
377
      with_crypto=openssl
378 379 380 381 382 383 384 385
      with_openssl=yes
], [
      with_openssl=no
])
if test x$with_openssl != xno; then OSTREE_FEATURES="$OSTREE_FEATURES openssl"; fi
AM_CONDITIONAL(USE_OPENSSL, test $with_openssl != no)
dnl end openssl

Jussi Laako's avatar
Jussi Laako committed
386 387 388 389 390 391 392 393 394 395 396
dnl begin gnutls; in contrast to openssl this one only
dnl supports --with-crypto=gnutls
GNUTLS_DEPENDENCY="gnutls >= 3.5.0"
AS_IF([ test $with_crypto = gnutls ], [
      PKG_CHECK_MODULES(OT_DEP_CRYPTO, $GNUTLS_DEPENDENCY)
      AC_DEFINE([HAVE_GNUTLS], 1, [Define if we have gnutls])
      OSTREE_FEATURES="$OSTREE_FEATURES gnutls"
])
AM_CONDITIONAL(USE_GNUTLS, test $with_crypto = gnutls)
dnl end gnutls

397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
dnl Avahi dependency for finding repos
AVAHI_DEPENDENCY="avahi-client >= 0.6.31 avahi-glib >= 0.6.31"

AC_ARG_WITH(avahi,
            AS_HELP_STRING([--without-avahi], [Do not use Avahi]),
            :, with_avahi=maybe)

AS_IF([ test x$with_avahi != xno ], [
    AC_MSG_CHECKING([for $AVAHI_DEPENDENCY])
    PKG_CHECK_EXISTS($AVAHI_DEPENDENCY, have_avahi=yes, have_avahi=no)
    AC_MSG_RESULT([$have_avahi])
    AS_IF([ test x$have_avahi = xno && test x$with_avahi != xmaybe ], [
       AC_MSG_ERROR([Avahi is enabled but could not be found])
    ])
    AS_IF([ test x$have_avahi = xyes], [
        AC_DEFINE([HAVE_AVAHI], 1, [Define if we have avahi-client.pc and avahi-glib.pc])
        PKG_CHECK_MODULES(OT_DEP_AVAHI, $AVAHI_DEPENDENCY)
        with_avahi=yes
    ], [
        with_avahi=no
    ])
], [ with_avahi=no ])
if test x$with_avahi != xno; then OSTREE_FEATURES="$OSTREE_FEATURES avahi"; fi
AM_CONDITIONAL(USE_AVAHI, test $with_avahi != no)

422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
dnl This is what is in RHEL7.2 right now, picking it arbitrarily
LIBMOUNT_DEPENDENCY="mount >= 2.23.0"

AC_ARG_WITH(libmount,
	    AS_HELP_STRING([--without-libmount], [Do not use libmount]),
	    :, with_libmount=maybe)

AS_IF([ test x$with_libmount != xno ], [
    AC_MSG_CHECKING([for $LIBMOUNT_DEPENDENCY])
    PKG_CHECK_EXISTS($LIBMOUNT_DEPENDENCY, have_libmount=yes, have_libmount=no)
    AC_MSG_RESULT([$have_libmount])
    AS_IF([ test x$have_libmount = xno && test x$with_libmount != xmaybe ], [
       AC_MSG_ERROR([libmount is enabled but could not be found])
    ])
    AS_IF([ test x$have_libmount = xyes], [
        AC_DEFINE([HAVE_LIBMOUNT], 1, [Define if we have libmount.pc])
	PKG_CHECK_MODULES(OT_DEP_LIBMOUNT, $LIBMOUNT_DEPENDENCY)
	with_libmount=yes
440 441 442 443
  save_LIBS=$LIBS
  LIBS=$OT_DEP_LIBMOUNT_LIBS
  AC_CHECK_FUNCS(mnt_unref_cache)
  LIBS=$save_LIBS
444 445 446 447
    ], [
	with_libmount=no
    ])
], [ with_libmount=no ])
448
if test x$with_libmount != xno; then OSTREE_FEATURES="$OSTREE_FEATURES libmount"; fi
449 450
AM_CONDITIONAL(USE_LIBMOUNT, test $with_libmount != no)

Colin Walters's avatar
Colin Walters committed
451 452 453 454 455
# Enabled by default because I think people should use it.
AC_ARG_ENABLE(rofiles-fuse,
              [AS_HELP_STRING([--enable-rofiles-fuse],
                              [generate rofiles-fuse helper [default=yes]])],,
              enable_rofiles_fuse=yes)
456
AS_IF([ test x$enable_rofiles_fuse != xno ], [
Colin Walters's avatar
Colin Walters committed
457 458 459 460
    PKG_CHECK_MODULES(BUILDOPT_FUSE, $FUSE_DEPENDENCY)
], [enable_rofiles_fuse=no])
AM_CONDITIONAL(BUILDOPT_FUSE, test x$enable_rofiles_fuse = xyes)

Colin Walters's avatar
Colin Walters committed
461 462 463 464
AC_ARG_WITH(dracut,
            AS_HELP_STRING([--with-dracut],
                           [Install dracut module (default: no)]),,
              [with_dracut=no])
465 466 467 468 469 470 471 472
case x$with_dracut in
    xno) ;;
    xyes) ;;
    xyesbutnoconf) ;;
    *) AC_MSG_ERROR([Unknown --with-dracut value $with_dracut])
esac    
AM_CONDITIONAL(BUILDOPT_DRACUT, test x$with_dracut = xyes || test x$with_dracut = xyesbutnoconf)
AM_CONDITIONAL(BUILDOPT_DRACUT_CONF, test x$with_dracut = xyes)
Colin Walters's avatar
Colin Walters committed
473

474 475 476 477 478 479
AC_ARG_WITH(mkinitcpio,
            AS_HELP_STRING([--with-mkinitcpio],
                           [Install mkinitcpio module (default: no)]),,
              [with_mkinitcpio=no])
AM_CONDITIONAL(BUILDOPT_MKINITCPIO, test x$with_mkinitcpio = xyes)

480
dnl We have separate checks for libsystemd and the unit dir for historical reasons
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
AC_ARG_WITH(libsystemd,
            AS_HELP_STRING([--without-libsystemd], [Do not use libsystemd]),
            :, with_libsystemd=maybe)

AS_IF([ test x$with_libsystemd != xno ], [
    AC_MSG_CHECKING([for libsystemd])
    PKG_CHECK_EXISTS(libsystemd, have_libsystemd=yes, have_libsystemd=no)
    AC_MSG_RESULT([$have_libsystemd])
    AS_IF([ test x$have_libsystemd = xno && test x$with_libsystemd != xmaybe ], [
       AC_MSG_ERROR([libsystemd is enabled but could not be found])
    ])
    AS_IF([ test x$have_libsystemd = xyes], [
        AC_DEFINE([HAVE_LIBSYSTEMD], 1, [Define if we have libsystemd.pc])
        PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd])
        with_libsystemd=yes
    ], [
        with_libsystemd=no
    ])
], [ with_libsystemd=no ])
AM_CONDITIONAL(BUILDOPT_LIBSYSTEMD, test $with_libsystemd != no)
501 502

AS_IF([test "x$have_libsystemd" = "xyes"], [
503
  with_systemd=yes
504 505 506 507 508 509 510
  AC_ARG_WITH([systemdsystemunitdir],
              AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
              [],
              [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
  AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
    AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
  ])
511 512 513 514 515 516 517
  AC_ARG_WITH([systemdsystemgeneratordir],
              AS_HELP_STRING([--with-systemdsystemgeneratordir=DIR], [Directory for systemd generators]),
              [],
              [with_systemdsystemgeneratordir=$($PKG_CONFIG --variable=systemdsystemgeneratordir systemd)])
  AS_IF([test "x$with_systemdsystemgeneratordir" != "xno"], [
    AC_SUBST([systemdsystemgeneratordir], [$with_systemdsystemgeneratordir])
  ])
518
])
519
AM_CONDITIONAL(BUILDOPT_SYSTEMD, test x$with_systemd = xyes)
520 521 522 523
dnl If we have both, we use the "new /var" model with ostree-system-generator
AM_CONDITIONAL(BUILDOPT_SYSTEMD_AND_LIBMOUNT,[test x$with_systemd = xyes && test x$with_libmount = xyes])
AM_COND_IF(BUILDOPT_SYSTEMD_AND_LIBMOUNT,
  AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if systemd and libmount]))
524

525
AC_ARG_WITH(builtin-grub2-mkconfig,
526
            AS_HELP_STRING([--with-builtin-grub2-mkconfig],
527 528 529 530
                           [Use a builtin minimal grub2-mkconfig to generate a GRUB2 configuration file (default: no)]),,
              [with_builtin_grub2_mkconfig=no])
AM_CONDITIONAL(BUILDOPT_BUILTIN_GRUB2_MKCONFIG, test x$with_builtin_grub2_mkconfig = xyes)
AM_COND_IF(BUILDOPT_BUILTIN_GRUB2_MKCONFIG,
531 532 533 534 535 536 537 538 539 540
           AC_DEFINE([USE_BUILTIN_GRUB2_MKCONFIG], 1, [Define if using internal ostree-grub-generator]))
AC_ARG_WITH(grub2-mkconfig-path,
            AS_HELP_STRING([--with-grub2-mkconfig-path],
                           [Path to grub2-mkconfig]))
AS_IF([test x$with_grub2_mkconfig_path = x], [
  dnl Otherwise, look for the path to the system generator.  On some
  dnl distributions GRUB2 *-mkconfig executable has 'grub2' prefix and
  dnl on some 'grub'.  We default to grub2-mkconfig.
  AC_CHECK_PROGS(GRUB2_MKCONFIG, [grub2-mkconfig grub-mkconfig], [grub2-mkconfig])
],[GRUB2_MKCONFIG=$with_grub2_mkconfig_path])
541
AC_DEFINE_UNQUOTED([GRUB2_MKCONFIG_PATH], ["$GRUB2_MKCONFIG"], [The system grub2-mkconfig executable name])
542

543 544 545 546
AC_ARG_WITH(static-compiler,
            AS_HELP_STRING([--with-static-compiler],
                           [Use the given compiler to build ostree-prepare-root statically linked (default: no)]),,
              [with_static_compiler=no])
547
AM_CONDITIONAL(BUILDOPT_USE_STATIC_COMPILER, test "x$with_static_compiler" != xno)
548 549
AC_SUBST(STATIC_COMPILER, $with_static_compiler)

550 551 552
dnl for tests (but we can't use asan with gjs or any introspection,
dnl see https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso for more info)
AS_IF([test "x$found_introspection" = xyes && test x$using_asan != xyes], [
553 554 555 556 557 558 559
  AC_PATH_PROG(GJS, [gjs])
  if test -n "$GJS"; then
    have_gjs=yes
  else
    have_gjs=no
  fi
], [have_gjs=no])
560 561
AM_CONDITIONAL(BUILDOPT_GJS, test x$have_gjs = xyes)

562 563 564 565 566 567 568 569 570 571 572 573 574 575 576
# Do we enable building experimental (non-stable) API?
# The OSTREE_ENABLE_EXPERIMENTAL_API #define is used internally and in public
# headers, so any consumer of libostree who wants to use experimental API must
#    #define OSTREE_ENABLE_EXPERIMENTAL_API 1
# before including libostree headers. This means the name in the AC_DEFINE below
# is public API.
AC_ARG_ENABLE([experimental-api],
  [AS_HELP_STRING([--enable-experimental-api],
                  [Enable unstable experimental API in libostree [default=no]])],,
  [enable_experimental_api=no])
AS_IF([test x$enable_experimental_api = xyes],
  [AC_DEFINE([OSTREE_ENABLE_EXPERIMENTAL_API],[1],[Define if experimental API should be enabled])
   OSTREE_FEATURES="$OSTREE_FEATURES experimental"]
)
AM_CONDITIONAL([ENABLE_EXPERIMENTAL_API],[test x$enable_experimental_api = xyes])
577
AM_CONDITIONAL([BUILDOPT_IS_DEVEL_BUILD],[test x$is_release_build != xyes])
578 579 580 581
AM_COND_IF([BUILDOPT_IS_DEVEL_BUILD],
            AC_DEFINE([BUILDOPT_IS_DEVEL_BUILD], [1], [Define if doing a development build])
            release_build_type=devel,
            release_build_type=release)
582
OSTREE_FEATURES="$OSTREE_FEATURES $release_build_type"
583

584 585 586
# P2P API is public in OSTree >= 2018.6
OSTREE_FEATURES="$OSTREE_FEATURES p2p"

Colin Walters's avatar
Colin Walters committed
587 588
AC_CONFIG_FILES([
Makefile
589
apidoc/Makefile
Colin Walters's avatar
Colin Walters committed
590
src/libostree/ostree-1.pc
591
src/libostree/ostree-version.h
Colin Walters's avatar
Colin Walters committed
592 593
])
AC_OUTPUT
594 595

echo "
596
    libostree $VERSION ($release_build_type)
597
    features: $OSTREE_FEATURES
598 599 600
    ===============


601
    introspection:                                $found_introspection
602
    Rust (internal oxidation):                    $rust_debug_release
Colin Walters's avatar
Colin Walters committed
603
    rofiles-fuse:                                 $enable_rofiles_fuse
Colin Walters's avatar
Colin Walters committed
604
    HTTP backend:                                 $fetcher_backend
605
    \"ostree trivial-httpd\":                       $enable_trivial_httpd_cmdline
Colin Walters's avatar
Colin Walters committed
606
    SELinux:                                      $with_selinux
Jussi Laako's avatar
Jussi Laako committed
607
    cryptographic checksums:                      $with_crypto
608
    systemd:                                      $have_libsystemd
609
    libmount:                                     $with_libmount
610
    libarchive (parse tar files directly):        $with_libarchive
611
    static deltas:                                yes (always enabled now)
612
    O_TMPFILE:                                    $enable_otmpfile
613
    wrpseudo-compat:                              $enable_wrpseudo_compat
Colin Walters's avatar
Colin Walters committed
614
    man pages (xsltproc):                         $enable_man
615
    api docs (gtk-doc):                           $enable_gtk_doc
616
    installed tests:                              $enable_installed_tests
617
    gjs-based tests:                              $have_gjs
618
    dracut:                                       $with_dracut
619
    mkinitcpio:                                   $with_mkinitcpio
620 621
    Static compiler for ostree-prepare-root:      $with_static_compiler
    Experimental API                              $enable_experimental_api"
622 623 624 625 626
AS_IF([test x$with_builtin_grub2_mkconfig = xyes], [
    echo "    builtin grub2-mkconfig (instead of system):   $with_builtin_grub2_mkconfig"
], [
    echo "    grub2-mkconfig path:                          $GRUB2_MKCONFIG"
])
627
echo ""