1*00b67f09SDavid van Moolenbroek# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") 2*00b67f09SDavid van Moolenbroek# 3*00b67f09SDavid van Moolenbroek# Permission to use, copy, modify, and/or distribute this software for any 4*00b67f09SDavid van Moolenbroek# purpose with or without fee is hereby granted, provided that the above 5*00b67f09SDavid van Moolenbroek# copyright notice and this permission notice appear in all copies. 6*00b67f09SDavid van Moolenbroek# 7*00b67f09SDavid van Moolenbroek# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 8*00b67f09SDavid van Moolenbroek# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9*00b67f09SDavid van Moolenbroek# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 10*00b67f09SDavid van Moolenbroek# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11*00b67f09SDavid van Moolenbroek# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 12*00b67f09SDavid van Moolenbroek# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13*00b67f09SDavid van Moolenbroek# PERFORMANCE OF THIS SOFTWARE. 14*00b67f09SDavid van Moolenbroek 15*00b67f09SDavid van MoolenbroekAC_INIT(perftcpdns.c) 16*00b67f09SDavid van Moolenbroek 17*00b67f09SDavid van MoolenbroekAC_PREREQ(2.13) 18*00b67f09SDavid van Moolenbroek 19*00b67f09SDavid van MoolenbroekAC_PROG_CC 20*00b67f09SDavid van Moolenbroek 21*00b67f09SDavid van MoolenbroekAC_CHECK_LIB(m, sqrt) 22*00b67f09SDavid van MoolenbroekAC_CHECK_LIB(rt, clock_gettime) 23*00b67f09SDavid van Moolenbroek 24*00b67f09SDavid van MoolenbroekAC_MSG_CHECKING(epoll support) 25*00b67f09SDavid van MoolenbroekAC_TRY_RUN([ 26*00b67f09SDavid van Moolenbroek#include <sys/epoll.h> 27*00b67f09SDavid van Moolenbroekint main() { 28*00b67f09SDavid van Moolenbroek if (epoll_create(1) < 0) 29*00b67f09SDavid van Moolenbroek return (1); 30*00b67f09SDavid van Moolenbroek return (0); 31*00b67f09SDavid van Moolenbroek} 32*00b67f09SDavid van Moolenbroek], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(epoll not found)]) 33*00b67f09SDavid van Moolenbroek 34*00b67f09SDavid van Moolenbroekcase "$host" in 35*00b67f09SDavid van Moolenbroek *-freebsd*) 36*00b67f09SDavid van Moolenbroek # We don't want to set -lpthread as that break 37*00b67f09SDavid van Moolenbroek # the ability to choose threads library at final 38*00b67f09SDavid van Moolenbroek # link time and is not valid for all architectures. 39*00b67f09SDavid van Moolenbroek 40*00b67f09SDavid van Moolenbroek PTHREAD= 41*00b67f09SDavid van Moolenbroek if test "X$GCC" = "Xyes"; then 42*00b67f09SDavid van Moolenbroek saved_cc="$CC" 43*00b67f09SDavid van Moolenbroek CC="$CC -pthread" 44*00b67f09SDavid van Moolenbroek AC_MSG_CHECKING(for gcc -pthread support); 45*00b67f09SDavid van Moolenbroek AC_TRY_LINK([#include <pthread.h>], 46*00b67f09SDavid van Moolenbroek [printf("%x\n", pthread_create);], 47*00b67f09SDavid van Moolenbroek PTHREAD="yes" 48*00b67f09SDavid van Moolenbroek AC_MSG_RESULT(yes), 49*00b67f09SDavid van Moolenbroek AC_MSG_RESULT(no)) 50*00b67f09SDavid van Moolenbroek CC="$saved_cc" 51*00b67f09SDavid van Moolenbroek fi 52*00b67f09SDavid van Moolenbroek if test "X$PTHREAD" != "Xyes"; then 53*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(pthread, pthread_create,, 54*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(thr, thread_create,, 55*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(c_r, pthread_create,, 56*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(c, pthread_create,, 57*00b67f09SDavid van Moolenbroek AC_MSG_ERROR("could not find thread libraries"))))) 58*00b67f09SDavid van Moolenbroek fi 59*00b67f09SDavid van Moolenbroek ;; 60*00b67f09SDavid van Moolenbroek *) 61*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(pthread, pthread_create,, 62*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(pthread, __pthread_create,, 63*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(pthread, __pthread_create_system,, 64*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(c_r, pthread_create,, 65*00b67f09SDavid van Moolenbroek AC_CHECK_LIB(c, pthread_create,, 66*00b67f09SDavid van Moolenbroek AC_MSG_ERROR("could not find thread libraries")))))) 67*00b67f09SDavid van Moolenbroek ;; 68*00b67f09SDavid van Moolenbroekesac 69*00b67f09SDavid van Moolenbroek 70*00b67f09SDavid van MoolenbroekAC_OUTPUT(Makefile) 71