From: Dmitry Eremin-Solenikov <dmitry.ereminsoleni...@linaro.org>

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsoleni...@linaro.org>
---
/** Email created from pull request 45 (lumag:m4)
 ** https://github.com/Linaro/odp/pull/45
 ** Patch: https://github.com/Linaro/odp/pull/45.patch
 ** Base sha: e6be64e01589f1aa335ea178e8314bf35ad34847
 ** Merge commit sha: 6f335855aeda94f83296fb7e0d08b293ea4121db
 **/
 configure.ac                           | 2 --
 pkgconfig/libodp-linux.pc.in           | 2 +-
 platform/linux-generic/Makefile.am     | 1 +
 platform/linux-generic/m4/configure.m4 | 1 +
 platform/linux-generic/m4/odp_timer.m4 | 8 ++++++++
 5 files changed, 11 insertions(+), 3 deletions(-)
 create mode 100644 platform/linux-generic/m4/odp_timer.m4

diff --git a/configure.ac b/configure.ac
index d0766f6c..5bf33270 100644
--- a/configure.ac
+++ b/configure.ac
@@ -332,8 +332,6 @@ AC_CONFIG_FILES([Makefile
                 pkgconfig/libodphelper.pc
                 ])
 
-AC_SEARCH_LIBS([timer_create],[rt posix4])
-
 ##########################################################################
 # distribute the changed variables among the Makefiles
 
diff --git a/pkgconfig/libodp-linux.pc.in b/pkgconfig/libodp-linux.pc.in
index 172e8d09..fb749dad 100644
--- a/pkgconfig/libodp-linux.pc.in
+++ b/pkgconfig/libodp-linux.pc.in
@@ -7,5 +7,5 @@ Name: libodp-linux
 Description: The ODP packet processing engine
 Version: @PKGCONFIG_VERSION@
 Libs: -L${libdir} -lodp-linux @DPDK_LIBS@
-Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_PMDS@ @DPDK_LIBS@ @PCAP_LIBS@ 
@PTHREAD_LIBS@ -lrt -lpthread
+Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_PMDS@ @DPDK_LIBS@ @PCAP_LIBS@ 
@PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread
 Cflags: -I${includedir}
diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index 616045bc..067b5e07 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -225,6 +225,7 @@ __LIB__libodp_linux_la_SOURCES = \
 __LIB__libodp_linux_la_LIBADD = $(OPENSSL_LIBS)
 __LIB__libodp_linux_la_LIBADD += $(DPDK_LIBS) $(DPDK_PMDS)
 __LIB__libodp_linux_la_LIBADD += $(PTHREAD_LIBS)
+__LIB__libodp_linux_la_LIBADD += $(TIMER_LIBS)
 
 if HAVE_PCAP
 __LIB__libodp_linux_la_SOURCES += pktio/pcap.c
diff --git a/platform/linux-generic/m4/configure.m4 
b/platform/linux-generic/m4/configure.m4
index a2a25408..c6d79b8c 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -29,6 +29,7 @@ AC_LINK_IFELSE(
     exit -1)
 
 m4_include([platform/linux-generic/m4/odp_pthread.m4])
+m4_include([platform/linux-generic/m4/odp_timer.m4])
 m4_include([platform/linux-generic/m4/odp_openssl.m4])
 m4_include([platform/linux-generic/m4/odp_pcap.m4])
 m4_include([platform/linux-generic/m4/odp_netmap.m4])
diff --git a/platform/linux-generic/m4/odp_timer.m4 
b/platform/linux-generic/m4/odp_timer.m4
new file mode 100644
index 00000000..3122c92b
--- /dev/null
+++ b/platform/linux-generic/m4/odp_timer.m4
@@ -0,0 +1,8 @@
+##########################################################################
+# Check for POSIX timer functions
+##########################################################################
+
+AC_CHECK_LIB([rt], [timer_create], [TIMER_LIBS="-lrt"],
+            [AC_CHECK_LIB([posix4], [timer_create], [TIMER_LIBS="-lposix4"],
+                          [AC_MSG_FAILURE([timer_create not found])])])
+AC_SUBST([TIMER_LIBS])

Reply via email to