Statistics
| Branch: | Revision:

iof-bird / bird-2.0.1 / aclocal.m4 @ 6b3f1a54

History | View | Annotate | Download (1.86 KB)

1
dnl ** Additional Autoconf tests for BIRD configure script
2
dnl ** (c) 1999 Martin Mares <mj@ucw.cz>
3

    
4
AC_DEFUN([BIRD_CHECK_PTHREADS],
5
[
6
  bird_tmp_cflags="$CFLAGS"
7
  CFLAGS="$CFLAGS -pthread"
8

    
9
  AC_CACHE_CHECK(
10
    [whether POSIX threads are available],
11
    [bird_cv_lib_pthreads],
12
    [
13
      AC_LINK_IFELSE(
14
	[
15
	  AC_LANG_PROGRAM(
16
	    [ #include <pthread.h> ],
17
	    [
18
	      pthread_t pt;
19
	      pthread_create(&pt, NULL, NULL, NULL);
20
	      pthread_spinlock_t lock;
21
	      pthread_spin_lock(&lock);
22
	    ]
23
	  )
24
	],
25
	[bird_cv_lib_pthreads=yes],
26
	[bird_cv_lib_pthreads=no]
27
      )
28
    ]
29
  )
30

    
31
  CFLAGS="$bird_tmp_cflags"
32
])
33

    
34
AC_DEFUN([BIRD_CHECK_MPLS_KERNEL],
35
[
36
  AC_CACHE_CHECK(
37
    [for Linux MPLS headers],
38
    [bird_cv_mpls_kernel],
39
    [
40
      AC_COMPILE_IFELSE(
41
	[
42
	  AC_LANG_PROGRAM(
43
	    [
44
	      #include <linux/lwtunnel.h>
45
	      #include <linux/netlink.h>
46
	      #include <linux/rtnetlink.h>
47
	      #include <sys/socket.h>
48
	      void t(int arg);
49
	    ],
50
	    [
51
	      t(AF_MPLS);
52
	      t(RTA_VIA);
53
	      t(RTA_NEWDST);
54
	      t(RTA_ENCAP_TYPE);
55
	      t(RTA_ENCAP);
56
	      struct rtvia rtvia;
57
	      t(LWTUNNEL_ENCAP_MPLS);
58
	    ]
59
	  )
60
	],
61
	[bird_cv_mpls_kernel=yes],
62
	[bird_cv_mpls_kernel=no]
63
      )
64
    ]
65
  )
66
])
67

    
68

    
69
AC_DEFUN([BIRD_CHECK_GCC_OPTION],
70
[
71
  bird_tmp_cflags="$CFLAGS"
72
  CFLAGS="$3 $2"
73

    
74
  AC_CACHE_CHECK(
75
    [whether CC supports $2],
76
    [$1],
77
    [
78
      AC_COMPILE_IFELSE(
79
	[AC_LANG_PROGRAM()],
80
	[$1=yes],
81
	[$1=no]
82
      )
83
    ]
84
  )
85

    
86
  CFLAGS="$bird_tmp_cflags"
87
])
88

    
89
AC_DEFUN([BIRD_ADD_GCC_OPTION],
90
[
91
  if test "$$1" = yes ; then
92
    CFLAGS="$CFLAGS $2"
93
  fi
94
])
95

    
96
# BIRD_CHECK_PROG_FLAVOR_GNU(PROGRAM-PATH, IF-SUCCESS, [IF-FAILURE])
97
# copied from autoconf internal _AC_PATH_PROG_FLAVOR_GNU
98
AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU],
99
[
100
  # Check for GNU $1
101
  case `"$1" --version 2>&1` in
102
    *GNU*)
103
      $2
104
      ;;
105
  m4_ifval([$3],
106
    [*)
107
      $3
108
      ;;
109
    ]
110
  )
111
  esac
112
])