-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
146 lines (116 loc) · 3.16 KB
/
configure.ac
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
AC_INIT(py-netif, 1.0)
AC_LANG(C)
AC_PROG_CC
define(SECTION_TITLE,
[
echo >& AS_MESSAGE_FD
echo ' $1 ' | sed -e's/./-/g' >&AS_MESSAGE_FD
echo ' $1' >& AS_MESSAGE_FD
echo ' $1 ' | sed -e's/./-/g' >&AS_MESSAGE_FD
])
dnl works for checking define statements in c
m4_include([m4/AX_CHECK_DEFINE.m4])
freebsd_src=${FREEBSD_SRC:=/usr/src}
dnl Setting appropriate CFLAGS
CFLAGS="-nostdinc
-I${freebsd_src}/sys/
-I${freebsd_src}/sbin/ifconfig/
-I${freebsd_src}/lib/libifconfig/
${CFLAGS} -I/usr/include"
SECTION_TITLE([RUNNING TESTS ON if_lagg HEADER])
AC_CHECK_HEADERS([sys/types.h], [], [AC_ERROR([A working sys/types header is required])])
AC_CHECK_HEADERS([sys/sysctl.h], [], [AC_ERROR([A working sys/sysctl header is required])])
AC_CHECK_HEADERS([net/if_lagg.h], [], [AC_ERROR([A working if_lagg header is required])],[
#include <sys/types.h>
#include <sys/sysctl.h>
#include <net/ethernet.h>
#include <net/if.h>
])
dnl Checking for LAGG_PROTO_ETHERCHANNEL define
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
#include <sys/types.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <net/if_lagg.h>
],
[
#ifdef LAGG_PROTO_ETHERCHANNEL
int ok;
(void)ok;
#else
choke me
#endif
]
)],
[AC_SUBST(HAVE_LAGG_PROTO_ETHERCHANNEL, 1)],
[AC_SUBST(HAVE_LAGG_PROTO_ETHERCHANNEL, 0)]
)
dnl Checking for LAGG_PORT_DISABLED define
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
#include <sys/types.h>
#include <net/if.h>
#include <net/ethernet.h>
#include <net/if_lagg.h>
],
[
#ifdef LAGG_PORT_DISABLED
int ok;
(void)ok;
#else
choke me
#endif
]
)],
[AC_SUBST(HAVE_LAGG_PORT_DISABLED, 1)],
[AC_SUBST(HAVE_LAGG_PORT_DISABLED, 0)]
)
SECTION_TITLE([RUNNING TESTS ON if HEADER])
AC_CHECK_HEADERS([sys/cdefs.h], [], [AC_ERROR([A working sys/cdef header is required])])
AC_CHECK_HEADERS([net/if.h], [], [AC_ERROR([A working net/if.h is required])],[
#include <sys/cdefs.h>
])
dnl Checking for IFCAP_POLLING_NOCOUNT define
AX_CHECK_DEFINE(
[net/if.h], [IFCAP_POLLING_NOCOUNT],
[AC_SUBST(HAVE_IFCAP_POLLING_NOCOUNT, 1)],
[AC_SUBST(HAVE_IFCAP_POLLING_NOCOUNT, 0)]
)
SECTION_TITLE([RUNNING TESTS ON ifmedia.c])
AC_CHECK_HEADERS([ifmedia.c], [], [AC_ERROR([A working ifmedia.c is required])])
dnl Checking ifm_subtype_tokenring_descriptions existence
AC_MSG_NOTICE([Checking ifm_subtype_tokenring_descriptions existence])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#include <ifmedia.c>],
[
size_t n = sizeof(ifm_subtype_tokenring_descriptions) /* ; */
]
)],
[AC_DEFINE(HAVE_IFM_SUBTYPE_TOKENRING_DESCRIPTIONS, 1, [FreeBSD with Token Ring support]) AC_MSG_NOTICE([OK])],
[AC_MSG_NOTICE([Not found])]
)
dnl Checking ifm_subtype_fddi_descriptions existence
AC_MSG_NOTICE([Checking IFM_SUBTYPE_FDDI_DESCRIPTIONS existence])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[
#include <sys/types.h>
#include <net/if_media.h>
],
[
#ifdef IFM_SUBTYPE_FDDI_DESCRIPTIONS
int ok;
(void)ok;
#else
choke me
#endif
]
)],
[AC_DEFINE(HAVE_IFM_SUBTYPE_FDDI_DESCRIPTIONS, 1, [FreeBSD with FDDI support]) AC_MSG_NOTICE([OK])],
[AC_MSG_NOTICE([Not found])]
)
SECTION_TITLE([GENERATING CONFIG FILES])
AC_CONFIG_FILES([config.pxi])
AC_CONFIG_HEADERS([config.h])
dnl Process Makefile.in to create Makefile
AC_OUTPUT(Makefile)