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
|
2016-02-03 23:38:33 +11:00
|
|
|
*mingw*|*cygwin*)
|
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
|
|
|
}])
|
|
|
|
|
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)
|
|
|
|
AC_COMPILE_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;
|
|
|
|
}
|
|
|
|
])],
|
|
|
|
[AC_MSG_RESULT(yes) ; libzmq_cv_has_atomic_instrisics="yes" ; $1],
|
|
|
|
[AC_MSG_RESULT(no) ; libzmq_cv_has_atomic_instrisics="no" ; $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
|
|
|
}])
|
|
|
|
|
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
|
|
|
}])
|
|
|
|
|
|
|
|
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],
|
2016-09-21 11:24:26 +08:00
|
|
|
[choose polling system manually. Valid values are 'kqueue', 'epoll', 'devpoll', 'pollset', 'poll', 'select', or 'auto'. [default=auto]])])
|
2011-09-04 10:28:15 +02:00
|
|
|
|
2016-02-11 16:14:12 +01:00
|
|
|
if test "x$with_poller" == "x"; then
|
|
|
|
pollers=auto
|
|
|
|
else
|
|
|
|
pollers=$with_poller
|
|
|
|
fi
|
|
|
|
if test "$pollers" == "auto"; then
|
|
|
|
# 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:
|
|
|
|
AC_MSG_NOTICE([Choosing polling system from '$pollers'...])
|
|
|
|
poller_found=0
|
|
|
|
for poller in $pollers; do
|
|
|
|
case "$poller" in
|
|
|
|
kqueue)
|
|
|
|
LIBZMQ_CHECK_POLLER_KQUEUE([
|
|
|
|
AC_MSG_NOTICE([Using 'kqueue' polling system])
|
|
|
|
AC_DEFINE(ZMQ_USE_KQUEUE, 1, [Use 'kqueue' polling system])
|
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
epoll)
|
2016-12-26 18:01:36 +01:00
|
|
|
LIBZMQ_CHECK_POLLER_EPOLL_CLOEXEC([
|
|
|
|
AC_MSG_NOTICE([Using 'epoll' polling system with CLOEXEC])
|
2016-02-11 16:14:12 +01:00
|
|
|
AC_DEFINE(ZMQ_USE_EPOLL, 1, [Use 'epoll' polling system])
|
2016-12-26 18:01:36 +01:00
|
|
|
AC_DEFINE(ZMQ_USE_EPOLL_CLOEXEC, 1, [Use 'epoll' polling system with CLOEXEC])
|
2016-02-11 16:14:12 +01:00
|
|
|
poller_found=1
|
2016-12-26 18:01:36 +01:00
|
|
|
],[
|
|
|
|
LIBZMQ_CHECK_POLLER_EPOLL([
|
|
|
|
AC_MSG_NOTICE([Using 'epoll' polling system with CLOEXEC])
|
|
|
|
AC_DEFINE(ZMQ_USE_EPOLL, 1, [Use 'epoll' polling system])
|
|
|
|
poller_found=1
|
|
|
|
])
|
2016-02-11 16:14:12 +01:00
|
|
|
])
|
|
|
|
;;
|
|
|
|
devpoll)
|
|
|
|
LIBZMQ_CHECK_POLLER_DEVPOLL([
|
|
|
|
AC_MSG_NOTICE([Using 'devpoll' polling system])
|
|
|
|
AC_DEFINE(ZMQ_USE_DEVPOLL, 1, [Use 'devpoll' polling system])
|
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
2016-09-21 11:24:26 +08:00
|
|
|
pollset)
|
|
|
|
LIBZMQ_CHECK_POLLER_POLLSET([
|
|
|
|
AC_MSG_NOTICE([Using 'pollset' polling system])
|
|
|
|
AC_DEFINE(ZMQ_USE_POLLSET, 1, [Use 'pollset' polling system])
|
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
2016-02-11 16:14:12 +01:00
|
|
|
poll)
|
|
|
|
LIBZMQ_CHECK_POLLER_POLL([
|
|
|
|
AC_MSG_NOTICE([Using 'poll' polling system])
|
|
|
|
AC_DEFINE(ZMQ_USE_POLL, 1, [Use 'poll' polling system])
|
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
select)
|
|
|
|
LIBZMQ_CHECK_POLLER_SELECT([
|
|
|
|
AC_MSG_NOTICE([Using 'select' polling system])
|
|
|
|
AC_DEFINE(ZMQ_USE_SELECT, 1, [Use 'select' polling system])
|
|
|
|
poller_found=1
|
|
|
|
])
|
|
|
|
;;
|
|
|
|
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
|
2011-09-04 10:28:15 +02:00
|
|
|
}])
|