autoconf: bump release to 5.2.1 for interim builds
[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.2.1], [cifs-utils@samba.org], [cifs-utils], [http://linux-cifs.samba.org/cifs-utils/])
5 AC_CONFIG_SRCDIR([replace.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_FILES([Makefile])
8 AC_CONFIG_MACRO_DIR(aclocal)
9
10 AM_INIT_AUTOMAKE
11
12 # "with" 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=no@:>@])],
22         enable_cifscreds=$enableval,
23         enable_cifscreds="no")
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 # Checks for programs.
38 AC_PROG_CC
39 AC_PROG_SED
40 AC_GNU_SOURCE
41
42 # Checks for typedefs, structures, and compiler characteristics.
43 AC_HEADER_STDBOOL
44 AC_TYPE_UID_T
45 AC_TYPE_OFF_T
46 AC_TYPE_PID_T
47 AC_TYPE_SIZE_T
48 AC_CHECK_TYPES([ptrdiff_t, ssize_t, uint32_t, uint8_t])
49
50 # Checks for library functions.
51 AC_FUNC_GETMNTENT
52 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
53 AC_FUNC_MALLOC
54 AC_FUNC_REALLOC
55 AC_FUNC_STRNLEN
56
57 # check for required functions
58 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])])
59
60 AC_CHECK_FUNCS(clock_gettime, [], [
61   AC_CHECK_LIB(rt, clock_gettime, [
62       AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
63         AC_DEFINE(HAVE_CLOCK_GETTIME,1,
64                 [Whether the clock_gettime func is there])
65       LIBS="$LIBS -lrt"
66         ])
67   ])
68
69 # Checks for header files.
70 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])])
71
72 if test $enable_cifsupcall != "no"; then
73         AC_CHECK_HEADERS([krb5.h krb5/krb5.h])
74         if test x$ac_cv_header_krb5_krb5_h != xyes ; then
75                 if test x$ac_cv_header_krb5_h != xyes ; then
76                         if test "$enable_cifsupcall" = "yes"; then
77                                 AC_MSG_ERROR([krb5.h not found, consider installing krb5-libs-devel.])
78                         else
79                                 AC_MSG_WARN([krb5.h not found, consider installing krb5-libs-devel. Disabling cifs.upcall.])
80                                 enable_cifsupcall="no"
81                         fi
82                 fi
83         fi
84 fi
85 if test $enable_cifsupcall != "no"; then
86         if test x$ac_cv_header_krb5_krb5_h = xyes ; then
87                 krb5_include="#include <krb5/krb5.h>"
88         fi
89         if test x$ac_cv_header_krb5_h = xyes ; then
90                 krb5_include="#include <krb5.h>"
91         fi
92
93         AC_CACHE_CHECK([for keyvalue in krb5_keyblock],
94                 [ac_cv_have_krb5_keyblock_keyvalue],[
95                         AC_TRY_COMPILE([$krb5_include],
96                         [krb5_keyblock key; key.keyvalue.data = NULL;],
97                         ac_cv_have_krb5_keyblock_keyvalue=yes,
98                         ac_cv_have_krb5_keyblock_keyvalue=no)])
99         if test x"$ac_cv_have_krb5_keyblock_keyvalue" = x"yes" ; then
100                 AC_DEFINE(HAVE_KRB5_KEYBLOCK_KEYVALUE,1,
101                         [Whether the krb5_keyblock struct has a keyvalue property])
102         fi
103 fi
104 if test $enable_cifsupcall != "no"; then
105         AC_CHECK_HEADERS([talloc.h], , [
106                                 if test "$enable_cifsupcall" = "yes"; then
107                                         AC_MSG_ERROR([talloc.h not found, consider installing libtalloc-devel.])
108                                 else
109                                         AC_MSG_WARN([talloc.h not found, consider installing libtalloc-devel. Disabling cifs.upcall.])
110                                         enable_cifsupcall="no"
111                                 fi
112                         ])
113 fi
114 if test $enable_cifsupcall != "no" -o $enable_cifsidmap != "no"; then
115         AC_CHECK_HEADERS([keyutils.h], , [
116                                 if test "$enable_cifsupcall" = "yes"; then
117                                         AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
118                                 else
119                                         AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.upcall.])
120                                         enable_cifsupcall="no"
121                                 fi
122                                 if test "$enable_cifsidmap" = "yes"; then
123                                         AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
124                                 else
125                                         AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.idmap.])
126                                         enable_cifsidmap="no"
127                                 fi
128                         ])
129 fi
130 if test $enable_cifsacl != "no"; then
131         AC_CHECK_HEADERS([wbclient.h], , [
132                                 if test "$enable_cifsacl" = "yes"; then
133                                         AC_MSG_ERROR([wbclient.h not found, consider installing libwbclient-devel.])
134                                 else
135                                         AC_MSG_WARN([wbclient.h not found, consider installing libwbclient-devel. Disabling getcifsacl.])
136                                         enable_cifsacl="no"
137                                 fi
138                         ],
139                         [AC_INCLUDES_DEFAULT]
140                         [#ifdef HAVE_STDBOOL_H
141                             #include <stdbool.h>
142                             #endif
143                         ])
144 fi
145 if test $enable_cifsupcall != "no"; then
146         AC_CHECK_LIB([krb5], [krb5_init_context],
147                         [ KRB5_LDADD='-lkrb5' ],
148                         AC_MSG_ERROR([no functioning krb5 library found!]))
149         AC_SUBST(KRB5_LDADD)
150 fi
151
152 # checks for wbclient.h and libwbclient.so library
153 AC_TEST_WBCHL
154
155 if test $enable_cifscreds = "yes"; then
156         AC_CHECK_HEADERS([keyutils.h], , [AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])])
157 fi
158
159
160 # ugly, but I'm not sure how to check for functions in a library that's not in $LIBS
161 cu_saved_libs=$LIBS
162 LIBS="$LIBS $KRB5_LDADD"
163
164 # determine whether we can use MIT's new 'krb5_auth_con_getsendsubkey' to extract the signing key
165 if test $enable_cifsupcall != "no"; then
166         AC_CHECK_FUNCS([krb5_auth_con_getsendsubkey])
167 fi
168
169 # non-critical functions (we have workarounds for these)
170 if test $enable_cifsupcall != "no"; then
171         AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
172         AC_CHECK_FUNCS([krb5_auth_con_setaddrs krb5_auth_con_set_req_cksumtype])
173 fi
174
175 LIBS=$cu_saved_libs
176
177 AM_CONDITIONAL(CONFIG_CIFSUPCALL, [test "$enable_cifsupcall" != "no"])
178 AM_CONDITIONAL(CONFIG_CIFSCREDS, [test "$enable_cifscreds" = "yes"])
179 AM_CONDITIONAL(CONFIG_CIFSIDMAP, [test "$enable_cifsidmap" != "no"])
180 AM_CONDITIONAL(CONFIG_CIFSACL, [test "$enable_cifsacl" != "no"])
181
182 LIBCAP_NG_PATH
183
184 if test "x$CAPNG_LDADD" = "x"; then
185         AC_LIBCAP
186 fi
187 AC_OUTPUT