2 # Process this file with autoconf to produce a configure script.
4 AC_INIT([cifs-utils], [5.8.1], [linux-cifs@vger.kernel.org], [cifs-utils], [https://wiki.samba.org/index.php/LinuxCIFS_utils])
5 AC_CONFIG_SRCDIR([replace.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_FILES([Makefile contrib/Makefile contrib/request-key.d/Makefile])
8 AC_CONFIG_MACRO_DIR(aclocal)
14 [AC_HELP_STRING([--enable-pie],
15 [Produce position independent executables @<:@default=yes@:>@])],
16 enable_pie=$enableval,
20 [AC_HELP_STRING([--enable-relro],
21 [Enable relocations read-only support @<:@default=yes@:>@])],
22 enable_relro=$enableval,
25 AC_ARG_ENABLE(cifsupcall,
26 [AC_HELP_STRING([--enable-cifsupcall],
27 [Create cifs.upcall binary @<:@default=yes@:>@])],
28 enable_cifsupcall=$enableval,
29 enable_cifsupcall="maybe")
31 AC_ARG_ENABLE(cifscreds,
32 [AC_HELP_STRING([--enable-cifscreds],
33 [Create cifscreds utility @<:@default=yes@:>@])],
34 enable_cifscreds=$enableval,
35 enable_cifscreds="maybe")
37 AC_ARG_ENABLE(cifsidmap,
38 [AC_HELP_STRING([--enable-cifsidmap],
39 [Create cifs.idmap binary @<:@default=yes@:>@])],
40 enable_cifsidmap=$enableval,
41 enable_cifsidmap="maybe")
43 AC_ARG_ENABLE(cifsacl,
44 [AC_HELP_STRING([--enable-cifsacl],
45 [Create get/set cifsacl binary @<:@default=yes@:>@])],
46 enable_cifsacl=$enableval,
47 enable_cifsacl="maybe")
49 AC_ARG_ENABLE(systemd,
50 [AC_HELP_STRING([--enable-systemd],
51 [Enable systemd specific behavior for mount.cifs @<:@default=yes@:>@])],
52 enable_systemd=$enableval,
53 enable_systemd="maybe")
55 # check for ROOTSBINDIR environment var
56 if test -z $ROOTSBINDIR; then
61 AC_ARG_VAR(ROOTSBINDIR, [Location where files ordinarily under /sbin should be installed. Note: unaffected by --prefix. @<:@default=/sbin@:>@])
63 # Checks for programs.
68 # AC_PROG_SED is only avaliable in recent autoconf versions.
69 # Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
72 [AC_CHECK_PROG(SED, sed, sed)])
74 # Checks for typedefs, structures, and compiler characteristics.
80 AC_CHECK_TYPES([ptrdiff_t, ssize_t, uint32_t, uint8_t])
82 # Checks for library functions.
84 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
89 # check for required functions
90 AC_CHECK_FUNCS([alarm atexit endpwent getmntent getpass gettimeofday inet_ntop memset realpath setenv strchr strcmp strdup strerror strncasecmp strndup strpbrk strrchr strstr strtol strtoul tolower uname], , [AC_MSG_ERROR([necessary functions(s) not found])])
92 AC_CHECK_FUNCS(clock_gettime, [], [
93 AC_CHECK_LIB(rt, clock_gettime, [
94 AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
95 AC_DEFINE(HAVE_CLOCK_GETTIME,1,
96 [Whether the clock_gettime func is there])
101 # Checks for header files.
102 AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h inttypes.h limits.h mntent.h netdb.h stddef.h stdint.h stdbool.h stdlib.h stdio.h errno.h string.h strings.h sys/mount.h sys/param.h sys/socket.h sys/time.h syslog.h unistd.h], , [AC_MSG_ERROR([necessary header(s) not found])])
104 # do we have sys/fsuid.h and setfsuid()?
105 AC_CHECK_HEADERS([sys/fsuid.h])
106 AC_CHECK_FUNC(setfsuid, , [AC_MSG_ERROR([System does not support setfsuid()])])
108 # FIXME: add test(s) to autodisable these flags when compiler/linker don't support it
109 if test $enable_pie != "no"; then
110 PIE_CFLAGS="-fpie -pie"
114 AC_SUBST([PIE_CFLAGS])
116 if test $enable_relro != "no"; then
117 RELRO_CFLAGS="-Wl,-z,relro,-z,now"
121 AC_SUBST([RELRO_CFLAGS])
123 if test $enable_cifsupcall != "no"; then
124 AC_CHECK_HEADERS([krb5.h krb5/krb5.h])
125 if test x$ac_cv_header_krb5_krb5_h != xyes ; then
126 if test x$ac_cv_header_krb5_h != xyes ; then
127 if test "$enable_cifsupcall" = "yes"; then
128 AC_MSG_ERROR([krb5.h not found, consider installing krb5-libs-devel.])
130 AC_MSG_WARN([krb5.h not found, consider installing krb5-libs-devel. Disabling cifs.upcall.])
131 enable_cifsupcall="no"
136 if test $enable_cifsupcall != "no"; then
137 if test x$ac_cv_header_krb5_krb5_h = xyes ; then
138 krb5_include="#include <krb5/krb5.h>"
140 if test x$ac_cv_header_krb5_h = xyes ; then
141 krb5_include="#include <krb5.h>"
144 AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
145 [ac_cv_have_krb5_keyblock_keyvalue],[
146 AC_TRY_COMPILE([$krb5_include],
147 [krb5_keyblock key; key.keyvalue.data = NULL;],
148 ac_cv_have_krb5_keyblock_keyvalue=yes,
149 ac_cv_have_krb5_keyblock_keyvalue=no)])
150 if test x"$ac_cv_have_krb5_keyblock_keyvalue" = x"yes" ; then
151 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
152 [Whether the krb5_keyblock struct has a keyvalue property])
155 if test $enable_cifsupcall != "no"; then
156 AC_CHECK_HEADERS([talloc.h], , [
157 if test "$enable_cifsupcall" = "yes"; then
158 AC_MSG_ERROR([talloc.h not found, consider installing libtalloc-devel.])
160 AC_MSG_WARN([talloc.h not found, consider installing libtalloc-devel. Disabling cifs.upcall.])
161 enable_cifsupcall="no"
165 if test $enable_cifsupcall != "no" -o $enable_cifsidmap != "no"; then
166 AC_CHECK_HEADERS([keyutils.h], , [
167 if test "$enable_cifsupcall" = "yes"; then
168 AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
170 AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.upcall.])
171 enable_cifsupcall="no"
173 if test "$enable_cifsidmap" = "yes"; then
174 AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
176 AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.idmap.])
177 enable_cifsidmap="no"
181 if test $enable_cifsupcall != "no"; then
182 AC_CHECK_LIB([krb5], [krb5_init_context],
183 [ KRB5_LDADD='-lkrb5' ],
184 AC_MSG_ERROR([no functioning krb5 library found!]))
188 # checks for wbclient.h and libwbclient.so library
191 if test $enable_cifscreds != "no"; then
192 AC_CHECK_HEADERS([keyutils.h], , [
194 if test $enable_cifscreds = "yes"; then
195 AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
197 AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifscreds.])
198 enable_cifscreds="no"
204 # ugly, but I'm not sure how to check for functions in a library that's not in $LIBS
206 LIBS="$LIBS $KRB5_LDADD"
208 # determine whether we can use MIT's new 'krb5_auth_con_getsendsubkey' to extract the signing key
209 if test $enable_cifsupcall != "no"; then
210 AC_CHECK_FUNCS([krb5_auth_con_getsendsubkey])
213 # non-critical functions (we have workarounds for these)
214 if test $enable_cifsupcall != "no"; then
215 AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
216 AC_CHECK_FUNCS([krb5_auth_con_setaddrs krb5_auth_con_set_req_cksumtype])
219 if test $enable_systemd != "no"; then
220 AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd specific behavior for mount.cifs])
223 # MIT krb5 < 1.7 does not have this declaration but does have the symbol
224 AC_CHECK_DECLS(krb5_auth_con_set_req_cksumtype, [], [], [#include <krb5.h>])
228 AM_CONDITIONAL(CONFIG_CIFSUPCALL, [test "$enable_cifsupcall" != "no"])
229 AM_CONDITIONAL(CONFIG_CIFSCREDS, [test "$enable_cifscreds" != "no"])
230 AM_CONDITIONAL(CONFIG_CIFSIDMAP, [test "$enable_cifsidmap" != "no"])
231 AM_CONDITIONAL(CONFIG_CIFSACL, [test "$enable_cifsacl" != "no"])
235 if test "x$CAPNG_LDADD" = "x"; then