summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeale Ferguson <neale@sinenomine.net>2011-01-12 09:22:25 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-01-12 09:22:25 +0100
commit70513871082462c957e46986040ebe7b10d64557 (patch)
treee3ac79e6604f3b8b679df7deca54e7e0bbf8cf9c
parent725ebce13ca7871002063c4a254bf532d35ee878 (diff)
Support dynamic generation of C preprocessor definitions for PGM rather than hardcoding them.
Signed-off-by: Neale Ferguson <neale@sinenomine.net>
-rw-r--r--AUTHORS1
-rw-r--r--configure.in59
-rw-r--r--src/Makefile.am14
-rw-r--r--src/clock.cpp5
4 files changed, 60 insertions, 19 deletions
diff --git a/AUTHORS b/AUTHORS
index 3943d94..0c3276b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -40,6 +40,7 @@ McClain Looney <m@loonsoft.com>
Mikael Helbo Kjaer <mhk@designtech.dk>
Mikko Koppanen <mkoppanen@php.net>
Min Ragan-Kelley <benjaminrk@gmail.com>
+Neale Ferguson <neale@sinenomine.net>
Nir Soffer <nirsof@gmail.com>
Pavel Gushcha <pavimus@gmail.com>
Pavol Malosek <malosek@fastmq.com>
diff --git a/configure.in b/configure.in
index 9c03518..a201919 100644
--- a/configure.in
+++ b/configure.in
@@ -283,7 +283,7 @@ if test "x$with_pgm_ext" != "xno"; then
AC_MSG_CHECKING([if the PGM extension is supported on this platform])
# OpenPGM is only supported by the vendor on x86, AMD64, and SPARC platforms...
case "${host_cpu}" in
- i*86|x86_64|amd64|*sparc*)
+ i*86|x86_64|amd64|*sparc*|s390*)
# Supported
;;
*)
@@ -315,7 +315,7 @@ if test "x$with_pgm_ext" != "xno"; then
;;
esac
- # Gzip, Perl and Python are required duing PGM build
+ # Gzip, Perl and Python are required during PGM build
AC_CHECK_PROG(ac_zmq_have_gzip, gzip, yes, no)
if test "x$ac_zmq_have_gzip" != "xyes"; then
AC_MSG_ERROR([gzip is required for building the PGM extension.])
@@ -366,15 +366,62 @@ AC_LANG_POP([C++])
AM_CONDITIONAL(BUILD_PGM, test "x$ac_zmq_pgm_ext" = "xyes")
AM_CONDITIONAL(ON_MINGW, test "x$ac_zmq_on_mingw32" = "xyes")
+# Checks for library functions.
+AC_TYPE_SIGNAL
+AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
+AC_CHECK_HEADERS([alloca.h])
+
+if test "x$with_pgm_ext" != "xno"; then
+
+ # Check additional functions for PGM build
+ AC_CHECK_FUNCS(poll epoll_create pselect getopt vasprintf getprotobyname_r2 getprotobyname_r)
+
+ if test "x$ac_cv_func_gettimeofday" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_GETTIMEOFDAY $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_getprotobyname_r2" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_GETPROTOBYNAME_R2 $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_poll" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_POLL $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_epoll_create" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_EPOLL $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_getifaddrs" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_GETIFADDRS $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_getopt" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_GETOPT $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_pselect" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_PSELECT $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_header_alloca_h" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_ALLOCA_H $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_c_compiler_gnu" = "xno"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_ISO_VARARGS $LIBZMQ_EXTRA_CFLAGS"
+ else
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_GNU_VARARGS $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ if test "x$ac_cv_func_vasprintf" = "xyes"; then
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_VASPRINTF $LIBZMQ_EXTRA_CFLAGS"
+ fi
+ case "${host_cpu}" in
+ i*86|x86_64|amd64|*sparc*)
+ LIBZMQ_EXTRA_CFLAGS="-DCONFIG_HAVE_TSC -DCONFIG_HAVE_RTC -DCONFIG_HAVE_HPET $LIBZMQ_EXTRA_CFLAGS"
+ ;;
+ *sparc*|s390*)
+ ;;
+ esac
+fi
+
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
AC_SUBST(LIBZMQ_EXTRA_LDFLAGS)
-# Checks for library functions.
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
-
AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile
perf/Makefile src/libzmq.pc \
devices/Makefile devices/zmq_forwarder/Makefile \
diff --git a/src/Makefile.am b/src/Makefile.am
index 0b00f1c..3286bc4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -207,25 +207,13 @@ libpgm_diff_flags = \
else
libpgm_diff_flags = \
- -DCONFIG_HAVE_GETPROTOBYNAME_R2 \
- -DCONFIG_HAVE_ISO_VARARGS \
- -DCONFIG_HAVE_ALLOCA_H \
-DCONFIG_HAVE_PROC \
-DCONFIG_HAVE_BACKTRACE \
- -DCONFIG_HAVE_PSELECT \
- -DCONFIG_HAVE_RTC \
- -DCONFIG_HAVE_TSC \
- -DCONFIG_HAVE_HPET \
- -DCONFIG_HAVE_POLL \
- -DCONFIG_HAVE_EPOLL \
- -DCONFIG_HAVE_GETIFADDRS \
-DCONFIG_HAVE_IFR_NETMASK \
-DCONFIG_HAVE_MCAST_JOIN \
-DCONFIG_HAVE_IP_MREQN \
-DCONFIG_HAVE_SPRINTF_GROUPING \
- -DCONFIG_HAVE_VASPRINTF \
- -DCONFIG_BIND_INADDR_ANY \
- -DCONFIG_HAVE_GETOPT
+ -DCONFIG_BIND_INADDR_ANY
endif
libpgm_la_CFLAGS = -I$(top_srcdir)/foreign/openpgm/@pgm_basename@/openpgm/pgm/include/ @LIBZMQ_EXTRA_CFLAGS@ \
diff --git a/src/clock.cpp b/src/clock.cpp
index e18a715..e95b5f6 100644
--- a/src/clock.cpp
+++ b/src/clock.cpp
@@ -106,6 +106,11 @@ uint64_t zmq::clock_t::rdtsc ()
} tsc;
asm("rdtsc" : "=a" (tsc.u32val [0]), "=d" (tsc.u32val [1]));
return tsc.u64val;
+#elif defined(__s390__)
+ uint64_t tsc;
+ asm("\tstck\t%0\n" : "=Q" (tsc) : : "cc");
+ tsc >>= 12; /* convert to microseconds just to be consistent */
+ return(tsc);
#else
return 0;
#endif