libxl: only include utmp.h if it's present
authorRoger Pau Monne <roger.pau@citrix.com>
Mon, 2 Jun 2014 15:08:20 +0000 (17:08 +0200)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 18 Jun 2014 16:20:42 +0000 (17:20 +0100)
Add a configure check for utmp.h presence, and gate the usage of
utmp.h in libxl to the result of the test.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
[ ijc -- resolved minor conflict in configure.ac and reran autogen ]

tools/config.h.in
tools/configure
tools/configure.ac
tools/libxl/libxl_bootloader.c

index 180966259784ca98bcb75fe472dac29cc8d2eaec..028c36020756e6ee6018adecf1a4b808cccec6eb 100644 (file)
@@ -51,6 +51,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
+
 /* Define to 1 if you have the <valgrind/memcheck.h> header file. */
 #undef HAVE_VALGRIND_MEMCHECK_H
 
index ea7b4de00397a638e7eb0ea4e107d84aa70561cd..c3a6824f559a5da93a16741cb6530d05fdf10e71 100755 (executable)
@@ -8070,7 +8070,7 @@ fi
 esac
 
 # Checks for header files.
-for ac_header in yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h
+for ac_header in yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
index d9eab5a6293067d599f6d57881d9506169bd81a2..9db798b57a9c085e1ddc6efed2fb8cf7267492de 100644 (file)
@@ -265,7 +265,7 @@ AC_CHECK_LIB([fdt], [fdt_create], [], [AC_MSG_ERROR([Could not find libfdt])])
 esac
 
 # Checks for header files.
-AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h])
+AC_CHECK_HEADERS([yajl/yajl_version.h sys/eventfd.h valgrind/memcheck.h utmp.h])
 
 AC_OUTPUT()
 
index 3287bf77da9a64327736e6bf923608e0c2bb3a52..c3ec782c1408968894b0d54039e7ab0c1e6b4c22 100644 (file)
@@ -15,7 +15,9 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 
 #include <termios.h>
+#ifdef HAVE_UTMP_H
 #include <utmp.h>
+#endif
 
 #ifdef INCLUDE_LIBUTIL_H
 #include INCLUDE_LIBUTIL_H