2010-10-16 01:05:15 +02:00
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CONFIG_LIBTOOL #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Configure libtool. Requires AC_CANONICAL_HOST #
|
2010-11-17 15:06:51 +01:00
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CONFIG_LIBTOOL], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
2010-11-17 15:06:51 +01:00
|
|
|
|
|
|
|
# Libtool configuration for different targets
|
|
|
|
case "${host_os}" in
|
2017-03-19 18:38:43 -04:00
|
|
|
*mingw*|*cygwin*|*msys*)
|
2010-11-17 15:06:51 +01:00
|
|
|
# Disable static build by default
|
|
|
|
AC_DISABLE_STATIC
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Everything else with static enabled
|
|
|
|
AC_ENABLE_STATIC
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_ICC([action-if-found], [action-if-not-found]) #
|
2010-10-16 01:05:15 +02:00
|
|
|
dnl # Check if the current language is compiled using ICC #
|
|
|
|
dnl # Adapted from http://software.intel.com/en-us/forums/showthread.php?t=67984 #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_ICC],
|
2010-10-16 01:05:15 +02:00
|
|
|
[AC_CACHE_CHECK([whether we are using Intel _AC_LANG compiler],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler],
|
2010-10-16 01:05:15 +02:00
|
|
|
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[[#ifndef __INTEL_COMPILER
|
|
|
|
error if not ICC
|
|
|
|
#endif
|
|
|
|
]])],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler="yes" ; $1],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler="no" ; $2])
|
2010-10-16 01:05:15 +02:00
|
|
|
])])
|
2010-11-15 17:02:36 +01:00
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_SUN_STUDIO([action-if-found], [action-if-not-found]) #
|
2010-11-15 17:02:36 +01:00
|
|
|
dnl # Check if the current language is compiled using Sun Studio #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_SUN_STUDIO],
|
2010-11-15 17:02:36 +01:00
|
|
|
[AC_CACHE_CHECK([whether we are using Sun Studio _AC_LANG compiler],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler],
|
2010-11-15 17:02:36 +01:00
|
|
|
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[[#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
|
|
|
|
error if not sun studio
|
|
|
|
#endif
|
|
|
|
]])],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="yes" ; $1],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="no" ; $2])
|
2010-11-15 17:02:36 +01:00
|
|
|
])])
|
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_CLANG([action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check if the current language is compiled using clang #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_CLANG],
|
2010-12-01 10:33:07 +01:00
|
|
|
[AC_CACHE_CHECK([whether we are using clang _AC_LANG compiler],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler],
|
2010-12-01 10:33:07 +01:00
|
|
|
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[[#ifndef __clang__
|
|
|
|
error if not clang
|
|
|
|
#endif
|
|
|
|
]])],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="yes" ; $1],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="no" ; $2])
|
2010-12-01 10:33:07 +01:00
|
|
|
])])
|
|
|
|
|
2010-12-07 11:14:46 +01:00
|
|
|
dnl ##############################################################################
|
2011-04-03 07:34:14 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_GCC4([action-if-found], [action-if-not-found]) #
|
2010-12-07 11:14:46 +01:00
|
|
|
dnl # Check if the current language is compiled using clang #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_GCC4],
|
2010-12-07 11:14:46 +01:00
|
|
|
[AC_CACHE_CHECK([whether we are using gcc >= 4 _AC_LANG compiler],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler],
|
2010-12-07 11:14:46 +01:00
|
|
|
[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
|
|
|
|
[[#if (!defined __GNUC__ || __GNUC__ < 4)
|
|
|
|
error if not gcc4 or higher
|
|
|
|
#endif
|
|
|
|
]])],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="yes" ; $1],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="no" ; $2])
|
2010-12-07 11:14:46 +01:00
|
|
|
])])
|
|
|
|
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_DOC_BUILD #
|
2010-11-15 17:02:36 +01:00
|
|
|
dnl # Check whether to build documentation and install man-pages #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_DOC_BUILD], [{
|
2010-11-17 15:10:43 +01:00
|
|
|
|
2016-01-18 21:25:22 +01:00
|
|
|
# Man pages are built/installed if asciidoc and xmlto are present
|
|
|
|
# --with-docs=no overrides this
|
|
|
|
AC_ARG_WITH([docs],
|
2016-02-11 16:52:41 +01:00
|
|
|
AS_HELP_STRING([--without-docs],
|
|
|
|
[Don't build and install man pages [default=build]]),
|
2016-01-18 21:25:22 +01:00
|
|
|
[with_docs=$withval])
|
2016-10-27 14:13:44 +01:00
|
|
|
AC_ARG_WITH([documentation], [AS_HELP_STRING([--without-documentation],
|
|
|
|
[Don't build and install man pages [default=build] DEPRECATED: use --without-docs])])
|
2016-01-18 21:25:22 +01:00
|
|
|
|
2016-10-27 14:13:44 +01:00
|
|
|
if test "x$with_documentation" = "xno"; then
|
|
|
|
AC_MSG_WARN([--without-documentation is DEPRECATED and will be removed in the next release, use --without-docs])
|
|
|
|
fi
|
|
|
|
if test "x$with_docs" = "xno" || test "x$with_documentation" = "xno"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_build_doc="no"
|
|
|
|
libzmq_install_man="no"
|
2010-11-17 15:10:43 +01:00
|
|
|
else
|
|
|
|
# Determine whether or not documentation should be built and installed.
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_build_doc="yes"
|
|
|
|
libzmq_install_man="yes"
|
2010-11-17 15:10:43 +01:00
|
|
|
# Check for asciidoc and xmlto and don't build the docs if these are not installed.
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_CHECK_PROG(libzmq_have_asciidoc, asciidoc, yes, no)
|
|
|
|
AC_CHECK_PROG(libzmq_have_xmlto, xmlto, yes, no)
|
|
|
|
if test "x$libzmq_have_asciidoc" = "xno" -o "x$libzmq_have_xmlto" = "xno"; then
|
|
|
|
libzmq_build_doc="no"
|
2010-11-17 15:10:43 +01:00
|
|
|
# Tarballs built with 'make dist' ship with prebuilt documentation.
|
|
|
|
if ! test -f doc/zmq.7; then
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_install_man="no"
|
2010-11-17 15:10:43 +01:00
|
|
|
AC_MSG_WARN([You are building an unreleased version of 0MQ and asciidoc or xmlto are not installed.])
|
|
|
|
AC_MSG_WARN([Documentation will not be built and manual pages will not be installed.])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Do not install man pages if on mingw
|
2016-02-03 23:54:22 +11:00
|
|
|
if test "x$libzmq_on_mingw" = "xyes"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_install_man="no"
|
2010-11-15 17:02:36 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether to build documentation])
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_MSG_RESULT([$libzmq_build_doc])
|
2010-11-15 17:02:36 +01:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether to install manpages])
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_MSG_RESULT([$libzmq_install_man])
|
2010-11-15 17:02:36 +01:00
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
AM_CONDITIONAL(BUILD_DOC, test "x$libzmq_build_doc" = "xyes")
|
|
|
|
AM_CONDITIONAL(INSTALL_MAN, test "x$libzmq_install_man" = "xyes")
|
2010-11-15 17:02:36 +01:00
|
|
|
}])
|
2010-11-19 09:10:26 +01:00
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_COMPILER([action-if-found], [action-if-not-found]) #
|
2010-11-19 09:10:26 +01:00
|
|
|
dnl # Check that compiler for the current language actually works #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_COMPILER], [{
|
2010-11-19 09:10:26 +01:00
|
|
|
# Test that compiler for the current language actually works
|
|
|
|
AC_CACHE_CHECK([whether the _AC_LANG compiler works],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works],
|
2010-11-19 09:10:26 +01:00
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
|
2011-04-02 22:50:46 +02:00
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works="yes" ; $1],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works="no" ; $2])
|
2010-11-19 09:10:26 +01:00
|
|
|
])
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works" != "xyes"; then
|
2010-11-19 09:10:26 +01:00
|
|
|
AC_MSG_ERROR([Unable to find a working _AC_LANG compiler])
|
|
|
|
fi
|
|
|
|
}])
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_COMPILERS #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check compiler characteristics. This is so that we can AC_REQUIRE checks #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_COMPILERS], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
# For that the compiler works and try to come up with the type
|
|
|
|
AC_LANG_PUSH([C])
|
2011-04-02 22:50:46 +02:00
|
|
|
LIBZMQ_CHECK_LANG_COMPILER
|
2010-12-01 10:33:07 +01:00
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
LIBZMQ_CHECK_LANG_ICC
|
|
|
|
LIBZMQ_CHECK_LANG_SUN_STUDIO
|
|
|
|
LIBZMQ_CHECK_LANG_CLANG
|
|
|
|
LIBZMQ_CHECK_LANG_GCC4
|
2010-12-01 10:33:07 +01:00
|
|
|
AC_LANG_POP([C])
|
|
|
|
|
|
|
|
AC_LANG_PUSH(C++)
|
2011-04-02 22:50:46 +02:00
|
|
|
LIBZMQ_CHECK_LANG_COMPILER
|
2010-12-01 10:33:07 +01:00
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
LIBZMQ_CHECK_LANG_ICC
|
|
|
|
LIBZMQ_CHECK_LANG_SUN_STUDIO
|
|
|
|
LIBZMQ_CHECK_LANG_CLANG
|
|
|
|
LIBZMQ_CHECK_LANG_GCC4
|
2010-12-01 10:33:07 +01:00
|
|
|
AC_LANG_POP([C++])
|
|
|
|
|
|
|
|
# Set GCC and GXX variables correctly
|
|
|
|
if test "x$GCC" = "xyes"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "xyes" = "x$libzmq_cv_c_intel_compiler"; then
|
2010-12-01 10:33:07 +01:00
|
|
|
GCC="no"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "x$GXX" = "xyes"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "xyes" = "x$libzmq_cv_cxx_intel_compiler"; then
|
2010-12-01 10:33:07 +01:00
|
|
|
GXX="no"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_FLAG([flag], [action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check if the compiler supports given flag. Works for C and C++ #
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl ############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
|
2010-12-07 11:14:46 +01:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
|
|
|
|
2010-12-01 10:33:07 +01:00
|
|
|
AC_MSG_CHECKING([whether _AC_LANG compiler supports $1])
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
|
2010-12-01 10:33:07 +01:00
|
|
|
ac_[]_AC_LANG_ABBREV[]_werror_flag="yes"
|
|
|
|
|
|
|
|
case "x[]_AC_LANG_ABBREV" in
|
|
|
|
xc)
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_check_lang_flag_save_CFLAGS="$CFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
CFLAGS="$CFLAGS $1"
|
|
|
|
;;
|
|
|
|
xcxx)
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_check_lang_flag_save_CPPFLAGS="$CPPFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
CPPFLAGS="$CPPFLAGS $1"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
AC_MSG_WARN([testing compiler characteristic on an unknown language])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
|
|
|
# This hack exist for ICC, which outputs unknown options as remarks
|
|
|
|
# Remarks are not turned into errors even with -Werror on
|
2010-12-07 11:14:46 +01:00
|
|
|
[if ($GREP 'ignoring unknown' conftest.err ||
|
|
|
|
$GREP 'not supported' conftest.err) >/dev/null 2>&1; then
|
2011-04-02 22:50:46 +02:00
|
|
|
eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"
|
2010-12-01 10:33:07 +01:00
|
|
|
else
|
2011-04-02 22:50:46 +02:00
|
|
|
eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="yes"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi],
|
2011-04-02 22:50:46 +02:00
|
|
|
[eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"])
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
case "x[]_AC_LANG_ABBREV" in
|
|
|
|
xc)
|
2011-04-02 22:50:46 +02:00
|
|
|
CFLAGS="$libzmq_cv_check_lang_flag_save_CFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
;;
|
|
|
|
xcxx)
|
2011-04-02 22:50:46 +02:00
|
|
|
CPPFLAGS="$libzmq_cv_check_lang_flag_save_CPPFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# nothing to restore
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Restore the werror flag
|
2011-04-02 22:50:46 +02:00
|
|
|
ac_[]_AC_LANG_ABBREV[]_werror_flag=$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# Call the action as the flags are restored
|
2011-04-02 22:50:46 +02:00
|
|
|
AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
|
2010-12-01 10:33:07 +01:00
|
|
|
[AC_MSG_RESULT(yes) ; $2], [AC_MSG_RESULT(no) ; $3])
|
|
|
|
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ####################################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_FLAG_PREPEND([flag], [action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check if the compiler supports given flag. Works for C and C++ #
|
|
|
|
dnl # This macro prepends the flag to CFLAGS or CPPFLAGS accordingly #
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl ####################################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG_PREPEND], [{
|
|
|
|
LIBZMQ_CHECK_LANG_FLAG([$1])
|
2010-12-01 10:33:07 +01:00
|
|
|
case "x[]_AC_LANG_ABBREV" in
|
|
|
|
xc)
|
2011-04-02 22:50:46 +02:00
|
|
|
AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
|
2010-12-01 10:33:07 +01:00
|
|
|
[CFLAGS="$1 $CFLAGS"; $2], $3)
|
|
|
|
;;
|
|
|
|
xcxx)
|
2011-04-02 22:50:46 +02:00
|
|
|
AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
|
2010-12-01 10:33:07 +01:00
|
|
|
[CPPFLAGS="$1 $CPPFLAGS"; $2], $3)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_ENABLE_DEBUG([action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check whether to enable debug build and set compiler flags accordingly #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_ENABLE_DEBUG], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# Require compiler specifics
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_REQUIRE([LIBZMQ_CHECK_COMPILERS])
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# This flag is checked also in
|
|
|
|
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
|
2016-02-11 16:52:41 +01:00
|
|
|
[enable debugging information [default=disabled]])])
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable debugging information)
|
|
|
|
|
|
|
|
if test "x$enable_debug" = "xyes"; then
|
|
|
|
|
|
|
|
# GCC, clang and ICC
|
|
|
|
if test "x$GCC" = "xyes" -o \
|
2011-04-02 22:50:46 +02:00
|
|
|
"x$libzmq_cv_c_intel_compiler" = "xyes" -o \
|
|
|
|
"x$libzmq_cv_c_clang_compiler" = "xyes"; then
|
2010-12-01 10:33:07 +01:00
|
|
|
CFLAGS="-g -O0 "
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_c_sun_studio_compiler" = "xyes"; then
|
2010-12-01 10:33:07 +01:00
|
|
|
CFLAGS="-g0 "
|
|
|
|
fi
|
|
|
|
|
|
|
|
# GCC, clang and ICC
|
|
|
|
if test "x$GXX" = "xyes" -o \
|
2011-04-02 22:50:46 +02:00
|
|
|
"x$libzmq_cv_cxx_intel_compiler" = "xyes" -o \
|
|
|
|
"x$libzmq_cv_cxx_clang_compiler" = "xyes"; then
|
2010-12-01 10:33:07 +01:00
|
|
|
CPPFLAGS="-g -O0 "
|
|
|
|
CXXFLAGS="-g -O0 "
|
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_cxx_sun_studio_compiler" = "xyes"; then
|
2010-12-01 10:33:07 +01:00
|
|
|
CPPFLAGS="-g0 "
|
|
|
|
CXXFLAGS="-g0 "
|
|
|
|
fi
|
|
|
|
|
2010-12-18 12:13:10 +01:00
|
|
|
if test "x$ZMQ_ORIG_CFLAGS" != "xnone"; then
|
|
|
|
CFLAGS="${CFLAGS} ${ZMQ_ORIG_CFLAGS}"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
2010-12-18 12:13:10 +01:00
|
|
|
if test "x$ZMQ_ORIG_CPPFLAGS" != "xnone"; then
|
|
|
|
CPPFLAGS="${CPPFLAGS} ${ZMQ_ORIG_CPPFLAGS}"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
2010-12-18 12:13:10 +01:00
|
|
|
if test "x$ZMQ_ORIG_CXXFLAGS" != "xnone"; then
|
|
|
|
CXXFLAGS="${CXXFLAGS} ${ZMQ_ORIG_CXXFLAGS}"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
}])
|
|
|
|
|
2011-04-02 22:49:41 +02:00
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_WITH_GCOV([action-if-found], [action-if-not-found]) #
|
2011-04-02 22:49:41 +02:00
|
|
|
dnl # Check whether to build with code coverage #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_WITH_GCOV], [{
|
2011-04-02 22:49:41 +02:00
|
|
|
# Require compiler specifics
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_REQUIRE([LIBZMQ_CHECK_COMPILERS])
|
2011-04-02 22:49:41 +02:00
|
|
|
|
|
|
|
AC_ARG_WITH(gcov, [AS_HELP_STRING([--with-gcov=yes/no],
|
2016-02-11 16:52:41 +01:00
|
|
|
[with GCC Code Coverage reporting.])],
|
2011-04-02 22:49:41 +02:00
|
|
|
[ZMQ_GCOV="$withval"])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether to enable code coverage)
|
|
|
|
|
2011-04-03 07:34:14 +02:00
|
|
|
if test "x$ZMQ_GCOV" = "xyes"; then
|
2011-04-02 22:49:41 +02:00
|
|
|
|
2011-04-03 07:34:14 +02:00
|
|
|
if test "x$GXX" != "xyes"; then
|
|
|
|
AC_MSG_ERROR([--with-gcov=yes works only with GCC])
|
|
|
|
fi
|
|
|
|
|
|
|
|
CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
|
|
|
|
if test "x${ZMQ_ORIG_CPPFLAGS}" != "xnone"; then
|
|
|
|
CFLAGS="${CFLAGS} ${ZMQ_ORIG_CFLAGS}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
CPPFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
|
|
|
|
if test "x${ZMQ_ORIG_CPPFLAGS}" != "xnone"; then
|
|
|
|
CPPFLAGS="${CPPFLAGS} ${ZMQ_ORIG_CPPFLAGS}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
CXXFLAGS="-fprofile-arcs"
|
|
|
|
if test "x${ZMQ_ORIG_CXXFLAGS}" != "xnone"; then
|
|
|
|
CXXFLAGS="${CXXFLAGS} ${ZMQ_ORIG_CXXFLAGS}"
|
|
|
|
fi
|
2011-04-02 22:49:41 +02:00
|
|
|
|
2011-04-03 07:34:14 +02:00
|
|
|
LIBS="-lgcov ${LIBS}"
|
2011-04-02 22:49:41 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
AS_IF([test "x$ZMQ_GCOV" = "xyes"],
|
|
|
|
[AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
|
|
|
|
}])
|
|
|
|
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_WITH_FLAG([flags], [macro]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Runs a normal autoconf check with compiler flags #
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_WITH_FLAG], [{
|
|
|
|
libzmq_check_with_flag_save_CFLAGS="$CFLAGS"
|
|
|
|
libzmq_check_with_flag_save_CPPFLAGS="$CPPFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
CFLAGS="$CFLAGS $1"
|
|
|
|
CPPFLAGS="$CPPFLAGS $1"
|
|
|
|
|
|
|
|
# Execute the macro
|
|
|
|
$2
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
CFLAGS="$libzmq_check_with_flag_save_CFLAGS"
|
|
|
|
CPPFLAGS="$libzmq_check_with_flag_save_CPPFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_LANG_WALL([action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # How to define -Wall for the current compiler #
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]__wall_flag variable to found style #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl ##############################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_LANG_WALL], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([how to enable additional warnings for _AC_LANG compiler])
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag=""
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# C compilers
|
|
|
|
case "x[]_AC_LANG_ABBREV" in
|
|
|
|
xc)
|
|
|
|
# GCC, clang and ICC
|
|
|
|
if test "x$GCC" = "xyes" -o \
|
2011-04-02 22:50:46 +02:00
|
|
|
"x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
|
|
|
|
"x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-Wall"
|
2010-12-01 10:33:07 +01:00
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-v"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
xcxx)
|
|
|
|
# GCC, clang and ICC
|
|
|
|
if test "x$GXX" = "xyes" -o \
|
2011-04-02 22:50:46 +02:00
|
|
|
"x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
|
|
|
|
"x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-Wall"
|
2010-12-01 10:33:07 +01:00
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="+w"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Call the action
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag" != "x"; then
|
|
|
|
AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag])
|
2010-12-01 10:33:07 +01:00
|
|
|
$1
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([not found])
|
|
|
|
$2
|
|
|
|
fi
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ####################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_LANG_STRICT([action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check how to turn on strict standards compliance #
|
|
|
|
dnl ####################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_LANG_STRICT], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
AC_MSG_CHECKING([how to enable strict standards compliance in _AC_LANG compiler])
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag=""
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# C compilers
|
|
|
|
case "x[]_AC_LANG_ABBREV" in
|
|
|
|
xc)
|
|
|
|
# GCC, clang and ICC
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$GCC" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-pedantic"
|
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-strict-ansi"
|
2010-12-01 10:33:07 +01:00
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-Xc"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
xcxx)
|
|
|
|
# GCC, clang and ICC
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$GXX" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-pedantic"
|
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-strict-ansi"
|
2010-12-01 10:33:07 +01:00
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-compat=5"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Call the action
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag" != "x"; then
|
|
|
|
AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag])
|
2010-12-01 10:33:07 +01:00
|
|
|
$1
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([not found])
|
|
|
|
$2
|
|
|
|
fi
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ########################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_LANG_WERROR([action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check how to turn warnings to errors #
|
|
|
|
dnl ########################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_LANG_WERROR], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
AC_MSG_CHECKING([how to turn warnings to errors in _AC_LANG compiler])
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag=""
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# C compilers
|
|
|
|
case "x[]_AC_LANG_ABBREV" in
|
|
|
|
xc)
|
|
|
|
# GCC, clang and ICC
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$GCC" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
|
2010-12-01 10:33:07 +01:00
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
xcxx)
|
|
|
|
# GCC, clang and ICC
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$GXX" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
|
2010-12-01 10:33:07 +01:00
|
|
|
# Sun studio
|
2011-04-02 22:50:46 +02:00
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Call the action
|
2011-04-02 22:50:46 +02:00
|
|
|
if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag" != "x"; then
|
|
|
|
AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag])
|
2010-12-01 10:33:07 +01:00
|
|
|
$1
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([not found])
|
|
|
|
$2
|
|
|
|
fi
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_PRAGMA([pragma], [action-if-found], [action-if-not-found]) #
|
2010-12-01 10:33:07 +01:00
|
|
|
dnl # Check if the compiler supports given pragma #
|
|
|
|
dnl ################################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_PRAGMA], [{
|
2010-12-01 10:33:07 +01:00
|
|
|
# Need to know how to enable all warnings
|
2011-04-02 22:50:46 +02:00
|
|
|
LIBZMQ_LANG_WALL
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether _AC_LANG compiler supports pragma $1])
|
|
|
|
|
|
|
|
# Save flags
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
|
2010-12-01 10:33:07 +01:00
|
|
|
ac_[]_AC_LANG_ABBREV[]_werror_flag="yes"
|
|
|
|
|
|
|
|
if test "x[]_AC_LANG_ABBREV" = "xc"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_check_lang_pragma_save_CFLAGS="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS $libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag"
|
2010-12-01 10:33:07 +01:00
|
|
|
elif test "x[]_AC_LANG_ABBREV" = "xcxx"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
libzmq_cv_check_lang_pragma_save_CPPFLAGS="$CPPFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS $libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag"
|
2010-12-01 10:33:07 +01:00
|
|
|
else
|
|
|
|
AC_MSG_WARN([testing compiler characteristic on an unknown language])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#pragma $1]])],
|
2011-04-02 22:50:46 +02:00
|
|
|
[eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)="yes" ; AC_MSG_RESULT(yes)],
|
|
|
|
[eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)="no" ; AC_MSG_RESULT(no)])
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
if test "x[]_AC_LANG_ABBREV" = "xc"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
CFLAGS="$libzmq_cv_check_lang_pragma_save_CFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
elif test "x[]_AC_LANG_ABBREV" = "xcxx"; then
|
2011-04-02 22:50:46 +02:00
|
|
|
CPPFLAGS="$libzmq_cv_check_lang_pragma_save_CPPFLAGS"
|
2010-12-01 10:33:07 +01:00
|
|
|
fi
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
ac_[]_AC_LANG_ABBREV[]_werror_flag=$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
|
2010-12-01 10:33:07 +01:00
|
|
|
|
|
|
|
# Call the action as the flags are restored
|
2011-04-02 22:50:46 +02:00
|
|
|
AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)[ = "xyes"],
|
2010-12-01 10:33:07 +01:00
|
|
|
[$2], [$3])
|
|
|
|
}])
|
2010-12-07 11:14:46 +01:00
|
|
|
|
|
|
|
dnl ################################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
dnl # LIBZMQ_CHECK_LANG_VISIBILITY([action-if-found], [action-if-not-found]) #
|
2010-12-07 11:14:46 +01:00
|
|
|
dnl # Check if the compiler supports dso visibility #
|
|
|
|
dnl ################################################################################
|
2011-04-02 22:50:46 +02:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_LANG_VISIBILITY], [{
|
|
|
|
|
|
|
|
libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag=""
|
|
|
|
|
|
|
|
if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes" -o \
|
|
|
|
"x$libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler" = "xyes" -o \
|
|
|
|
"x$libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler" = "xyes"; then
|
|
|
|
LIBZMQ_CHECK_LANG_FLAG([-fvisibility=hidden],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-fvisibility=hidden"])
|
|
|
|
elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
|
|
|
|
LIBZMQ_CHECK_LANG_FLAG([-xldscope=hidden],
|
|
|
|
[libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag="-xldscope=hidden"])
|
2010-12-07 11:14:46 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(whether _AC_LANG compiler supports dso visibility)
|
|
|
|
|
2011-04-02 22:50:46 +02:00
|
|
|
AS_IF([test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag" != "x"],
|
2010-12-07 11:14:46 +01:00
|
|
|
[AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
|
|
|
|
}])
|
2011-09-04 10:28:15 +02:00
|
|
|
|
2011-10-26 11:26:00 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if SOCK_CLOEXEC is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_SOCK_CLOEXEC], [{
|
2015-02-06 15:11:07 +01:00
|
|
|
AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [libzmq_cv_sock_cloexec],
|
|
|
|
[AC_TRY_RUN([/* SOCK_CLOEXEC test */
|
2011-10-26 11:26:00 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s = socket (PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
|
|
|
return (s == -1);
|
|
|
|
}
|
2015-02-06 15:11:07 +01:00
|
|
|
],
|
|
|
|
[libzmq_cv_sock_cloexec="yes"],
|
|
|
|
[libzmq_cv_sock_cloexec="no"],
|
|
|
|
[libzmq_cv_sock_cloexec="not during cross-compile"]
|
|
|
|
)]
|
2011-10-26 11:26:00 +02:00
|
|
|
)
|
2015-02-06 15:11:07 +01:00
|
|
|
AS_IF([test "x$libzmq_cv_sock_cloexec" = "xyes"], [$1], [$2])
|
2011-10-26 11:26:00 +02:00
|
|
|
}])
|
|
|
|
|
2017-07-27 23:29:33 +01:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_O_CLOEXEC([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if O_CLOEXEC is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_O_CLOEXEC], [{
|
|
|
|
AC_CACHE_CHECK([whether O_CLOEXEC is supported], [libzmq_cv_o_cloexec],
|
|
|
|
[AC_TRY_RUN([/* O_CLOEXEC test */
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s = open ("/dev/null", O_CLOEXEC | O_RDONLY);
|
|
|
|
return (s == -1);
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[libzmq_cv_o_cloexec="yes"],
|
|
|
|
[libzmq_cv_o_cloexec="no"],
|
|
|
|
[libzmq_cv_o_cloexec="not during cross-compile"]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
AS_IF([test "x$libzmq_cv_o_cloexec" = "xyes"], [$1], [$2])
|
|
|
|
}])
|
|
|
|
|
2015-01-28 10:27:15 -06:00
|
|
|
dnl ################################################################################
|
2016-12-26 18:18:00 +01:00
|
|
|
dnl # LIBZMQ_CHECK_EVENTFD_CLOEXEC([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if EFD_CLOEXEC is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_EVENTFD_CLOEXEC], [{
|
|
|
|
AC_CACHE_CHECK([whether EFD_CLOEXEC is supported], [libzmq_cv_efd_cloexec],
|
|
|
|
[AC_TRY_RUN([/* EFD_CLOEXEC test */
|
|
|
|
#include <sys/eventfd.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s = eventfd (0, EFD_CLOEXEC);
|
|
|
|
return (s == -1);
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[libzmq_cv_efd_cloexec="yes"],
|
|
|
|
[libzmq_cv_efd_cloexec="no"],
|
|
|
|
[libzmq_cv_efd_cloexec="not during cross-compile"]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
AS_IF([test "x$libzmq_cv_efd_cloexec" = "xyes"], [$1], [$2])
|
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
2015-01-28 10:27:15 -06:00
|
|
|
dnl # LIBZMQ_CHECK_ATOMIC_INSTRINSICS([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if compiler supoorts __atomic_Xxx intrinsics #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_ATOMIC_INTRINSICS], [{
|
|
|
|
AC_MSG_CHECKING(whether compiler supports __atomic_Xxx intrinsics)
|
2018-05-07 22:02:25 +03:00
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
2015-01-28 10:27:15 -06:00
|
|
|
/* atomic intrinsics test */
|
|
|
|
int v = 0;
|
|
|
|
int main (int, char **)
|
|
|
|
{
|
|
|
|
int t = __atomic_add_fetch (&v, 1, __ATOMIC_ACQ_REL);
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
])],
|
2018-05-07 22:02:25 +03:00
|
|
|
[AC_MSG_RESULT(yes) ; GCC_ATOMIC_BUILTINS_SUPPORTED=1 libzmq_cv_has_atomic_instrisics="yes" ; $1])
|
|
|
|
|
|
|
|
if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != x1; then
|
2018-09-13 20:13:20 +02:00
|
|
|
save_LIBS=$LIBS
|
|
|
|
LIBS="$LIBS -latomic"
|
2018-05-07 22:02:25 +03:00
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
|
|
|
/* atomic intrinsics test */
|
|
|
|
int v = 0;
|
|
|
|
int main (int, char **)
|
|
|
|
{
|
|
|
|
int t = __atomic_add_fetch (&v, 1, __ATOMIC_ACQ_REL);
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
])],
|
2020-01-12 10:10:15 +01:00
|
|
|
[AC_MSG_RESULT(yes) ; libzmq_cv_has_atomic_instrisics="yes" PKGCFG_LIBS_PRIVATE="$PKGCFG_LIBS_PRIVATE -latomic" ; $1],
|
2018-09-13 20:13:20 +02:00
|
|
|
[AC_MSG_RESULT(no) ; libzmq_cv_has_atomic_instrisics="no" LIBS=$save_LIBS ; $2])
|
2018-05-07 22:02:25 +03:00
|
|
|
fi
|
2015-01-28 10:27:15 -06:00
|
|
|
}])
|
|
|
|
|
Add socket option BINDTODEVICE
Linux now supports Virtual Routing and Forwarding (VRF) as per:
https://www.kernel.org/doc/Documentation/networking/vrf.txt
In order for an application to bind or connect to a socket with an
address in a VRF, they need to first bind the socket to the VRF device:
setsockopt(sd, SOL_SOCKET, SO_BINDTODEVICE, dev, strlen(dev)+1);
Note "dev" is the VRF device, eg. VRF "blue", rather than an interface
enslaved to the VRF.
Add a new socket option, ZMQ_BINDTODEVICE, to bind a socket to a device.
In general, if a socket is bound to a device, eg. an interface, only
packets received from that particular device are processed by the socket.
If device is a VRF device, then subsequent binds/connects to that socket
use addresses in the VRF routing table.
2017-07-28 14:35:09 +01:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_SO_BINDTODEVICE([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if SO_BINDTODEVICE is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_SO_BINDTODEVICE], [{
|
|
|
|
AC_CACHE_CHECK([whether SO_BINDTODEVICE is supported], [libzmq_cv_so_bindtodevice],
|
|
|
|
[AC_TRY_RUN([/* SO_BINDTODEVICE test */
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
/* Actually making the setsockopt() call requires CAP_NET_RAW */
|
|
|
|
#ifndef SO_BINDTODEVICE
|
|
|
|
return 1;
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[libzmq_cv_so_bindtodevice="yes"],
|
|
|
|
[libzmq_cv_so_bindtodevice="no"],
|
|
|
|
[libzmq_cv_so_bindtodevice="not during cross-compile"]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
AS_IF([test "x$libzmq_cv_so_bindtodevice" = "xyes"], [$1], [$2])
|
|
|
|
}])
|
|
|
|
|
2012-04-05 19:39:53 +04:00
|
|
|
dnl ################################################################################
|
2012-04-06 20:04:35 +04:00
|
|
|
dnl # LIBZMQ_CHECK_SO_KEEPALIVE([action-if-found], [action-if-not-found]) #
|
2012-04-05 19:39:53 +04:00
|
|
|
dnl # Check if SO_KEEPALIVE is supported #
|
|
|
|
dnl ################################################################################
|
2012-04-06 20:04:35 +04:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_SO_KEEPALIVE], [{
|
2015-02-06 15:11:07 +01:00
|
|
|
AC_CACHE_CHECK([whether SO_KEEPALIVE is supported], [libzmq_cv_so_keepalive],
|
|
|
|
[AC_TRY_RUN([/* SO_KEEPALIVE test */
|
2012-04-05 19:39:53 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s, rc, opt = 1;
|
|
|
|
return (
|
|
|
|
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
|
|
|
((rc = setsockopt (s, SOL_SOCKET, SO_KEEPALIVE, (char*) &opt, sizeof (int))) == -1)
|
|
|
|
);
|
|
|
|
}
|
2015-02-06 15:11:07 +01:00
|
|
|
],
|
|
|
|
[libzmq_cv_so_keepalive="yes"],
|
|
|
|
[libzmq_cv_so_keepalive="no"],
|
|
|
|
[libzmq_cv_so_keepalive="not during cross-compile"]
|
|
|
|
)]
|
2012-04-06 20:04:35 +04:00
|
|
|
)
|
2015-02-06 15:11:07 +01:00
|
|
|
AS_IF([test "x$libzmq_cv_so_keepalive" = "xyes"], [$1], [$2])
|
2012-04-06 20:04:35 +04:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_TCP_KEEPCNT([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if TCP_KEEPCNT is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPCNT], [{
|
2015-02-06 15:11:07 +01:00
|
|
|
AC_CACHE_CHECK([whether TCP_KEEPCNT is supported], [libzmq_cv_tcp_keepcnt],
|
|
|
|
[AC_TRY_RUN([/* TCP_KEEPCNT test */
|
2012-04-06 20:04:35 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s, rc, opt = 1;
|
|
|
|
return (
|
|
|
|
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
|
|
|
((rc = setsockopt (s, SOL_SOCKET, SO_KEEPALIVE, (char*) &opt, sizeof (int))) == -1) ||
|
|
|
|
((rc = setsockopt (s, IPPROTO_TCP, TCP_KEEPCNT, (char*) &opt, sizeof (int))) == -1)
|
|
|
|
);
|
|
|
|
}
|
2015-02-06 15:11:07 +01:00
|
|
|
],
|
|
|
|
[libzmq_cv_tcp_keepcnt="yes"],
|
|
|
|
[libzmq_cv_tcp_keepcnt="no"],
|
|
|
|
[libzmq_cv_tcp_keepcnt="not during cross-compile"]
|
|
|
|
)]
|
2012-04-05 19:39:53 +04:00
|
|
|
)
|
2015-02-06 15:11:07 +01:00
|
|
|
AS_IF([test "x$libzmq_cv_tcp_keepcnt" = "xyes"], [$1], [$2])
|
2012-04-05 19:39:53 +04:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
2012-04-06 20:04:35 +04:00
|
|
|
dnl # LIBZMQ_CHECK_TCP_KEEPIDLE([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if TCP_KEEPIDLE is supported #
|
2012-04-05 19:39:53 +04:00
|
|
|
dnl ################################################################################
|
2012-04-06 20:04:35 +04:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPIDLE], [{
|
2015-02-06 15:11:07 +01:00
|
|
|
AC_CACHE_CHECK([whether TCP_KEEPIDLE is supported], [libzmq_cv_tcp_keepidle],
|
|
|
|
[AC_TRY_RUN([/* TCP_KEEPIDLE test */
|
2012-04-06 20:04:35 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s, rc, opt = 1;
|
|
|
|
return (
|
|
|
|
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
|
|
|
((rc = setsockopt (s, SOL_SOCKET, SO_KEEPALIVE, (char*) &opt, sizeof (int))) == -1) ||
|
|
|
|
((rc = setsockopt (s, IPPROTO_TCP, TCP_KEEPIDLE, (char*) &opt, sizeof (int))) == -1)
|
|
|
|
);
|
|
|
|
}
|
2015-02-06 15:11:07 +01:00
|
|
|
],
|
|
|
|
[libzmq_cv_tcp_keepidle="yes"],
|
|
|
|
[libzmq_cv_tcp_keepidle="no"],
|
|
|
|
[libzmq_cv_tcp_keepidle="not during cross-compile"]
|
|
|
|
)]
|
2012-04-06 20:04:35 +04:00
|
|
|
)
|
2015-02-06 15:11:07 +01:00
|
|
|
AS_IF([test "x$libzmq_cv_tcp_keepidle" = "xyes"], [$1], [$2])
|
2012-04-06 20:04:35 +04:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_TCP_KEEPINTVL([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if TCP_KEEPINTVL is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPINTVL], [{
|
2015-02-06 15:11:07 +01:00
|
|
|
AC_CACHE_CHECK([whether TCP_KEEPINTVL is supported], [libzmq_cv_tcp_keepintvl],
|
|
|
|
[AC_TRY_RUN([/* TCP_KEEPINTVL test */
|
2012-04-05 19:39:53 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s, rc, opt = 1;
|
|
|
|
return (
|
|
|
|
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
|
|
|
((rc = setsockopt (s, SOL_SOCKET, SO_KEEPALIVE, (char*) &opt, sizeof (int))) == -1) ||
|
|
|
|
((rc = setsockopt (s, IPPROTO_TCP, TCP_KEEPINTVL, (char*) &opt, sizeof (int))) == -1)
|
|
|
|
);
|
|
|
|
}
|
2015-02-06 15:11:07 +01:00
|
|
|
],
|
|
|
|
[libzmq_cv_tcp_keepintvl="yes"],
|
|
|
|
[libzmq_cv_tcp_keepintvl="no"],
|
|
|
|
[libzmq_cv_tcp_keepintvl="not during cross-compile"]
|
|
|
|
)]
|
2012-04-06 20:04:35 +04:00
|
|
|
)
|
2015-02-06 15:11:07 +01:00
|
|
|
AS_IF([test "x$libzmq_cv_tcp_keepintvl" = "xyes"], [$1], [$2])
|
2012-04-06 20:04:35 +04:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_TCP_KEEPALIVE([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if TCP_KEEPALIVE is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPALIVE], [{
|
2015-02-06 15:11:07 +01:00
|
|
|
AC_CACHE_CHECK([whether TCP_KEEPALIVE is supported], [libzmq_cv_tcp_keepalive],
|
|
|
|
[AC_TRY_RUN([/* TCP_KEEPALIVE test */
|
2012-04-06 20:04:35 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <netinet/tcp.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s, rc, opt = 1;
|
|
|
|
return (
|
|
|
|
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
|
|
|
((rc = setsockopt (s, SOL_SOCKET, SO_KEEPALIVE, (char*) &opt, sizeof (int))) == -1) ||
|
|
|
|
((rc = setsockopt (s, IPPROTO_TCP, TCP_KEEPALIVE, (char*) &opt, sizeof (int))) == -1)
|
|
|
|
);
|
|
|
|
}
|
2015-02-06 15:11:07 +01:00
|
|
|
],
|
|
|
|
[libzmq_cv_tcp_keepalive="yes"],
|
|
|
|
[libzmq_cv_tcp_keepalive="no"],
|
|
|
|
[libzmq_cv_tcp_keepalive="not during cross-compile"]
|
|
|
|
)]
|
2012-04-05 19:39:53 +04:00
|
|
|
)
|
2015-02-06 15:11:07 +01:00
|
|
|
AS_IF([test "x$libzmq_cv_tcp_keepalive" = "xyes"], [$1], [$2])
|
2012-04-05 19:39:53 +04:00
|
|
|
}])
|
|
|
|
|
2021-01-06 16:22:41 -06:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_SO_PRIORITY([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check if SO_PRIORITY is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_SO_PRIORITY], [{
|
|
|
|
AC_CACHE_CHECK([whether SO_PRIORITY is supported], [libzmq_cv_so_priority],
|
|
|
|
[AC_TRY_RUN([/* SO_PRIORITY test */
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
int s, rc, opt = 1;
|
|
|
|
return (
|
|
|
|
((s = socket (PF_INET, SOCK_STREAM, 0)) == -1) ||
|
|
|
|
((rc = setsockopt (s, SOL_SOCKET, SO_PRIORITY, (char*) &opt, sizeof (int))) == -1)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
],
|
|
|
|
[libzmq_cv_so_priority="yes"],
|
|
|
|
[libzmq_cv_so_priority="no"],
|
|
|
|
[libzmq_cv_so_priority="not during cross-compile"]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
AS_IF([test "x$libzmq_cv_so_priority" = "xyes"], [$1], [$2])
|
|
|
|
}])
|
|
|
|
|
2017-07-27 21:37:12 +01:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_GETRANDOM([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks if getrandom is supported #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_GETRANDOM], [{
|
|
|
|
AC_CACHE_CHECK([whether getrandom is supported], [libzmq_cv_getrandom],
|
|
|
|
[AC_TRY_RUN([/* thread-local storage test */
|
|
|
|
#include <sys/random.h>
|
|
|
|
|
|
|
|
int main (int argc, char *argv [])
|
|
|
|
{
|
|
|
|
char buf[4];
|
2018-05-09 10:41:20 +01:00
|
|
|
int rc = getrandom(buf, 4, 0);
|
|
|
|
return rc == -1 ? 1 : 0;
|
2017-07-27 21:37:12 +01:00
|
|
|
}
|
|
|
|
],
|
|
|
|
[libzmq_cv_getrandom="yes"],
|
|
|
|
[libzmq_cv_getrandom="no"],
|
|
|
|
[libzmq_cv_getrandom="not during cross-compile"]
|
|
|
|
)]
|
|
|
|
)
|
|
|
|
AS_IF([test "x$libzmq_cv_getrandom" = "xyes"], [$1], [$2])
|
|
|
|
}])
|
|
|
|
|
2011-09-04 10:28:15 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_POLLER_KQUEUE([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks kqueue polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_KQUEUE], [{
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
2011-09-04 10:28:15 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/event.h>
|
|
|
|
#include <sys/time.h>
|
2016-02-11 16:14:12 +01:00
|
|
|
],[[
|
2011-09-04 10:28:15 +02:00
|
|
|
struct kevent t_kev;
|
|
|
|
kqueue();
|
2016-02-11 16:14:12 +01:00
|
|
|
]])],
|
|
|
|
[$1], [$2]
|
|
|
|
)
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
2012-01-27 15:24:47 -08:00
|
|
|
dnl # LIBZMQ_CHECK_POLLER_EPOLL_RUN([action-if-found], [action-if-not-found]) #
|
2016-12-26 18:01:36 +01:00
|
|
|
dnl # LIBZMQ_CHECK_POLLER_EPOLL_CLOEXEC([action-if-found], [action-if-not-found]) #
|
2012-01-27 15:24:47 -08:00
|
|
|
dnl # Checks epoll polling system can actually run #
|
2015-01-28 10:27:15 -06:00
|
|
|
dnl # For cross-compile, only requires that epoll can link #
|
2011-09-04 10:28:15 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_EPOLL], [{
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_RUN_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
2011-09-04 10:28:15 +02:00
|
|
|
#include <sys/epoll.h>
|
2016-02-11 16:14:12 +01:00
|
|
|
],[[
|
2011-09-04 10:28:15 +02:00
|
|
|
struct epoll_event t_ev;
|
2012-01-27 13:27:21 -08:00
|
|
|
int r;
|
|
|
|
r = epoll_create(10);
|
|
|
|
return(r < 0);
|
2016-02-11 16:14:12 +01:00
|
|
|
]])],
|
|
|
|
[$1],[$2],[
|
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
2012-01-27 15:24:47 -08:00
|
|
|
#include <sys/epoll.h>
|
2016-02-11 16:14:12 +01:00
|
|
|
],[[
|
|
|
|
struct epoll_event t_ev;
|
|
|
|
epoll_create(10);
|
|
|
|
]])],
|
|
|
|
[$1], [$2]
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|
|
|
|
|
2016-12-26 18:01:36 +01:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_EPOLL_CLOEXEC], [{
|
|
|
|
AC_RUN_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
|
|
|
#include <sys/epoll.h>
|
|
|
|
],[[
|
|
|
|
struct epoll_event t_ev;
|
|
|
|
int r;
|
|
|
|
r = epoll_create1(EPOLL_CLOEXEC);
|
|
|
|
return(r < 0);
|
|
|
|
]])],
|
|
|
|
[$1],[$2],[
|
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
|
|
|
#include <sys/epoll.h>
|
|
|
|
],[[
|
|
|
|
struct epoll_event t_ev;
|
|
|
|
epoll_create1(EPOLL_CLOEXEC);
|
|
|
|
]])],
|
|
|
|
[$1], [$2]
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
}])
|
|
|
|
|
2011-09-04 10:28:15 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_POLLER_DEVPOLL([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks devpoll polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_DEVPOLL], [{
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
2011-09-04 10:28:15 +02:00
|
|
|
#include <sys/devpoll.h>
|
2016-02-11 16:14:12 +01:00
|
|
|
],[[
|
2011-09-04 10:28:15 +02:00
|
|
|
struct pollfd t_devpoll;
|
|
|
|
int fd = open("/dev/poll", O_RDWR);
|
2016-02-11 16:14:12 +01:00
|
|
|
]])],
|
|
|
|
[$1], [$2]
|
|
|
|
)
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|
|
|
|
|
2016-09-21 11:24:26 +08:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_POLLER_POLLSET([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks pollset polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_POLLSET], [{
|
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
|
|
|
#include <sys/poll.h>
|
|
|
|
#include <sys/pollset.h>
|
|
|
|
],[[
|
|
|
|
pollset_t ps = pollset_create(-1);
|
|
|
|
]])],
|
|
|
|
[$1], [$2]
|
|
|
|
)
|
|
|
|
}])
|
|
|
|
|
2011-09-04 10:28:15 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_POLLER_POLL([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks poll polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_POLL], [{
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
2011-09-04 10:28:15 +02:00
|
|
|
#include <poll.h>
|
2016-02-11 16:14:12 +01:00
|
|
|
],[[
|
2011-09-04 10:28:15 +02:00
|
|
|
struct pollfd t_poll;
|
|
|
|
poll(&t_poll, 1, 1);
|
2016-02-11 16:14:12 +01:00
|
|
|
]])],
|
|
|
|
[$1], [$2]
|
|
|
|
)
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|
|
|
|
|
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_POLLER_SELECT([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks select polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER_SELECT], [{
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
2011-09-06 08:51:23 +02:00
|
|
|
#ifdef ZMQ_HAVE_WINDOWS
|
|
|
|
#include "winsock2.h"
|
|
|
|
#elif defined ZMQ_HAVE_OPENVMS
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#else
|
2011-09-04 10:28:15 +02:00
|
|
|
#include <sys/select.h>
|
2011-09-06 08:51:23 +02:00
|
|
|
#endif
|
2016-02-11 16:14:12 +01:00
|
|
|
],[[
|
2011-09-04 10:28:15 +02:00
|
|
|
fd_set t_rfds;
|
|
|
|
struct timeval tv;
|
|
|
|
FD_ZERO(&t_rfds);
|
|
|
|
FD_SET(0, &t_rfds);
|
|
|
|
tv.tv_sec = 5;
|
2011-09-06 08:51:23 +02:00
|
|
|
tv.tv_usec = 0;
|
2016-11-24 12:44:51 +00:00
|
|
|
select(1, &t_rfds, 0, 0, &tv);
|
2016-02-11 16:14:12 +01:00
|
|
|
]])],
|
|
|
|
[$1],[$2]
|
|
|
|
)
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|
|
|
|
|
2021-09-16 17:20:24 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_PSELECT([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Checks pselect polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_PSELECT], [{
|
|
|
|
AC_LINK_IFELSE([
|
|
|
|
AC_LANG_PROGRAM([
|
|
|
|
#include <sys/select.h>
|
|
|
|
#include <signal.h>
|
|
|
|
],[[
|
|
|
|
fd_set t_rfds;
|
|
|
|
struct timespec ts;
|
|
|
|
FD_ZERO(&t_rfds);
|
|
|
|
FD_SET(0, &t_rfds);
|
|
|
|
ts.tv_sec = 5;
|
|
|
|
ts.tv_nsec = 0;
|
|
|
|
sigset_t sigmask, sigmask_without_sigterm;
|
|
|
|
sigemptyset(&sigmask);
|
|
|
|
sigprocmask(SIG_BLOCK, &sigmask, &sigmask_without_sigterm);
|
|
|
|
|
|
|
|
pselect(1, &t_rfds, 0, 0, &ts, &sigmask);
|
|
|
|
]])],
|
|
|
|
[$1],[$2]
|
|
|
|
)
|
|
|
|
}])
|
|
|
|
|
2011-09-04 10:28:15 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_POLLER([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Choose polling system #
|
|
|
|
dnl ################################################################################
|
|
|
|
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_DEFUN([LIBZMQ_CHECK_POLLER], [{
|
2014-02-14 14:40:51 +01:00
|
|
|
# Allow user to override poller autodetection
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_ARG_WITH([poller],
|
|
|
|
[AS_HELP_STRING([--with-poller],
|
2018-06-03 11:55:26 +08:00
|
|
|
[choose I/O thread polling system manually. Valid values are 'kqueue', 'epoll', 'devpoll', 'pollset', 'poll', 'select', 'wepoll', or 'auto'. [default=auto]])])
|
2018-05-22 15:57:20 +02:00
|
|
|
|
|
|
|
# Allow user to override poller autodetection
|
|
|
|
AC_ARG_WITH([api_poller],
|
|
|
|
[AS_HELP_STRING([--with-api-poller],
|
|
|
|
[choose zmq_poll(er)_* API polling system manually. Valid values are 'poll', 'select', or 'auto'. [default=auto]])])
|
2011-09-04 10:28:15 +02:00
|
|
|
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "x$with_poller" = "x"; then
|
2016-02-11 16:14:12 +01:00
|
|
|
pollers=auto
|
|
|
|
else
|
|
|
|
pollers=$with_poller
|
|
|
|
fi
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "$pollers" = "auto"; then
|
2016-02-11 16:14:12 +01:00
|
|
|
# We search for pollers in this order
|
2016-09-21 11:24:26 +08:00
|
|
|
pollers="kqueue epoll devpoll pollset poll select"
|
2016-02-11 16:14:12 +01:00
|
|
|
fi
|
2011-09-04 10:28:15 +02:00
|
|
|
|
2016-02-11 16:14:12 +01:00
|
|
|
# try to find suitable polling system. the order of testing is:
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Choosing I/O thread polling system from '$pollers'...])
|
2016-02-11 16:14:12 +01:00
|
|
|
poller_found=0
|
|
|
|
for poller in $pollers; do
|
|
|
|
case "$poller" in
|
|
|
|
kqueue)
|
|
|
|
LIBZMQ_CHECK_POLLER_KQUEUE([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'kqueue' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_KQUEUE, 1, [Use 'kqueue' I/O thread polling system])
|
2016-02-11 16:14:12 +01:00
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
epoll)
|
2017-02-02 18:18:37 +01:00
|
|
|
case "$host_os" in
|
|
|
|
solaris*|sunos*)
|
|
|
|
# Recent illumos and Solaris systems did add epoll()
|
|
|
|
# syntax, but it does not fully satisfy expectations
|
|
|
|
# that ZMQ has from Linux systems. Unless you undertake
|
|
|
|
# to fix the integration, do not disable this exception
|
|
|
|
# and use select() or poll() on Solarish OSes for now.
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([NOT using 'epoll' I/O thread polling system on '$host_os']) ;;
|
2017-02-02 18:18:37 +01:00
|
|
|
*)
|
|
|
|
LIBZMQ_CHECK_POLLER_EPOLL_CLOEXEC([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'epoll' I/O thread polling system with CLOEXEC])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_EPOLL, 1, [Use 'epoll' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_EPOLL_CLOEXEC, 1, [Use 'epoll' I/O thread polling system with CLOEXEC])
|
2017-02-02 18:18:37 +01:00
|
|
|
poller_found=1
|
|
|
|
],[
|
|
|
|
LIBZMQ_CHECK_POLLER_EPOLL([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'epoll' I/O thread polling system with CLOEXEC])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_EPOLL, 1, [Use 'epoll' I/O thread polling system])
|
2017-02-02 18:18:37 +01:00
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
esac
|
2016-02-11 16:14:12 +01:00
|
|
|
;;
|
|
|
|
devpoll)
|
|
|
|
LIBZMQ_CHECK_POLLER_DEVPOLL([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'devpoll' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_DEVPOLL, 1, [Use 'devpoll' I/O thread polling system])
|
2016-02-11 16:14:12 +01:00
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
2016-09-21 11:24:26 +08:00
|
|
|
pollset)
|
|
|
|
LIBZMQ_CHECK_POLLER_POLLSET([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'pollset' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_POLLSET, 1, [Use 'pollset' I/O thread polling system])
|
2016-09-21 11:24:26 +08:00
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
2016-02-11 16:14:12 +01:00
|
|
|
poll)
|
|
|
|
LIBZMQ_CHECK_POLLER_POLL([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'poll' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_POLL, 1, [Use 'poll' I/O thread polling system])
|
2016-02-11 16:14:12 +01:00
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
select)
|
|
|
|
LIBZMQ_CHECK_POLLER_SELECT([
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'select' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_SELECT, 1, [Use 'select' I/O thread polling system])
|
2016-02-11 16:14:12 +01:00
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
2018-06-03 11:55:26 +08:00
|
|
|
wepoll)
|
|
|
|
# wepoll can only be manually selected
|
|
|
|
AC_MSG_NOTICE([Using 'wepoll' I/O thread polling system])
|
|
|
|
AC_DEFINE(ZMQ_IOTHREAD_POLLER_USE_EPOLL, 1, [Use 'epoll' I/O thread polling system])
|
|
|
|
poller_found=1
|
|
|
|
;;
|
2016-02-11 16:14:12 +01:00
|
|
|
esac
|
|
|
|
test $poller_found -eq 1 && break
|
|
|
|
done
|
|
|
|
if test $poller_found -eq 0; then
|
|
|
|
AC_MSG_ERROR([None of '$pollers' are valid pollers on this platform])
|
|
|
|
fi
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "x$with_api_poller" = "x"; then
|
2018-05-22 15:57:20 +02:00
|
|
|
with_api_poller=auto
|
|
|
|
fi
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "x$with_api_poller" = "xauto"; then
|
|
|
|
if test $poller = "select"; then
|
2018-05-22 15:57:20 +02:00
|
|
|
api_poller=select
|
2019-05-22 01:30:54 +02:00
|
|
|
elif test $poller = "wepoll"; then
|
2018-06-03 11:55:26 +08:00
|
|
|
api_poller=select
|
2018-05-22 15:57:20 +02:00
|
|
|
else
|
|
|
|
api_poller=poll
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
api_poller=$with_api_poller
|
|
|
|
fi
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "$api_poller" = "select"; then
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'select' zmq_poll(er)_* API polling system])
|
|
|
|
AC_DEFINE(ZMQ_POLL_BASED_ON_SELECT, 1, [Use 'select' zmq_poll(er)_* API polling system])
|
2019-05-22 01:30:54 +02:00
|
|
|
elif test "$api_poller" = "poll"; then
|
2018-05-22 15:57:20 +02:00
|
|
|
AC_MSG_NOTICE([Using 'poll' zmq_poll(er)_* API polling system])
|
|
|
|
AC_DEFINE(ZMQ_POLL_BASED_ON_POLL, 1, [Use 'poll' zmq_poll(er)_* API polling system])
|
|
|
|
else
|
|
|
|
AC_MSG_ERROR([Invalid API poller '$api_poller' specified])
|
|
|
|
fi
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|
2019-01-19 19:39:42 +00:00
|
|
|
|
2021-09-16 17:20:24 +02:00
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_PPOLL([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Check whether zmq_ppoll can be activated, and do so if it can #
|
|
|
|
dnl ################################################################################
|
|
|
|
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_PPOLL], [{
|
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
|
|
|
|
|
|
case "${host_os}" in
|
|
|
|
*mingw*|*cygwin*|*msys*)
|
|
|
|
# Disable ppoll by default on Windows
|
|
|
|
AC_MSG_NOTICE([NOT building active zmq_ppoll on '$host_os']) ;;
|
|
|
|
*)
|
|
|
|
LIBZMQ_CHECK_PSELECT([
|
|
|
|
AC_MSG_NOTICE([Building with zmq_ppoll])
|
|
|
|
AC_DEFINE(ZMQ_HAVE_PPOLL, 1, [Build with zmq_ppoll])
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}])
|
|
|
|
|
2019-01-19 19:39:42 +00:00
|
|
|
dnl ##############################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_CACHELINE #
|
|
|
|
dnl # Check cacheline size for alignment purposes #
|
|
|
|
dnl ##############################################################################
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_CACHELINE], [{
|
|
|
|
|
|
|
|
zmq_cacheline_size=64
|
|
|
|
AC_CHECK_TOOL(libzmq_getconf, getconf)
|
|
|
|
if ! test "x$libzmq_getconf" = "x"; then
|
|
|
|
zmq_cacheline_size=$($libzmq_getconf LEVEL1_DCACHE_LINESIZE 2>/dev/null || echo 64)
|
2023-01-10 01:12:20 +08:00
|
|
|
if test "x$zmq_cacheline_size" = "x0" -o "x$zmq_cacheline_size" = "x-1" -o "x$zmq_cacheline_size" = "xundefined"; then
|
2019-01-19 19:39:42 +00:00
|
|
|
# getconf on some architectures does not know the size, try to fallback to
|
|
|
|
# the value the kernel knows on Linux
|
|
|
|
zmq_cacheline_size=$(cat /sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size 2>/dev/null || echo 64)
|
|
|
|
fi
|
2021-02-18 11:05:29 -06:00
|
|
|
fi
|
|
|
|
if test "x$zmq_cacheline_size" = "xundefined"; then
|
|
|
|
# On some platforms e.g. Fedora33 s390x the cacheline size reported
|
|
|
|
# by getconf as 'undefined'.
|
|
|
|
zmq_cacheline_size=64
|
2019-01-19 19:39:42 +00:00
|
|
|
fi
|
|
|
|
AC_MSG_NOTICE([Using "$zmq_cacheline_size" bytes alignment for lock-free data structures])
|
|
|
|
AC_DEFINE_UNQUOTED(ZMQ_CACHELINE_SIZE, $zmq_cacheline_size, [Using "$zmq_cacheline_size" bytes alignment for lock-free data structures])
|
|
|
|
}])
|
2019-02-11 07:05:04 -05:00
|
|
|
|
|
|
|
dnl ################################################################################
|
|
|
|
dnl # LIBZMQ_CHECK_CV_IMPL([action-if-found], [action-if-not-found]) #
|
|
|
|
dnl # Choose condition variable implementation #
|
|
|
|
dnl ################################################################################
|
|
|
|
|
|
|
|
AC_DEFUN([LIBZMQ_CHECK_CV_IMPL], [{
|
|
|
|
# Allow user to override condition variable autodetection
|
|
|
|
AC_ARG_WITH([cv-impl],
|
|
|
|
[AS_HELP_STRING([--with-cv-impl],
|
|
|
|
[choose condition variable implementation manually. Valid values are 'stl11', 'pthread', 'none', or 'auto'. [default=auto]])])
|
|
|
|
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "x$with_cv_impl" = "x"; then
|
2019-02-11 07:05:04 -05:00
|
|
|
cv_impl=auto
|
|
|
|
else
|
|
|
|
cv_impl=$with_cv_impl
|
|
|
|
fi
|
|
|
|
case $host_os in
|
|
|
|
vxworks*)
|
|
|
|
cv_impl="vxworks"
|
|
|
|
AC_DEFINE(ZMQ_USE_CV_IMPL_VXWORKS, 1, [Use vxworks condition variable implementation.])
|
|
|
|
;;
|
|
|
|
esac
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "$cv_impl" = "auto" || test "$cv_impl" = "stl11"; then
|
2019-02-11 07:05:04 -05:00
|
|
|
AC_LANG_PUSH([C++])
|
|
|
|
AC_CHECK_HEADERS(condition_variable, [stl11="yes"
|
|
|
|
AC_DEFINE(ZMQ_USE_CV_IMPL_STL11, 1, [Use stl11 condition variable implementation.])],
|
|
|
|
[stl11="no"])
|
|
|
|
AC_LANG_POP([C++])
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "$cv_impl" = "stl11" && test "x$stl11" = "xno"; then
|
2019-02-11 07:05:04 -05:00
|
|
|
AC_MSG_ERROR([--with-cv-impl set to stl11 but cannot find condition_variable])
|
|
|
|
fi
|
|
|
|
fi
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "$cv_impl" = "pthread" || test "x$stl11" = "xno"; then
|
2019-02-11 07:05:04 -05:00
|
|
|
AC_DEFINE(ZMQ_USE_CV_IMPL_PTHREADS, 1, [Use pthread condition variable implementation.])
|
|
|
|
fi
|
2019-05-22 01:30:54 +02:00
|
|
|
if test "$cv_impl" = "none"; then
|
2019-02-11 07:05:04 -05:00
|
|
|
AC_DEFINE(ZMQ_USE_CV_IMPL_NONE, 1, [Use no condition variable implementation.])
|
|
|
|
fi
|
|
|
|
AC_MSG_NOTICE([Using "$cv_impl" condition variable implementation.])
|
|
|
|
}])
|