]> git.proxmox.com Git - mirror_lxcfs.git/blob - configure.ac
release 2.0.0.rc8
[mirror_lxcfs.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.61)
4 AC_INIT([lxcfs], [2.0.0.rc8], [lxc-devel@lists.linuxcontainers.org])
5 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
6 AC_CONFIG_MACRO_DIR([m4])
7
8 AM_INIT_AUTOMAKE([subdir-objects -Wno-portability])
9
10 AC_GNU_SOURCE
11 AC_CONFIG_HEADERS([config.h])
12 AC_CONFIG_FILES([
13 Makefile
14 config/Makefile
15 config/init/Makefile
16 config/init/systemd/Makefile
17 config/init/sysvinit/Makefile
18 config/init/upstart/Makefile
19 share/Makefile
20 share/00-lxcfs.conf
21 share/lxc.mount.hook
22 share/lxc.reboot.hook
23 tests/Makefile ])
24
25 LT_INIT
26 AC_PROG_CC
27
28 AC_PROG_CC_C99
29
30 AC_CHECK_LIB(pthread, main)
31
32 PKG_CHECK_MODULES(FUSE, fuse)
33
34 AC_PATH_PROG(HELP2MAN, help2man, false // No help2man //)
35 AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$HELP2MAN" != "xfalse // No help2man //" ])
36
37 AC_ARG_WITH([runtime-path],
38 [AC_HELP_STRING(
39 [--with-runtime-path=dir],
40 [runtime directory (default: /run)]
41 )], [], [with_runtime_path=['/run']])
42
43 AS_AC_EXPAND(RUNTIME_PATH, "$with_runtime_path")
44 AS_AC_EXPAND(LXCFSSHAREDIR, "$datarootdir/lxcfs")
45 AS_AC_EXPAND(LXCCONFDIR, "$datarootdir/lxc/config/common.conf.d")
46 AS_AC_EXPAND(LXCFSTARGETDIR, "$localstatedir/lib/lxcfs")
47
48 # Detect the distribution. This is used for the default configuration and
49 # for some distro-specific build options.
50 AC_MSG_CHECKING([host distribution])
51 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.]))
52 if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
53 with_distro=`lsb_release -is`
54 fi
55 if test "z$with_distro" = "z"; then
56 AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
57 AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
58 AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
59 AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
60 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
61 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
62 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
63 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
64 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
65 AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
66 AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
67 AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
68 AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
69 fi
70 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
71
72 if test "z$with_distro" = "z"; then
73 with_distro="unknown"
74 fi
75 case $with_distro in
76 ubuntu)
77 distroconf=default.conf.ubuntu
78 ;;
79 redhat|centos|fedora|oracle|oracleserver)
80 distroconf=default.conf.libvirt
81 ;;
82 *)
83 distroconf=default.conf.unknown
84 ;;
85 esac
86 AC_MSG_RESULT([$with_distro])
87 AM_CONDITIONAL([HAVE_DEBIAN], [test x"$with_distro" = "xdebian" -o x"$with_distro" = "xubuntu"])
88 AM_CONDITIONAL([DISTRO_UBUNTU], [test "x$with_distro" = "xubuntu"])
89
90 # Check for init system type
91 AC_MSG_CHECKING([for init system type])
92 AC_ARG_WITH([init-script],
93 [AC_HELP_STRING([--with-init-script@<:@=TYPE@<:@,TYPE,...@:>@@:>@],
94 [Type(s) of init script to install: bsd, openrc, sysvinit, systemd, upstart,
95 distro @<:@default=distro@:>@])],[],[with_init_script=distro])
96 case "$with_init_script" in
97 distro)
98 case $with_distro in
99 fedora)
100 init_script=systemd
101 ;;
102 redhat|centos|oracle|oracleserver)
103 init_script=sysvinit
104 ;;
105 debian)
106 init_script=upstart,systemd,sysvinit
107 ;;
108 ubuntu)
109 init_script=upstart,systemd,sysvinit
110 ;;
111 slackware)
112 echo -n "Warning: bsd init job not yet implemented"
113 init_script=
114 ;;
115 gentoo)
116 echo -n "Warning: openrc init job not yet implemented"
117 init_script=
118 ;;
119 *)
120 echo -n "Linux distribution init system unknown."
121 init_script=
122 ;;
123 esac
124 ;;
125 *)
126 init_script=$with_init_script
127 ;;
128 esac
129
130 # Check valid init systems were given, run in subshell so we don't mess up IFS
131 (IFS="," ; for init_sys in $init_script;
132 do
133 case "$init_sys" in
134 none|bsd|openrc|sysvinit|systemd|upstart)
135 ;;
136 *)
137 exit 1
138 ;;
139 esac
140 done) || AC_MSG_ERROR([Unknown init system type in $init_script])
141
142 AM_CONDITIONAL([INIT_SCRIPT_BSD], [echo "$init_script" |grep -q "bsd"])
143 AM_CONDITIONAL([INIT_SCRIPT_OPENRC], [echo "$init_script" |grep -q "openrc"])
144 AM_CONDITIONAL([INIT_SCRIPT_SYSV], [echo "$init_script" |grep -q "sysvinit"])
145 AM_CONDITIONAL([INIT_SCRIPT_SYSTEMD], [echo "$init_script" |grep -q "systemd"])
146 AM_CONDITIONAL([INIT_SCRIPT_UPSTART], [echo "$init_script" |grep -q "upstart"])
147 AC_MSG_RESULT($init_script)
148
149
150 AC_ARG_WITH(
151 [pamdir],
152 [AS_HELP_STRING([--with-pamdir=PATH],[Specify the directory where PAM modules are stored,
153 or "none" if PAM modules are not to be built])],
154 [pamdir="${withval}"],
155 [
156 if test "${prefix}" = "/usr"; then
157 pamdir="/lib${libdir##*/lib}/security"
158 else
159 pamdir="\$(libdir)/security"
160 fi
161 ]
162 )
163
164 AM_CONDITIONAL([HAVE_PAM], [test x"$pamdir" != "xnone"])
165 if test "z$pamdir" != "znone"; then
166 AC_ARG_VAR([PAM_CFLAGS], [C compiler flags for pam])
167 AC_ARG_VAR([PAM_LIBS], [linker flags for pam])
168 AC_CHECK_LIB(
169 [pam],
170 [pam_authenticate],
171 [PAM_LIBS="-lpam"],
172 [AC_MSG_ERROR([*** libpam not found.])
173 ])
174
175 AC_SUBST(PAM_LIBS)
176 AC_SUBST([pamdir])
177 fi
178
179 # Rootfs path, where the container mount structure is assembled
180 AC_ARG_WITH([rootfs-path],
181 [AC_HELP_STRING(
182 [--with-rootfs-path=dir],
183 [lxc rootfs mount point]
184 )], [], [with_rootfs_path=['${libdir}/lxc/rootfs']])
185
186 AS_AC_EXPAND(LIBDIR, "$libdir")
187
188 AC_OUTPUT