acinclude.m4 36.8 KB
Newer Older
1
dnl ##############################################################################
2
dnl # LIBZMQ_CONFIG_LIBTOOL                                                      #
3
dnl # Configure libtool. Requires AC_CANONICAL_HOST                              #
Mikko Koppanen's avatar
Mikko Koppanen committed
4
dnl ##############################################################################
5
AC_DEFUN([LIBZMQ_CONFIG_LIBTOOL],  [{
6
    AC_REQUIRE([AC_CANONICAL_HOST])
Mikko Koppanen's avatar
Mikko Koppanen committed
7 8 9

    # Libtool configuration for different targets
    case "${host_os}" in
10
        *mingw*|*cygwin*)
Mikko Koppanen's avatar
Mikko Koppanen committed
11 12 13 14 15 16 17 18 19 20 21
            # Disable static build by default
            AC_DISABLE_STATIC
        ;;
        *)
            # Everything else with static enabled
            AC_ENABLE_STATIC
        ;;
    esac
}])

dnl ##############################################################################
22
dnl # LIBZMQ_CHECK_LANG_ICC([action-if-found], [action-if-not-found])            #
23 24 25
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 ##############################################################################
26
AC_DEFUN([LIBZMQ_CHECK_LANG_ICC],
27
          [AC_CACHE_CHECK([whether we are using Intel _AC_LANG compiler],
28
          [libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler],
29 30 31 32 33
          [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#ifndef __INTEL_COMPILER
       error if not ICC
#endif
]])],
34 35
          [libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler="yes" ; $1],
          [libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler="no" ; $2])
36
])])
Mikko Koppanen's avatar
Mikko Koppanen committed
37 38

dnl ##############################################################################
39
dnl # LIBZMQ_CHECK_LANG_SUN_STUDIO([action-if-found], [action-if-not-found])     #
Mikko Koppanen's avatar
Mikko Koppanen committed
40 41
dnl # Check if the current language is compiled using Sun Studio                 #
dnl ##############################################################################
42
AC_DEFUN([LIBZMQ_CHECK_LANG_SUN_STUDIO],
Mikko Koppanen's avatar
Mikko Koppanen committed
43
          [AC_CACHE_CHECK([whether we are using Sun Studio _AC_LANG compiler],
44
          [libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler],
Mikko Koppanen's avatar
Mikko Koppanen committed
45 46 47 48 49
          [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if !defined(__SUNPRO_CC) && !defined(__SUNPRO_C)
       error if not sun studio
#endif
]])],
50 51
          [libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="yes" ; $1],
          [libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler="no" ; $2])
Mikko Koppanen's avatar
Mikko Koppanen committed
52 53 54
])])

dnl ##############################################################################
55
dnl # LIBZMQ_CHECK_LANG_CLANG([action-if-found], [action-if-not-found])          #
56 57
dnl # Check if the current language is compiled using clang                      #
dnl ##############################################################################
58
AC_DEFUN([LIBZMQ_CHECK_LANG_CLANG],
59
          [AC_CACHE_CHECK([whether we are using clang _AC_LANG compiler],
60
          [libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler],
61 62 63 64 65
          [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#ifndef __clang__
       error if not clang
#endif
]])],
66 67
          [libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="yes" ; $1],
          [libzmq_cv_[]_AC_LANG_ABBREV[]_clang_compiler="no" ; $2])
68 69
])])

Mikko Koppanen's avatar
Mikko Koppanen committed
70
dnl ##############################################################################
Mikko Koppanen's avatar
Mikko Koppanen committed
71
dnl # LIBZMQ_CHECK_LANG_GCC4([action-if-found], [action-if-not-found])           #
Mikko Koppanen's avatar
Mikko Koppanen committed
72 73
dnl # Check if the current language is compiled using clang                      #
dnl ##############################################################################
74
AC_DEFUN([LIBZMQ_CHECK_LANG_GCC4],
Mikko Koppanen's avatar
Mikko Koppanen committed
75
          [AC_CACHE_CHECK([whether we are using gcc >= 4 _AC_LANG compiler],
76
          [libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler],
Mikko Koppanen's avatar
Mikko Koppanen committed
77 78 79 80 81
          [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
[[#if (!defined __GNUC__ || __GNUC__ < 4)
       error if not gcc4 or higher
#endif
]])],
82 83
          [libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="yes" ; $1],
          [libzmq_cv_[]_AC_LANG_ABBREV[]_gcc4_compiler="no" ; $2])
Mikko Koppanen's avatar
Mikko Koppanen committed
84 85
])])

86
dnl ##############################################################################
87
dnl # LIBZMQ_CHECK_DOC_BUILD                                                     #
Mikko Koppanen's avatar
Mikko Koppanen committed
88 89
dnl # Check whether to build documentation and install man-pages                 #
dnl ##############################################################################
90
AC_DEFUN([LIBZMQ_CHECK_DOC_BUILD], [{
91

92 93 94
    # Man pages are built/installed if asciidoc and xmlto are present
    #   --with-docs=no overrides this
    AC_ARG_WITH([docs],
95 96
        AS_HELP_STRING([--without-docs],
            [Don't build and install man pages [default=build]]),
97 98 99
        [with_docs=$withval])

    if test "x$with_docs" = "xno"; then
100 101
        libzmq_build_doc="no"
        libzmq_install_man="no"
102 103
    else
        # Determine whether or not documentation should be built and installed.
104 105
        libzmq_build_doc="yes"
        libzmq_install_man="yes"
106
        # Check for asciidoc and xmlto and don't build the docs if these are not installed.
107 108 109 110
        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"
111 112
            # Tarballs built with 'make dist' ship with prebuilt documentation.
            if ! test -f doc/zmq.7; then
113
                libzmq_install_man="no"
114 115 116 117 118 119
                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
120
        if test "x$libzmq_on_mingw" = "xyes"; then
121
            libzmq_install_man="no"
Mikko Koppanen's avatar
Mikko Koppanen committed
122 123 124 125
        fi
    fi

    AC_MSG_CHECKING([whether to build documentation])
126
    AC_MSG_RESULT([$libzmq_build_doc])
Mikko Koppanen's avatar
Mikko Koppanen committed
127 128

    AC_MSG_CHECKING([whether to install manpages])
129
    AC_MSG_RESULT([$libzmq_install_man])
Mikko Koppanen's avatar
Mikko Koppanen committed
130

131 132
    AM_CONDITIONAL(BUILD_DOC, test "x$libzmq_build_doc" = "xyes")
    AM_CONDITIONAL(INSTALL_MAN, test "x$libzmq_install_man" = "xyes")
Mikko Koppanen's avatar
Mikko Koppanen committed
133
}])
134 135

dnl ##############################################################################
136
dnl # LIBZMQ_CHECK_LANG_COMPILER([action-if-found], [action-if-not-found])       #
137 138
dnl # Check that compiler for the current language actually works                #
dnl ##############################################################################
139
AC_DEFUN([LIBZMQ_CHECK_LANG_COMPILER], [{
140 141
    # Test that compiler for the current language actually works
    AC_CACHE_CHECK([whether the _AC_LANG compiler works],
142
                   [libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works],
143
                   [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
144 145
                   [libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works="yes" ; $1],
                   [libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works="no" ; $2])
146 147
                   ])

148
    if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_compiler_works" != "xyes"; then
149 150 151
        AC_MSG_ERROR([Unable to find a working _AC_LANG compiler])
    fi
}])
152 153

dnl ##############################################################################
154
dnl # LIBZMQ_CHECK_COMPILERS                                                     #
155 156
dnl # Check compiler characteristics. This is so that we can AC_REQUIRE checks   #
dnl ##############################################################################
157
AC_DEFUN([LIBZMQ_CHECK_COMPILERS], [{
158 159
    # For that the compiler works and try to come up with the type
    AC_LANG_PUSH([C])
160
    LIBZMQ_CHECK_LANG_COMPILER
161

162 163 164 165
    LIBZMQ_CHECK_LANG_ICC
    LIBZMQ_CHECK_LANG_SUN_STUDIO
    LIBZMQ_CHECK_LANG_CLANG
    LIBZMQ_CHECK_LANG_GCC4
166 167 168
    AC_LANG_POP([C])

    AC_LANG_PUSH(C++)
169
    LIBZMQ_CHECK_LANG_COMPILER
170

171 172 173 174
    LIBZMQ_CHECK_LANG_ICC
    LIBZMQ_CHECK_LANG_SUN_STUDIO
    LIBZMQ_CHECK_LANG_CLANG
    LIBZMQ_CHECK_LANG_GCC4
175 176 177 178
    AC_LANG_POP([C++])

    # Set GCC and GXX variables correctly
    if test "x$GCC" = "xyes"; then
179
        if test "xyes" = "x$libzmq_cv_c_intel_compiler"; then
180 181 182 183 184
            GCC="no"
        fi
    fi

    if test "x$GXX" = "xyes"; then
185
        if test "xyes" = "x$libzmq_cv_cxx_intel_compiler"; then
186 187 188 189 190 191
            GXX="no"
        fi
    fi
}])

dnl ############################################################################
192
dnl # LIBZMQ_CHECK_LANG_FLAG([flag], [action-if-found], [action-if-not-found]) #
193
dnl # Check if the compiler supports given flag. Works for C and C++           #
194
dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no           #
195
dnl ############################################################################
196
AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG], [{
197

Mikko Koppanen's avatar
Mikko Koppanen committed
198 199
    AC_REQUIRE([AC_PROG_GREP])

200 201
    AC_MSG_CHECKING([whether _AC_LANG compiler supports $1])

202
    libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
203 204 205 206
    ac_[]_AC_LANG_ABBREV[]_werror_flag="yes"

    case "x[]_AC_LANG_ABBREV" in
        xc)
207
            libzmq_cv_check_lang_flag_save_CFLAGS="$CFLAGS"
208 209 210
            CFLAGS="$CFLAGS $1"
        ;;
        xcxx)
211
            libzmq_cv_check_lang_flag_save_CPPFLAGS="$CPPFLAGS"
212 213 214 215 216 217 218 219 220 221
            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
Mikko Koppanen's avatar
Mikko Koppanen committed
222 223
                      [if ($GREP 'ignoring unknown' conftest.err ||
                           $GREP 'not supported' conftest.err) >/dev/null 2>&1; then
224
                           eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"
225
                       else
226
                           eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="yes"
227
                       fi],
228
                      [eval AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)="no"])
229 230 231

    case "x[]_AC_LANG_ABBREV" in
        xc)
232
            CFLAGS="$libzmq_cv_check_lang_flag_save_CFLAGS"
233 234
        ;;
        xcxx)
235
            CPPFLAGS="$libzmq_cv_check_lang_flag_save_CPPFLAGS"
236 237 238 239 240 241 242
        ;;
        *)
            # nothing to restore
        ;;
    esac

    # Restore the werror flag
243
    ac_[]_AC_LANG_ABBREV[]_werror_flag=$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
244 245

    # Call the action as the flags are restored
246
    AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
247 248 249 250 251
          [AC_MSG_RESULT(yes) ; $2], [AC_MSG_RESULT(no) ; $3])

}])

dnl ####################################################################################
252
dnl # LIBZMQ_CHECK_LANG_FLAG_PREPEND([flag], [action-if-found], [action-if-not-found]) #
253 254
dnl # Check if the compiler supports given flag. Works for C and C++                   #
dnl # This macro prepends the flag to CFLAGS or CPPFLAGS accordingly                   #
255
dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_[FLAG]=yes/no                   #
256
dnl ####################################################################################
257 258
AC_DEFUN([LIBZMQ_CHECK_LANG_FLAG_PREPEND], [{
    LIBZMQ_CHECK_LANG_FLAG([$1])
259 260
    case "x[]_AC_LANG_ABBREV" in
       xc)
261
            AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
262 263 264
                  [CFLAGS="$1 $CFLAGS"; $2], $3)
       ;;
       xcxx)
265
            AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_flag_$1)[ = "xyes"],
266 267 268 269 270 271
                  [CPPFLAGS="$1 $CPPFLAGS"; $2], $3)
       ;;
    esac
}])

dnl ##############################################################################
272
dnl # LIBZMQ_CHECK_ENABLE_DEBUG([action-if-found], [action-if-not-found])        #
273 274
dnl # Check whether to enable debug build and set compiler flags accordingly     #
dnl ##############################################################################
275
AC_DEFUN([LIBZMQ_CHECK_ENABLE_DEBUG], [{
276 277

    # Require compiler specifics
278
    AC_REQUIRE([LIBZMQ_CHECK_COMPILERS])
279 280 281

    # This flag is checked also in
    AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
282
        [enable debugging information [default=disabled]])])
283 284 285 286 287 288 289

    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 \
290 291
                "x$libzmq_cv_c_intel_compiler" = "xyes" -o \
                "x$libzmq_cv_c_clang_compiler" = "xyes"; then
292
            CFLAGS="-g -O0 "
293
        elif test "x$libzmq_cv_c_sun_studio_compiler" = "xyes"; then
294 295 296 297 298
            CFLAGS="-g0 "
        fi

        # GCC, clang and ICC
        if test "x$GXX" = "xyes" -o \
299 300
                "x$libzmq_cv_cxx_intel_compiler" = "xyes" -o \
                "x$libzmq_cv_cxx_clang_compiler" = "xyes"; then
301 302 303
            CPPFLAGS="-g -O0 "
            CXXFLAGS="-g -O0 "
        # Sun studio
304
        elif test "x$libzmq_cv_cxx_sun_studio_compiler" = "xyes"; then
305 306 307 308
            CPPFLAGS="-g0 "
            CXXFLAGS="-g0 "
        fi

309 310
        if test "x$ZMQ_ORIG_CFLAGS" != "xnone"; then
            CFLAGS="${CFLAGS} ${ZMQ_ORIG_CFLAGS}"
311
        fi
312 313
        if test "x$ZMQ_ORIG_CPPFLAGS" != "xnone"; then
            CPPFLAGS="${CPPFLAGS} ${ZMQ_ORIG_CPPFLAGS}"
314
        fi
315 316
        if test "x$ZMQ_ORIG_CXXFLAGS" != "xnone"; then
            CXXFLAGS="${CXXFLAGS} ${ZMQ_ORIG_CXXFLAGS}"
317 318 319 320 321 322 323
        fi
        AC_MSG_RESULT(yes)
    else
        AC_MSG_RESULT(no)
    fi
}])

324
dnl ##############################################################################
325
dnl # LIBZMQ_WITH_GCOV([action-if-found], [action-if-not-found])                 #
326 327
dnl # Check whether to build with code coverage                                  #
dnl ##############################################################################
328
AC_DEFUN([LIBZMQ_WITH_GCOV], [{
329
    # Require compiler specifics
330
    AC_REQUIRE([LIBZMQ_CHECK_COMPILERS])
331 332

    AC_ARG_WITH(gcov, [AS_HELP_STRING([--with-gcov=yes/no],
333
                      [with GCC Code Coverage reporting.])],
334 335 336 337
                      [ZMQ_GCOV="$withval"])

    AC_MSG_CHECKING(whether to enable code coverage)

Mikko Koppanen's avatar
Mikko Koppanen committed
338
    if test "x$ZMQ_GCOV" = "xyes"; then
339

Mikko Koppanen's avatar
Mikko Koppanen committed
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
        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
358

Mikko Koppanen's avatar
Mikko Koppanen committed
359
        LIBS="-lgcov ${LIBS}"
360 361 362 363 364 365
    fi

    AS_IF([test "x$ZMQ_GCOV" = "xyes"],
          [AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
}])

366
dnl ##############################################################################
367
dnl # LIBZMQ_CHECK_WITH_FLAG([flags], [macro])                                   #
368 369
dnl # Runs a normal autoconf check with compiler flags                           #
dnl ##############################################################################
370 371 372
AC_DEFUN([LIBZMQ_CHECK_WITH_FLAG], [{
    libzmq_check_with_flag_save_CFLAGS="$CFLAGS"
    libzmq_check_with_flag_save_CPPFLAGS="$CPPFLAGS"
373 374 375 376 377 378 379

    CFLAGS="$CFLAGS $1"
    CPPFLAGS="$CPPFLAGS $1"

    # Execute the macro
    $2

380 381
    CFLAGS="$libzmq_check_with_flag_save_CFLAGS"
    CPPFLAGS="$libzmq_check_with_flag_save_CPPFLAGS"
382 383 384
}])

dnl ##############################################################################
385
dnl # LIBZMQ_LANG_WALL([action-if-found], [action-if-not-found])                 #
386
dnl # How to define -Wall for the current compiler                               #
387
dnl # Sets libzmq_cv_[]_AC_LANG_ABBREV[]__wall_flag variable to found style      #
388
dnl ##############################################################################
389
AC_DEFUN([LIBZMQ_LANG_WALL], [{
390 391 392

    AC_MSG_CHECKING([how to enable additional warnings for _AC_LANG compiler])

393
    libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag=""
394 395 396 397 398 399

    # C compilers
    case "x[]_AC_LANG_ABBREV" in
       xc)
            # GCC, clang and ICC
            if test "x$GCC" = "xyes" -o \
400 401 402
                    "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"
403
            # Sun studio
404 405
            elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="-v"
406 407 408 409 410
            fi
       ;;
       xcxx)
            # GCC, clang and ICC
            if test "x$GXX" = "xyes" -o \
411 412 413
                    "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"
414
            # Sun studio
415 416
            elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag="+w"
417 418 419 420 421 422 423
            fi
       ;;
       *)
       ;;
    esac

    # Call the action
424 425
    if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag" != "x"; then
        AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag])
426 427 428 429 430 431 432 433
        $1
    else
        AC_MSG_RESULT([not found])
        $2
    fi
}])

dnl ####################################################################
434
dnl # LIBZMQ_LANG_STRICT([action-if-found], [action-if-not-found])     #
435 436
dnl # Check how to turn on strict standards compliance                 #
dnl ####################################################################
437
AC_DEFUN([LIBZMQ_LANG_STRICT], [{
438 439
    AC_MSG_CHECKING([how to enable strict standards compliance in _AC_LANG compiler])

440
    libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag=""
441 442 443 444 445

    # C compilers
    case "x[]_AC_LANG_ABBREV" in
       xc)
            # GCC, clang and ICC
446 447 448 449
            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"
450
            # Sun studio
451 452
            elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-Xc"
453 454 455 456
            fi
       ;;
       xcxx)
            # GCC, clang and ICC
457 458 459 460
            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"
461
            # Sun studio
462 463
            elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag="-compat=5"
464 465 466 467 468 469 470
            fi
       ;;
       *)
       ;;
    esac

    # Call the action
471 472
    if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag" != "x"; then
        AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_strict_flag])
473 474 475 476 477 478 479 480
        $1
    else
        AC_MSG_RESULT([not found])
        $2
    fi
}])

dnl ########################################################################
481
dnl # LIBZMQ_LANG_WERROR([action-if-found], [action-if-not-found])         #
482 483
dnl # Check how to turn warnings to errors                                 #
dnl ########################################################################
484
AC_DEFUN([LIBZMQ_LANG_WERROR], [{
485 486
    AC_MSG_CHECKING([how to turn warnings to errors in _AC_LANG compiler])

487
    libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag=""
488 489 490 491 492

    # C compilers
    case "x[]_AC_LANG_ABBREV" in
       xc)
            # GCC, clang and ICC
493 494
            if test "x$GCC" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
495
            # Sun studio
496 497
            elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
498 499 500 501
            fi
       ;;
       xcxx)
            # GCC, clang and ICC
502 503
            if test "x$GXX" = "xyes" -o "x$libzmq_cv_[]_AC_LANG_ABBREV[]_intel_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-Werror"
504
            # Sun studio
505 506
            elif test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_sun_studio_compiler" = "xyes"; then
                libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag="-errwarn=%all"
507 508 509 510 511 512 513
            fi
       ;;
       *)
       ;;
    esac

    # Call the action
514 515
    if test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag" != "x"; then
        AC_MSG_RESULT([$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag])
516 517 518 519 520 521 522 523
        $1
    else
        AC_MSG_RESULT([not found])
        $2
    fi
}])

dnl ################################################################################
524
dnl # LIBZMQ_CHECK_LANG_PRAGMA([pragma], [action-if-found], [action-if-not-found]) #
525 526
dnl # Check if the compiler supports given pragma                                  #
dnl ################################################################################
527
AC_DEFUN([LIBZMQ_CHECK_LANG_PRAGMA], [{
528
    # Need to know how to enable all warnings
529
    LIBZMQ_LANG_WALL
530 531 532 533

    AC_MSG_CHECKING([whether _AC_LANG compiler supports pragma $1])

    # Save flags
534
    libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save=$ac_[]_AC_LANG_ABBREV[]_werror_flag
535 536 537
    ac_[]_AC_LANG_ABBREV[]_werror_flag="yes"

    if test "x[]_AC_LANG_ABBREV" = "xc"; then
538 539
        libzmq_cv_check_lang_pragma_save_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag"
540
    elif test "x[]_AC_LANG_ABBREV" = "xcxx"; then
541 542
        libzmq_cv_check_lang_pragma_save_CPPFLAGS="$CPPFLAGS"
        CPPFLAGS="$CPPFLAGS $libzmq_cv_[]_AC_LANG_ABBREV[]_wall_flag"
543 544 545 546 547
    else
        AC_MSG_WARN([testing compiler characteristic on an unknown language])
    fi

    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#pragma $1]])],
548 549
                      [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)])
550 551

    if test "x[]_AC_LANG_ABBREV" = "xc"; then
552
        CFLAGS="$libzmq_cv_check_lang_pragma_save_CFLAGS"
553
    elif test "x[]_AC_LANG_ABBREV" = "xcxx"; then
554
        CPPFLAGS="$libzmq_cv_check_lang_pragma_save_CPPFLAGS"
555 556
    fi

557
    ac_[]_AC_LANG_ABBREV[]_werror_flag=$libzmq_cv_[]_AC_LANG_ABBREV[]_werror_flag_save
558 559

    # Call the action as the flags are restored
560
    AS_IF([eval test x$]AS_TR_SH(libzmq_cv_[]_AC_LANG_ABBREV[]_supports_pragma_$1)[ = "xyes"],
561 562
          [$2], [$3])
}])
Mikko Koppanen's avatar
Mikko Koppanen committed
563 564

dnl ################################################################################
565
dnl # LIBZMQ_CHECK_LANG_VISIBILITY([action-if-found], [action-if-not-found])       #
Mikko Koppanen's avatar
Mikko Koppanen committed
566 567
dnl # Check if the compiler supports dso visibility                                #
dnl ################################################################################
568 569 570 571 572 573 574 575 576 577 578 579
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"])
Mikko Koppanen's avatar
Mikko Koppanen committed
580 581 582 583
    fi

    AC_MSG_CHECKING(whether _AC_LANG compiler supports dso visibility)

584
    AS_IF([test "x$libzmq_cv_[]_AC_LANG_ABBREV[]_visibility_flag" != "x"],
Mikko Koppanen's avatar
Mikko Koppanen committed
585 586
          [AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
}])
587

588 589 590 591 592
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], [{
593 594
    AC_CACHE_CHECK([whether SOCK_CLOEXEC is supported], [libzmq_cv_sock_cloexec],
        [AC_TRY_RUN([/* SOCK_CLOEXEC test */
595 596 597 598 599 600 601 602
#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);
}
603 604 605 606 607
        ],
        [libzmq_cv_sock_cloexec="yes"],
        [libzmq_cv_sock_cloexec="no"],
        [libzmq_cv_sock_cloexec="not during cross-compile"]
        )]
608
    )
609
    AS_IF([test "x$libzmq_cv_sock_cloexec" = "xyes"], [$1], [$2])
610 611
}])

612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
dnl ################################################################################
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]
    )
}])

632
dnl ################################################################################
633
dnl # LIBZMQ_CHECK_SO_KEEPALIVE([action-if-found], [action-if-not-found])          #
634 635
dnl # Check if SO_KEEPALIVE is supported                                           #
dnl ################################################################################
636
AC_DEFUN([LIBZMQ_CHECK_SO_KEEPALIVE], [{
637 638
    AC_CACHE_CHECK([whether SO_KEEPALIVE is supported], [libzmq_cv_so_keepalive],
        [AC_TRY_RUN([/* SO_KEEPALIVE test */
639 640 641 642 643 644 645 646 647 648 649
#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)
    );
}
650 651 652 653 654
        ],
        [libzmq_cv_so_keepalive="yes"],
        [libzmq_cv_so_keepalive="no"],
        [libzmq_cv_so_keepalive="not during cross-compile"]
        )]
655
    )
656
    AS_IF([test "x$libzmq_cv_so_keepalive" = "xyes"], [$1], [$2])
657 658 659 660 661 662 663
}])

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], [{
664 665
    AC_CACHE_CHECK([whether TCP_KEEPCNT is supported], [libzmq_cv_tcp_keepcnt],
        [AC_TRY_RUN([/* TCP_KEEPCNT test */
666 667 668 669 670 671 672 673 674 675 676 677 678 679
#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)
    );
}
680 681 682 683 684
        ],
        [libzmq_cv_tcp_keepcnt="yes"],
        [libzmq_cv_tcp_keepcnt="no"],
        [libzmq_cv_tcp_keepcnt="not during cross-compile"]
        )]
685
    )
686
    AS_IF([test "x$libzmq_cv_tcp_keepcnt" = "xyes"], [$1], [$2])
687 688 689
}])

dnl ################################################################################
690 691
dnl # LIBZMQ_CHECK_TCP_KEEPIDLE([action-if-found], [action-if-not-found])          #
dnl # Check if TCP_KEEPIDLE is supported                                           #
692
dnl ################################################################################
693
AC_DEFUN([LIBZMQ_CHECK_TCP_KEEPIDLE], [{
694 695
    AC_CACHE_CHECK([whether TCP_KEEPIDLE is supported], [libzmq_cv_tcp_keepidle],
        [AC_TRY_RUN([/* TCP_KEEPIDLE test */
696 697 698 699 700 701 702 703 704 705 706 707 708 709
#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)
    );
}
710 711 712 713 714
        ],
        [libzmq_cv_tcp_keepidle="yes"],
        [libzmq_cv_tcp_keepidle="no"],
        [libzmq_cv_tcp_keepidle="not during cross-compile"]
        )]
715
    )
716
    AS_IF([test "x$libzmq_cv_tcp_keepidle" = "xyes"], [$1], [$2])
717 718 719 720 721 722 723
}])

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], [{
724 725
    AC_CACHE_CHECK([whether TCP_KEEPINTVL is supported], [libzmq_cv_tcp_keepintvl],
        [AC_TRY_RUN([/* TCP_KEEPINTVL test */
726 727 728 729 730 731 732 733 734 735 736 737 738 739
#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)
    );
}
740 741 742 743 744
        ],
        [libzmq_cv_tcp_keepintvl="yes"],
        [libzmq_cv_tcp_keepintvl="no"],
        [libzmq_cv_tcp_keepintvl="not during cross-compile"]
        )]
745
    )
746
    AS_IF([test "x$libzmq_cv_tcp_keepintvl" = "xyes"], [$1], [$2])
747 748 749 750 751 752 753
}])

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], [{
754 755
    AC_CACHE_CHECK([whether TCP_KEEPALIVE is supported], [libzmq_cv_tcp_keepalive],
        [AC_TRY_RUN([/* TCP_KEEPALIVE test */
756 757 758 759 760 761 762 763 764 765 766 767 768 769
#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)
    );
}
770 771 772 773 774
        ],
        [libzmq_cv_tcp_keepalive="yes"],
        [libzmq_cv_tcp_keepalive="no"],
        [libzmq_cv_tcp_keepalive="not during cross-compile"]
        )]
775
    )
776
    AS_IF([test "x$libzmq_cv_tcp_keepalive" = "xyes"], [$1], [$2])
777 778
}])

779 780 781 782 783
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], [{
784 785
    AC_LINK_IFELSE([
        AC_LANG_PROGRAM([
786 787 788
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
789
        ],[[
790 791
struct kevent t_kev;
kqueue();
792 793 794
        ]])],
        [$1], [$2]
    )
795 796 797
}])

dnl ################################################################################
798 799
dnl # LIBZMQ_CHECK_POLLER_EPOLL_RUN([action-if-found], [action-if-not-found])      #
dnl # Checks epoll polling system can actually run #
800
dnl # For cross-compile, only requires that epoll can link #
801 802
dnl ################################################################################
AC_DEFUN([LIBZMQ_CHECK_POLLER_EPOLL], [{
803 804
    AC_RUN_IFELSE([
        AC_LANG_PROGRAM([
805
#include <sys/epoll.h>
806
        ],[[
807
struct epoll_event t_ev;
808 809 810
int r;
r = epoll_create(10);
return(r < 0);
811 812 813 814
        ]])],
        [$1],[$2],[
            AC_LINK_IFELSE([
                AC_LANG_PROGRAM([
815
#include <sys/epoll.h>
816 817 818 819 820 821 822 823
                ],[[
struct epoll_event t_ev;
epoll_create(10);
                ]])],
                [$1], [$2]
            )
        ]
    )
824 825 826 827 828 829 830
}])

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], [{
831 832
    AC_LINK_IFELSE([
        AC_LANG_PROGRAM([
833
#include <sys/devpoll.h>
834
        ],[[
835 836
struct pollfd t_devpoll;
int fd = open("/dev/poll", O_RDWR);
837 838 839
        ]])],
        [$1], [$2]
    )
840 841 842 843 844 845 846
}])

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], [{
847 848
    AC_LINK_IFELSE([
        AC_LANG_PROGRAM([
849
#include <poll.h>
850
        ],[[
851 852
struct pollfd t_poll;
poll(&t_poll, 1, 1);
853 854 855
        ]])],
        [$1], [$2]
    )
856 857 858 859 860 861 862
}])

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], [{
863 864
    AC_LINK_IFELSE([
        AC_LANG_PROGRAM([
865 866 867 868 869 870
#ifdef ZMQ_HAVE_WINDOWS
#include "winsock2.h"
#elif defined ZMQ_HAVE_OPENVMS
#include <sys/types.h>
#include <sys/time.h>
#else
871
#include <sys/select.h>
872
#endif
873
        ],[[
874 875 876 877 878
fd_set t_rfds;
struct timeval tv;
FD_ZERO(&t_rfds);
FD_SET(0, &t_rfds);
tv.tv_sec = 5;
879
tv.tv_usec = 0;
880
select(1, &t_rfds, NULL, NULL, &tv);
881 882 883
        ]])],
        [$1],[$2]
    )
884 885 886 887 888 889 890
}])

dnl ################################################################################
dnl # LIBZMQ_CHECK_POLLER([action-if-found], [action-if-not-found])                #
dnl # Choose polling system                                                        #
dnl ################################################################################

891
AC_DEFUN([LIBZMQ_CHECK_POLLER], [{
892
    # Allow user to override poller autodetection
893 894 895
    AC_ARG_WITH([poller],
        [AS_HELP_STRING([--with-poller],
        [choose polling system manually. Valid values are 'kqueue', 'epoll', 'devpoll', 'poll', 'select', or 'auto'. [default=auto]])])
896

897 898 899 900 901 902 903 904 905
    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
        pollers="kqueue epoll devpoll poll select"
    fi
906

907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952
    # 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)
                LIBZMQ_CHECK_POLLER_EPOLL([
                    AC_MSG_NOTICE([Using 'epoll' polling system])
                    AC_DEFINE(ZMQ_USE_EPOLL, 1, [Use 'epoll' polling system])
                    poller_found=1
                ])
            ;;
            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
                ])
            ;;
            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
953
}])