compile sysinfo.c only if sysinfo fct exist (does not exist on freebsd)
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 30 Nov 2011 01:46:18 +0000 (01:46 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 30 Nov 2011 01:46:18 +0000 (01:46 +0000)
config.h.in
configure
configure.ac
src/server/Makefile.am
src/server/Makefile.in

index 1e799c2..37e9a4e 100644 (file)
 /* Define to 1 if you have the `strtol' function. */
 #undef HAVE_STRTOL
 
-/* Define to 1 if you have the `sysinfo' function. */
-#undef HAVE_SYSINFO
+/* Use sysinfo */
+#undef HAVE_SYSINFO_FCT
 
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
index fc841b0..a0ef872 100755 (executable)
--- a/configure
+++ b/configure
@@ -682,6 +682,8 @@ GMSGFMT
 MSGFMT
 GETTEXT_MACRO_VERSION
 USE_NLS
+SYSINFO_FCT_FALSE
+SYSINFO_FCT_TRUE
 LIBOBJS
 EGREP
 GREP
@@ -4818,7 +4820,7 @@ $as_echo "#define realloc rpl_realloc" >>confdefs.h
 fi
 
 
-for ac_func in gettimeofday memmove socket strdup strtol sysinfo
+for ac_func in gettimeofday memmove socket strdup strtol
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -4831,6 +4833,26 @@ fi
 done
 
 
+SYSINFO_FCT=
+ac_fn_c_check_func "$LINENO" "sysinfo" "ac_cv_func_sysinfo"
+if test "x$ac_cv_func_sysinfo" = xyes; then :
+  SYSINFO_FCT='1'
+$as_echo "#define HAVE_SYSINFO_FCT 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"sysinfo function not present\"" >&5
+$as_echo "$as_me: WARNING: \"sysinfo function not present\"" >&2;}
+fi
+
+ if test -n "$SYSINFO_FCT"; then
+  SYSINFO_FCT_TRUE=
+  SYSINFO_FCT_FALSE='#'
+else
+  SYSINFO_FCT_TRUE='#'
+  SYSINFO_FCT_FALSE=
+fi
+
+
 
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
@@ -8723,6 +8745,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${SYSINFO_FCT_TRUE}" && test -z "${SYSINFO_FCT_FALSE}"; then
+  as_fn_error $? "conditional \"SYSINFO_FCT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GTK_TRUE}" && test -z "${GTK_FALSE}"; then
   as_fn_error $? "conditional \"GTK\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
index f25d92b..12d201e 100644 (file)
@@ -27,7 +27,13 @@ AC_TYPE_SSIZE_T
 # Checks for library functions.
 AC_FUNC_MALLOC
 AC_FUNC_REALLOC
-AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol sysinfo])
+AC_CHECK_FUNCS([gettimeofday memmove socket strdup strtol])
+
+SYSINFO_FCT=
+AC_CHECK_FUNC(sysinfo,
+             [SYSINFO_FCT='1' AC_DEFINE([HAVE_SYSINFO_FCT],[1],[Use sysinfo])],
+              [AC_MSG_WARN("sysinfo function not present")])
+AM_CONDITIONAL(SYSINFO_FCT, test -n "$SYSINFO_FCT")
 
 AM_GNU_GETTEXT_VERSION([0.16])
 AM_GNU_GETTEXT([external])
index 9ab2c10..2ea35c0 100644 (file)
@@ -19,10 +19,16 @@ LIBS = \
 if GTOP
 AM_CPPFLAGS += $(GTOP_CFLAGS)
 LIBS += $(GTOP_LIBS) 
-psensor_server_SOURCES += sysinfo.h sysinfo.c
 AM_LDFLAGS = -Wl,--as-needed
+
+if SYSINFO_FCT
+psensor_server_SOURCES += sysinfo.h sysinfo.c
 endif
 
+endif
+
+
+
 
 
 dist_man_MANS =  psensor-server.1
index ca6c408..8a0de61 100644 (file)
@@ -37,7 +37,7 @@ host_triplet = @host@
 bin_PROGRAMS = psensor-server$(EXEEXT)
 @GTOP_TRUE@am__append_1 = $(GTOP_CFLAGS)
 @GTOP_TRUE@am__append_2 = $(GTOP_LIBS) 
-@GTOP_TRUE@am__append_3 = sysinfo.h sysinfo.c
+@GTOP_TRUE@@SYSINFO_FCT_TRUE@am__append_3 = sysinfo.h sysinfo.c
 subdir = src/server
 DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in
@@ -53,7 +53,7 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
 PROGRAMS = $(bin_PROGRAMS)
 am__psensor_server_SOURCES_DIST = server.c server.h sysinfo.h \
        sysinfo.c
-@GTOP_TRUE@am__objects_1 = sysinfo.$(OBJEXT)
+@GTOP_TRUE@@SYSINFO_FCT_TRUE@am__objects_1 = sysinfo.$(OBJEXT)
 am_psensor_server_OBJECTS = server.$(OBJEXT) $(am__objects_1)
 psensor_server_OBJECTS = $(am_psensor_server_OBJECTS)
 psensor_server_LDADD = $(LDADD)