[pisa-src] r2157 - in trunk: Makefile.am configure.ac libpisa/sysdep.c libpisa/sysdep.h

  • From: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Wed, 17 Mar 2010 19:08:56 +0100

Author: gherzan
Date: Wed Mar 17 19:08:56 2010
New Revision: 2157

Log:
Rework the way HAVE_CLOCK_GETTIME was defined. It's now being done
at configure time. A new Automake conditional was added in order to
link againt librt only where it's availabe.

Modified:
   trunk/Makefile.am
   trunk/configure.ac
   trunk/libpisa/sysdep.c
   trunk/libpisa/sysdep.h

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am   Wed Mar 17 13:41:36 2010        (r2156)
+++ trunk/Makefile.am   Wed Mar 17 19:08:56 2010        (r2157)
@@ -168,8 +168,9 @@
 pisasd_pisasdconf_LDADD            = libpisa/libpisa.la
 test_checkhipd_LDADD               = libpisa/libpisa.la
 
+if HAVE_CLOCK_GETTIME
 libpisa_libpisa_la_LIBADD          = -lrt
-
+endif
 
 HEADER_OBJS = $(HEADER_LIST_EXPANDED:.h=.ho)
 

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac  Wed Mar 17 13:41:36 2010        (r2156)
+++ trunk/configure.ac  Wed Mar 17 19:08:56 2010        (r2157)
@@ -43,7 +43,13 @@
 AC_CHECK_LIB(crypto, DSA_generate_key,, [AC_MSG_ERROR([OpenSSL not found])])
 AC_CHECK_LIB(config, config_setting_index,, [AC_MSG_ERROR([libconfig not 
found])])
 AC_CHECK_LIB(pthread, pthread_create,, [AC_MSG_ERROR([libpthread not found])])
-AC_CHECK_LIB(rt, clock_gettime,, [AC_MSG_ERROR([clock_gettime not found])])
+AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime="yes")
+
+if test x"$have_clock_gettime" = x"yes" ; then
+        AC_DEFINE(HAVE_CLOCK_GETTIME)
+        AH_TEMPLATE(HAVE_CLOCK_GETTIME, [Define to 1 if clock_gettime is 
available.])
+fi
+AM_CONDITIONAL(HAVE_CLOCK_GETTIME, test x"$have_clock_gettime" = x"yes")
 
 # compile-time options
 AC_MSG_CHECKING([whether to have verbose debug])

Modified: trunk/libpisa/sysdep.c
==============================================================================
--- trunk/libpisa/sysdep.c      Wed Mar 17 13:41:36 2010        (r2156)
+++ trunk/libpisa/sysdep.c      Wed Mar 17 19:08:56 2010        (r2157)
@@ -22,6 +22,7 @@
 #include <sys/ioctl.h>
 #include <net/if.h>
 
+#include "config.h"
 #include "global.h"
 #include "sysdep.h"
 #include "util.h"

Modified: trunk/libpisa/sysdep.h
==============================================================================
--- trunk/libpisa/sysdep.h      Wed Mar 17 13:41:36 2010        (r2156)
+++ trunk/libpisa/sysdep.h      Wed Mar 17 19:08:56 2010        (r2157)
@@ -20,10 +20,9 @@
 
 #include <linux/if_tun.h>
 
-#define HAVE_CLOCK_GETTIME
-
 #endif /* __linux__ */
 
+#include "config.h"
 
 #ifndef HAVE_CLOCK_GETTIME
 

Other related posts:

  • » [pisa-src] r2157 - in trunk: Makefile.am configure.ac libpisa/sysdep.c libpisa/sysdep.h - Mircea Gherzan