Commit 770aedbd authored by Martin Lucina's avatar Martin Lucina

Build fixes for Solaris and non-GNU compilers

Compiling C++ code with -D_POSIX_SOURCE on Solaris is unsupported, so remove it.
Isolate GCC-isms inside checks that we are actually using GCC/G++.
Only check for -lstdc++ when on GCC and doing static linking.
parent 1dc0380e
...@@ -38,17 +38,25 @@ LTVER="0:0:0" ...@@ -38,17 +38,25 @@ LTVER="0:0:0"
AC_SUBST(LTVER) AC_SUBST(LTVER)
# Checks for programs. # Checks for programs.
AM_PROG_CC_C_O AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AM_PROG_CC_C_O
AC_LIBTOOL_WIN32_DLL AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_PROG_SED AC_PROG_SED
AC_PROG_AWK AC_PROG_AWK
# Set a helper variable to indicate GNU C and C++ are in use
if test "x$GCC" = "xyes" -a "x$GXX" = "xyes"; then
gnu_compilers="yes"
else
gnu_compilers="no"
fi
# Checks for libraries. # Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([pthread], [pthread_create])
# If using GNU C++, libstdc++ must be available. # If using GNU C/C++ and static linking, libstdc++ must be available.
if test "x$GXX" = "xyes"; then if test "x$gnu_compilers" = "xyes" -a "x$enable_shared" = "xno"; then
# libstdc++ depends on libm on some platforms # libstdc++ depends on libm on some platforms
AC_CHECK_LIB([m], [main]) AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([stdc++], [main], , AC_CHECK_LIB([stdc++], [main], ,
...@@ -106,7 +114,7 @@ case "${host_os}" in ...@@ -106,7 +114,7 @@ case "${host_os}" in
;; ;;
*solaris*) *solaris*)
# Define on Solaris to enable all library features # Define on Solaris to enable all library features
CPPFLAGS="-D_POSIX_C_SOURCE=200112L -D_PTHREADS $CPPFLAGS" CPPFLAGS="-D_PTHREADS $CPPFLAGS"
AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS]) AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS])
AC_CHECK_LIB(socket, main) AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main) AC_CHECK_LIB(nsl, main)
...@@ -214,7 +222,9 @@ esac ...@@ -214,7 +222,9 @@ esac
# CPU-specific optimizations # CPU-specific optimizations
case "${host_cpu}" in case "${host_cpu}" in
*sparc*) *sparc*)
if test "x$gnu_compilers" = "xyes"; then
CPPFLAGS="$CPPFLAGS -mcpu=v9" CPPFLAGS="$CPPFLAGS -mcpu=v9"
fi
;; ;;
*) *)
;; ;;
...@@ -359,14 +369,18 @@ if test "x$with_pgm_ext" != "xno"; then ...@@ -359,14 +369,18 @@ if test "x$with_pgm_ext" != "xno"; then
pgm_ext="yes" pgm_ext="yes"
fi fi
# If not on QNX nor OSX nor PGM add -pedantic into LIBZMQ_EXTRA_CXXFLAGS. # -Wall, -Werror and -pedantic are GNU compiler specific.
if test "x$pedantic" = "xyes" -a "x$pgm_ext" = "xno"; then # Also, these break OpenPGM so don't specify them if we are building with it.
if test "x$gnu_compilers" = "xyes" -a "x$pgm_ext" = "xno"; then
LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Wall"
if test "x$pedantic" = "xyes"; then
LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -pedantic" LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -pedantic"
fi fi
# If not on QNX nor PGM add -Werror into LIBZMQ_EXTRA_CXXFLAGS. if test "x$werror" = "xyes"; then
if test "x$werror" = "xyes" -a "x$pgm_ext" = "xno"; then
LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Werror" LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Werror"
fi
fi fi
AM_CONDITIONAL(BUILD_PGM, test "x$pgm_ext" = "xyes") AM_CONDITIONAL(BUILD_PGM, test "x$pgm_ext" = "xyes")
......
...@@ -257,7 +257,7 @@ libzmq_la_CXXFLAGS = -I$(top_srcdir)/foreign/openpgm/@pgm_basename@/openpgm/pgm/ ...@@ -257,7 +257,7 @@ libzmq_la_CXXFLAGS = -I$(top_srcdir)/foreign/openpgm/@pgm_basename@/openpgm/pgm/
endif endif
if BUILD_NO_PGM if BUILD_NO_PGM
libzmq_la_CXXFLAGS = -Wall @LIBZMQ_EXTRA_CXXFLAGS@ libzmq_la_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
endif endif
dist-hook: dist-hook:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment