summaryrefslogtreecommitdiffstats
path: root/contrib/perftcpdns/configure.in
blob: 35dc82081bb362ac9eec58b3844941cbfed05d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.

AC_INIT(perftcpdns.c)

AC_PREREQ(2.13)

AC_PROG_CC

AC_CHECK_LIB(m, sqrt)
AC_CHECK_LIB(rt, clock_gettime)

AC_MSG_CHECKING(epoll support)
AC_TRY_RUN([
#include <sys/epoll.h>
int main() {
	if (epoll_create(1) < 0)
		return (1);
	return (0);
}
], [AC_MSG_RESULT(yes)], [AC_MSG_ERROR(epoll not found)])

case "$host" in
        *-freebsd*)
                # We don't want to set -lpthread as that break
                # the ability to choose threads library at final
                # link time and is not valid for all architectures.
                
                PTHREAD=
                if test "X$GCC" = "Xyes"; then
                        saved_cc="$CC"
                        CC="$CC -pthread"
                        AC_MSG_CHECKING(for gcc -pthread support);
                        AC_TRY_LINK([#include <pthread.h>],
                                    [printf("%x\n", pthread_create);],
                                    PTHREAD="yes"
                                    AC_MSG_RESULT(yes),
                                    AC_MSG_RESULT(no))
                        CC="$saved_cc"
                fi
                if test "X$PTHREAD" != "Xyes"; then
                        AC_CHECK_LIB(pthread, pthread_create,,
                        AC_CHECK_LIB(thr, thread_create,,
                        AC_CHECK_LIB(c_r, pthread_create,,
                        AC_CHECK_LIB(c, pthread_create,,
                        AC_MSG_ERROR("could not find thread libraries")))))
                fi
                ;;
        *)
                AC_CHECK_LIB(pthread, pthread_create,,
                        AC_CHECK_LIB(pthread, __pthread_create,,
                        AC_CHECK_LIB(pthread, __pthread_create_system,,
                        AC_CHECK_LIB(c_r, pthread_create,,
                        AC_CHECK_LIB(c, pthread_create,,
                        AC_MSG_ERROR("could not find thread libraries"))))))
        ;;
esac

AC_OUTPUT(Makefile)