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