cifs.upcall: missing prototype for krb5_auth_con_set_req_cksumtype in MIT
[jlayton/cifs-utils.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_INIT([cifs-utils], [5.4.1], [cifs-utils@samba.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)
9
10 AM_INIT_AUTOMAKE
11
12 # "enable" options
13 AC_ARG_ENABLE(cifsupcall,
14         [AC_HELP_STRING([--enable-cifsupcall],
15                         [Create cifs.upcall binary @<:@default=yes@:>@])],
16         enable_cifsupcall=$enableval,
17         enable_cifsupcall="maybe")
18
19 AC_ARG_ENABLE(cifscreds,
20         [AC_HELP_STRING([--enable-cifscreds],
21                         [Create cifscreds utility @<:@default=yes@:>@])],
22         enable_cifscreds=$enableval,
23         enable_cifscreds="maybe")
24
25 AC_ARG_ENABLE(cifsidmap,
26         [AC_HELP_STRING([--enable-cifsidmap],
27                         [Create cifs.idmap binary @<:@default=yes@:>@])],
28         enable_cifsidmap=$enableval,
29         enable_cifsidmap="maybe")
30
31 AC_ARG_ENABLE(cifsacl,
32         [AC_HELP_STRING([--enable-cifsacl],
33                         [Create get/set cifsacl binary @<:@default=yes@:>@])],
34         enable_cifsacl=$enableval,
35         enable_cifsacl="maybe")
36
37 # check for ROOTSBINDIR environment var
38 if test -z $ROOTSBINDIR; then
39         ROOTSBINDIR="/sbin"
40         export ROOTSBINDIR
41 fi
42
43 AC_ARG_VAR(ROOTSBINDIR, [Location where files ordinarily under /sbin should be installed. Note: unaffected by --prefix. @<:@default=/sbin@:>@])
44
45 # Checks for programs.
46 AC_PROG_CC
47 AC_PROG_SED
48 AC_GNU_SOURCE
49 AM_PROG_CC_C_O
50
51 # Checks for typedefs, structures, and compiler characteristics.
52 AC_HEADER_STDBOOL
53 AC_TYPE_UID_T
54 AC_TYPE_OFF_T
55 AC_TYPE_PID_T
56 AC_TYPE_SIZE_T
57 AC_CHECK_TYPES([ptrdiff_t, ssize_t, uint32_t, uint8_t])
58
59 # Checks for library functions.
60 AC_FUNC_GETMNTENT
61 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
62 AC_FUNC_MALLOC
63 AC_FUNC_REALLOC
64 AC_FUNC_STRNLEN
65
66 # check for required functions
67 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])])
68
69 AC_CHECK_FUNCS(clock_gettime, [], [
70   AC_CHECK_LIB(rt, clock_gettime, [
71       AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
72         AC_DEFINE(HAVE_CLOCK_GETTIME,1,
73                 [Whether the clock_gettime func is there])
74       LIBS="$LIBS -lrt"
75         ])
76   ])
77
78 # Checks for header files.
79 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])])
80
81 # do we have sys/fsuid.h and setfsuid()?
82 AC_CHECK_HEADERS([sys/fsuid.h])
83 AC_CHECK_FUNC(setfsuid, , [AC_MSG_ERROR([System does not support setfsuid()])])
84
85 if test $enable_cifsupcall != "no"; then
86         AC_CHECK_HEADERS([krb5.h krb5/krb5.h])
87         if test x$ac_cv_header_krb5_krb5_h != xyes ; then
88                 if test x$ac_cv_header_krb5_h != xyes ; then
89                         if test "$enable_cifsupcall" = "yes"; then
90                                 AC_MSG_ERROR([krb5.h not found, consider installing krb5-libs-devel.])
91                         else
92                                 AC_MSG_WARN([krb5.h not found, consider installing krb5-libs-devel. Disabling cifs.upcall.])
93                                 enable_cifsupcall="no"
94                         fi
95                 fi
96         fi
97 fi
98 if test $enable_cifsupcall != "no"; then
99         if test x$ac_cv_header_krb5_krb5_h = xyes ; then
100                 krb5_include="#include <krb5/krb5.h>"
101         fi
102         if test x$ac_cv_header_krb5_h = xyes ; then
103                 krb5_include="#include <krb5.h>"
104         fi
105
106         AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
107                 [ac_cv_have_krb5_keyblock_keyvalue],[
108                         AC_TRY_COMPILE([$krb5_include],
109                         [krb5_keyblock key; key.keyvalue.data = NULL;],
110                         ac_cv_have_krb5_keyblock_keyvalue=yes,
111                         ac_cv_have_krb5_keyblock_keyvalue=no)])
112         if test x"$ac_cv_have_krb5_keyblock_keyvalue" = x"yes" ; then
113                 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
114                         [Whether the krb5_keyblock struct has a keyvalue property])
115         fi
116 fi
117 if test $enable_cifsupcall != "no"; then
118         AC_CHECK_HEADERS([talloc.h], , [
119                                 if test "$enable_cifsupcall" = "yes"; then
120                                         AC_MSG_ERROR([talloc.h not found, consider installing libtalloc-devel.])
121                                 else
122                                         AC_MSG_WARN([talloc.h not found, consider installing libtalloc-devel. Disabling cifs.upcall.])
123                                         enable_cifsupcall="no"
124                                 fi
125                         ])
126 fi
127 if test $enable_cifsupcall != "no" -o $enable_cifsidmap != "no"; then
128         AC_CHECK_HEADERS([keyutils.h], , [
129                                 if test "$enable_cifsupcall" = "yes"; then
130                                         AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
131                                 else
132                                         AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.upcall.])
133                                         enable_cifsupcall="no"
134                                 fi
135                                 if test "$enable_cifsidmap" = "yes"; then
136                                         AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
137                                 else
138                                         AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.idmap.])
139                                         enable_cifsidmap="no"
140                                 fi
141                         ])
142 fi
143 if test $enable_cifsupcall != "no"; then
144         AC_CHECK_LIB([krb5], [krb5_init_context],
145                         [ KRB5_LDADD='-lkrb5' ],
146                         AC_MSG_ERROR([no functioning krb5 library found!]))
147         AC_SUBST(KRB5_LDADD)
148 fi
149
150 # checks for wbclient.h and libwbclient.so library
151 AC_TEST_WBCHL
152
153 if test $enable_cifscreds != "no"; then
154         AC_CHECK_HEADERS([keyutils.h], , [
155
156                                 if test $enable_cifscreds = "yes"; then
157                                         AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
158                                 else
159                                         AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifscreds.])
160                                         enable_cifscreds="no"
161                                 fi
162                         ])
163 fi
164
165
166 # ugly, but I'm not sure how to check for functions in a library that's not in $LIBS
167 cu_saved_libs=$LIBS
168 LIBS="$LIBS $KRB5_LDADD"
169
170 # determine whether we can use MIT's new 'krb5_auth_con_getsendsubkey' to extract the signing key
171 if test $enable_cifsupcall != "no"; then
172         AC_CHECK_FUNCS([krb5_auth_con_getsendsubkey])
173 fi
174
175 # non-critical functions (we have workarounds for these)
176 if test $enable_cifsupcall != "no"; then
177         AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
178         AC_CHECK_FUNCS([krb5_auth_con_setaddrs krb5_auth_con_set_req_cksumtype])
179 fi
180
181 # MIT krb5 < 1.7 does not have this declaration but does have the symbol
182 AC_CHECK_DECLS(krb5_auth_con_set_req_cksumtype, [], [], [#include <krb5.h>])
183
184 LIBS=$cu_saved_libs
185
186 AM_CONDITIONAL(CONFIG_CIFSUPCALL, [test "$enable_cifsupcall" != "no"])
187 AM_CONDITIONAL(CONFIG_CIFSCREDS, [test "$enable_cifscreds" != "no"])
188 AM_CONDITIONAL(CONFIG_CIFSIDMAP, [test "$enable_cifsidmap" != "no"])
189 AM_CONDITIONAL(CONFIG_CIFSACL, [test "$enable_cifsacl" != "no"])
190
191 LIBCAP_NG_PATH
192
193 if test "x$CAPNG_LDADD" = "x"; then
194         AC_LIBCAP
195 fi
196 AC_OUTPUT