forked from tgraf/bmon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
208 lines (175 loc) · 5.56 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#
# configure.in Configure Script
#
# Copyright (c) 2001-2013 Thomas Graf <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
AC_INIT(bmon, 3.8, [], [], [http://www.infradead.org/~tgr/bmon/])
AC_CONFIG_HEADERS(include/bmon/defs.h)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_TYPE_PID_T
AC_FUNC_FORK
AC_CHECK_HEADERS(getopt.h ncurses/ncurses.h ncurses.h curses.h)
AC_CHECK_HEADERS(dirent.h sys/utsname.h sys/sockio.h netinet6/in6.h)
AC_CHECK_HEADERS(fcntl.h netdb.h netinet/in.h sysctl/ioctl.h)
AC_CHECK_HEADERS(sys/param.h sys/socket.h)
AC_CHECK_TYPES(suseconds_t)
AC_CHECK_FUNCS(atexit gettimeofday memset pow socket strcasecmp)
AC_CHECK_FUNCS(strchr strdup strerror strncasecmp strstr strtol)
AC_CHECK_FUNCS(uname getdate)
AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
AS_IF([test "x$PKG_CONFIG" = "xno"],[
AC_MSG_ERROR([
*** The pkg-config script could not be found. Make sure it is
*** in your path, or set the PKG_CONFIG environment variable
*** to the full path to pkg-config.])
])
AX_WITH_CURSES
if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then
AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])
fi
PKG_CHECK_MODULES([CONFUSE], [libconfuse], [], AC_MSG_ERROR([requires libconfuse]))
case ${target_os} in
linux*|uclinux*)
PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [], AC_MSG_ERROR([requires libnl3-dev]))
PKG_CHECK_MODULES([LIBNL_ROUTE], [libnl-route-3.0], [], AC_MSG_ERROR([requires libnl3-route]))
;;
esac
AC_CHECK_LIB(m, pow, [], AC_MSG_ERROR([requires libm]))
BMON_LIB=""
#####################################################################
##
## libcurses check
##
#####################################################################
CURSES="No "
AC_CHECK_LIB(ncurses, initscr, [
AC_DEFINE_UNQUOTED(HAVE_NCURSES, "1", [have ncurses])
LCURSES="ncurses"
CURSES="Yes"
],[
AC_CHECK_LIB(curses,initscr, [
AC_DEFINE_UNQUOTED(HAVE_CURSES, "1", [have curses])
LCURSES="curses"
CURSES="Yes"
],[
echo
echo "*** Warning: Building bmon w/o curses support ***"
echo
])
])
LIBCURSES="-l$LCURSES"
AC_CHECK_LIB($LCURSES, redrawwin, [
AC_DEFINE_UNQUOTED(HAVE_REDRAWWIN, "1", [have redrawwin])
])
AC_CHECK_LIB($LCURSES, use_default_colors, [
AC_DEFINE_UNQUOTED(HAVE_USE_DEFAULT_COLORS, "1", [have udc])
])
#####################################################################
##
## interface counter overflow workaround
##
#####################################################################
AC_ARG_ENABLE(cnt-workaround,
[ --disable-cnt-workaround Disables interface counter overflow workaround],[
if test x$enableval = xno; then
AC_DEFINE_UNQUOTED(DISABLE_OVERFLOW_WORKAROUND,"1",[no overflow workaround])
fi
])
#####################################################################
##
## curses
##
#####################################################################
AC_ARG_ENABLE(curses,
[ --disable-curses Disables curses output],[
if test x$enableval = xno; then
CURSES="No "
fi
])
#####################################################################
##
## debug check
##
#####################################################################
DEBUG=0
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug mode (default disabled)],[
if test x$enableval = xyes; then
AC_DEFINE_UNQUOTED(DEBUG, "1", [enable debugging])
DEBUG=1;
fi
])
#####################################################################
##
## target os eval
##
#####################################################################
case ${target_os} in
linux*)
AC_DEFINE_UNQUOTED(SYS_LINUX, "1", [operating system])
;;
*solaris*)
AC_DEFINE_UNQUOTED(SYS_SUNOS, "1", [operating system])
;;
*bsd*)
AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
;;
*darwin*)
AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
;;
*)
AC_DEFINE_UNQUOTED(SYS_OTHER, "1", [operating system])
;;
esac
#####################################################################
##
## export variables
##
#####################################################################
AC_SUBST(DEBUG)
AC_SUBST(STATIC)
AC_SUBST(SYS)
AC_SUBST(ARCH)
AC_SUBST(CURSES)
AC_CONFIG_FILES([
Makefile
include/Makefile
src/Makefile
man/Makefile
examples/Makefile
])
AC_OUTPUT