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