1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_HEADERS([config.h])
5 dnl Checks for programs.
10 dnl Check for compiler options
11 AC_ARG_ENABLE(static-link, [ --enable-static-link=[yes/no] Link all binaries statically [default=no].],
13 enable_static_link="no")
14 if test "x$enable_static_link" != "xyes"; then
15 AC_MSG_CHECKING(whether compiler supports PIE)
17 CFLAGS="$CFLAGS -fPIE"
19 LDFLAGS="$LDFLAGS -pie"
20 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]])], compilepie="yes")
21 if test "x$compilepie" != "xyes"; then
29 CFLAGS="$CFLAGS -static"
30 LDFLAGS="$LDFLAGS -static"
33 dnl Strip binaries before installation
34 AC_ARG_ENABLE(strip-binaries, [ --enable-strip-binaries=[yes/no] Strip binaries while installing them [default=yes].],
37 if test "x$enable_strip" = "xyes"; then
43 dnl Checks for libraries.
44 AC_ARG_ENABLE(ldapmail, [ --enable-ldapmail=[yes/no/try] Enable ldap mail address lookups [default=no].],
47 if test "x$enable_ldapmail" != "xno"; then
50 AC_CHECK_LIB(ldap, ldap_initialize, have_new_ldap="yes", AC_CHECK_LIB(ldap, ldap_init, have_old_ldap="yes"))
51 if test "x$have_new_ldap" != "xno" -o "x$have_old_ldap" != "xno"; then
52 LDAPLIBS="-L/usr/lib -lldap -llber"
53 AC_DEFINE([USE_LDAP_MAIL_LOOKUP], 1, [Lookup email address using LDAP])
54 COMPILE_OPTS="$COMPILE_OPTS USE_LDAP_MAIL_LOOKUP"
55 if test "x$have_new_ldap" = "xyes"; then
56 AC_DEFINE([USE_LDAP_23], 1, [LDAP 2.3 or newer installed])
57 AC_CHECK_DECL(ldap_perror, ,
58 AC_DEFINE([NEED_LDAP_PERROR], 1, [ldap_perror function not declared]),
62 if test "x$enable_ldapmail" = "xyes"; then
63 AC_MSG_ERROR([LDAP support required but library not found.]);
70 AC_CHECK_HEADER(ext2fs/ext2fs.h,ext2fshead="yes")
71 if test "x$ext2fshead" = "xyes"; then
72 AC_DEFINE([HAVE_EXT2_INCLUDE], 1, [Header files for e2fslib])
73 AC_MSG_CHECKING([for ext2_ino_t])
75 AC_EGREP_HEADER(ext2_ino_t, ext2fs/ext2fs.h, have_ext2_ino_t="yes")
76 if test "x$have_ext2_ino_t" != "xyes"; then
77 AC_MSG_RESULT([not found])
79 AC_MSG_RESULT([found])
80 AC_DEFINE([HAVE_EXT2_INO_T], 1, [ext2fs.h defines ext2_ino_t])
84 AC_ARG_ENABLE(ext2direct,
85 [ --enable-ext2direct=[yes/no/try] Enable scanning of EXT2/EXT3 filesystem using e2fslib [default=try].],
87 enable_ext2direct="try")
88 if test "x$enable_ext2direct" != "xno"; then
89 AC_CHECK_LIB(com_err, com_err, EXT2LIBS="-lcom_err $EXT2LIBS")
90 AC_CHECK_LIB(ext2fs, ext2fs_initialize, EXT2LIBS="-lext2fs $EXT2LIBS",, "-lcom_err")
91 if test "${ac_cv_lib_com_err_com_err}" != "yes" -o "${ac_cv_lib_ext2fs_ext2fs_initialize}" != "yes"; then
92 if test "x$enable_ext2direct" = "xyes"; then
93 AC_MSG_ERROR([Ext2 direct support required but libraries not found.])
95 AC_MSG_WARN([Ext2 direct support won't be compiled. Libraries not found.])
97 enable_ext2direct="no"
100 if test "x$ext2fshead" != "xyes"; then
101 if test "x$enable_ext2direct" = "xyes"; then
102 AC_MSG_ERROR([Ext2 direct support required but header files not found.])
104 AC_MSG_WARN([Ext2 direct support won't be compiled. Header files not found.])
106 enable_ext2direct="no"
109 enable_ext2direct="yes"
112 if test "x$enable_ext2direct" = "xyes"; then
113 AC_DEFINE([EXT2_DIRECT], 1, [Scanning of ext? filesystems using e2fslib])
114 COMPILE_OPTS="$COMPILE_OPTS EXT2_DIRECT"
119 AC_ARG_ENABLE(netlink,
120 [ --enable-netlink=[yes/no/try] Compile daemon receiving quota messages via netlink [default=no].],
123 if test "x$enable_netlink" != "xno"; then
124 PKG_CHECK_MODULES([DBUS], [dbus-1])
126 AC_CHECK_LIB(nl, genl_register, NETLINKLIBS="-lnl $DBUS_LIBS")
127 if test -z "$NETLINKLIBS" -o -z "$DBUS_LIBS"; then
128 if test "x$enable_netlink" = "xyes"; then
129 AC_MSG_ERROR([Required libraries for quota netlink daemon not found.])
131 AC_MSG_WARN([Quota netlink daemon won't be compiled. Required libraries not found.])
136 CPPFLAGS="$DBUS_CFLAGS $CPPFLAGS"
137 if test -z "$DBUS_LIBS"; then
138 if test "x$enable_netlink" = "xyes"; then
139 AC_MSG_ERROR([Required headers for quota netlink daemon not found.])
141 AC_MSG_WARN([Quota netlink daemon won't be compiled. Required headers not found.])
146 QUOTA_NETLINK_PROG=quota_nld
150 AC_SUBST(QUOTA_NETLINK_PROG)
151 AC_SUBST(NETLINKLIBS)
153 AC_SEARCH_LIBS(gethostbyname, nsl)
154 AC_MSG_CHECKING(for host_access in -lwrap)
155 AC_CACHE_VAL(ac_cv_lib_wrap_main,
158 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
160 #include <sys/types.h>
161 #include <sys/socket.h>
162 #include <netinet/in.h>
164 struct request_info request;
165 int deny_severity, allow_severity;]],[[hosts_access(&request);]])],
166 dnl We always restore LIBS as we add -lwrap in the next check
167 [ac_cv_lib_wrap_main=yes; LIBS="$saved_LIBS"; AC_MSG_RESULT(yes)],
168 [ac_cv_lib_wrap_main=no; LIBS="$saved_LIBS"; AC_MSG_RESULT(no)])
171 if test ${ac_cv_lib_wrap_main} = yes; then
172 AC_CHECK_HEADER(tcpd.h,, [
173 echo 'ERROR: could not find tcpd.h - missing TCP wrappers package'
177 AC_DEFINE([HOSTS_ACCESS], 1, [Use hosts.allow and hosts.deny for access checking of rpc.rquotad])
178 COMPILE_OPTS="$COMPILE_OPTS HOSTS_ACCESS"
181 dnl Checks for typedefs, structures, and compiler characteristics.
186 [ --enable-rpc=[yes/no] Enable RPC support [default=yes].],
189 AC_ARG_ENABLE(rpcsetquota,
190 [ --enable-rpcsetquota=[yes/no] Use RPC for setting quotas [default=no].],
192 enable_rpcsetquota="no")
193 AC_ARG_ENABLE(xfs_roothack,
194 [ --enable-xfs_roothack=[yes/no] Support old XFS root filesystems [default=no].],
196 enable_xfs_roothack="no")
197 AC_ARG_ENABLE(bsd_behaviour,
198 [ --enable-bsd_behaviour=[yes/no] Mimic BSD behaviour [default=yes].],
200 enable_bsd_behaviour="yes")
201 AC_ARG_ENABLE(libefence,
202 [ --enable-libefence=[yes/no] Use Electric Fence memory checks [default=no].],
204 enable_libefence="no")
207 [ --enable-nls=[yes/no] Enable gettext [default=yes].],
210 AC_ARG_ENABLE(rootsbin,
211 [ --enable-rootsbin=[yes/no] Use /sbin for some important binaries regardless $prefix [default=no].],
213 enable_rootsbin="no")
214 AC_ARG_ENABLE(proc-mounts,
215 [ --enable-proc-mounts=[path] Use alternate file instead of /etc/mtab [default=/proc/mounts].],
217 enable_proc_mounts="/proc/mounts")
219 if test "$enable_rpc" = "yes" ; then
220 AC_DEFINE([RPC], 1, [Support for RPC])
221 COMPILE_OPTS="$COMPILE_OPTS RPC"
223 if test "$enable_rpcsetquota" = "yes" ; then
224 AC_DEFINE([RPC_SETQUOTA], 1, [Allow setting of quotas over RPC])
225 COMPILE_OPTS="$COMPILE_OPTS RPC_SETQUOTA"
227 if test "$enable_xfs_roothack" = "yes" ; then
228 AC_DEFINE([XFS_ROOTHACK], 1, [Assume quota mount options for root filesystem])
229 COMPILE_OPTS="$COMPILE_OPTS XFS_ROOTHACK"
231 if test "$enable_bsd_behaviour" = "yes" ; then
232 AC_DEFINE([BSD_BEHAVIOUR], 1, [Check rights to query / set quotas before calling quotactl])
233 COMPILE_OPTS="$COMPILE_OPTS BSD_BEHAVIOUR"
235 if test "$enable_libefence" = "yes" ; then
236 LIBMALLOC="/usr/lib/libefence.a"
238 if test "$enable_nls" = "yes" ; then
239 AC_DEFINE([USE_GETTEXT], 1, [Use gettext to translate messages])
242 if test "$enable_proc_mounts" != "no"; then
243 AC_DEFINE_UNQUOTED([ALT_MTAB], ["$enable_proc_mounts"], [File with mounted filesystems])
245 if test "$enable_rootsbin" = "yes" ; then
248 ROOTSBIN='$(prefix)/sbin'
251 AC_DEFINE_UNQUOTED([COMPILE_OPTS], ["$COMPILE_OPTS"], [Configuration options])
252 AC_DEFINE([PACKAGE_VERSION], ["4.01"], [Version of quota tools])