0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan HuntAC_PREREQ(2.13)
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan HuntAC_CHECK_LIB(m, sqrt)
4f1435ca32485fa409cb88a4958468c4a65d3736Evan HuntAC_CHECK_LIB(rt, clock_gettime)
9509569d873051b47d1cf38acd2ce6963115f289Evan HuntAC_MSG_CHECKING(epoll support)
9509569d873051b47d1cf38acd2ce6963115f289Evan Hunt if (epoll_create(1) < 0)
9509569d873051b47d1cf38acd2ce6963115f289Evan Hunt], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(epoll not found)])
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Huntcase "$host" in
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt # We don't want to set -lpthread as that break
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt # the ability to choose threads library at final
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt # link time and is not valid for all architectures.
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt if test "X$GCC" = "Xyes"; then
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt saved_cc="$CC"
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt CC="$CC -pthread"
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_MSG_CHECKING(for gcc -pthread support);
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_TRY_LINK([#include <pthread.h>],
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt [printf("%x\n", pthread_create);],
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt PTHREAD="yes"
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_MSG_RESULT(yes),
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_MSG_RESULT(no))
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt CC="$saved_cc"
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt if test "X$PTHREAD" != "Xyes"; then
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(pthread, pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(thr, thread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(c_r, pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(c, pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_MSG_ERROR("could not find thread libraries")))))
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(pthread, pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(pthread, __pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(pthread, __pthread_create_system,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(c_r, pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_CHECK_LIB(c, pthread_create,,
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan Hunt AC_MSG_ERROR("could not find thread libraries"))))))
7cd8e7915afba7064c18c4bf74ecce0627c61027Evan HuntAC_OUTPUT(Makefile)