| 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| 3 | # |
| 4 | # GNU Guix --- Functional package management for GNU |
| 5 | # Copyright © 2012-2021, 2022-2023, 2025 Ludovic Courtès <[email protected]> |
| 6 | # Copyright © 2013, 2016 Mark H Weaver <[email protected]> |
| 7 | # Copyright © 2014-2016 Alex Kost <[email protected]> |
| 8 | # Copyright © 2014-2016 David Thompson <[email protected]> |
| 9 | # Copyright © 2015-2016, 2018 Mathieu Lirzin <[email protected]> |
| 10 | # Copyright © 2015-2020 Mathieu Othacehe <[email protected]> |
| 11 | # Copyright © 2016 Eric Le Bihan <[email protected]> |
| 12 | # Copyright © 2016, 2018, 2020, 2022 Ricardo Wurmus <[email protected]> |
| 13 | # Copyright © 2017 Tobias Geerinckx-Rice <[email protected]> |
| 14 | # Copyright © 2018 nikita <[email protected]> |
| 15 | # Copyright © 2018, 2021 Julien Lepiller <[email protected]> |
| 16 | # Copyright © 2017-2018 Eric Bavier <[email protected]> |
| 17 | # Copyright © 2020-2021, 2023-2024 Maxim Cournoyer <[email protected]> |
| 18 | # Copyright © 2024 Janneke Nieuwenhuizen <[email protected]> |
| 19 | # Copyright © 2024 gemmaro <[email protected]> |
| 20 | |
| 21 | AC_PREREQ([2.69]) |
| 22 | AC_INIT([GNU Guix], |
| 23 | [m4_esyscmd([build-aux/git-version-gen .tarball-version])], |
| 24 | [https://codeberg.org/guix/guix/issues/], [guix], |
| 25 | [https://www.gnu.org/software/guix/]) |
| 26 | AC_CONFIG_AUX_DIR([build-aux]) |
| 27 | |
| 28 | AM_INIT_AUTOMAKE([1.14 gnu tar-ustar silent-rules subdir-objects \ |
| 29 | color-tests parallel-tests -Woverride -Wno-portability]) |
| 30 | |
| 31 | # Enable silent rules by default. |
| 32 | AM_SILENT_RULES([yes]) |
| 33 | |
| 34 | AC_CONFIG_SRCDIR([guix.scm]) |
| 35 | AC_CONFIG_MACRO_DIR([m4]) |
| 36 | |
| 37 | dnl For the C++ code. This must be used early. |
| 38 | AC_USE_SYSTEM_EXTENSIONS |
| 39 | |
| 40 | AM_GNU_GETTEXT([external]) |
| 41 | AM_GNU_GETTEXT_VERSION([0.19.1]) |
| 42 | |
| 43 | GUIX_SYSTEM_TYPE |
| 44 | GUIX_ASSERT_SUPPORTED_SYSTEM |
| 45 | GUIX_CHANNEL_METADATA |
| 46 | |
| 47 | AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = "xyes"]) |
| 48 | |
| 49 | AC_ARG_WITH(store-dir, |
| 50 | AS_HELP_STRING([--with-store-dir=PATH], |
| 51 | [file name of the store (defaults to /gnu/store)]), |
| 52 | [storedir="$withval"], |
| 53 | [storedir="/gnu/store"]) |
| 54 | AC_SUBST(storedir) |
| 55 | |
| 56 | AC_ARG_WITH([bash-completion-dir], |
| 57 | AS_HELP_STRING([--with-bash-completion-dir=DIR], |
| 58 | [name of the Bash completion directory]), |
| 59 | [bashcompletiondir="$withval"], |
| 60 | [bashcompletiondir='${sysconfdir}/bash_completion.d']) |
| 61 | AC_SUBST([bashcompletiondir]) |
| 62 | |
| 63 | AC_ARG_WITH([zsh-completion-dir], |
| 64 | AS_HELP_STRING([--with-zsh-completion-dir=DIR], |
| 65 | [name of the Zsh completion directory]), |
| 66 | [zshcompletiondir="$withval"], |
| 67 | [zshcompletiondir='${datadir}/zsh/site-functions']) |
| 68 | AC_SUBST([zshcompletiondir]) |
| 69 | |
| 70 | AC_ARG_WITH([fish-completion-dir], |
| 71 | AS_HELP_STRING([--with-fish-completion-dir=DIR], |
| 72 | [name of the Fish completion directory]), |
| 73 | [fishcompletiondir="$withval"], |
| 74 | [fishcompletiondir='${datadir}/fish/vendor_completions.d']) |
| 75 | AC_SUBST([fishcompletiondir]) |
| 76 | |
| 77 | AC_ARG_WITH([selinux-policy-dir], |
| 78 | AS_HELP_STRING([--with-selinux-policy-dir=DIR], |
| 79 | [name of the SELinux policy directory]), |
| 80 | [selinux_policydir="$withval"], |
| 81 | [selinux_policydir='${datadir}/selinux/']) |
| 82 | AC_SUBST([selinux_policydir]) |
| 83 | |
| 84 | AC_ARG_WITH([apparmor-profile-dir], |
| 85 | AS_HELP_STRING([--with-apparmor-profile-dir=DIR], |
| 86 | [name of the AppArmor profile directory]), |
| 87 | [apparmor_profiledir="$withval"], |
| 88 | [apparmor_profiledir='${sysconfdir}/apparmor.d']) |
| 89 | AC_SUBST([apparmor_profiledir]) |
| 90 | apparmor_profile_tunablesdir='${apparmor_profiledir}/tunables' |
| 91 | AC_SUBST([apparmor_profile_tunablesdir]) |
| 92 | |
| 93 | dnl Better be verbose. |
| 94 | AC_MSG_CHECKING([for the store directory]) |
| 95 | AC_MSG_RESULT([$storedir]) |
| 96 | |
| 97 | AC_ARG_ENABLE([daemon], |
| 98 | [AS_HELP_STRING([--disable-daemon], [do not build the Nix daemon (C++)])], |
| 99 | [guix_build_daemon="$enableval"], |
| 100 | [guix_build_daemon="yes"]) |
| 101 | |
| 102 | dnl Prepare a version of $localstatedir & co. that does not contain references |
| 103 | dnl to shell variables. Also set some sane default directory variables for |
| 104 | dnl use with the Guix. This also causes localstatedir to be /var and |
| 105 | dnl sysconfdir to be /etc. |
| 106 | AC_PREFIX_DEFAULT() |
| 107 | guix_prefix="`eval echo $prefix | sed -e"s|NONE|$ac_default_prefix|g"`" |
| 108 | guix_localstatedir="`eval echo $localstatedir | sed -e "s|NONE|$guix_prefix|g"`" |
| 109 | guix_sysconfdir="`eval echo $sysconfdir | sed -e "s|NONE|$guix_prefix|g"`" |
| 110 | AC_SUBST([guix_localstatedir]) |
| 111 | AC_SUBST([guix_sysconfdir]) |
| 112 | |
| 113 | GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests]) |
| 114 | AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"]) |
| 115 | |
| 116 | dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.) |
| 117 | dnl Make sure they are available. |
| 118 | m4_pattern_forbid([PKG_CHECK_MODULES]) |
| 119 | m4_pattern_forbid([GUILE_MODULE_AVAILABLE]) |
| 120 | m4_pattern_forbid([^GUILE_P]) |
| 121 | m4_pattern_allow([^GUILE_PKG_ERRORS]) |
| 122 | m4_pattern_forbid([^GUIX_]) |
| 123 | |
| 124 | dnl Search for 'guile' and 'guild'. This macro defines |
| 125 | dnl 'GUILE_EFFECTIVE_VERSION'. |
| 126 | GUILE_PKG([3.0]) |
| 127 | GUILE_PROGS |
| 128 | if test "x$GUILD" = "x"; then |
| 129 | AC_MSG_ERROR(['guild' binary not found; please check your Guile installation.]) |
| 130 | fi |
| 131 | |
| 132 | dnl (guix ui), notably, requires 'default-optimization-level' added in 3.0.3. |
| 133 | dnl (guix serialization) requires 'bytevector-slice' added in 3.0.9. |
| 134 | PKG_CHECK_MODULES([GUILE], [guile-3.0 >= 3.0.9]) |
| 135 | |
| 136 | dnl Get CFLAGS and LDFLAGS for libguile. |
| 137 | GUILE_FLAGS |
| 138 | |
| 139 | dnl Installation directories for .scm and .go files. |
| 140 | guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION" |
| 141 | guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache" |
| 142 | AC_SUBST([guilemoduledir]) |
| 143 | AC_SUBST([guileobjectdir]) |
| 144 | |
| 145 | dnl The GnuTLS bindings are necessary for substitutes over HTTPS and for 'guix |
| 146 | dnl pull', among other things. |
| 147 | GUILE_MODULE_AVAILABLE([have_gnutls], [(gnutls)]) |
| 148 | if test "x$have_gnutls" != "xyes"; then |
| 149 | AC_MSG_ERROR([The Guile bindings of GnuTLS are missing; please install them.]) |
| 150 | fi |
| 151 | |
| 152 | dnl Check for Guile-Git. |
| 153 | GUILE_MODULE_AVAILABLE([have_guile_git], [(git)]) |
| 154 | if test "x$have_guile_git" != "xyes"; then |
| 155 | AC_MSG_ERROR([Guile-Git is missing; please install it.]) |
| 156 | fi |
| 157 | |
| 158 | dnl Check Guile-Git version resp. required recently added symbol. |
| 159 | GUILE_MODULE_REQUIRED_EXPORT([(git)], [graph-descendant?]) |
| 160 | |
| 161 | dnl Check for Guile-JSON. |
| 162 | GUIX_CHECK_GUILE_JSON |
| 163 | if test "x$guix_cv_have_recent_guile_json" != "xyes"; then |
| 164 | AC_MSG_ERROR([Guile-JSON is missing; please install it.]) |
| 165 | fi |
| 166 | |
| 167 | dnl Guile-Sqlite3 is used by the (guix store ...) modules. |
| 168 | GUIX_CHECK_GUILE_SQLITE3 |
| 169 | if test "x$guix_cv_have_recent_guile_sqlite3" != "xyes"; then |
| 170 | AC_MSG_ERROR([A recent Guile-SQLite3 could not be found; please install it.]) |
| 171 | fi |
| 172 | |
| 173 | GUIX_CHECK_GUILE_GCRYPT |
| 174 | if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then |
| 175 | AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.]) |
| 176 | fi |
| 177 | |
| 178 | GUIX_CHECK_GUILE_GIT |
| 179 | if test "x$guix_cv_have_recent_guile_git" != "xyes"; then |
| 180 | AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.]) |
| 181 | fi |
| 182 | |
| 183 | dnl Check for the optional Guile-Lib. |
| 184 | GUILE_MODULE_EXPORTS([have_guile_lib], [(htmlprag)], [%strict-tokenizer?]) |
| 185 | AM_CONDITIONAL([HAVE_GUILE_LIB], [test "x$have_guile_lib" = "xyes"]) |
| 186 | AM_COND_IF(HAVE_GUILE_LIB,, |
| 187 | [AC_MSG_WARN([The Guile-Lib requirement was not satisfied (>= 0.2.7); |
| 188 | Some features such as the Go importer will not be usable.])]) |
| 189 | |
| 190 | dnl Check for Guile-zlib. |
| 191 | GUIX_CHECK_GUILE_ZLIB |
| 192 | if test "x$guix_cv_have_recent_guile_zlib" != "xyes"; then |
| 193 | AC_MSG_ERROR([A recent Guile-zlib could not be found; please install it.]) |
| 194 | fi |
| 195 | |
| 196 | dnl Check for Guile-lzlib. |
| 197 | GUILE_MODULE_AVAILABLE([have_guile_lzlib], [(lzlib)]) |
| 198 | if test "x$have_guile_lzlib" != "xyes"; then |
| 199 | AC_MSG_ERROR([Guile-lzlib is missing; please install it.]) |
| 200 | fi |
| 201 | |
| 202 | dnl Check for Guile-semver. |
| 203 | GUILE_MODULE_AVAILABLE([have_guile_semver], [(semver)]) |
| 204 | if test "x$have_guile_semver" != "xyes"; then |
| 205 | AC_MSG_ERROR([Guile-semver is missing; please install it.]) |
| 206 | fi |
| 207 | |
| 208 | dnl Check for Guile-Avahi. |
| 209 | GUILE_MODULE_AVAILABLE([have_guile_avahi], [(avahi)]) |
| 210 | AM_CONDITIONAL([HAVE_GUILE_AVAHI], |
| 211 | [test "x$have_guile_avahi" = "xyes"]) |
| 212 | |
| 213 | dnl Guile-newt is used by the graphical installer. |
| 214 | GUILE_MODULE_AVAILABLE([have_guile_newt], [(newt)]) |
| 215 | |
| 216 | AC_ARG_ENABLE([installer], |
| 217 | AS_HELP_STRING([--enable-installer], [Build the graphical installer sources.])) |
| 218 | |
| 219 | AS_IF([test "x$enable_installer" = "xyes"], [ |
| 220 | if test "x$have_guile_newt" != "xyes"; then |
| 221 | AC_MSG_ERROR([Guile-newt could not be found; please install it.]) |
| 222 | fi |
| 223 | ]) |
| 224 | |
| 225 | AM_CONDITIONAL([ENABLE_INSTALLER], |
| 226 | [test "x$enable_installer" = "xyes"]) |
| 227 | |
| 228 | dnl Make sure we have a full-fledged Guile. |
| 229 | GUIX_ASSERT_GUILE_FEATURES([regex posix socket net-db threads]) |
| 230 | |
| 231 | AC_PROG_SED |
| 232 | |
| 233 | dnl Decompressors, for use by the substituter and other modules. |
| 234 | AC_PATH_PROG([GZIP], [gzip]) |
| 235 | AC_PATH_PROG([BZIP2], [bzip2]) |
| 236 | AC_PATH_PROG([XZ], [xz]) |
| 237 | AC_SUBST([GZIP]) |
| 238 | AC_SUBST([BZIP2]) |
| 239 | AC_SUBST([XZ]) |
| 240 | |
| 241 | dnl Git is now required for the "builtin:git-download" derivation builder. |
| 242 | AC_PATH_PROG([GIT], [git]) |
| 243 | if test "x$GIT" = "x"; then |
| 244 | AC_MSG_ERROR([Git is missing; please install it.]) |
| 245 | fi |
| 246 | AC_SUBST([GIT]) |
| 247 | |
| 248 | LIBGCRYPT_LIBDIR="no" |
| 249 | LIBGCRYPT_PREFIX="no" |
| 250 | |
| 251 | AC_ARG_WITH([libgcrypt-prefix], |
| 252 | [AS_HELP_STRING([--with-libgcrypt-prefix=DIR], [search for GNU libgcrypt in DIR])], |
| 253 | [case "$withval" in |
| 254 | yes|no) |
| 255 | ;; |
| 256 | *) |
| 257 | LIBGCRYPT_PREFIX="$withval" |
| 258 | LIBGCRYPT_LIBDIR="$withval/lib" |
| 259 | ;; |
| 260 | esac]) |
| 261 | |
| 262 | AC_ARG_WITH([libgcrypt-libdir], |
| 263 | [AS_HELP_STRING([--with-libgcrypt-libdir=DIR], |
| 264 | [search for GNU libgcrypt's shared library in DIR])], |
| 265 | [case "$withval" in |
| 266 | yes|no) |
| 267 | LIBGCRYPT_LIBDIR="no" |
| 268 | ;; |
| 269 | *) |
| 270 | LIBGCRYPT_LIBDIR="$withval" |
| 271 | ;; |
| 272 | esac]) |
| 273 | |
| 274 | dnl If none of the --with-libgcrypt-* options was used, try to determine the |
| 275 | dnl the library directory. |
| 276 | case "x$LIBGCRYPT_PREFIX$LIBGCRYPT_LIBDIR" in |
| 277 | xnono) |
| 278 | GUIX_LIBGCRYPT_LIBDIR([LIBGCRYPT_LIBDIR]) |
| 279 | ;; |
| 280 | esac |
| 281 | |
| 282 | AC_SUBST([LIBGCRYPT_PREFIX]) |
| 283 | AC_SUBST([LIBGCRYPT_LIBDIR]) |
| 284 | |
| 285 | dnl Check for Guile-SSH, for the (guix ssh) module. |
| 286 | GUIX_CHECK_GUILE_SSH |
| 287 | AM_CONDITIONAL([HAVE_GUILE_SSH], |
| 288 | [test "x$guix_cv_have_recent_guile_ssh" = "xyes"]) |
| 289 | |
| 290 | AC_CACHE_SAVE |
| 291 | |
| 292 | m4_include([config-daemon.ac]) |
| 293 | |
| 294 | dnl `dot' (from the Graphviz package) is only needed for maintainers. |
| 295 | dnl See `Building from Git' in the manual for more info. |
| 296 | AM_MISSING_PROG([DOT], [dot]) |
| 297 | |
| 298 | dnl Manual pages. |
| 299 | AM_MISSING_PROG([HELP2MAN], [help2man]) |
| 300 | |
| 301 | dnl Documentation translation. |
| 302 | AM_MISSING_PROG([PO4A], [po4a]) |
| 303 | |
| 304 | AC_MSG_CHECKING([if building from git]) |
| 305 | if test -e .git; then |
| 306 | in_git_p=yes |
| 307 | else |
| 308 | in_git_p=no |
| 309 | fi |
| 310 | AC_MSG_RESULT([$in_git_p]) |
| 311 | AM_CONDITIONAL([in_git_p], |
| 312 | [test "x$in_git_p" = "xyes"]) |
| 313 | |
| 314 | case "$storedir" in |
| 315 | /gnu/store) |
| 316 | ;; |
| 317 | *) |
| 318 | AC_MSG_WARN([Using a store directory other than '/gnu/store' will prevent you]) |
| 319 | AC_MSG_WARN([from downloading substitutes from gnu.org.]) |
| 320 | ;; |
| 321 | esac |
| 322 | |
| 323 | AC_CONFIG_FILES([Makefile |
| 324 | po/guix/Makefile.in |
| 325 | po/packages/Makefile.in |
| 326 | etc/guix-daemon.cil |
| 327 | etc/apparmor.d/tunables/guix |
| 328 | guix/config.scm]) |
| 329 | |
| 330 | AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env]) |
| 331 | AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in], |
| 332 | [chmod +x pre-inst-env]) |
| 333 | |
| 334 | dnl Automake trips on Make conditionals (see: |
| 335 | dnl <https://lists.gnu.org/archive/html/bug-automake/2001-11/msg00015.html>) |
| 336 | ENDIF=endif |
| 337 | AC_SUBST(ENDIF) |
| 338 | |
| 339 | AC_OUTPUT |