"Fossies" - the Fresh Open Source Software Archive

Member "lxc-4.0.10/configure.ac" (16 Jul 2021, 37914 Bytes) of package /linux/misc/lxc-4.0.10.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 4.0.9_vs_4.0.10.

    1 AC_PREREQ([2.69])
    2 
    3 m4_define([lxc_devel], 0)
    4 m4_define([lxc_version_major], 4)
    5 m4_define([lxc_version_minor], 0)
    6 m4_define([lxc_version_micro], 10)
    7 m4_define([lxc_version_beta], [])
    8 
    9 m4_define([lxc_abi_major], 1)
   10 m4_define([lxc_abi_minor], 7)
   11 m4_define([lxc_abi_micro], 0)
   12 m4_define([lxc_abi], [lxc_abi_major.lxc_abi_minor.lxc_abi_micro])
   13 
   14 m4_define([lxc_version_base], [lxc_version_major.lxc_version_minor.lxc_version_micro])
   15 m4_define([lxc_version],
   16        [ifelse(lxc_devel, 1,
   17         ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta])-devel,
   18         ifelse(lxc_version_beta, [], [lxc_version_base], [lxc_version_base.lxc_version_beta]))])
   19 
   20 AC_INIT([lxc],[lxc_version])
   21 
   22 # We need pkg-config
   23 PKG_PROG_PKG_CONFIG
   24 
   25 AC_SUBST(LXC_VERSION_BASE, lxc_version_base)
   26 AC_SUBST(LXC_VERSION_BETA, lxc_version_beta)
   27 
   28 AC_SUBST([LXC_VERSION_MAJOR], [lxc_version_major])
   29 AC_SUBST([LXC_VERSION_MINOR], [lxc_version_minor])
   30 AC_SUBST([LXC_VERSION_MICRO], [lxc_version_micro])
   31 AC_SUBST([LXC_VERSION], [lxc_version])
   32 AC_SUBST([LXC_DEVEL], [lxc_devel])
   33 
   34 AC_SUBST([LXC_ABI_MAJOR], [lxc_abi_major])
   35 AC_SUBST([LXC_ABI_MINOR], [lxc_abi_minor])
   36 AC_SUBST([LXC_ABI_MICRO], [lxc_abi_micro])
   37 AC_SUBST([LXC_ABI], [lxc_abi])
   38 
   39 AC_CONFIG_SRCDIR([configure.ac])
   40 AC_CONFIG_AUX_DIR([config])
   41 AC_CONFIG_HEADERS([src/config.h])
   42 AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
   43 AC_CANONICAL_HOST
   44 AM_PROG_CC_C_O
   45 AC_USE_SYSTEM_EXTENSIONS
   46 AC_SYS_LARGEFILE
   47 
   48 # Test if we have a new enough compiler.
   49 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
   50 #define GCC_VERSION \
   51 	(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
   52 
   53 #define CLANG_VERSION \
   54 	(__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
   55 
   56 #if GCC_VERSION < 40700 && CLANG_VERSION < 10000
   57 #error Sorry, your compiler is too old - please upgrade it
   58 #endif
   59 	]])], [valid_compiler=yes], [valid_compiler=no])
   60 if test "x$valid_compiler" = "xno"; then
   61 	AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it])
   62 fi
   63 
   64 AC_PROG_GCC_TRADITIONAL
   65 AC_PROG_CXX
   66 AC_ENABLE_SHARED
   67 AC_ENABLE_STATIC
   68 # Check binaries
   69 AC_PROG_SED
   70 case $CC in clang*)
   71 	AC_CHECK_TOOL([AR], llvm-ar)
   72 	AC_CHECK_TOOL([NM], llvm-nm)
   73 	AC_CHECK_TOOL([OBJCOPY], llvm-objcopy)
   74 	AC_CHECK_TOOL([RANLIB], llvm-ranlib)
   75 esac
   76 
   77 # libtool
   78 LT_INIT
   79 AC_SUBST([LIBTOOL_DEPS])
   80 
   81 # Detect the distribution. This is used for the default configuration and
   82 # for some distro-specific build options.
   83 AC_MSG_CHECKING([host distribution])
   84 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, redhatenterpriseserver, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, plamo, paldo, openmandriva, pardus, sparclinux, altlinux.]))
   85 if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
   86 	with_distro=`lsb_release -is`
   87 fi
   88 if test "z$with_distro" = "z"; then
   89 	AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
   90 	AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
   91 	AC_CHECK_FILE(/etc/sparclinux-release,with_distro="sparclinux")
   92 	AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
   93 	AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
   94 	AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
   95 	AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
   96 	AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
   97 	AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
   98 	AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
   99 	AC_CHECK_FILE(/etc/plamo-version,with_distro="plamo")
  100 	AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
  101 	AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
  102 	AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
  103 	AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
  104 	AC_CHECK_FILE(/etc/altlinux-release,with_distro="altlinux")
  105 	AC_CHECK_FILE(/etc/pld-release,with_distro="pld")
  106 fi
  107 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
  108 
  109 if test "z$with_distro" = "zforsparc"; then
  110 	with_distro="sparclinux"
  111 fi
  112 
  113 if test "z$with_distro" = "z"; then
  114 	with_distro="unknown"
  115 fi
  116 case $with_distro in
  117 	ubuntu|raspbian)
  118 		distroconf=default.conf.lxcbr
  119 		distrosysconf="$sysconfdir/default"
  120 		;;
  121 	redhat|redhatenterpriseserver|centos|fedora|oracle|oracleserver|sparclinux|altlinux|suse|opensuse*|plamo|pld)
  122 		distroconf=default.conf.lxcbr
  123 		distrosysconf="$sysconfdir/sysconfig"
  124 		;;
  125 	*)
  126 		distroconf=default.conf.unknown
  127 		distrosysconf="$sysconfdir/default"
  128 		;;
  129 esac
  130 AC_MSG_RESULT([$with_distro])
  131 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu" -o x"$with_distro" = "xraspbian"])
  132 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
  133 
  134 AC_CONFIG_LINKS([config/etc/default.conf:config/etc/${distroconf}])
  135 
  136 # Check for init system type
  137 AC_MSG_CHECKING([for init system type])
  138 AC_ARG_WITH([init-script],
  139 	    [AS_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
  140 			    [Type(s) of init script to install: sysvinit, systemd, upstart,
  141 			     distro @<:@default=distro@:>@])],[],[with_init_script=distro])
  142 case "$with_init_script" in
  143 	distro)
  144 		case $with_distro in
  145 			fedora|altlinux|opensuse*)
  146 				init_script=systemd
  147 				;;
  148 			redhat|redhatenterpriseserver|oracle|oracleserver|sparclinux|plamo)
  149 				init_script=sysvinit
  150 				;;
  151 			centos)
  152 				init_script=sysvinit,systemd
  153 				;;
  154 			debian|raspbian|ubuntu)
  155 				init_script=upstart,systemd
  156 				;;
  157 			pld)
  158 				init_script=sysvinit,upstart,systemd
  159 				;;
  160 			*)
  161 				echo -n "Linux distribution init system unknown."
  162 				init_script=
  163 				;;
  164 		esac
  165 		;;
  166 	*)
  167 		init_script=$with_init_script
  168 		;;
  169 esac
  170 
  171 # Check valid init systems were given, run in subshell so we don't mess up IFS
  172 (IFS="," ; for init_sys in $init_script;
  173 do
  174 	case "$init_sys" in
  175 		none|sysvinit|systemd|upstart)
  176 			;;
  177 		*)
  178 			exit 1
  179 			;;
  180 	esac
  181 done) || AC_MSG_ERROR([Unknown init system type in $init_script])
  182 
  183 AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
  184 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
  185 AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
  186 AC_MSG_RESULT($init_script)
  187 
  188 # systemd unit dir
  189 AC_ARG_WITH([systemdsystemunitdir],
  190 	AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
  191 	[with_systemdsystemunitdir=$withval],
  192 	[with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
  193 if test -z "$with_systemdsystemunitdir"; then
  194   with_systemdsystemunitdir=/lib/systemd/system
  195 fi
  196 if test "x$with_systemdsystemunitdir" != "xno"; then
  197   AC_SUBST([SYSTEMD_UNIT_DIR], [$with_systemdsystemunitdir])
  198 fi
  199 
  200 AC_ARG_ENABLE([werror],
  201 	[AS_HELP_STRING([--disable-werror], [do not treat warnings as errors])],
  202 	[enable_werror=$enableval], [enable_werror=yes])
  203 
  204 AC_ARG_ENABLE([no_undefined],
  205 	[AS_HELP_STRING([--disable-no-undefined], [do not pass -Wl,--no-undefined])],
  206 	[enable_no_undefined=$enableval], [enable_no_undefined=yes])
  207 AM_CONDITIONAL([ENABLE_NO_UNDEFINED], [test "x$enable_no_undefined" = "xyes"])
  208 
  209 AC_ARG_ENABLE([fuzzers],
  210 	[AS_HELP_STRING([--enable-fuzzers], [compile with fuzzers])],
  211 	[enable_fuzzers=$enableval], [enable_fuzzers=no])
  212 AM_CONDITIONAL([ENABLE_FUZZERS], [test "x$enable_fuzzers" = "xyes"])
  213 
  214 AM_CONDITIONAL([OSS_FUZZ], [test "x$LIB_FUZZING_ENGINE" != x])
  215 
  216 # Allow disabling rpath
  217 AC_ARG_ENABLE([rpath],
  218 	[AS_HELP_STRING([--enable-rpath], [set rpath in executables [default=no]])],
  219 	[enable_rpath=$enableval], [enable_rpath=no])
  220 AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
  221 
  222 # Documentation (manpages)
  223 AC_ARG_ENABLE([doc],
  224 	[AS_HELP_STRING([--enable-doc], [make man pages [default=auto]])],
  225 	[enable_doc=$enableval], [enable_doc=auto])
  226 
  227 if test "x$enable_doc" = "xyes" -o "x$enable_doc" = "xauto"; then
  228 	db2xman=""
  229 	dbparsers="docbook2X2man docbook2x-man db2x_docbook2man docbook2man docbook-to-man"
  230 
  231 	AC_MSG_CHECKING(for docbook2x-man)
  232 	for name in ${dbparsers}; do
  233 		if "$name" --help >/dev/null 2>&1; then
  234 			db2xman="$name"
  235 			break;
  236 		fi
  237 	done
  238 
  239 	if test -n "${db2xman}"; then
  240 		AC_MSG_RESULT([${db2xman}])
  241 		enable_doc="yes"
  242 	else
  243 		AC_MSG_RESULT([no])
  244 		if test "x$enable_doc" = "xyes"; then
  245 			AC_MSG_ERROR([docbook2x-man is required, but could not be found])
  246 		fi
  247 		enable_doc="no"
  248 	fi
  249 
  250 	AC_SUBST(db2xman)
  251 fi
  252 AM_CONDITIONAL([ENABLE_DOCBOOK], [test "x$db2xman" != "x"])
  253 AM_CONDITIONAL([USE_DOCBOOK2X], [test "x$db2xman" != "xdocbook2man"])
  254 
  255 if test "x$db2xman" = "xdocbook2man"; then
  256 	docdtd="\"-//Davenport//DTD DocBook V3.0//EN\""
  257 else
  258 	docdtd="\"-//OASIS//DTD DocBook XML\" \"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd\""
  259 fi
  260 AC_SUBST(docdtd)
  261 
  262 # Documentation (API)
  263 AC_ARG_ENABLE([api-docs],
  264 	[AS_HELP_STRING([--enable-api-docs], [make API documentation [default=auto]])],
  265 	[enable_api_docs=$enableval], [enable_api_docs=auto])
  266 
  267 if test "x$enable_api_docs" = "xyes" -o "x$enable_api_docs" = "xauto"; then
  268 	AC_CHECK_PROGS([HAVE_DOXYGEN],[doxygen])
  269 	AC_SUBST([HAVE_DOXYGEN])
  270 
  271 	if test "x$HAVE_DOXYGEN" != "x"; then
  272 		enable_api_docs="yes"
  273 	else
  274 		if test "x$enable_api_docs" = "xyes"; then
  275 			AC_MSG_ERROR([doxygen is required, but could not be found])
  276 		fi
  277 		enable_api_docs="no"
  278 	fi
  279 fi
  280 
  281 AM_CONDITIONAL([ENABLE_API_DOCS], [test "x$HAVE_DOXYGEN" != "x"])
  282 
  283 AC_CONFIG_MACRO_DIRS([config])
  284 
  285 # Apparmor
  286 AC_ARG_ENABLE([apparmor],
  287 	[AS_HELP_STRING([--enable-apparmor], [enable apparmor support [default=auto]])],
  288 	[enable_apparmor=$enableval], [enable_apparmor=auto])
  289 
  290 if test "$enable_apparmor" = "auto" ; then
  291 	AC_CHECK_LIB([apparmor],[aa_change_profile],[enable_apparmor=yes], [enable_apparmor=no])
  292 fi
  293 AM_CONDITIONAL([ENABLE_APPARMOR], [test "x$enable_apparmor" = "xyes"])
  294 
  295 # OpenSSL
  296 # libssl-dev
  297 AC_ARG_ENABLE([openssl],
  298 	[AS_HELP_STRING([--enable-openssl], [enable OpenSSL support [default=auto]])],
  299 	[enable_openssl=$enableval], [enable_openssl=auto])
  300 
  301 if test "$enable_openssl" = "auto" ; then
  302 	AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [enable_openssl=yes], [enable_openssl=no])
  303 
  304 fi
  305 AM_CONDITIONAL([ENABLE_OPENSSL], [test "x$enable_openssl" = "xyes"])
  306 
  307 AC_ARG_ENABLE([static-binaries],
  308 	[AS_HELP_STRING([--enable-static-binaries], [build all binaries statically [default=no]])],
  309 	[enable_static_binaries=$enableval], [enable_static_binaries=no])
  310 AM_CONDITIONAL([ENABLE_STATIC_BINARIES], [test "x$enable_static_binaries" = "xyes"])
  311 
  312 AM_COND_IF([ENABLE_OPENSSL],
  313 	[AC_CHECK_HEADER([openssl/engine.h],[],[AC_MSG_ERROR([You must install the OpenSSL development package in order to compile lxc])])
  314 	AM_COND_IF([ENABLE_STATIC_BINARIES], [AC_SUBST([OPENSSL_LIBS], '-lssl -lcrypto -ldl')], [AC_SUBST([OPENSSL_LIBS], '-lssl -lcrypto')])])
  315 
  316 # SELinux
  317 AC_ARG_ENABLE([selinux],
  318 	[AS_HELP_STRING([--enable-selinux], [enable SELinux support [default=auto]])],
  319 	[enable_selinux=$enableval], [enable_selinux=auto])
  320 
  321 if test "x$enable_selinux" = xauto; then
  322 	AC_CHECK_LIB([selinux],[setexeccon_raw],[enable_selinux=yes],[enable_selinux=no])
  323 fi
  324 AM_CONDITIONAL([ENABLE_SELINUX], [test "x$enable_selinux" = "xyes"])
  325 AM_COND_IF([ENABLE_SELINUX],
  326 	[AC_CHECK_HEADER([selinux/selinux.h],[],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
  327 	AC_CHECK_LIB([selinux], [setexeccon_raw],[true],[AC_MSG_ERROR([You must install the SELinux development package in order to compile lxc])])
  328 	AC_SUBST([SELINUX_LIBS], [-lselinux])])
  329 
  330 # Seccomp syscall filter
  331 AC_ARG_ENABLE([seccomp],
  332 	[AS_HELP_STRING([--enable-seccomp], [enable seccomp support [default=auto]])],
  333 	[enable_seccomp=$enableval], [enable_seccomp=auto])
  334 
  335 if test "x$enable_seccomp" = "xauto" ; then
  336 	AC_CHECK_LIB([seccomp],[seccomp_init],[enable_seccomp=yes],[enable_seccomp=no])
  337 fi
  338 AM_CONDITIONAL([ENABLE_SECCOMP], [test "x$enable_seccomp" = "xyes"])
  339 
  340 AM_COND_IF([ENABLE_SECCOMP],
  341 	[PKG_CHECK_MODULES([SECCOMP],[libseccomp],[],[
  342 		AC_CHECK_HEADER([seccomp.h],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
  343 		AC_CHECK_LIB([seccomp], [seccomp_init],[],[AC_MSG_ERROR([You must install the seccomp development package in order to compile lxc])])
  344 		AC_SUBST([SECCOMP_LIBS], [-lseccomp])
  345 		])
  346 	# HAVE_SCMP_FILTER_CTX=1 will tell us we have libseccomp api >= 1.0.0
  347 	OLD_CFLAGS="$CFLAGS"
  348 	CFLAGS="$CFLAGS $SECCOMP_CFLAGS"
  349 	AC_CHECK_TYPES([scmp_filter_ctx], [], [], [[#include <seccomp.h>]])
  350 	AC_CHECK_DECLS([seccomp_notify_fd], [], [], [[#include <seccomp.h>]])
  351 	AC_CHECK_TYPES([struct seccomp_notif_sizes], [], [], [[#include <seccomp.h>]])
  352 	AC_CHECK_DECLS([seccomp_syscall_resolve_name_arch], [], [], [[#include <seccomp.h>]])
  353 	CFLAGS="$OLD_CFLAGS"
  354 	])
  355 
  356 AC_MSG_CHECKING(for static libcap)
  357 # Check for static libcap, make sure the function checked for differs from the
  358 # the one checked below so the cache doesn't give a wrong answer
  359 OLD_CFLAGS="$CFLAGS"
  360 OLD_CPPFLAGS="$CPPFLAGS"
  361 OLD_LDFLAGS="$LDFLAGS"
  362 OLD_LIBS="$LIBS"
  363 CFLAGS=""
  364 CPPFLAGS=""
  365 LDFLAGS="-static"
  366 LIBS="-lcap"
  367 AC_LINK_IFELSE([
  368   AC_LANG_SOURCE(
  369     [[int main() { return 0; }]]
  370   )],[have_static_libcap=yes],[have_static_libcap=no])
  371 AM_CONDITIONAL([HAVE_STATIC_LIBCAP], [test "x$have_static_libcap" = "xyes"])
  372 if test "x$have_static_libcap" = "xyes"; then
  373 	AC_DEFINE([HAVE_STATIC_LIBCAP], 1, [Have static libcap])
  374 	AC_MSG_RESULT([yes])
  375 else
  376 	AC_MSG_RESULT([no])
  377 fi
  378 CPPFLAGS="$OLD_CPPFLAGS"
  379 CFLAGS="$OLD_CFLAGS"
  380 LDFLAGS="$OLD_LDFLAGS"
  381 LIBS="$OLD_LIBS"
  382 
  383 
  384 # Linux capabilities
  385 AC_ARG_ENABLE([capabilities],
  386 	[AS_HELP_STRING([--enable-capabilities], [enable kernel capabilities support [default=auto]])],
  387 	[enable_capabilities=$enableval], [enable_capabilities=auto])
  388 
  389 if test "x$enable_capabilities" = "xauto"; then
  390 	AC_CHECK_LIB([cap],[cap_set_proc],[enable_capabilities=yes],[enable_capabilities=no])
  391 fi
  392 AM_CONDITIONAL([ENABLE_CAP], [test "x$enable_capabilities" = "xyes"])
  393 
  394 AM_COND_IF([ENABLE_CAP],
  395 	[AC_CHECK_HEADER([sys/capability.h],[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
  396 	AC_CHECK_LIB(cap,cap_set_proc,[],[AC_MSG_ERROR([You must install the libcap development package in order to compile lxc])])
  397         # Test whether we support getting file capabilities via cap_get_file().
  398         AC_CHECK_LIB(cap,cap_get_file, AC_DEFINE(LIBCAP_SUPPORTS_FILE_CAPABILITIES,1,[Have cap_get_file]),[],[])
  399         AC_SUBST([CAP_LIBS], [-lcap])])
  400 
  401 # Configuration examples
  402 AC_ARG_ENABLE([examples],
  403 	[AS_HELP_STRING([--enable-examples], [install examples [default=yes]])],
  404 	[enable_examples=$enableval], [enable_examples=yes])
  405 AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])
  406 
  407 # Enable dumping stack traces
  408 AC_ARG_ENABLE([mutex-debugging],
  409 	[AS_HELP_STRING([--enable-mutex-debugging], [Makes mutexes to report error and provide stack trace [default=no]])],
  410 	[enable_mutex_debugging=$enableval], [enable_mutex_debugging=no])
  411 AM_CONDITIONAL([MUTEX_DEBUGGING], [test "x$enable_mutex_debugging" = "xyes"])
  412 
  413 AM_COND_IF([MUTEX_DEBUGGING],
  414 	AC_DEFINE_UNQUOTED([MUTEX_DEBUGGING], 1, [Enabling mutex debugging]))
  415 
  416 # Not in older autoconf versions
  417 # AS_VAR_COPY(DEST, SOURCE)
  418 # -------------------------
  419 # Set the polymorphic shell variable DEST to the contents of the polymorphic
  420 # shell variable SOURCE.
  421 m4_ifdef([AS_VAR_COPY], [],
  422 [AC_DEFUN([AS_VAR_COPY],
  423     [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
  424 ])
  425 
  426 dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
  427 m4_ifdef([PKG_CHECK_VAR], [],
  428 [AC_DEFUN([PKG_CHECK_VAR],
  429     [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
  430      AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
  431      _PKG_CONFIG([$1], [variable="][$3]["], [$2])
  432      AS_VAR_COPY([$1], [pkg_cv_][$1])
  433      AS_VAR_IF([$1], [""], [$5], [$4])dnl
  434     ])# PKG_CHECK_VAR
  435 ])
  436 
  437 # Optional bash integration
  438 AC_ARG_ENABLE([bash],
  439 	[AS_HELP_STRING([--enable-bash], [build bash integration [default=yes]])],
  440 	[enable_bash=$enableval], [enable_bash=yes])
  441 AM_CONDITIONAL([ENABLE_BASH], [test "x$enable_bash" = "xyes"])
  442 
  443 AM_COND_IF([ENABLE_BASH],
  444 	[AC_MSG_CHECKING([bash completion directory])
  445 	PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
  446 		bashcompdir="${sysconfdir}/bash_completion.d")
  447 	AC_MSG_RESULT([$bashcompdir])
  448 	AC_SUBST(bashcompdir)
  449 	])
  450 
  451 # Build the command line tools
  452 AC_ARG_ENABLE([tools],
  453 	[AS_HELP_STRING([--enable-tools], [build the command line tools [default=yes]])],
  454 	[enable_tools=$enableval], [enable_tools=yes])
  455 AM_CONDITIONAL([ENABLE_TOOLS], [test "x$enable_tools" = "xyes"])
  456 
  457 # Build the liblxc commands
  458 AC_ARG_ENABLE([commands],
  459 	[AS_HELP_STRING([--enable-commands], [build the liblxc commands [default=yes]])],
  460 	[enable_commands=$enableval], [enable_commands=yes])
  461 AM_CONDITIONAL([ENABLE_COMMANDS], [test "x$enable_commands" = "xyes"])
  462 
  463 AC_ARG_ENABLE([static-binaries],
  464 	[AS_HELP_STRING([--enable-static-binaries], [build all binaries statically [default=no]])],
  465 	[enable_static_binaries=$enableval], [enable_static_binaries=no])
  466 AM_CONDITIONAL([ENABLE_STATIC_BINARIES], [test "x$enable_static_binaries" = "xyes"])
  467 
  468 AC_ARG_ENABLE([sanitizers],
  469 	[AS_HELP_STRING([--enable-sanitizers], [build with sanitizers enabled [default=no]])],
  470 	[enable_sanitizers=$enableval], [enable_sanitizers=no])
  471 AM_CONDITIONAL([ENABLE_SANITIZERS], [test "x$enable_sanitizers" = "xyes"])
  472 if test "x$enable_sanitizers" = "xyes"; then
  473 	AC_DEFINE([ENABLE_SANITIZERS], 1, [build with sanitizers enabled])
  474 
  475 	CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
  476 		-fsanitize=address \
  477 		-fsanitize=undefined \
  478 		-fno-optimize-sibling-calls \
  479 		-fno-omit-frame-pointer])
  480 	AC_SUBST(AM_CFLAGS)
  481 
  482 	AC_MSG_RESULT([yes])
  483 else
  484 	AC_MSG_RESULT([no])
  485 fi
  486 
  487 if test "x$enable_fuzzers" = "xyes"; then
  488 	if test "x$LIB_FUZZING_ENGINE" = x; then
  489 		CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
  490 			-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION \
  491 			-DRUN_ON_OSS_FUZZ=0 \
  492 			-fsanitize=fuzzer-no-link])
  493 	else
  494 		CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
  495 			-DRUN_ON_OSS_FUZZ=1])
  496 	fi
  497 else
  498 	CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[-flto=thin])
  499 fi
  500 AC_SUBST(AM_CFLAGS)
  501 
  502 # Optional test binaries
  503 AC_ARG_ENABLE([tests],
  504 	[AS_HELP_STRING([--enable-tests], [build test/example binaries [default=no]])],
  505 	[enable_tests=$enableval], [enable_tests=no])
  506 AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = "xyes"])
  507 
  508 # Allow overriding the default runtime dir (/run)
  509 AC_ARG_WITH([runtime-path],
  510 	[AS_HELP_STRING([--with-runtime-path=dir], [runtime directory (default: /run)])],
  511 	[with_runtime_path=$withval], [with_runtime_path=['/run']])
  512 
  513 # LXC container path, where the containers are actually stored
  514 # This is overridden by an entry in the file called LXCCONF
  515 # (i.e. /etc/lxc/lxc.conf)
  516 AC_ARG_WITH([config-path],
  517 	[AS_HELP_STRING([--with-config-path=dir], [lxc configuration repository path])],
  518 	[with_config_path=$withval], [with_config_path=['${localstatedir}/lib/lxc']])
  519 
  520 # The path of the global lxc configuration file.
  521 AC_ARG_WITH([global-conf],
  522 	[AS_HELP_STRING([--with-global-conf=dir], [global lxc configuration file])],
  523 	[with_global_conf=$withval], [with_global_conf=['${sysconfdir}/lxc/lxc.conf']])
  524 
  525 # The path of the userns network configuration file
  526 AC_ARG_WITH([usernic-conf],
  527 	[AS_HELP_STRING([--with-usernic-conf], [user network interface configuration file])],
  528 	[with_usernic_conf=$withval], [with_usernic_conf=['${sysconfdir}/lxc/lxc-usernet']])
  529 
  530 # The path of the runtime usernic database
  531 AC_ARG_WITH([usernic-db],
  532 	[AS_HELP_STRING([--with-usernic-db], [lxc user nic database])],
  533 	[with_usernic_db=$withval], [with_usernic_db=['${with_runtime_path}/lxc/nics']])
  534 
  535 # Rootfs path, where the container mount structure is assembled
  536 AC_ARG_WITH([rootfs-path],
  537 	[AS_HELP_STRING([--with-rootfs-path=dir], [lxc rootfs mount point])],
  538 	[with_rootfs_path=$withval], [with_rootfs_path=['${libdir}/lxc/rootfs']])
  539 
  540 # cgroup pattern specification
  541 AC_ARG_WITH([cgroup-pattern],
  542 	[AS_HELP_STRING([--with-cgroup-pattern=pattern], [pattern for container cgroups])],
  543 	[with_cgroup_pattern=$withval], [with_cgroup_pattern=['']])
  544 
  545 # The path for the apparmor_parser's cache for generated apparmor profiles
  546 AC_ARG_WITH([apparmor-cache-dir],
  547 	[AS_HELP_STRING([--with-apparmor-cache-dir=dir],[path for apparmor_parser cache])],
  548 	[with_apparmor_cache_dir=$withval], [with_apparmor_cache_dir=['${localstatedir}/cache/lxc/apparmor']])
  549 
  550 # Container log path.  By default, use $lxcpath.
  551 AC_MSG_CHECKING([Whether to place logfiles in container config path])
  552 AC_ARG_ENABLE([configpath-log],
  553 	[AS_HELP_STRING([--enable-configpath-log], [use logfiles in config path [default=no]])],
  554 	[enable_configpath_log=$enableval], [enable_configpath_log=no])
  555 AC_MSG_RESULT([$enable_configpath_log])
  556 AM_CONDITIONAL([USE_CONFIGPATH_LOGS], [test "$enable_configpath_log" = "yes"])
  557 
  558 if test "$enable_configpath_log" = "yes"; then
  559 	default_log_path="${with_config_path}"
  560 else
  561 	default_log_path="${localstatedir}/log/lxc"
  562 fi
  563 
  564 AC_ARG_WITH([log-path],
  565 	[AS_HELP_STRING([--with-log-path=dir],[per container log path])],
  566 	[with_log_path=$withval], [with_log_path=['${default_log_path}']])
  567 
  568 # Expand some useful variables
  569 AS_AC_EXPAND(PREFIX, "$prefix")
  570 AS_AC_EXPAND(LIBDIR, "$libdir")
  571 AS_AC_EXPAND(BINDIR, "$bindir")
  572 AS_AC_EXPAND(SBINDIR, "$sbindir")
  573 AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
  574 AS_AC_EXPAND(INCLUDEDIR, "$includedir")
  575 AS_AC_EXPAND(SYSCONFDIR, "$sysconfdir")
  576 AS_AC_EXPAND(LXC_DEFAULT_CONFIG, "$sysconfdir/lxc/default.conf")
  577 AS_AC_EXPAND(DATADIR, "$datadir")
  578 AS_AC_EXPAND(LOCALSTATEDIR, "$localstatedir")
  579 AS_AC_EXPAND(DOCDIR, "$docdir")
  580 AS_AC_EXPAND(LXC_GENERATE_DATE, "$(date --utc --date=@${SOURCE_DATE_EPOCH:-$(date +%s)} '+%Y-%m-%d')")
  581 AS_AC_EXPAND(LXCPATH, "$with_config_path")
  582 AS_AC_EXPAND(LXC_GLOBAL_CONF, "$with_global_conf")
  583 AS_AC_EXPAND(LXC_USERNIC_CONF, "$with_usernic_conf")
  584 AS_AC_EXPAND(LXC_USERNIC_DB, "$with_usernic_db")
  585 AS_AC_EXPAND(LXC_DISTRO_SYSCONF, "$distrosysconf")
  586 AS_AC_EXPAND(LXCROOTFSMOUNT, "$with_rootfs_path")
  587 AS_AC_EXPAND(LXCTEMPLATEDIR, "$datadir/lxc/templates")
  588 AS_AC_EXPAND(LXCTEMPLATECONFIG, "$datadir/lxc/config")
  589 AS_AC_EXPAND(LXCHOOKDIR, "$datadir/lxc/hooks")
  590 AS_AC_EXPAND(LXCBINHOOKDIR, "$libexecdir/lxc/hooks")
  591 AS_AC_EXPAND(LXCINITDIR, "$libexecdir")
  592 AS_AC_EXPAND(LOGPATH, "$with_log_path")
  593 AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
  594 AS_AC_EXPAND(APPARMOR_CACHE_DIR, "$with_apparmor_cache_dir")
  595 AC_SUBST(DEFAULT_CGROUP_PATTERN, ["$with_cgroup_pattern"])
  596 
  597 # We need the install path so criu knows where to reference the hook scripts.
  598 AC_DEFINE_UNQUOTED([DATADIR], "$DATADIR", ["Prefix for shared files."])
  599 
  600 # Check for some standard kernel headers
  601 AC_CHECK_HEADERS([linux/unistd.h linux/netlink.h linux/genetlink.h],
  602 				[],
  603 				AC_MSG_ERROR([Please install the Linux kernel headers.]),
  604 				[#include <sys/socket.h>])
  605 
  606 # Check for alternate C libraries
  607 AC_MSG_CHECKING(for bionic libc)
  608 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
  609 	[[#ifndef __ANDROID__
  610 error: Not bionic!
  611 #endif]])],
  612 	[is_bionic=yes],
  613 	[is_bionic=no])
  614 if test "x$is_bionic" = "xyes"; then
  615 	AC_DEFINE([IS_BIONIC], 1, [bionic libc])
  616 	AC_MSG_RESULT([yes])
  617 else
  618 	AC_MSG_RESULT([no])
  619 fi
  620 AM_CONDITIONAL([IS_BIONIC], [test "x$is_bionic" = "xyes"])
  621 
  622 # Configuration examples
  623 AC_ARG_ENABLE([pam],
  624 	[AS_HELP_STRING([--enable-pam], [enable pam module [default=no]])],
  625 	[enable_pam=$enableval], [enable_pam=no])
  626 AM_CONDITIONAL([ENABLE_PAM], [test "x$enable_pam" = "xyes"])
  627 
  628 AM_COND_IF([ENABLE_PAM],
  629 	[AC_ARG_WITH(
  630 		[pamdir],
  631 		[AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored,
  632 							or "none" if PAM modules are not to be built])],
  633 		[pamdir=$withval],
  634 		[
  635 			if test "${prefix}" = "/usr"; then
  636 				pamdir="/lib${libdir##*/lib}/security"
  637 			else
  638 				pamdir="\$(libdir)/security"
  639 			fi
  640 		]
  641 	)])
  642 
  643 AM_CONDITIONAL([HAVE_PAM], [test x"$pamdir" != "xnone"])
  644 AM_COND_IF([ENABLE_PAM],
  645 	[if test "z$pamdir" != "znone"; then
  646 		AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam])
  647 		AC_ARG_VAR([PAM_LIBS], [linker flags for pam])
  648 		AC_CHECK_LIB(
  649 			[pam],
  650 			[pam_authenticate],
  651 			[PAM_LIBS="-lpam"],
  652 			[AC_MSG_ERROR([*** libpam not found.])
  653 			])
  654 
  655 		AC_SUBST(PAM_LIBS)
  656 		AC_SUBST([pamdir])
  657 	fi])
  658 
  659 # Some systems lack PR_CAPBSET_DROP definition => HAVE_DECL_PR_CAPBSET_DROP
  660 AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
  661 
  662 # Some systems lack PR_{G,S}ET_NO_NEW_PRIVS definition => HAVE_DECL_PR_{G,S}ET_NO_NEW_PRIVS
  663 AC_CHECK_DECLS([PR_SET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
  664 AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
  665 
  666 # Check for some headers
  667 AC_CHECK_HEADERS([pty.h sys/memfd.h sys/personality.h sys/resource.h sys/signalfd.h sys/timerfd.h utmpx.h])
  668 
  669 AC_CHECK_HEADER([ifaddrs.h],
  670 	AM_CONDITIONAL(HAVE_IFADDRS_H, true)
  671 	AC_DEFINE(HAVE_IFADDRS_H, 1, [Have ifaddrs.h]),
  672 	AM_CONDITIONAL(HAVE_IFADDRS_H, false))
  673 
  674 # lookup major()/minor()/makedev()
  675 AC_HEADER_MAJOR
  676 
  677 # Check for some syscalls functions
  678 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig fsmount openat2 close_range statvfs mount_setattr])
  679 AC_CHECK_TYPES([__aligned_u64], [], [], [[#include <linux/types.h>]])
  680 AC_CHECK_TYPES([struct mount_attr], [], [], [[#include <linux/mount.h>]])
  681 AC_CHECK_TYPES([struct open_how], [], [], [[#include <linux/openat2.h>]])
  682 AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
  683 AC_CHECK_MEMBERS([struct clone_args.set_tid],[],[],[[#include <linux/sched.h>]])
  684 AC_CHECK_MEMBERS([struct clone_args.cgroup],[],[],[[#include <linux/sched.h>]])
  685 
  686 # Check for strerror_r() support. Defines:
  687 # - HAVE_STRERROR_R if available
  688 # - HAVE_DECL_STRERROR_R if defined
  689 # - STRERROR_R_CHAR_P if it returns char *
  690 AC_FUNC_STRERROR_R
  691 
  692 # Check if "%m" is supported by printf and Co
  693 AC_MSG_CHECKING([%m format])
  694 AC_RUN_IFELSE([AC_LANG_SOURCE([[
  695 #include <stdio.h>
  696 int main(void)
  697 {
  698   char msg[256];
  699   int rc;
  700 
  701   rc = snprintf(msg, sizeof(msg), "%m\n");
  702   if ((rc > 1) && (msg[0] != '%'))
  703   {
  704     return 0;
  705   }
  706   else
  707   {
  708     return 1;
  709   }
  710 }]])],[fmt_m=yes],[fmt_m=no],[fmt_m=no])
  711 if test "x$fmt_m" = "xyes"; then
  712 	AC_DEFINE([HAVE_M_FORMAT], 1, [Have %m format])
  713 	AC_MSG_RESULT([yes])
  714 else
  715 	AC_MSG_RESULT([no])
  716 fi
  717 
  718 # Check for some functions
  719 AC_CHECK_LIB(pthread, main)
  720 AC_CHECK_LIB(util, openpty)
  721 AC_CHECK_FUNCS([hasmntopt setmntent endmntent utmpxname])
  722 AC_CHECK_FUNCS([getgrgid_r],
  723 	AM_CONDITIONAL(HAVE_GETGRGID_R, true)
  724 	AC_DEFINE(HAVE_GETGRGID_R,1,[Have getgrgid_r]),
  725 	AM_CONDITIONAL(HAVE_GETGRGID_R, false))
  726 AC_CHECK_FUNCS([getline],
  727 	AM_CONDITIONAL(HAVE_GETLINE, true)
  728 	AC_DEFINE(HAVE_GETLINE,1,[Have getline]),
  729 	AM_CONDITIONAL(HAVE_GETLINE, false))
  730 AC_CHECK_FUNCS([getsubopt],
  731 	AM_CONDITIONAL(HAVE_GETSUBOPT, true)
  732 	AC_DEFINE(HAVE_GETSUBOPT,1,[Have getsubopt]),
  733 	AM_CONDITIONAL(HAVE_GETSUBOPT, false))
  734 AC_CHECK_FUNCS([fgetln],
  735 	AM_CONDITIONAL(HAVE_FGETLN, true)
  736 	AC_DEFINE(HAVE_FGETLN,1,[Have fgetln]),
  737 	AM_CONDITIONAL(HAVE_FGETLN, false))
  738 AC_CHECK_FUNCS([keyctl],
  739 	AM_CONDITIONAL(HAVE_KEYCTL, true)
  740 	AC_DEFINE(HAVE_KEYCTL,1,[Have keyctl]),
  741 	AM_CONDITIONAL(HAVE_KEYCTL, false))
  742 AC_CHECK_FUNCS([openpty],
  743 	AM_CONDITIONAL(HAVE_OPENPTY, true)
  744 	AC_DEFINE(HAVE_OPENPTY,1,[Have openpty]),
  745 	AM_CONDITIONAL(HAVE_OPENPTY, false))
  746 AC_CHECK_FUNCS([prlimit],
  747 	AM_CONDITIONAL(HAVE_PRLIMIT, true)
  748 	AC_DEFINE(HAVE_PRLIMIT,1,[Have prlimit]),
  749 	AM_CONDITIONAL(HAVE_PRLIMIT, false))
  750 AC_CHECK_FUNCS([prlimit64],
  751 	AM_CONDITIONAL(HAVE_PRLIMIT64, true)
  752 	AC_DEFINE(HAVE_PRLIMIT64,1,[Have prlimit64]),
  753 	AM_CONDITIONAL(HAVE_PRLIMIT64, false))
  754 AC_CHECK_FUNCS([pthread_setcancelstate],
  755 	AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, true)
  756 	AC_DEFINE(HAVE_PTHREAD_SETCANCELSTATE,1,[Have pthread_setcancelstate]),
  757 	AM_CONDITIONAL(HAVE_PTHREAD_SETCANCELSTATE, false))
  758 AC_CHECK_FUNCS([strlcpy],
  759 	AM_CONDITIONAL(HAVE_STRLCPY, true)
  760 	AC_DEFINE(HAVE_STRLCPY,1,[Have strlcpy]),
  761 	AM_CONDITIONAL(HAVE_STRLCPY, false))
  762 AC_CHECK_FUNCS([strlcat],
  763 	AM_CONDITIONAL(HAVE_STRLCAT, true)
  764 	AC_DEFINE(HAVE_STRLCAT,1,[Have strlcat]),
  765 	AM_CONDITIONAL(HAVE_STRLCAT, false))
  766 AC_CHECK_FUNCS([strchrnul],
  767 	AM_CONDITIONAL(HAVE_STRCHRNUL, true)
  768 	AC_DEFINE(HAVE_STRCHRNUL,1,[Have strchnul]),
  769 	AM_CONDITIONAL(HAVE_STRCHRNUL, false))
  770 AC_CHECK_FUNCS([fmemopen],
  771 	AM_CONDITIONAL(HAVE_FMEMOPEN, true)
  772 	AC_DEFINE(HAVE_FMEMOPEN,1,[Have fmemopen]),
  773 	AM_CONDITIONAL(HAVE_FMEMOPEN, false))
  774 
  775 # HAVE_STRUCT_RTNL_LINK_STATS64={0,1}
  776 AC_CHECK_TYPES([struct rtnl_link_stats64], [], [], [[#include <linux/if_link.h>]])
  777 
  778 # Check for some libraries
  779 AX_PTHREAD
  780 AC_SEARCH_LIBS(clock_gettime, [rt])
  781 
  782 # See if we support thread-local storage.
  783 LXC_CHECK_TLS
  784 
  785 # Hardening flags
  786 CC_CHECK_FLAGS_APPEND([AM_CFLAGS],[CFLAGS],[ \
  787 	-fPIE \
  788 	-Wvla \
  789 	-std=gnu11 \
  790 	-fms-extensions \
  791 	-fdiagnostics-color \
  792 	-Wimplicit-fallthrough=5 \
  793 	-Wcast-align \
  794 	-Wstrict-prototypes \
  795 	-fno-strict-aliasing \
  796 	-fstack-clash-protection \
  797 	-fstack-protector-strong \
  798 	--param=ssp-buffer-size=4 \
  799 	-g \
  800 	--mcet -fcf-protection \
  801 	-Werror=implicit-function-declaration \
  802 	-Wlogical-op \
  803 	-Wmissing-include-dirs \
  804 	-Wold-style-definition \
  805 	-Winit-self \
  806 	-Wunused-but-set-variable \
  807 	-Wfloat-equal \
  808 	-Wsuggest-attribute=noreturn \
  809 	-Werror=return-type \
  810 	-Werror=incompatible-pointer-types \
  811 	-Wformat=2 \
  812 	-Wshadow \
  813 	-Wendif-labels \
  814 	-Werror=overflow \
  815 	-fdiagnostics-show-option \
  816 	-Werror=shift-count-overflow \
  817 	-Werror=shift-overflow=2 \
  818 	-Wdate-time \
  819 	-Wnested-externs \
  820 	-fasynchronous-unwind-tables \
  821 	-pipe \
  822 	-fexceptions \
  823 	-Warray-bounds \
  824 	-Wrestrict \
  825 	-Wreturn-local-addr \
  826 	-fsanitize=cfi \
  827 	-Wstringop-overflow])
  828 AC_SUBST(AM_CFLAGS)
  829 
  830 CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[ \
  831 	-Wl,--as-needed \
  832         -Wl,--gc-sections \
  833         -Wl,-z,relro \
  834         -Wl,-z,now \
  835         -pie \
  836         -Wl,-fuse-ld=gold])
  837 
  838 AM_COND_IF([ENABLE_NO_UNDEFINED],
  839 	[CC_CHECK_FLAGS_APPEND([AM_LDFLAGS],[LDFLAGS],[-Wl,--no-undefined])])
  840 
  841 AC_SUBST(AM_LDFLAGS)
  842 
  843 CFLAGS="$CFLAGS -Wvla -std=gnu11 -fms-extensions"
  844 if test "x$enable_werror" = "xyes"; then
  845 	CFLAGS="$CFLAGS -Werror"
  846 fi
  847 
  848 AC_ARG_ENABLE([thread-safety],
  849 	[AS_HELP_STRING([--enable-thread-safety], [enforce thread-safety otherwise fail the build [default=yes]])],
  850 	[enable_thread_safety=$enableval], [enable_thread_safety=yes])
  851 AM_CONDITIONAL([ENFORCE_THREAD_SAFETY], [test "x$enable_thread_safety" = "xyes"])
  852 if test "x$enable_thread_safety" = "xyes"; then
  853 	AC_DEFINE([ENFORCE_THREAD_SAFETY], 1, [enforce thread-safety otherwise fail the build])
  854 	AC_MSG_RESULT([yes])
  855 else
  856 	AC_MSG_RESULT([no])
  857 fi
  858 
  859 AC_ARG_ENABLE([coverity-build],
  860 	[AS_HELP_STRING([--enable-coverity-build], [build for use with Coverity [default=no]])],
  861 	[enable_coverity_build=$enableval], [enable_coverity_build=no])
  862 AM_CONDITIONAL([ENABLE_COVERITY_BUILD], [test "x$enable_coverity_build" = "xyes"])
  863 if test "x$enable_coverity_build" = "xyes"; then
  864 	AC_DEFINE([ENABLE_COVERITY_BUILD], 1, [build for use with Coverity])
  865 	AC_MSG_RESULT([yes])
  866 else
  867 	AC_MSG_RESULT([no])
  868 fi
  869 
  870 AC_ARG_ENABLE([dlog],
  871 	[AS_HELP_STRING([--enable-dlog], [enable dlog support [default=no]])],
  872 	[enable_dlog=$enableval], [enable_dlog=no])
  873 AM_CONDITIONAL([ENABLE_DLOG], [test "x$enable_dlog" = "xyes"])
  874 
  875 AM_COND_IF([ENABLE_DLOG],
  876 	[PKG_CHECK_MODULES([DLOG],[dlog],[],[
  877 		AC_CHECK_HEADER([dlog.h],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
  878 		AC_CHECK_LIB([dlog], [dlog_print],[],[AC_MSG_ERROR([You must install the dlog development package in order to compile lxc])])
  879 		AC_SUBST([DLOG_LIBS], [-ldlog])
  880 		])
  881 	])
  882 
  883 AC_ARG_ENABLE([memfd-rexec],
  884 	[AS_HELP_STRING([--enable-memfd-rexec], [enforce liblxc as a memfd to protect against certain symlink attacks [default=yes]])],
  885 	[enable_memfd_rexec=$enableval], [enable_memfd_rexec=yes])
  886 AM_CONDITIONAL([ENFORCE_MEMFD_REXEC], [test "x$enable_memfd_rexec" = "xyes"])
  887 if test "x$enable_memfd_rexec" = "xyes"; then
  888 	AC_DEFINE([ENFORCE_MEMFD_REXEC], 1, [Rexec liblxc as memfd])
  889 	AC_MSG_RESULT([yes])
  890 else
  891 	AC_MSG_RESULT([no])
  892 fi
  893 
  894 # Files requiring some variable expansion
  895 AC_CONFIG_FILES([
  896 	Makefile
  897 	lxc.pc
  898 	lxc.spec
  899 
  900 	coccinelle/Makefile
  901 
  902 	config/Makefile
  903 	config/apparmor/Makefile
  904 	config/apparmor/abstractions/start-container
  905 	config/selinux/Makefile
  906 	config/bash/Makefile
  907 	config/bash/lxc
  908 	config/init/Makefile
  909 	config/init/common/Makefile
  910 	config/init/common/lxc-containers
  911 	config/init/common/lxc-net
  912 	config/init/systemd/Makefile
  913 	config/init/systemd/lxc.service
  914 	config/init/systemd/lxc@.service
  915 	config/init/systemd/lxc-net.service
  916 	config/init/sysvinit/Makefile
  917 	config/init/sysvinit/lxc-containers
  918 	config/init/sysvinit/lxc-net
  919 	config/init/upstart/lxc.conf
  920 	config/init/upstart/lxc-net.conf
  921 	config/init/upstart/Makefile
  922 	config/etc/Makefile
  923 	config/templates/Makefile
  924 	config/templates/common.conf
  925 	config/templates/common.conf.d/Makefile
  926 	config/templates/nesting.conf
  927 	config/templates/oci.common.conf
  928 	config/templates/userns.conf
  929 	config/yum/Makefile
  930 	config/sysconfig/Makefile
  931 	config/sysconfig/lxc
  932 
  933 	doc/Makefile
  934 	doc/api/Makefile
  935 	doc/lxc-attach.sgml
  936 	doc/lxc-autostart.sgml
  937 	doc/lxc-cgroup.sgml
  938 	doc/lxc-checkconfig.sgml
  939 	doc/lxc-checkpoint.sgml
  940 	doc/lxc-config.sgml
  941 	doc/lxc-console.sgml
  942 	doc/lxc-copy.sgml
  943 	doc/lxc-create.sgml
  944 	doc/lxc-destroy.sgml
  945 	doc/lxc-device.sgml
  946 	doc/lxc-execute.sgml
  947 	doc/lxc-freeze.sgml
  948 	doc/lxc-info.sgml
  949 	doc/lxc-ls.sgml
  950 	doc/lxc-monitor.sgml
  951 	doc/lxc-snapshot.sgml
  952 	doc/lxc-start.sgml
  953 	doc/lxc-stop.sgml
  954 	doc/lxc-top.sgml
  955 	doc/lxc-unfreeze.sgml
  956 	doc/lxc-unshare.sgml
  957 	doc/lxc-update-config.sgml
  958 	doc/lxc-user-nic.sgml
  959 	doc/lxc-usernsexec.sgml
  960 	doc/lxc-wait.sgml
  961 
  962 	doc/pam_cgfs.sgml
  963 
  964 	doc/lxc.conf.sgml
  965 	doc/lxc.container.conf.sgml
  966 	doc/lxc.system.conf.sgml
  967 	doc/lxc-usernet.sgml
  968 	doc/lxc.sgml
  969 	doc/common_options.sgml
  970 	doc/see_also.sgml
  971 
  972 	doc/rootfs/Makefile
  973 
  974 	doc/examples/Makefile
  975 	doc/examples/lxc-macvlan.conf
  976 	doc/examples/lxc-vlan.conf
  977 	doc/examples/lxc-no-netns.conf
  978 	doc/examples/lxc-empty-netns.conf
  979 	doc/examples/lxc-phys.conf
  980 	doc/examples/lxc-veth.conf
  981 	doc/examples/lxc-complex.conf
  982 
  983 	doc/ja/Makefile
  984 	doc/ja/lxc-attach.sgml
  985 	doc/ja/lxc-autostart.sgml
  986 	doc/ja/lxc-cgroup.sgml
  987 	doc/ja/lxc-checkconfig.sgml
  988 	doc/ja/lxc-checkpoint.sgml
  989 	doc/ja/lxc-config.sgml
  990 	doc/ja/lxc-console.sgml
  991 	doc/ja/lxc-copy.sgml
  992 	doc/ja/lxc-create.sgml
  993 	doc/ja/lxc-destroy.sgml
  994 	doc/ja/lxc-device.sgml
  995 	doc/ja/lxc-execute.sgml
  996 	doc/ja/lxc-freeze.sgml
  997 	doc/ja/lxc-info.sgml
  998 	doc/ja/lxc-ls.sgml
  999 	doc/ja/lxc-monitor.sgml
 1000 	doc/ja/lxc-snapshot.sgml
 1001 	doc/ja/lxc-start.sgml
 1002 	doc/ja/lxc-stop.sgml
 1003 	doc/ja/lxc-top.sgml
 1004 	doc/ja/lxc-unfreeze.sgml
 1005 	doc/ja/lxc-unshare.sgml
 1006 	doc/ja/lxc-update-config.sgml
 1007 	doc/ja/lxc-user-nic.sgml
 1008 	doc/ja/lxc-usernsexec.sgml
 1009 	doc/ja/lxc-wait.sgml
 1010 
 1011 	doc/ja/pam_cgfs.sgml
 1012 
 1013 	doc/ja/lxc.conf.sgml
 1014 	doc/ja/lxc.container.conf.sgml
 1015 	doc/ja/lxc.system.conf.sgml
 1016 	doc/ja/lxc-usernet.sgml
 1017 	doc/ja/lxc.sgml
 1018 	doc/ja/common_options.sgml
 1019 	doc/ja/see_also.sgml
 1020 
 1021 	doc/ko/Makefile
 1022 	doc/ko/lxc-attach.sgml
 1023 	doc/ko/lxc-autostart.sgml
 1024 	doc/ko/lxc-cgroup.sgml
 1025 	doc/ko/lxc-checkconfig.sgml
 1026 	doc/ko/lxc-checkpoint.sgml
 1027 	doc/ko/lxc-config.sgml
 1028 	doc/ko/lxc-console.sgml
 1029 	doc/ko/lxc-copy.sgml
 1030 	doc/ko/lxc-create.sgml
 1031 	doc/ko/lxc-destroy.sgml
 1032 	doc/ko/lxc-device.sgml
 1033 	doc/ko/lxc-execute.sgml
 1034 	doc/ko/lxc-freeze.sgml
 1035 	doc/ko/lxc-info.sgml
 1036 	doc/ko/lxc-ls.sgml
 1037 	doc/ko/lxc-monitor.sgml
 1038 	doc/ko/lxc-snapshot.sgml
 1039 	doc/ko/lxc-start.sgml
 1040 	doc/ko/lxc-stop.sgml
 1041 	doc/ko/lxc-top.sgml
 1042 	doc/ko/lxc-unfreeze.sgml
 1043 	doc/ko/lxc-unshare.sgml
 1044 	doc/ko/lxc-user-nic.sgml
 1045 	doc/ko/lxc-usernsexec.sgml
 1046 	doc/ko/lxc-wait.sgml
 1047 
 1048 	doc/ko/lxc.conf.sgml
 1049 	doc/ko/lxc.container.conf.sgml
 1050 	doc/ko/lxc.system.conf.sgml
 1051 	doc/ko/lxc-usernet.sgml
 1052 	doc/ko/lxc.sgml
 1053 	doc/ko/common_options.sgml
 1054 	doc/ko/see_also.sgml
 1055 
 1056 	hooks/Makefile
 1057 	hooks/dhclient
 1058 
 1059 	templates/Makefile
 1060 	templates/lxc-busybox
 1061 	templates/lxc-download
 1062 	templates/lxc-local
 1063 	templates/lxc-oci
 1064 
 1065 	src/Makefile
 1066 	src/lxc/Makefile
 1067 	src/lxc/lxc.functions
 1068 	src/lxc/cmd/lxc-checkconfig
 1069 	src/lxc/cmd/lxc-update-config
 1070 	src/lxc/version.h
 1071 
 1072 	src/tests/Makefile
 1073 	src/tests/lxc-test-usernic
 1074 ])
 1075 AC_CONFIG_COMMANDS([default],[[]],[[]])
 1076 AC_OUTPUT
 1077 
 1078 # Configuration overview
 1079 cat << EOF
 1080 
 1081 ----------------------------
 1082 Binaries
 1083  - Command Line Tools:
 1084    - lxc-attach:     $enable_tools
 1085    - lxc-autostart:  $enable_tools
 1086    - lxc-cgroup:     $enable_tools
 1087    - lxc-checkpoint: $enable_tools
 1088    - lxc-config:     $enable_tools
 1089    - lxc-console:    $enable_tools
 1090    - lxc-copy:       $enable_tools
 1091    - lxc-create:     $enable_tools
 1092    - lxc-destroy:    $enable_tools
 1093    - lxc-device:     $enable_tools
 1094    - lxc-execute:    $enable_tools
 1095    - lxc-freeze:     $enable_tools
 1096    - lxc-info:       $enable_tools
 1097    - lxc-ls:         $enable_tools
 1098    - lxc-monitor:    $enable_tools
 1099    - lxc-snapshot:   $enable_tools
 1100    - lxc-start:      $enable_tools
 1101    - lxc-stop:       $enable_tools
 1102    - lxc-top:        $enable_tools
 1103    - lxc-unfreeze:   $enable_tools
 1104    - lxc-unshare:    $enable_tools
 1105    - lxc-wait:       $enable_tools
 1106 
 1107  - liblxc Commands:
 1108    - lxc-checkconfig:   $enable_commands
 1109    - lxc-update-config: $enable_commands
 1110    - lxc-init:          $enable_commands
 1111    - lxc-monitord:      $enable_commands
 1112    - lxc-user-nic:      $enable_commands
 1113    - lxc-usernsexec:    $enable_commands
 1114 
 1115  - static binaries: $enable_static_binaries
 1116 
 1117 Environment:
 1118  - compiler: $CC
 1119  - cflags: ${AM_CFLAGS} ${PTHREAD_CFLAGS}
 1120  - ldflags: ${AM_LDFLAGS} ${PTHREAD_LIBS}
 1121  - distribution: $with_distro
 1122  - init script type(s): $init_script
 1123  - rpath: $enable_rpath
 1124  - OpenSSL: $enable_openssl
 1125  - Bash integration: $enable_bash
 1126 
 1127 Security features:
 1128  - Apparmor: $enable_apparmor
 1129  - Linux capabilities: $enable_capabilities
 1130  - seccomp: $enable_seccomp
 1131  - SELinux: $enable_selinux
 1132  - memfd rexec: $enable_memfd_rexec
 1133 
 1134 PAM:
 1135  - PAM module: $enable_pam
 1136  - cgroup PAM module: $pamdir
 1137 
 1138 Documentation:
 1139  - examples: $enable_examples
 1140  - API documentation: $enable_api_docs
 1141  - user documentation: $enable_doc
 1142 
 1143 Debugging:
 1144  - Sanitizers: $enable_sanitizers
 1145  - Coverity: $enable_coverity_build
 1146  - mutex debugging: $enable_mutex_debugging
 1147  - tests: $enable_tests
 1148  - fuzzers: $enable_fuzzers
 1149 
 1150 Paths:
 1151  - Logs in configpath: $enable_configpath_log
 1152 
 1153 Thread-safety:
 1154  - enforce: $enable_thread_safety
 1155 
 1156 Dlog:
 1157  - enable: $enable_dlog
 1158 EOF