From b71c3005e68d02f800ff09bcacece79d167bff75 Mon Sep 17 00:00:00 2001 From: malosek Date: Mon, 7 Sep 2009 17:06:47 +0200 Subject: [PATCH] include directory split into c and cpp dirs, added --with-c and --with-cpp configure options --- Makefile.am | 2 -- autogen.sh | 8 ++++++- {include => c}/zmq.h | 0 configure.in | 45 +++++++++++++++++++++++++++------------- {include => cpp}/zmq.hpp | 0 perf/c/Makefile.am | 4 ++-- perf/cpp/Makefile.am | 4 ++-- src/Makefile.am | 15 +++++++++++--- src/app_thread.cpp | 2 +- src/dispatcher.cpp | 2 +- src/i_inout.hpp | 2 +- src/io_thread.cpp | 2 +- src/msg_content.hpp | 2 +- src/pipe.cpp | 2 +- src/pipe.hpp | 2 +- src/socket_base.cpp | 2 +- src/zmq.cpp | 2 +- src/zmq_decoder.hpp | 2 +- src/zmq_encoder.hpp | 2 +- 19 files changed, 65 insertions(+), 35 deletions(-) rename {include => c}/zmq.h (100%) rename {include => cpp}/zmq.hpp (100%) diff --git a/Makefile.am b/Makefile.am index 3055e64b..4dda619d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,3 @@ -include_HEADERS = include/zmq.h include/zmq.hpp - if BUILD_PYTHON DIR_P = python endif diff --git a/autogen.sh b/autogen.sh index 19f21740..dfa69c04 100755 --- a/autogen.sh +++ b/autogen.sh @@ -18,7 +18,13 @@ # Script to generate all required files from fresh svn checkout. - +pkg-config --version > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo + echo "Could not find pkg-config, pkg.m4 macro is probably not installed." + echo + exit 1 +fi autoreconf --install --force --verbose -I config diff --git a/include/zmq.h b/c/zmq.h similarity index 100% rename from include/zmq.h rename to c/zmq.h diff --git a/configure.in b/configure.in index 8feef7b4..6d693338 100644 --- a/configure.in +++ b/configure.in @@ -164,11 +164,29 @@ if test "x$HAVE_INTTYPES_H" = "xyes"; then inttypes="1" fi +# c +czmq="no" +AC_ARG_WITH([c], [AS_HELP_STRING([--with-c], + [build c language binding [default=no]])], [c=yes], [c=no]) + +if test "x$c" != "xno"; then + czmq="yes" +fi + +# c++ +cppzmq="no" +AC_ARG_WITH([cpp], [AS_HELP_STRING([--with-cpp], + [build c++ language binding [default=no]])], [cpp=yes], [cpp=no]) + +if test "x$cpp" != "xno"; then + cppzmq="yes" +fi + # Python pyzmq="no" AC_ARG_WITH(python_headersdir, - AC_HELP_STRING([--with-python-headersdir], [Python.h header file location]), + AS_HELP_STRING([--with-python-headersdir], [Python.h header file location]), [python_headersdir="$withval"], [python_headersdir="no"]) AC_ARG_WITH([python], [AS_HELP_STRING([--with-python], [build Python language binding [default=no]])], [with_python=yes], [with_python=no]) @@ -209,7 +227,7 @@ fi rbzmq="no" AC_ARG_WITH(ruby_headersdir, - AC_HELP_STRING([--with-ruby-headersdir], [ruby.h header file location]), + AS_HELP_STRING([--with-ruby-headersdir], [ruby.h header file location]), [ruby_headersdir="$withval"], [ruby_headersdir="no"]) if test "x$ruby_headersdir" != "xno"; then @@ -217,7 +235,7 @@ if test "x$ruby_headersdir" != "xno"; then fi AC_ARG_WITH(ruby_libdir, - AC_HELP_STRING([--with-ruby-libdir],[libruby library file location]), + AS_HELP_STRING([--with-ruby-libdir],[libruby library file location]), [ruby_libdir="$withval"], [ruby_libdir="no"]) if test "x$ruby_libdir" != "xno"; then @@ -249,17 +267,12 @@ RUBYDIR="$rubydir" AC_SUBST([RUBYDIR]) if test "x$pyzmq" != "xyes"; then - AC_CHECK_PROG(have_python, python, yes, no) - if test "x$have_python" != "xyes"; then - AC_MSG_ERROR([Could not find python.]) - fi + AC_CHECK_PROG(have_python, python, yes, no) + if test "x$have_python" != "xyes"; then + AC_MSG_ERROR([Could not find python.]) fi +fi - # Generate version.c - AC_CONFIG_COMMANDS([version.c], - [python third-party/openpgm/libpgm-1.0.0/openpgm/pgm/version_generator.py > \ - third-party/openpgm/libpgm-1.0.0/openpgm/pgm/version.c]) - # Java language binding jzmq="no" AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [build Java language binding [default=no]])], [with_java=yes], [with_java=no]) @@ -312,6 +325,10 @@ fi AM_CONDITIONAL(BUILD_PYTHON, test "x$pyzmq" = "xyes") AM_CONDITIONAL(BUILD_JAVA, test "x$jzmq" = "xyes") +AM_CONDITIONAL(BUILD_PYTHON, test "x$pyzmq" = "xyes") +AM_CONDITIONAL(BUILD_RUBY, test "x$rbzmq" = "xyes") +AM_CONDITIONAL(BUILD_C, test "x$czmq" = "xyes") +AM_CONDITIONAL(BUILD_CPP, test "x$cppzmq" = "xyes") AC_SUBST(stdint) AC_SUBST(inttypes) @@ -319,8 +336,6 @@ AC_SUBST(inttypes) # Subst ZMQ_EXTRA_CXXFLAGS AC_SUBST(ZMQ_EXTRA_CXXFLAGS) -AM_CONDITIONAL(BUILD_PYTHON, test "x$pyzmq" = "xyes") -AM_CONDITIONAL(BUILD_RUBY, test "x$rbzmq" = "xyes") # Checks for library functions. AC_FUNC_MALLOC @@ -342,6 +357,8 @@ AC_MSG_RESULT([ license text. ]) AC_MSG_RESULT([ ******************************************************** ]) AC_MSG_RESULT([]) AC_MSG_RESULT([ 0MQ install dir: $prefix]) +AC_MSG_RESULT([ C language binding: $czmq]) +AC_MSG_RESULT([ C++ language binding: $cppzmq]) AC_MSG_RESULT([ Python language binding: $pyzmq]) AC_MSG_RESULT([ Ruby language binding: $rbzmq]) if test "x$rbzmq" = "xyes"; then diff --git a/include/zmq.hpp b/cpp/zmq.hpp similarity index 100% rename from include/zmq.hpp rename to cpp/zmq.hpp diff --git a/perf/c/Makefile.am b/perf/c/Makefile.am index 6762e66d..430a9f29 100644 --- a/perf/c/Makefile.am +++ b/perf/c/Makefile.am @@ -1,6 +1,6 @@ -INCLUDES = -I$(top_builddir)/include +INCLUDES = -I$(top_builddir)/c -bin_PROGRAMS = local_lat remote_lat local_thr remote_thr +noinst_PROGRAMS = local_lat remote_lat local_thr remote_thr local_lat_LDADD = $(top_builddir)/src/libzmq.la local_lat_SOURCES = local_lat.c diff --git a/perf/cpp/Makefile.am b/perf/cpp/Makefile.am index 78709438..1ea01a08 100644 --- a/perf/cpp/Makefile.am +++ b/perf/cpp/Makefile.am @@ -1,6 +1,6 @@ -INCLUDES = -I$(top_builddir)/include +INCLUDES = -I$(top_srcdir)/cpp -I$(top_srcdir)/c -bin_PROGRAMS = local_lat remote_lat local_thr remote_thr +noinst_PROGRAMS = local_lat remote_lat local_thr remote_thr local_lat_LDADD = $(top_builddir)/src/libzmq.la local_lat_SOURCES = local_lat.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 88a6f4b5..da442f4f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,8 +1,17 @@ lib_LTLIBRARIES = libzmq.la -pkginclude_HEADERS = \ - ../include/zmq.h \ - ../include/zmq.hpp + +if BUILD_CPP +include_HEADERS = ../cpp/zmq.hpp ../c/zmq.h +endif + +if BUILD_C +if BUILD_CPP + +else +include_HEADERS = ../c/zmq.h +endif +endif libzmq_la_SOURCES = \ app_thread.hpp \ diff --git a/src/app_thread.cpp b/src/app_thread.cpp index 847fcc11..bdceca59 100644 --- a/src/app_thread.cpp +++ b/src/app_thread.cpp @@ -19,7 +19,7 @@ #include -#include "../include/zmq.h" +#include "../c/zmq.h" #include "platform.hpp" diff --git a/src/dispatcher.cpp b/src/dispatcher.cpp index 49c21972..530238dd 100644 --- a/src/dispatcher.cpp +++ b/src/dispatcher.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#include "../include/zmq.h" +#include "../c/zmq.h" #include "dispatcher.hpp" #include "app_thread.hpp" diff --git a/src/i_inout.hpp b/src/i_inout.hpp index 89b9fbdb..4664b13b 100644 --- a/src/i_inout.hpp +++ b/src/i_inout.hpp @@ -20,7 +20,7 @@ #ifndef __ZMQ_I_INOUT_HPP_INCLUDED__ #define __ZMQ_I_INOUT_HPP_INCLUDED__ -#include "../include/zmq.h" +#include "../c/zmq.h" namespace zmq { diff --git a/src/io_thread.cpp b/src/io_thread.cpp index 1d85292e..d5de4973 100644 --- a/src/io_thread.cpp +++ b/src/io_thread.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#include "../include/zmq.h" +#include "../c/zmq.h" #include "io_thread.hpp" #include "command.hpp" diff --git a/src/msg_content.hpp b/src/msg_content.hpp index b468746e..6c91966f 100644 --- a/src/msg_content.hpp +++ b/src/msg_content.hpp @@ -22,7 +22,7 @@ #include -#include "../include/zmq.h" +#include "../c/zmq.h" #include "atomic_counter.hpp" diff --git a/src/pipe.cpp b/src/pipe.cpp index 392d380b..a5a18be6 100644 --- a/src/pipe.cpp +++ b/src/pipe.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#include "../include/zmq.h" +#include "../c/zmq.h" #include "pipe.hpp" diff --git a/src/pipe.hpp b/src/pipe.hpp index b4e592a6..81316e4d 100644 --- a/src/pipe.hpp +++ b/src/pipe.hpp @@ -20,7 +20,7 @@ #ifndef __ZMQ_PIPE_HPP_INCLUDED__ #define __ZMQ_PIPE_HPP_INCLUDED__ -#include "../include/zmq.h" +#include "../c/zmq.h" #include "stdint.hpp" #include "i_endpoint.hpp" diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 93a0a4c3..ac5a88cf 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -20,7 +20,7 @@ #include #include -#include "../include/zmq.h" +#include "../c/zmq.h" #include "socket_base.hpp" #include "app_thread.hpp" diff --git a/src/zmq.cpp b/src/zmq.cpp index 0ffd530d..ad4839fc 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -17,7 +17,7 @@ along with this program. If not, see . */ -#include "../include/zmq.h" +#include "../c/zmq.h" #include #include diff --git a/src/zmq_decoder.hpp b/src/zmq_decoder.hpp index 212e68e5..16b53129 100644 --- a/src/zmq_decoder.hpp +++ b/src/zmq_decoder.hpp @@ -20,7 +20,7 @@ #ifndef __ZMQ_ZMQ_DECODER_HPP_INCLUDED__ #define __ZMQ_ZMQ_DECODER_HPP_INCLUDED__ -#include "../include/zmq.h" +#include "../c/zmq.h" #include "decoder.hpp" diff --git a/src/zmq_encoder.hpp b/src/zmq_encoder.hpp index 29563fc8..55826a55 100644 --- a/src/zmq_encoder.hpp +++ b/src/zmq_encoder.hpp @@ -20,7 +20,7 @@ #ifndef __ZMQ_ZMQ_ENCODER_HPP_INCLUDED__ #define __ZMQ_ZMQ_ENCODER_HPP_INCLUDED__ -#include "../include/zmq.h" +#include "../c/zmq.h" #include "encoder.hpp"