github.com/rkt/rkt@v1.30.1-0.20200224141603-171c416fac02/configure.ac (about)

     1  AC_PREREQ([2.63])
     2  AC_INIT([rkt], [1.30.0+git], [https://github.com/rkt/rkt/issues])
     3  
     4  AC_PROG_CC
     5  AC_PROG_CXX
     6  
     7  AC_DEFUN([RKT_CHECK_PROG],
     8           [AS_VAR_IF([$1], [],
     9                      [AC_CHECK_PROG($@)],[:])])
    10  
    11  AC_DEFUN([RKT_REQ_PROG],
    12           [AS_VAR_IF([$1], [],
    13                      [AC_CHECK_PROG($@)
    14                       AS_VAR_IF([$1], [$3], [:], AC_MSG_ERROR([*** $2 not found]))],
    15                      [:])])
    16  
    17  AC_DEFUN([RKT_REQ_ABS_PROG],
    18           [AS_VAR_IF([$1], [],
    19                      [AC_PATH_PROG($@)
    20                       AS_IF([test "x$]$1[" = 'x'], [AC_MSG_ERROR([*** $2 not found])])],
    21                      [:])])
    22  
    23  dnl We assume having bash in lots of places, so check it in the
    24  dnl beginning.
    25  RKT_REQ_ABS_PROG([BASH_SHELL], [bash])
    26  dnl for git suffix
    27  RKT_REQ_PROG([GIT],[git],[git])
    28  
    29  dnl this will be printed in configure summary and by rkt version
    30  RKT_FEATURES=""
    31  RKT_ADD_FEATURE() {
    32      RKT_FEATURES=`AS_ECHO(["${RKT_FEATURES} $1"]) | sed -e 's/^ \+//'`
    33  }
    34  dnl if version ends with +git, append a short git-hash.
    35  AS_IF([test `expr match 'AC_PACKAGE_VERSION' '.*+git$'` -gt 0],
    36        dnl version has +git suffix, ignore errors (not a git repo)
    37        [RKT_VERSION="AC_PACKAGE_VERSION`git rev-parse --short HEAD 2>/dev/null``git diff-index --quiet HEAD 2>/dev/null || AS_ECHO(["-dirty"])`"],
    38        dnl version has no +git suffix
    39        [RKT_VERSION="AC_PACKAGE_VERSION"])
    40  
    41  AC_CANONICAL_HOST
    42  AC_CANONICAL_BUILD
    43  
    44  AS_CASE([${host_cpu}],
    45          [aarch64],             [RKT_ACI_ARCH=aarch64; GOARCH=arm64;],
    46          [armv6l],              [RKT_ACI_ARCH=armv6l;  GOARCH=arm; GOARM=6;],
    47          [armv7l],              [RKT_ACI_ARCH=armv7l;  GOARCH=arm; GOARM=7;],
    48          [i?86 | x86],          [RKT_ACI_ARCH=i386;    GOARCH=386;],
    49          [powerpc | powerpc64], [RKT_ACI_ARCH=ppc64;   GOARCH=ppc64;],
    50          [powerpc64le],         [RKT_ACI_ARCH=ppc64le; GOARCH=ppc64le;],
    51          [x86_64],              [RKT_ACI_ARCH=amd64;   GOARCH=amd64;],
    52          [AC_MSG_ERROR([*** unsupported host arch specified: ${host_cpu}])])
    53  
    54  #### FLAGS
    55  
    56  ## STAGE1 - detailed setup
    57  
    58  AC_ARG_WITH(stage1-default-name,
    59              [AS_HELP_STRING([--with-stage1-default-name],
    60                              [default name of stage1, default: 'coreos.com/rkt/stage1-${flavor}'])],
    61              [RKT_STAGE1_DEFAULT_NAME="${withval}"],
    62              [RKT_STAGE1_DEFAULT_NAME=auto])
    63  
    64  AC_ARG_WITH(stage1-default-version,
    65              [AS_HELP_STRING([--with-stage1-default-version],
    66                              [default version of stage1, default: same as rkt version])],
    67              [RKT_STAGE1_DEFAULT_VERSION="${withval}"],
    68              [RKT_STAGE1_DEFAULT_VERSION=auto])
    69  
    70  ## STAGE1 - flavor setup
    71  
    72  AC_ARG_WITH([stage1-default-flavor],
    73              [AS_HELP_STRING([--with-stage1-default-flavor],
    74                              [stage1 flavor that will be loaded by default; has to be listed in --with-stage1-flavors, default: first from the stage1 flavors list])],
    75              [RKT_STAGE1_DEFAULT_FLAVOR="${withval}"],
    76              [RKT_STAGE1_DEFAULT_FLAVOR=auto])
    77  
    78  ## STAGE1 - common setup
    79  
    80  AC_ARG_WITH([stage1-flavors],
    81              [AS_HELP_STRING([--with-stage1-flavors],
    82                              [comma-separated list of stage1 flavors; choose from 'src', 'coreos', 'host', 'kvm', 'fly'; default: 'coreos,kvm,fly'])],
    83              [RKT_STAGE1_FLAVORS="${withval}"],
    84              [RKT_STAGE1_FLAVORS=auto])
    85  
    86  AC_ARG_WITH([stage1-flavors-version-override],
    87              [AS_HELP_STRING([--with-stage1-flavors-version-override],
    88                              [override the version of stage1 with a custom one; it also changes the default stage1 version in flavor setup])],
    89              [RKT_STAGE1_FLAVORS_VERSION_OVERRIDE="${withval}"],
    90              [RKT_STAGE1_FLAVORS_VERSION_OVERRIDE=auto])
    91  
    92  AC_ARG_WITH(stage1-default-location,
    93              [AS_HELP_STRING([--with-stage1-default-location],
    94                              [default location of stage1, default: none])],
    95              [RKT_STAGE1_DEFAULT_LOCATION="${withval}"],
    96              [RKT_STAGE1_DEFAULT_LOCATION=auto])
    97  
    98  AC_ARG_WITH(stage1-default-images-directory,
    99              [AS_HELP_STRING([--with-stage1-default-images-directory],
   100                              [default directory for stage1 images, default: LIBDIR/rkt/stage1-images])],
   101              [RKT_STAGE1_DEFAULT_IMAGES_DIR="${withval}"],
   102              [RKT_STAGE1_DEFAULT_IMAGES_DIR=auto])
   103  
   104  # STAGE1 - systemd src and version for src flavor
   105  
   106  AC_ARG_WITH([stage1-systemd-src],
   107              [AS_HELP_STRING([--with-stage1-systemd-src],
   108                              [URL to a systemd Git repository or path to a local systemd source directory, used in 'src' stage1 flavor (default: 'https://github.com/systemd/systemd.git')])],
   109              [RKT_STAGE1_SYSTEMD_SRC="${withval}"],
   110              [RKT_STAGE1_SYSTEMD_SRC='auto'])
   111  
   112  AC_ARG_WITH([stage1-systemd-version],
   113              [AS_HELP_STRING([--with-stage1-systemd-version],
   114                              [systemd version to build, used in 'src' stage1 flavor (default: 'v229', should be in format 'v<number>', like v229)])],
   115              [RKT_STAGE1_SYSTEMD_VER="${withval}"],
   116              [RKT_STAGE1_SYSTEMD_VER='auto'])
   117  
   118  AC_ARG_WITH([stage1-systemd-revision],
   119              [AS_HELP_STRING([--with-stage1-systemd-revision],
   120                              [systemd revision to check out to build, used in 'src' stage1 flavor when --with-stage1-systemd-src is a Git repository (default: the same value as --with-stage1-systemd-version)])],
   121              [RKT_STAGE1_SYSTEMD_REV="${withval}"],
   122              [RKT_STAGE1_SYSTEMD_REV='auto'])
   123  
   124  # STAGE1 - kvm hypervisor. lkvm or/and qemu can be chosen
   125  AC_ARG_WITH([stage1-kvm-hypervisors],
   126              [AS_HELP_STRING([--with-stage1-kvm-hypervisors],
   127                              [select hypervisors for kvm flavor; build stage1 aci for each of them. select "lkvm", "qemu" or both (default: 'qemu')])],
   128              [RKT_STAGE1_KVM_HV="${withval}"],
   129              [RKT_STAGE1_KVM_HV='qemu'])
   130  
   131  ## STAGE1 - path to coreos pxe and its systemd version for kvm and coreos flavors
   132  
   133  AC_ARG_WITH([coreos-local-pxe-image-path],
   134              [AS_HELP_STRING([--with-coreos-local-pxe-image-path],
   135                              [path to local CoreOS PXE image, used in 'coreos' and 'kvm' stage1 flavors (default: empty) (the GPG signature of this file will not be checked!)])],
   136              [RKT_LOCAL_COREOS_PXE_IMAGE_PATH="${withval}"],
   137              [RKT_LOCAL_COREOS_PXE_IMAGE_PATH=""])
   138  
   139  AC_ARG_WITH([coreos-local-pxe-image-systemd-version],
   140              [AS_HELP_STRING([--with-coreos-local-pxe-image-systemd-version],
   141                              [version of systemd in local CoreOS PXE image, used in 'coreos' and 'kvm' stage1 flavors (should be in format 'v<number>', like v229)])],
   142              [RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER="${withval}"],
   143              [RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER=])
   144  
   145  RKT_STAGE1_COREOS_BOARD=${GOARCH}-usr;
   146  
   147  ## Functional tests
   148  
   149  AC_ARG_ENABLE([functional-tests],
   150                [AS_HELP_STRING([--enable-functional-tests],
   151                                [enable functional tests on make check (linux only, uses sudo, default: 'no', use 'auto' to enable if possible, for host stage1 flavor systemd version 227 or higher on host is required)])],
   152                [RKT_RUN_FUNCTIONAL_TESTS="${enableval}"],
   153                [RKT_RUN_FUNCTIONAL_TESTS="no"])
   154  
   155  ## Incremental build
   156  
   157  AC_ARG_ENABLE([incremental-build],
   158                [AS_HELP_STRING([--enable-incremental-build],
   159                                [enable incremental build. Note: this does not work for cross compile builds.])],
   160                [INCREMENTAL_BUILD="${enableval}"],
   161                [INCREMENTAL_BUILD="no"])
   162  ## TPM
   163  
   164  AC_ARG_ENABLE([tpm],
   165                [AS_HELP_STRING([--enable-tpm],
   166                                [enable logging to TPM, use 'auto' to enable it if the required development files are found, default: 'yes'])],
   167                [RKT_ENABLE_TPM="${enableval}"],
   168                [RKT_ENABLE_TPM="yes"])
   169  
   170  ## Systemd-journal support on host
   171  
   172  AC_ARG_ENABLE([sdjournal],
   173                [AS_HELP_STRING([--enable-sdjournal],
   174                                [enable systemd-journal features on host, use 'auto' to enable it if the required development files are found, default: 'yes'])],
   175                [RKT_ENABLE_SDJOURNAL="${enableval}"],
   176                [RKT_ENABLE_SDJOURNAL="yes"])
   177  
   178  ## insecure go
   179  
   180  AC_ARG_ENABLE([insecure-go],
   181                [AS_HELP_STRING([--enable-insecure-go],
   182                                [allow building rkt with go having known security issues, default: no])],
   183                [RKT_INSECURE_GO="${enableval}"],
   184                [RKT_INSECURE_GO="no"])
   185  
   186  #### CHECKING
   187  
   188  ## STAGE1 - initial verification and setup
   189  
   190  dnl There are two kinds of setup - flavor and detailed. A flavor setup
   191  dnl is when we specify a default flavor. A detailed setup is when we
   192  dnl specify a default name and version instead.
   193  AS_IF([test "x${RKT_STAGE1_DEFAULT_FLAVOR}" != 'xauto' -a '(' "x${RKT_STAGE1_DEFAULT_NAME}" != 'xauto' -o "x${RKT_STAGE1_DEFAULT_VERSION}" != 'xauto' ')'],
   194                dnl Passed both --with-stage1-default-flavor and
   195                dnl --with-stage1-default-{name,version} - bail out,
   196                dnl they are mutually exclusive.
   197                [AC_MSG_ERROR([*** --with-stage1-default-flavor and --with-stage1-default-{name,version} flags are mutually exclusive; use either default flavor or specific default name and version])],
   198        [test "x${RKT_STAGE1_DEFAULT_FLAVOR}" = 'xauto' -a "x${RKT_STAGE1_DEFAULT_NAME}" = 'xauto' -a "x${RKT_STAGE1_DEFAULT_VERSION}" = 'xauto'],
   199                dnl Passed neither --with-stage1-default-flavor nor
   200                dnl --with-stage1-default-{name,version} - default to
   201                dnl flavor setup.
   202                [RKT_STAGE1_SETUP_KIND=flavor],
   203        [test "x${RKT_STAGE1_DEFAULT_FLAVOR}" != 'xauto'],
   204                dnl Passed --with-stage1-default-flavor flag - default
   205                dnl to flavor setup.
   206                [RKT_STAGE1_SETUP_KIND=flavor],
   207        [test "x${RKT_STAGE1_DEFAULT_NAME}" != 'xauto' -o "x${RKT_STAGE1_DEFAULT_VERSION}" != 'xauto'],
   208                dnl Passed one or both from
   209                dnl --with-stage1-default-{name,version} - default to
   210                dnl detailed setup.
   211                [RKT_STAGE1_SETUP_KIND=detailed])
   212  
   213  AS_CASE([${RKT_STAGE1_SETUP_KIND}],
   214          [detailed],
   215                    dnl Detailed setup - do not build any flavor unless
   216                    dnl explicitly asked for it and make sure that both
   217                    dnl name and version were passed.
   218                    [AS_VAR_IF([RKT_STAGE1_FLAVORS],[auto],
   219                               [RKT_STAGE1_FLAVORS=''])
   220                     RKT_STAGE1_DEFAULT_FLAVOR=''
   221                     AS_IF([test "x${RKT_STAGE1_DEFAULT_NAME}" = 'xauto' -o "x${RKT_STAGE1_DEFAULT_VERSION}" = 'xauto'],
   222                           [AC_MSG_ERROR([*** Both --with-stage1-default-name and --with-stage1-default-version must be specified])])],
   223          [flavor],
   224                    dnl The flavor setup - build coreos and kvm flavors
   225                    dnl and set the first flavor in the list as a
   226                    dnl default unless specified.
   227                    [AS_VAR_IF([RKT_STAGE1_FLAVORS],[auto],
   228                               [RKT_STAGE1_FLAVORS='coreos,kvm,fly'])
   229                     AS_VAR_IF([RKT_STAGE1_DEFAULT_FLAVOR],[auto],
   230                               [RKT_STAGE1_DEFAULT_FLAVOR=`AS_ECHO([${RKT_STAGE1_FLAVORS}]) | cut -d, -f1`])
   231                     RKT_STAGE1_DEFAULT_NAME=''
   232                     RKT_STAGE1_DEFAULT_VERSION=''],
   233          [AC_MSG_ERROR([*** Unknown setup kind, should not happen])])
   234  
   235  ## Stage1 flavor version override verification
   236  
   237  AS_VAR_IF([RKT_STAGE1_FLAVORS_VERSION_OVERRIDE], [auto],
   238            dnl no override, no checking
   239            [RKT_STAGE1_FLAVORS_VERSION_OVERRIDE=''],
   240            dnl check if we override the version, even if we build no flavors at all
   241            [AS_VAR_IF([RKT_STAGE1_FLAVORS], [],
   242                       [AC_MSG_WARN([* Overriding stage1 version, but no stage1 flavors are built])])])
   243  
   244  ## Stage1 default image directory
   245  
   246  dnl Normally it is autoconf which sets prefix and exec_prefix
   247  dnl variables to some default values if they were NONE, but that
   248  dnl happens way too late, so we need to do it ourselves right now.
   249  AS_VAR_IF([prefix],[NONE],
   250            [prefix="${ac_default_prefix}"])
   251  AS_VAR_IF([exec_prefix],[NONE],
   252            [exec_prefix="${prefix}"])
   253  AS_VAR_IF([RKT_STAGE1_DEFAULT_IMAGES_DIR],[auto],
   254            dnl Calling eval makes sure that ${libdir} is expanded.
   255            dnl autoconf defines it as '${eprefix}/lib' - note the
   256            dnl single quotes, which make ${eprefix} to be not
   257            dnl expanded. There is some rationale behind all this, but
   258            dnl we need no features coming from unexpanded variables.
   259            [eval RKT_STAGE1_DEFAULT_IMAGES_DIR="${libdir}/rkt/stage1-images"])
   260  AS_CASE([${RKT_STAGE1_DEFAULT_IMAGES_DIR}],
   261          [/*],
   262                  dnl alright, the path is absolute
   263                  [:],
   264          [AC_MSG_ERROR([*** Path to the stage1 images directory must be absolute])])
   265  
   266  ## Built stage1 flavors and hypervisors verification
   267  
   268  dnl a list of all flavors
   269  RKT_STAGE1_ALL_FLAVORS=coreos,kvm,host,src,fly
   270  
   271  dnl a list of all kvm hypervisors
   272  RKT_STAGE1_KVM_ALL_HV=lkvm,qemu
   273  
   274  dnl RKT_IS_VALID_FLAVOR checks if $1 is a valid flavor, $2 is an
   275  dnl additional string to an error message.
   276  AC_DEFUN([RKT_IS_VALID_FLAVOR],
   277           [AS_CASE([$1],
   278                    dnl Correct flavor, nothing to do.
   279                    [coreos|kvm|host|src|fly],
   280                            [],
   281                    dnl Bogus flavor, bail out.
   282                    [AC_MSG_ERROR([*** Unknown stage1 flavor "$1" $2])])])
   283  
   284  dnl RKT_IS_VALID_HYPERVISOR checks if $1 is a valid kvm hypervisor, $2 is an
   285  dnl additional string to an error message.
   286  AC_DEFUN([RKT_IS_VALID_HYPERVISOR],
   287           [AS_CASE([$1],
   288                    dnl Correct hypervisor, nothing to do.
   289                    [lkvm|qemu],
   290                            [],
   291                    dnl Bogus hypervisor, bail out.
   292                    [AC_MSG_ERROR([*** Unknown stage1 kvm hypervisor "$1" $2])])])
   293  
   294  dnl RKT_ITERATE iterates all comma-separated values stored in
   295  dnl $1 using an iterator variable $2 and executes body $3.
   296  AC_DEFUN([RKT_ITERATE],
   297           [for $2 in `AS_ECHO(["$1"]) | tr ',' ' '`
   298            do
   299                :
   300                $3
   301            done])
   302  
   303  dnl RKT_IF_HAS_VALUE checks if the comma-separated list of values in
   304  dnl $1 contains any value in the comma-separated list of values in
   305  dnl $2; if yes, executes $3, otherwise - $4.
   306  AC_DEFUN([RKT_IF_HAS_VALUE],
   307           [value_found=0
   308            RKT_ITERATE([$2],[value],
   309                                [AS_IF([AS_ECHO([",$1,"]) | grep --silent ",${value},"],
   310                                       [value_found=1
   311                                        break])])
   312            AS_IF([test ${value_found} -eq 1],[:;$3],[:;$4])])
   313  
   314  dnl common deps for flavors using CoreOS PXE image; not checking for
   315  dnl gpg - it will be checked when we will actually download the image
   316  dnl from the network
   317  AC_DEFUN([RKT_COMMON_COREOS_PROGS],
   318           [RKT_REQ_PROG([CAT],[cat],[cat])
   319            RKT_REQ_PROG([COMM],[comm],[comm])
   320            RKT_REQ_PROG([CPIO],[cpio],[cpio])
   321            RKT_REQ_PROG([GZIP],[gzip],[gzip])
   322            RKT_REQ_PROG([MD5SUM],[md5sum],[md5sum])
   323            RKT_REQ_PROG([MKTEMP],[mktemp],[mktemp])
   324            RKT_REQ_PROG([SORT],[sort],[sort])
   325            RKT_REQ_PROG([TOUCH],[touch],[touch])
   326            RKT_REQ_PROG([UNSQUASHFS],[unsquashfs],[unsquashfs])
   327            RKT_REQ_PROG([WGET],[wget],[wget])])
   328  
   329  dnl Validate passed flavors to build - make sure that valid flavors
   330  dnl were passed and each flavor was specified only once. Also, do some
   331  dnl basic program checks for each requested flavor.
   332  RKT_SPECIFIED_FLAVORS=''
   333  RKT_ITERATE([${RKT_STAGE1_FLAVORS}],[flavor],
   334                      [RKT_IS_VALID_FLAVOR([${flavor}],[in --with-stage1-flavors])
   335                       RKT_IF_HAS_VALUE([${RKT_SPECIFIED_FLAVORS}],[${flavor}],
   336                                         [AC_MSG_ERROR([*** "${flavor}" flavor specified twice in --with-stage1-flavors])])
   337                       RKT_SPECIFIED_FLAVORS="${RKT_SPECIFIED_FLAVORS},${flavor}"
   338                       AS_CASE([${flavor}],
   339                               [src],
   340                                       [AC_MSG_NOTICE([will build systemd from source, make sure that all its build requirements are fulfilled])],
   341                               [coreos],
   342                                       [RKT_COMMON_COREOS_PROGS],
   343                               [kvm],
   344                                       [AC_MSG_NOTICE([will build linux kernel and kvm hypervisors (${RKT_STAGE1_KVM_HV}) from source, make sure that all their build requirements are fulfilled])
   345                                        RKT_COMMON_COREOS_PROGS
   346                                        RKT_REQ_PROG([PATCH],[patch],[patch])
   347                                        RKT_REQ_PROG([TAR],[tar],[tar])
   348                                        RKT_REQ_PROG([XZ],[xz],[xz])
   349                                        AC_CHECK_HEADER([openssl/bio.h],
   350                                                        [],
   351                                                        [AC_MSG_ERROR([** No development headers for openssl found])],
   352                                                        [AC_INCLUDES_DEFAULT])],
   353                               [host],
   354                                       [],
   355                               [fly],
   356                                       [AC_MSG_WARN([* fly is an experimental stage1 implementation with almost no isolation and less features])],
   357                               [AC_MSG_ERROR([*** Unhandled flavor "${flavor}", should not happen])])])
   358  
   359  
   360  AS_VAR_IF([RKT_SPECIFIED_FLAVORS],[],
   361            dnl no flavors specified, no checks
   362            [],
   363            dnl some flavor are specified, do some checks for stuff needed by any flavor
   364            [AC_LANG_PUSH([C])
   365             AC_CHECK_HEADER([acl/libacl.h],
   366                             [],
   367                             [AC_MSG_ERROR([*** No development headers for libacl found])],
   368                             [AC_INCLUDES_DEFAULT])
   369             AC_CHECK_HEADER([dlfcn.h],
   370                             [],
   371                             [AC_MSG_ERROR([*** No development headers for libdl found])],
   372                             [AC_INCLUDES_DEFAULT])
   373             # check for static libc
   374             SAVE_LDFLAGS="$LDFLAGS"
   375             LDFLAGS="-static $LDFLAGS"
   376             AC_CHECK_LIB([c], [printf],
   377                          dnl static libc is there
   378                          [:],
   379                          dnl static libc is not there
   380                          [AC_MSG_ERROR([*** No static libc found. Try to install glibc-static or libc6-dev.])])
   381             LDFLAGS="$SAVE_LDFLAGS"
   382  
   383             # check for setns syscall, drop it in 2020 (centos 6.7 support ends
   384             # then).
   385             AC_MSG_CHECKING([whether C library provides setns function])
   386             AC_LINK_IFELSE([AC_LANG_PROGRAM([[
   387                                               #define _GNU_SOURCE
   388                                               #include <sched.h>
   389                                             ]], [[(void)setns(0, 0);]])],
   390                            [AC_MSG_RESULT([yes])],
   391                            [AC_MSG_RESULT([no])
   392                             AC_MSG_CHECKING([whether Linux kernel headers provide __NR_setns macro])
   393                             AC_LINK_IFELSE([AC_LANG_PROGRAM([[
   394                                                               #include <linux/unistd.h>
   395                                                             ]], [[(void)syscall(__NR_setns,0,0);]])],
   396                                            [AC_MSG_RESULT([yes])
   397                                             RKT_DEFINES_FOR_ENTER=-DNO_SETNS_AVAILABLE],
   398                                            [AC_MSG_RESULT([no])
   399                                             AC_MSG_ERROR([*** Neither setns function nor __NR_setns macro are available - either both glibc and kernel are too old or their development headers are not installed])])])
   400  
   401             AC_LANG_POP([C])])
   402  
   403  dnl Validate passed default flavor, it should be one of the built
   404  dnl stage1 flavors
   405  
   406  AS_VAR_IF([RKT_STAGE1_SETUP_KIND],['flavor'],
   407            [RKT_IS_VALID_FLAVOR([${RKT_STAGE1_DEFAULT_FLAVOR}],[in --with-stage1-default-flavor])
   408             RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}],[${RKT_STAGE1_DEFAULT_FLAVOR}],
   409                               dnl valid default flavor, alright
   410                               [],
   411                               dnl not a part of built flavors, bail out
   412                               [AC_MSG_ERROR([*** --with-stage1-default-flavor should use one of flavors from --with-stage1-flavors (${RKT_STAGE1_FLAVORS})])])])
   413  
   414  ## Options specific for src flavor
   415  
   416  # Process systemd src repo and version for src flavor.
   417  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}],[src],
   418                    dnl we are building src flavor
   419                    [AS_VAR_IF([RKT_STAGE1_SYSTEMD_SRC], [auto],
   420                               dnl systemd source not specified, use default
   421                               [RKT_STAGE1_SYSTEMD_SRC='https://github.com/systemd/systemd.git'],
   422                               dnl systemd source specified, use it
   423                               [:])
   424                     AS_VAR_IF([RKT_STAGE1_SYSTEMD_VER], [auto],
   425                               dnl systemd version not specified, use default
   426                               [RKT_STAGE1_SYSTEMD_VER='v999'],
   427                               dnl systemd version specified, use it
   428                               [:])
   429                     AS_VAR_IF([RKT_STAGE1_SYSTEMD_REV], [auto],
   430                               dnl systemd revision not specified, use default
   431                               [RKT_STAGE1_SYSTEMD_REV="master"],
   432                               dnl systemd revision specified, use it
   433                               [:])],
   434                    dnl we are not building src flavor
   435                    [AS_VAR_IF([RKT_STAGE1_SYSTEMD_SRC], [auto],
   436                               dnl systemd source not specified, alright, zero the value just in case
   437                               [RKT_STAGE1_SYSTEMD_SRC=''],
   438                               dnl systemd source specified, warn about it being ignored
   439                               [AC_MSG_WARN([* --with-stage1-systemd-src is ignored, src flavor is not built])])
   440                     AS_VAR_IF([RKT_STAGE1_SYSTEMD_REV], [auto],
   441                               dnl systemd source not specified, alright, zero the value just in case
   442                               [RKT_STAGE1_SYSTEMD_REV=''],
   443                               dnl systemd source specified, warn about it being ignored
   444                               [AC_MSG_WARN([* --with-stage1-systemd-revision is ignored, src flavor is not built])])
   445                     AS_VAR_IF([RKT_STAGE1_SYSTEMD_VER], [auto],
   446                               dnl systemd version not specified, alright, zero the value just in case
   447                               [RKT_STAGE1_SYSTEMD_VER=''],
   448                               dnl systemd version specified, warn about it being ignored
   449                               [AC_MSG_WARN([* --with-stage1-systemd-version is ignored, src flavor is not built])])])
   450  
   451  dnl Warn if version is HEAD, just use master.
   452  AS_VAR_IF([RKT_STAGE1_SYSTEMD_VER], [HEAD],
   453            [AC_MSG_WARN([* 'HEAD' is not a systemd version, setting it to 'master' instead])
   454             RKT_STAGE1_SYSTEMD_VER='master'])
   455  
   456  ## Options specific for kvm flavor
   457  
   458  RKT_SPECIFIED_HYPERVISORS=''
   459  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}],[kvm],
   460            [RKT_ITERATE([${RKT_STAGE1_KVM_HV}],[hypervisor],
   461                       [RKT_IS_VALID_HYPERVISOR([${hypervisor}],[in --with-stage1-kvm-hypervisors])
   462                        RKT_IF_HAS_VALUE([${RKT_SPECIFIED_HYPERVISORS}],[${hypervisor}],
   463                                  [AC_MSG_ERROR([*** "${hypervisor}" hypervisor specified twice in --with-stage1-kvm-hypervisors])])
   464                                  RKT_SPECIFIED_HYPERVISORS="${RKT_SPECIFIED_HYPERVISORS},${hypervisor}"
   465                                  AS_CASE([${hypervisor}],
   466                                            [lkvm],
   467                                                      [AC_MSG_NOTICE([including lkvm...])],
   468                                            [qemu],
   469                                                      [AC_MSG_NOTICE([including qemu...])],
   470                                            [AC_MSG_ERROR([*** Unhandled hypervisor "${hypervisor}". should not happen])])])])
   471  
   472  ## Options specific to coreos/kvm flavors
   473  
   474  # Process local CoreOS PXE image path and its systemd version for
   475  # coreos/kvm flavors.
   476  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}],[coreos,kvm],
   477                    dnl for kvm and coreos check if both pxe image path and
   478                    dnl systemd version are specified or neither
   479                    [AS_VAR_IF([RKT_LOCAL_COREOS_PXE_IMAGE_PATH], [],
   480                               dnl no local coreos pxe image path specified
   481                               [AS_VAR_IF([RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER],[],
   482                                          dnl no version specified, alright, keep quiet
   483                                          [:],
   484                                          dnl version specified, warn about it being ignored
   485                                          [AC_MSG_WARN([* --with-coreos-local-pxe-image-systemd-version is ignored, because --with-coreos-local-pxe-image-path was not specified])
   486                                           RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER=''])
   487                                dnl gpg is required for signature
   488                                dnl verification
   489                                RKT_REQ_PROG([GPG],[gpg],[gpg])],
   490                               dnl local coreos pxe image path specified
   491                               [AS_VAR_IF([RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER],[],
   492                                          dnl no version specified, bail out, version is required
   493                                          [AC_MSG_ERROR([*** No systemd version for local CoreOS PXE image specified, use --with-coreos-local-pxe-image-systemd-version])],
   494                                          dnl version specified, alright, keep quiet
   495                                          [:])])],
   496                    dnl for other flavors just warn if either is specified
   497                    [AS_VAR_IF([RKT_LOCAL_COREOS_PXE_IMAGE_PATH], [],
   498                               dnl empty value, alright
   499                               [:],
   500                               dnl not empty, warn about it, zero it just in case
   501                               [AC_MSG_WARN([* --with-coreos-local-pxe-image-path is ignored by ${RKT_STAGE1_DEFAULT_FLAVOR} stage1 flavor])
   502                                RKT_LOCAL_COREOS_PXE_IMAGE_PATH=''])
   503                     AS_VAR_IF([RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER], [],
   504                               dnl empty value, alright
   505                               [:],
   506                               dnl not empty, warn about it, zero it just in case
   507                               [AC_MSG_WARN([* --with-coreos-local-pxe-image-systemd-version is ignored by ${RKT_STAGE1_DEFAULT_FLAVOR} stage1 flavor])
   508                                RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER=''])])
   509  
   510  ## Setup default name, version, location and a filename in rkt dir,
   511  ## take version override into account for flavored setup
   512  
   513  # This will be set to something like stage1-coreos.aci, so rkt will
   514  # know what to look for in the rkt directory if default stage1 image
   515  # location is empty.
   516  RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY=''
   517  
   518  dnl Validate a default stage1 image location - check whether the
   519  dnl location is either a URL with supported scheme (docker, https,
   520  dnl http or file) or an absolute path. If it is the latter, get a
   521  dnl filename which will be used by rkt to load the stage1 image file
   522  dnl from the same directory if the image in the default location is
   523  dnl absent.
   524  AS_CASE([${RKT_STAGE1_DEFAULT_LOCATION}],
   525          [auto],
   526                  dnl no location passed at all, nix it
   527                  [RKT_STAGE1_DEFAULT_LOCATION=''],
   528          [docker://|https://|http://|file://],
   529                  dnl alright, a probably valid URL
   530                  [:],
   531          [/*],
   532                  dnl alright, an absolute path, let's get a filename
   533                  [RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY=`basename ${RKT_STAGE1_DEFAULT_LOCATION}`],
   534          dnl wrong default stage1 image location
   535          [AC_MSG_ERROR([*** Default stage1 image path is neither a valid URL (with docker://, https://, http:// or file:// scheme) nor an absolute path])])
   536  
   537  AS_CASE([${RKT_STAGE1_SETUP_KIND}],
   538          [detailed],
   539                    dnl detailed setup - not much to do, default name
   540                    dnl and version are already specified, warn if
   541                    dnl default location was not specified
   542                    [AS_VAR_IF([RKT_STAGE1_DEFAULT_LOCATION],[],
   543                               [AC_MSG_WARN([* It may be necessary to pass --stage1-{url,path,name,hash,from-dir} flag to run rkt])])],
   544          [flavor],
   545                    dnl flavor setup - set the default name and version,
   546                    dnl set the location if not specified
   547                    [AS_CASE([${RKT_STAGE1_DEFAULT_FLAVOR}],
   548                                     dnl for src flavor, we also append systemd version to stage1 name
   549                                     [src],
   550                                             [RKT_STAGE1_DEFAULT_NAME="coreos.com/rkt/stage1-${RKT_STAGE1_DEFAULT_FLAVOR}-${RKT_STAGE1_SYSTEMD_VER}"],
   551                                     dnl other flavors get only flavor name
   552                                     [RKT_STAGE1_DEFAULT_NAME="coreos.com/rkt/stage1-${RKT_STAGE1_DEFAULT_FLAVOR}"])
   553                     AS_VAR_IF([RKT_STAGE1_FLAVORS_VERSION_OVERRIDE], [],
   554                               [RKT_STAGE1_DEFAULT_VERSION="${RKT_VERSION}"],
   555                               [RKT_STAGE1_DEFAULT_VERSION="${RKT_STAGE1_FLAVORS_VERSION_OVERRIDE}"])
   556                     AS_VAR_IF([RKT_STAGE1_DEFAULT_LOCATION],[],
   557                               [RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY="stage1-${RKT_STAGE1_DEFAULT_FLAVOR}.aci"])],
   558          [AC_MSG_ERROR([*** Unknown setup kind, should not happen])])
   559  
   560  ## Functional tests
   561  
   562  dnl Check for gpg - required by functional tests. Note that this does
   563  dnl not bail out here if it is not found.
   564  RKT_CHECK_PROG([GPG],[gpg],[gpg])
   565  
   566  AS_IF([test "x${RKT_RUN_FUNCTIONAL_TESTS}" = 'xyes' -o "x${RKT_RUN_FUNCTIONAL_TESTS}" = 'xauto'],
   567        [AC_MSG_CHECKING([whether functional tests can be run])
   568         rkt_functional_tests_msg=''
   569         AS_CASE([${host}],
   570                 [*-*-linux*],
   571                         dnl we are on linux, checks can continue
   572                         [],
   573                 dnl non-linux host
   574                 [rkt_functional_tests_msg='Functional tests are supported only under linux'])
   575        AS_VAR_IF([rkt_functional_tests_msg],[],
   576                  dnl we are on linux host; check if we have default
   577                  dnl flavor set
   578                  [AS_VAR_IF([RKT_STAGE1_SETUP_KIND],[flavor],
   579                             dnl we have flavor setup, checks can
   580                             dnl continue
   581                             [:],
   582                             [rkt_functional_tests_msg='Currently functional tests cannot be run on 3rd party stage1 images'])])
   583        AS_VAR_IF([rkt_functional_tests_msg],[],
   584                  dnl we have a default flavor, check some special
   585                  dnl prerequisites for host flavor
   586                  [AS_VAR_IF([RKT_STAGE1_DEFAULT_FLAVOR], [host],
   587                             dnl checking if we are running systemd as init, -.mount is a mount unit for /.
   588                             [AS_IF([systemctl 2>/dev/null | grep --silent -e '-\.mount'],
   589                                    dnl systemd runs as init
   590                                    [sdv=`systemctl --version | head -1 | sed -e 's/^systemd \(@<:@0-9@:>@*\)$/\1/'`
   591                                     AS_IF([test ${sdv} -lt 227],
   592                                           [rkt_functional_tests_msg="Cannot run functional tests with ${RKT_STAGE1_DEFAULT_FLAVOR} stage1 flavor - systemd version on host is lower than 227 (currently running ${sdv})"])],
   593                                    dnl systemd is not an init
   594                                    [rkt_functional_tests_msg="Cannot run functional tests with ${RKT_STAGE1_DEFAULT_FLAVOR} stage1 flavor - no systemd on host"])])])
   595        dnl gpg is required for functional tests
   596        AS_VAR_IF([GPG],[gpg],
   597                  dnl gpg found, alright
   598                  [:],
   599                  dnl gpg not found, running functional tests is impossible
   600                  [rkt_functional_tests_msg='Cannot run functional tests - no gpg found'])
   601        AS_VAR_IF([rkt_functional_tests_msg], [],
   602                   dnl no message, tests can be run
   603                   [RKT_RUN_FUNCTIONAL_TESTS=yes
   604                    AC_MSG_RESULT([yes])],
   605                   dnl message available, tests will not be run
   606                   [AC_MSG_RESULT([no])
   607                    AS_VAR_IF([RKT_RUN_FUNCTIONAL_TESTS], [auto],
   608                              dnl functional tests are optional, so only print an info
   609                              [RKT_RUN_FUNCTIONAL_TESTS=no
   610                               AC_MSG_NOTICE([${rkt_functional_tests_msg}])],
   611                              dnl functional tests are required, so bail out
   612                              [AC_MSG_ERROR([*** ${rkt_functional_tests_msg}])])])])
   613  
   614  
   615  ## Miscellaneous stuff
   616  
   617  # Check if arch is supported for coreos/kvm flavor.
   618  AS_CASE([${RKT_ACI_ARCH}],
   619          dnl supported arches
   620          [aarch64 | amd64], [],
   621          dnl unsupported arches
   622          [RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [coreos,kvm,src],
   623                             [AC_MSG_ERROR([*** ${RKT_ACI_ARCH}: no arch support for stage1 flavors {coreos,kvm,src}])],
   624                             [AC_MSG_WARN([* ${RKT_ACI_ARCH}: unsupported arch])])])
   625  
   626  # Set the path to the interpreter binary for coreos flavor.
   627  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [coreos],
   628                    [AS_CASE([${RKT_ACI_ARCH}],
   629                             [aarch64],
   630                                      [RKT_STAGE1_INTERPRETER="/usr/lib/ld-linux-aarch64.so.1"],
   631                             [amd64],
   632                                      [RKT_STAGE1_INTERPRETER="/usr/lib/ld-linux-x86-64.so.2"])])
   633  
   634  # Set the path to the interpreter binary for src flavor.
   635  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [src],
   636                    [AS_CASE([${RKT_ACI_ARCH}],
   637                             [aarch64],
   638                                      [RKT_STAGE1_INTERPRETER="/lib64/ld-linux-aarch64.so.1"],
   639                             [amd64],
   640                                      [RKT_STAGE1_INTERPRETER="/lib64/ld-linux-x86-64.so.2"])])
   641  
   642  
   643  # cross_compiling is a standard autoconf variable.  See the autoconf manual for
   644  # details.
   645  AS_VAR_IF([cross_compiling], [no],
   646            dnl no crosscompilation
   647            [GOARCH_FOR_BUILD=${GOARCH_FOR_BUILD:-${GOARCH}}],
   648            dnl we do crosscompilation
   649            [AC_MSG_CHECKING([build golang arch])
   650             AS_VAR_IF([GOARCH_FOR_BUILD], [],
   651                       [AS_CASE([${build_cpu}],
   652                                [x86_64],
   653                                        [GOARCH_FOR_BUILD="amd64"],
   654                                [aarch64],
   655                                        [GOARCH_FOR_BUILD="arm64"],
   656                                [powerpc | powerpc64],
   657                                        [GOARCH_FOR_BUILD="ppc64"],
   658                                [powerpc64le],
   659                                        [GOARCH_FOR_BUILD="ppc64le"],
   660                                [AC_MSG_RESULT([unknown]); AC_MSG_ERROR([*** Unknown build cpu: ${build_cpu}.  Set GOARCH_FOR_BUILD variable.])])
   661                        AC_MSG_RESULT([${GOARCH_FOR_BUILD}])],
   662                       [AC_MSG_RESULT([user supplied ${GOARCH_FOR_BUILD}])])])
   663  
   664  AC_LANG_PUSH([C])
   665  
   666  # check for libc generally
   667  AC_CHECK_LIB([c], [fork],
   668               dnl libc is there
   669               [:],
   670               dnl libc is not there
   671               [AC_MSG_ERROR([*** No libc found. Try to install glibc-devel or libc6-dev.])])
   672  
   673  # Check whether we can build TPM support code
   674  AC_CHECK_HEADER(trousers/tss.h, [HAVE_TPM=yes], [HAVE_TPM=no], [AC_INCLUDES_DEFAULT])
   675  
   676  TPM_TAGS=''
   677  AS_CASE([${RKT_ENABLE_TPM}],
   678          [no],
   679                  dnl nothing to do
   680                  [:],
   681          [auto],
   682                  [AS_VAR_IF([HAVE_TPM],[yes],
   683                             [TPM_TAGS=tpm
   684                              RKT_ENABLE_TPM=yes],
   685                             [RKT_ENABLE_TPM=no])],
   686          [yes],
   687                  [AS_VAR_IF([HAVE_TPM],[no],
   688                             [AC_MSG_ERROR([*** TPM is enabled, but could not find required development files])])
   689                   TPM_TAGS=tpm],
   690          [AC_MSG_ERROR([*** Invalid value passed to --enable-tpm, should be either 'yes', 'no' or 'auto'])])
   691  AS_CASE([${RKT_ENABLE_TPM}],
   692          [no],
   693                  [RKT_ADD_FEATURE '-TPM'],
   694          [yes],
   695                  [RKT_ADD_FEATURE '+TPM'])
   696  
   697  # Check whether we have libsystemd-journal (for go-systemd/sdjournal)
   698  AC_CHECK_HEADER([systemd/sd-journal.h], [HAVE_SDJOURNAL=yes], [HAVE_SDJOURNAL=no], [AC_INCLUDES_DEFAULT])
   699  
   700  SDJOURNAL_TAGS=''
   701  AS_CASE([${RKT_ENABLE_SDJOURNAL}],
   702          [no],
   703                  dnl nothing to do
   704                  [:],
   705          [auto],
   706                  [AS_VAR_IF([HAVE_SDJOURNAL],[yes],
   707                             [SDJOURNAL_TAGS=sdjournal
   708                              RKT_ENABLE_SDJOURNAL=yes],
   709                             [RKT_ENABLE_SDJOURNAL=no])],
   710          [yes],
   711                  [AS_VAR_IF([HAVE_SDJOURNAL],[no],
   712                             [AC_MSG_ERROR([*** Host systemd-journal support enabled, but could not find required development files])])
   713                   SDJOURNAL_TAGS=sdjournal],
   714          [AC_MSG_ERROR([*** Invalid value passed to --enable-sdjournal, should be either 'yes', 'no' or 'auto'])])
   715  AS_CASE([${RKT_ENABLE_SDJOURNAL}],
   716          [no],
   717                  [RKT_ADD_FEATURE '-SDJOURNAL'],
   718          [yes],
   719                  [RKT_ADD_FEATURE '+SDJOURNAL'])
   720  
   721  AC_LANG_POP([C])
   722  
   723  AC_PROG_INSTALL
   724  RKT_REQ_PROG([FILE],[file],[file])
   725  RKT_REQ_PROG([GOBINARY],[go],[go])
   726  RKT_REQ_PROG([GOFMTBINARY],[gofmt],[gofmt])
   727  RKT_REQ_ABS_PROG([ABS_GO], [go])
   728  
   729  #### LINKER FLAGS
   730  
   731  dnl Digits regexp class. Square brackets are used by m4 for quoting,
   732  dnl so to get literal square brackets, m4 provides ugly @<:@ and @:>@
   733  dnl for [ and ].
   734  m4_define([DIGITS],[@<:@0-9@:>@])
   735  m4_define([ALNUM],[@<:@a-z0-9@:>@])
   736  
   737  dnl Detect go version. Successfully parse versions like "go1.5",
   738  dnl "go1.5.3", "go1.6rc1", "devel +66330d8 Wed Jan 13 23:40:13 2016
   739  dnl +0000".
   740  GO_VERSION_OUTPUT=`"${ABS_GO}" version`
   741  GO_VERSION=`AS_ECHO(["${GO_VERSION_OUTPUT}"]) | sed -e 's/^go version \(.*\) ALNUM*\/ALNUM*$/\1/'`
   742  AS_CASE([$GO_VERSION],
   743          [devel*],
   744                  [AC_MSG_WARN([* Using development version of go, all bets are off])],
   745          [go*],
   746                  [GO_VERSION=`AS_ECHO(["${GO_VERSION}"]) | sed -e 's/^go\(.*\)/\1/'`
   747                   GO_MAJOR=`AS_ECHO(["${GO_VERSION}"]) | grep -o '^DIGITS\+'`
   748                   GO_MINOR=`AS_ECHO(["${GO_VERSION}"]) | grep -o '^DIGITS\+\.DIGITS\+' | grep -o 'DIGITS\+$'`
   749                   GO_MICRO=`AS_ECHO(["${GO_VERSION}"]) | grep -o '^DIGITS\+\.DIGITS\+\.DIGITS\+' | sed -e 's/^DIGITS*\.DIGITS*\.\(DIGITS*\).*/\1/'`
   750                   AS_VAR_IF([GO_MICRO],[],
   751                             [GO_MICRO=0])
   752  
   753                   GO_BEST_MAJOR=1
   754                   GO_BEST_MINOR=5
   755                   AC_MSG_CHECKING([whether we have go ${GO_BEST_MAJOR}.${GO_BEST_MINOR} or newer])
   756                   AS_IF([test "${GO_MAJOR}" -gt "${GO_BEST_MAJOR}" || test "${GO_MAJOR}" -eq "${GO_BEST_MAJOR}" -a "${GO_MINOR}" -ge "${GO_BEST_MINOR}"],
   757                         [AC_MSG_RESULT([yes])],
   758                         [AC_MSG_RESULT([no])
   759                          AC_MSG_ERROR([*** go is too old (${GO_VERSION})])])
   760  
   761                   AC_MSG_CHECKING([whether we have a go version without CVE-2015-8618])
   762                   AS_IF([test "${GO_MAJOR}" -eq "1" -a "${GO_MINOR}" -eq "5" -a "${GO_MICRO}" -lt "3"],
   763                         [AC_MSG_RESULT([no])
   764                          insecure_go_warning="go version is vulnerable to CVE-2015-8618 (${GO_VERSION})"
   765                          AS_VAR_IF([RKT_INSECURE_GO],[no],
   766                                    [AC_MSG_ERROR([*** ${insecure_go_warning}])],
   767                                    [AC_MSG_WARN([* ${insecure_go_warning}])])],
   768                         [AC_MSG_RESULT([yes])])],
   769          [AC_MSG_ERROR([*** Could not parse the output of go version])])
   770  RKT_STAGE1_DEFAULT_NAME_LDFLAGS="-X 'main.buildDefaultStage1Name=${RKT_STAGE1_DEFAULT_NAME}'"
   771  RKT_STAGE1_DEFAULT_VERSION_LDFLAGS="-X 'main.buildDefaultStage1Version=${RKT_STAGE1_DEFAULT_VERSION}'"
   772  RKT_STAGE1_DEFAULT_LOCATION_LDFLAGS="-X 'main.buildDefaultStage1ImageLoc=${RKT_STAGE1_DEFAULT_LOCATION}'"
   773  RKT_STAGE1_DEFAULT_IMAGE_FILENAME_LDFLAGS="-X 'main.buildDefaultStage1ImageInRktDir=${RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY}'"
   774  RKT_STAGE1_DEFAULT_IMAGES_DIRECTORY_LDFLAGS="-X 'main.buildDefaultStage1ImagesDir=${RKT_STAGE1_DEFAULT_IMAGES_DIR}'"
   775  RKT_STAGE1_INTERPRETER_LDFLAGS="-X 'main.interpBin=${RKT_STAGE1_INTERPRETER}'"
   776  RKT_VERSION_LDFLAGS="-X 'github.com/rkt/rkt/version.Version=${RKT_VERSION}'"
   777  RKT_FEATURES_LDFLAGS="-X 'main.rktFeatures=${RKT_FEATURES}'"
   778  
   779  #### SUBSTITUTIONS
   780  
   781  AC_SUBST(RKT_VERSION)
   782  AC_SUBST(RKT_ACI_ARCH)
   783  AC_SUBST(RKT_STAGE1_FLAVORS_VERSION_OVERRIDE)
   784  
   785  AC_SUBST(RKT_STAGE1_DEFAULT_NAME)
   786  AC_SUBST(RKT_STAGE1_DEFAULT_VERSION)
   787  
   788  AC_SUBST(RKT_STAGE1_ALL_FLAVORS)
   789  AC_SUBST(RKT_STAGE1_FLAVORS)
   790  AC_SUBST(RKT_STAGE1_DEFAULT_FLAVOR)
   791  
   792  AC_SUBST(RKT_STAGE1_DEFAULT_LOCATION)
   793  AC_SUBST(RKT_STAGE1_DEFAULT_IMAGES_DIR)
   794  AC_SUBST(RKT_STAGE1_DEFAULT_IMAGE_FILENAME_IN_RKT_DIRECTORY)
   795  
   796  AC_SUBST(RKT_STAGE1_SYSTEMD_SRC)
   797  AC_SUBST(RKT_STAGE1_SYSTEMD_VER)
   798  AC_SUBST(RKT_STAGE1_SYSTEMD_REV)
   799  
   800  AC_SUBST(RKT_LOCAL_COREOS_PXE_IMAGE_PATH)
   801  AC_SUBST(RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER)
   802  
   803  AC_SUBST(RKT_STAGE1_COREOS_BOARD)
   804  AC_SUBST(RKT_STAGE1_INTERPRETER)
   805  
   806  AC_SUBST(RKT_RUN_FUNCTIONAL_TESTS)
   807  AC_SUBST(INCREMENTAL_BUILD)
   808  
   809  AC_SUBST(GOARCH)
   810  AC_SUBST(GOARM)
   811  AC_SUBST(GOARCH_FOR_BUILD)
   812  
   813  AC_SUBST(RKT_STAGE1_DEFAULT_NAME_LDFLAGS)
   814  AC_SUBST(RKT_STAGE1_DEFAULT_VERSION_LDFLAGS)
   815  AC_SUBST(RKT_STAGE1_DEFAULT_LOCATION_LDFLAGS)
   816  AC_SUBST(RKT_STAGE1_DEFAULT_IMAGE_FILENAME_LDFLAGS)
   817  AC_SUBST(RKT_STAGE1_DEFAULT_IMAGES_DIRECTORY_LDFLAGS)
   818  AC_SUBST(RKT_STAGE1_INTERPRETER_LDFLAGS)
   819  AC_SUBST(RKT_VERSION_LDFLAGS)
   820  AC_SUBST(RKT_FEATURES_LDFLAGS)
   821  
   822  AC_SUBST(RKT_STAGE1_KVM_ALL_HV)
   823  AC_SUBST(RKT_STAGE1_KVM_HV)
   824  AC_SUBST(TPM_TAGS)
   825  AC_SUBST(SDJOURNAL_TAGS)
   826  
   827  AC_SUBST(RKT_DEFINES_FOR_ENTER)
   828  
   829  #### FILE GENERATION AND REPORTING
   830  
   831  AC_CONFIG_FILES([Makefile])
   832  AC_OUTPUT
   833  
   834  AC_MSG_RESULT([
   835          AC_PACKAGE_NAME ${RKT_VERSION}
   836  
   837          stage1 setup
   838  
   839          type:                                   '${RKT_STAGE1_SETUP_KIND}'
   840          default stage1 location:                '${RKT_STAGE1_DEFAULT_LOCATION}'
   841          default stage1 images directory:        '${RKT_STAGE1_DEFAULT_IMAGES_DIR}'])
   842  
   843  AS_CASE([${RKT_STAGE1_SETUP_KIND}],
   844          [flavor],
   845                  [AC_MSG_RESULT([
   846          built stage1 flavors:                   '${RKT_STAGE1_FLAVORS}'
   847          default stage1 flavor:                  '${RKT_STAGE1_DEFAULT_FLAVOR}'
   848          implied default stage1 name:            '${RKT_STAGE1_DEFAULT_NAME}'])
   849                   AS_VAR_IF([RKT_STAGE1_FLAVORS_VERSION_OVERRIDE], [],
   850                             [AC_MSG_RESULT([dnl
   851          implied default stage1 version:         '${RKT_STAGE1_DEFAULT_VERSION}'])],
   852                             [AC_MSG_RESULT([dnl
   853          overridden default stage1 version:      '${RKT_STAGE1_DEFAULT_VERSION}'])])],
   854          [detailed],
   855                  [AC_MSG_RESULT([
   856          default stage1 name:                    '${RKT_STAGE1_DEFAULT_NAME}'
   857          default stage1 version:                 '${RKT_STAGE1_DEFAULT_VERSION}'])],
   858          [AC_MSG_ERROR([*** Unknown setup kind, should not happen])])
   859  
   860  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [coreos,kvm],
   861                    [AC_MSG_RESULT([
   862          coreos/kvm flavor specific build parameters
   863  
   864          local CoreOS PXE image path:            '${RKT_LOCAL_COREOS_PXE_IMAGE_PATH}'
   865          local CoreOS PXE image systemd version: '${RKT_LOCAL_COREOS_PXE_IMAGE_SYSTEMD_VER}'
   866          stage1 CoreOS board:                    '${RKT_STAGE1_COREOS_BOARD}'])])
   867  
   868  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [src],
   869                    [AC_MSG_RESULT([
   870          src flavor specific build parameters
   871  
   872          systemd source:                         '${RKT_STAGE1_SYSTEMD_SRC}'
   873          systemd Git revision:                   '${RKT_STAGE1_SYSTEMD_REV}'
   874          systemd version:                        '${RKT_STAGE1_SYSTEMD_VER}'])])
   875  
   876  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [kvm],
   877                    [AC_MSG_RESULT([
   878          kvm flavor specific build parameters
   879  
   880          hypervisors:                            '${RKT_STAGE1_KVM_HV}'])])
   881  
   882  RKT_IF_HAS_VALUE([${RKT_STAGE1_FLAVORS}], [coreos,src],
   883                    [AC_MSG_RESULT([
   884          coreos flavor specific build parameters
   885  
   886          interpreter:                            '${RKT_STAGE1_INTERPRETER}'])])
   887  
   888  
   889  AC_MSG_RESULT([
   890          other build parameters
   891  
   892          functional tests enabled:               '${RKT_RUN_FUNCTIONAL_TESTS}'
   893          incremental build:                      '${INCREMENTAL_BUILD}'
   894          features:                               '${RKT_FEATURES}'
   895          ACI arch:                               '${RKT_ACI_ARCH}'
   896          go version:                             '${GO_VERSION}'
   897          go arch:                                '${GOARCH}'])