autotools: make cifs.upcall dependent on an enable option
authorJeff Layton <jlayton@redhat.com>
Tue, 9 Mar 2010 03:06:46 +0000 (22:06 -0500)
committerJeff Layton <jlayton@redhat.com>
Tue, 9 Mar 2010 03:06:46 +0000 (22:06 -0500)
Make it so that cifs.upcall is built by default, but autodisable it if
the needed headers aren't present.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Makefile.am
configure.ac

index 84378ab2fb5960e598fbb3af1f9132300dd66156..fea8bdcecf57885c5ac040b2e90a307952d97fd8 100644 (file)
@@ -3,8 +3,12 @@ root_sbindir = "/sbin"
 root_sbin_PROGRAMS = mount.cifs
 mount_cifs_SOURCES = mount.cifs.c mtab.c util.c
 
+man_MANS = mount.cifs.8
+
+if CONFIG_CIFSUPCALL
 sbin_PROGRAMS = cifs.upcall
 cifs_upcall_SOURCES = cifs.upcall.c data_blob.c asn1.c spnego.c util.c
 cifs_upcall_LDADD = -ltalloc -lkrb5 -lkeyutils
+man_MANS += cifs.upcall.8
+endif
 
-man_MANS = cifs.upcall.8 mount.cifs.8
index 10f7f07ab6bf10fe8d6de48323d9ff9ab3a092e2..4048549698c6a5efde36b0dc74fbb54595982f7a 100644 (file)
@@ -8,6 +8,13 @@ AC_CONFIG_FILES([Makefile])
 
 AM_INIT_AUTOMAKE([cifs-utils], [4.0])
 
+# "with" options
+AC_ARG_ENABLE(cifsupcall,
+       [AC_HELP_STRING([--enable-cifsupcall],
+                       [Create cifs.upcall binary @<:@default=yes@:>@])],
+       enable_cifsupcall=$enableval,
+       enable_cifsupcall="maybe")
+
 # Checks for programs.
 AC_PROG_CC
 AC_GNU_SOURCE
@@ -16,9 +23,37 @@ AC_GNU_SOURCE
 
 # Checks for header files.
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h mntent.h netdb.h stddef.h stdint.h stdlib.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])])
-AC_CHECK_HEADERS([talloc.h], , [AC_MSG_ERROR([talloc.h not found, install libtalloc-devel])])
-AC_CHECK_HEADERS([krb5/krb5.h], , [AC_MSG_ERROR([krb5/krb5.h not found, install krb5-devel])])
-AC_CHECK_HEADERS([keyutils.h], , [AC_MSG_ERROR([keyutils.h not found, install keyutils-libs-devel])])
+
+if test $enable_cifsupcall != "no"; then
+       AC_CHECK_HEADERS([krb5/krb5.h], ,[
+                               if test "$enable_cifsupcall" = "yes"; then
+                                       AC_MSG_ERROR([krb5/krb5.h not found, consider installing krb5-libs-devel.])
+                               else
+                                       AC_MSG_WARN([krb5/krb5.h not found, consider installing krb5-libs-devel. Disabling cifs.upcall.])
+                                       enable_cifsupcall="no"
+                               fi
+                       ])
+fi
+if test $enable_cifsupcall != "no"; then
+       AC_CHECK_HEADERS([talloc.h], , [
+                               if test "$enable_cifsupcall" = "yes"; then
+                                       AC_MSG_ERROR([talloc.h not found, consider installing libtalloc-devel.])
+                               else
+                                       AC_MSG_WARN([talloc.h not found, consider installing libtalloc-devel. Disabling cifs.upcall.])
+                                       enable_cifsupcall="no"
+                               fi
+                       ])
+fi
+if test $enable_cifsupcall != "no"; then
+       AC_CHECK_HEADERS([keyutils.h], , [
+                               if test "$enable_cifsupcall" = "yes"; then
+                                       AC_MSG_ERROR([keyutils.h not found, consider installing keyutils-libs-devel.])
+                               else
+                                       AC_MSG_WARN([keyutils.h not found, consider installing keyutils-libs-devel. Disabling cifs.upcall.])
+                                       enable_cifsupcall="no"
+                               fi
+                       ])
+fi
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -39,6 +74,10 @@ AC_FUNC_STRNLEN
 AC_CHECK_FUNCS([alarm atexit endpwent getmntent getpass gettimeofday inet_ntop memset realpath setenv strchr strdup strerror strncasecmp strndup strpbrk strrchr strstr strtol strtoul uname], , [AC_MSG_ERROR([necessary functions(s) not found])])
 
 # non-critical functions (we have workarounds for these)
-AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
+if test $enable_cifsupcall != "no"; then
+       AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name])
+fi
+
+AM_CONDITIONAL(CONFIG_CIFSUPCALL, [test "$enable_cifsupcall" != "no"])
 
 AC_OUTPUT