2 # Process this file with autoconf to produce a configure script.
4 AC_INIT([cifs-utils], [6.0.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")
56 AC_ARG_WITH(idmap-plugin,
57 [AC_HELP_STRING([--with-idmap-plugin=/path/to/plugin],
58 [Define the path to the plugin that the idmapping infrastructure should use @<:@default=/etc/cifs-utils/idmap-plugin@:>@])],
60 pluginpath="/etc/cifs-utils/idmap-plugin")
61 AC_DEFINE_UNQUOTED(IDMAP_PLUGIN_PATH, "$pluginpath", [Location of plugin that ID mapping infrastructure should use. (usually a symlink to real plugin)])
62 AC_SUBST([pluginpath])
64 # check for ROOTSBINDIR environment var
65 if test -z $ROOTSBINDIR; then
70 AC_ARG_VAR(ROOTSBINDIR, [Location where files ordinarily under /sbin should be installed. Note: unaffected by --prefix. @<:@default=/sbin@:>@])
72 # Checks for programs.
77 # AC_PROG_SED is only avaliable in recent autoconf versions.
78 # Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
81 [AC_CHECK_PROG(SED, sed, sed)])
83 # Checks for typedefs, structures, and compiler characteristics.
89 AC_CHECK_TYPES([ptrdiff_t, ssize_t, uint32_t, uint8_t])
91 # Checks for library functions.
93 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
98 # check for required functions
99 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])])
101 AC_CHECK_FUNCS(clock_gettime, [], [
102 AC_CHECK_LIB(rt, clock_gettime, [
103 AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
104 AC_DEFINE(HAVE_CLOCK_GETTIME,1,
105 [Whether the clock_gettime func is there])
111 # Checks for header files.
112 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])])
114 # do we have sys/fsuid.h and setfsuid()?
115 AC_CHECK_HEADERS([sys/fsuid.h])
116 AC_CHECK_FUNC(setfsuid, , [AC_MSG_ERROR([System does not support setfsuid()])])
118 # FIXME: add test(s) to autodisable these flags when compiler/linker don't support it
119 if test $enable_pie != "no"; then
120 PIE_CFLAGS="-fpie -pie"
124 AC_SUBST([PIE_CFLAGS])
126 if test $enable_relro != "no"; then
127 RELRO_CFLAGS="-Wl,-z,relro,-z,now"
131 AC_SUBST([RELRO_CFLAGS])
133 if test $enable_cifsupcall != "no"; then
134 AC_CHECK_HEADERS([krb5.h krb5/krb5.h])
135 if test x$ac_cv_header_krb5_krb5_h != xyes ; then
136 if test x$ac_cv_header_krb5_h != xyes ; then
137 if test "$enable_cifsupcall" = "yes"; then
138 AC_MSG_ERROR([krb5.h not found, consider installing krb5-libs-devel.])
140 AC_MSG_WARN([krb5.h not found, consider installing krb5-libs-devel. Disabling cifs.upcall.])
141 enable_cifsupcall="no"
146 if test $enable_cifsupcall != "no"; then
147 if test x$ac_cv_header_krb5_krb5_h = xyes ; then
148 krb5_include="#include <krb5/krb5.h>"
150 if test x$ac_cv_header_krb5_h = xyes ; then
151 krb5_include="#include <krb5.h>"
154 AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
155 [ac_cv_have_krb5_keyblock_keyvalue],[
156 AC_TRY_COMPILE([$krb5_include],
157 [krb5_keyblock key; key.keyvalue.data = NULL;],
158 ac_cv_have_krb5_keyblock_keyvalue=yes,
159 ac_cv_have_krb5_keyblock_keyvalue=no)])
160 if test x"$ac_cv_have_krb5_keyblock_keyvalue" = x"yes" ; then
161 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
162 [Whether the krb5_keyblock struct has a keyvalue property])
165 if test $enable_cifsupcall != "no"; then
166 AC_CHECK_HEADERS([talloc.h], , [
167 if test "$enable_cifsupcall" = "yes"; then
168 AC_MSG_ERROR([talloc.h not found, consider installing libtalloc-devel.])
170 AC_MSG_WARN([talloc.h not found, consider installing libtalloc-devel. Disabling cifs.upcall.])
171 enable_cifsupcall="no"
175 if test $enable_cifsupcall != "no" -o $enable_cifsidmap != "no"; then
176 AC_CHECK_HEADERS([keyutils.h], , [
177 if test "$enable_cifsupcall" = "yes"; then
178 AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
180 AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.upcall.])
181 enable_cifsupcall="no"
183 if test "$enable_cifsidmap" = "yes"; then
184 AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
186 AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.idmap.])
187 enable_cifsidmap="no"
191 if test $enable_cifsupcall != "no"; then
192 AC_CHECK_LIB([krb5], [krb5_init_context],
193 [ KRB5_LDADD='-lkrb5' ],
194 AC_MSG_ERROR([no functioning krb5 library found!]))
198 # checks for wbclient.h and libwbclient.so library
201 # test for presence of WBC_ID_TYPE_BOTH enum value
202 AC_TEST_WBC_IDMAP_BOTH
204 if test $enable_cifscreds != "no"; then
205 AC_CHECK_HEADERS([keyutils.h], , [
207 if test $enable_cifscreds = "yes"; then
208 AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
210 AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifscreds.])
211 enable_cifscreds="no"
217 # ugly, but I'm not sure how to check for functions in a library that's not in $LIBS
219 LIBS="$LIBS $KRB5_LDADD"
221 # determine whether we can use MIT's new 'krb5_auth_con_getsendsubkey' to extract the signing key
222 if test $enable_cifsupcall != "no"; then
223 AC_CHECK_FUNCS([krb5_auth_con_getsendsubkey])
226 # non-critical functions (we have workarounds for these)
227 if test $enable_cifsupcall != "no"; then
228 AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
229 AC_CHECK_FUNCS([krb5_auth_con_setaddrs krb5_auth_con_set_req_cksumtype])
232 if test $enable_systemd != "no"; then
233 AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd specific behavior for mount.cifs])
236 # MIT krb5 < 1.7 does not have this declaration but does have the symbol
237 AC_CHECK_DECLS(krb5_auth_con_set_req_cksumtype, [], [], [#include <krb5.h>])
241 AM_CONDITIONAL(CONFIG_CIFSUPCALL, [test "$enable_cifsupcall" != "no"])
242 AM_CONDITIONAL(CONFIG_CIFSCREDS, [test "$enable_cifscreds" != "no"])
243 AM_CONDITIONAL(CONFIG_CIFSIDMAP, [test "$enable_cifsidmap" != "no"])
244 AM_CONDITIONAL(CONFIG_CIFSACL, [test "$enable_cifsacl" != "no"])
245 AM_CONDITIONAL(CONFIG_PLUGIN, [test "$enable_cifsidmap" != "no" -o "$enable_cifsacl" != "no"])
249 if test "x$CAPNG_LDADD" = "x"; then