1: #
2: # configure.in Configure Script
3: #
4: # Copyright (c) 2001-2016 Thomas Graf <tgraf@suug.ch>
5: #
6: # Permission is hereby granted, free of charge, to any person obtaining a
7: # copy of this software and associated documentation files (the "Software"),
8: # to deal in the Software without restriction, including without limitation
9: # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10: # and/or sell copies of the Software, and to permit persons to whom the
11: # Software is furnished to do so, subject to the following conditions:
12: #
13: # The above copyright notice and this permission notice shall be included
14: # in all copies or substantial portions of the Software.
15: #
16: # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17: # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18: # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19: # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20: # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21: # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22: # DEALINGS IN THE SOFTWARE.
23:
24: AC_INIT(bmon, 4.0, [], [], [https://github.com/tgraf/bmon])
25: AC_CONFIG_HEADERS(include/bmon/defs.h)
26: AC_CONFIG_AUX_DIR([build-aux])
27: AC_CONFIG_MACRO_DIR([m4])
28:
29: AC_CANONICAL_TARGET
30: AC_CANONICAL_SYSTEM
31:
32: AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
33: m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
34:
35: AC_ISC_POSIX
36: AC_PROG_CC
37: AC_PROG_CC_STDC
38: AC_PROG_CPP
39: AC_PROG_MAKE_SET
40: AC_PROG_INSTALL
41:
42: AC_C_CONST
43: AC_C_INLINE
44:
45: AC_HEADER_TIME
46: AC_HEADER_DIRENT
47:
48: AC_TYPE_SIZE_T
49: AC_TYPE_SIGNAL
50: AC_TYPE_PID_T
51:
52: AC_FUNC_FORK
53:
54: AC_CHECK_HEADERS(getopt.h ncurses/ncurses.h ncurses.h curses.h)
55: AC_CHECK_HEADERS(dirent.h sys/utsname.h sys/sockio.h netinet6/in6.h)
56: AC_CHECK_HEADERS(fcntl.h netdb.h netinet/in.h sysctl/ioctl.h)
57: AC_CHECK_HEADERS(sys/param.h sys/socket.h)
58:
59: AC_CHECK_TYPES(suseconds_t)
60:
61: AC_CHECK_FUNCS(atexit clock_gettime memset pow socket strcasecmp)
62: AC_CHECK_FUNCS(strchr strdup strerror strncasecmp strstr strtol)
63: AC_CHECK_FUNCS(uname getdate)
64:
65: AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
66: AS_IF([test "x$PKG_CONFIG" = "xno"],[
67: AC_MSG_ERROR([
68: *** The pkg-config script could not be found. Make sure it is
69: *** in your path, or set the PKG_CONFIG environment variable
70: *** to the full path to pkg-config.])
71: ])
72:
73: AX_WITH_CURSES
74: if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then
75: AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])
76: fi
77:
78: PKG_CHECK_MODULES([CONFUSE], [libconfuse], [], AC_MSG_ERROR([requires libconfuse]))
79:
80: case ${target_os} in
81: linux*|uclinux*)
82: PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [], AC_MSG_ERROR([requires libnl3-dev]))
83: PKG_CHECK_MODULES([LIBNL_ROUTE], [libnl-route-3.0], [], AC_MSG_ERROR([requires libnl3-route]))
84: ;;
85: esac
86:
87: AC_CHECK_LIB(m, pow, [], AC_MSG_ERROR([requires libm]))
88:
89: # Don't fail if not found (for instance, OS X does not have clock_gettime)
90: AC_CHECK_LIB(rt, clock_gettime, [], [])
91:
92: BMON_LIB=""
93:
94: #####################################################################
95: ##
96: ## libcurses check
97: ##
98: #####################################################################
99: CURSES="No "
100: AC_CHECK_LIB(ncurses, initscr, [
101: AC_DEFINE_UNQUOTED(HAVE_NCURSES, "1", [have ncurses])
102: LCURSES="ncurses"
103: CURSES="Yes"
104: ],[
105: AC_CHECK_LIB(curses,initscr, [
106: AC_DEFINE_UNQUOTED(HAVE_CURSES, "1", [have curses])
107: LCURSES="curses"
108: CURSES="Yes"
109: ],[
110: echo
111: echo "*** Warning: Building bmon w/o curses support ***"
112: echo
113: ])
114: ])
115:
116: LIBCURSES="-l$LCURSES"
117:
118: AC_CHECK_LIB($LCURSES, redrawwin, [
119: AC_DEFINE_UNQUOTED(HAVE_REDRAWWIN, "1", [have redrawwin])
120: ])
121:
122: AC_CHECK_LIB($LCURSES, use_default_colors, [
123: AC_DEFINE_UNQUOTED(HAVE_USE_DEFAULT_COLORS, "1", [have udc])
124: ])
125:
126: #####################################################################
127: ##
128: ## interface counter overflow workaround
129: ##
130: #####################################################################
131: AC_ARG_ENABLE(cnt-workaround,
132: [ --disable-cnt-workaround Disables interface counter overflow workaround],[
133: if test x$enableval = xno; then
134: AC_DEFINE_UNQUOTED(DISABLE_OVERFLOW_WORKAROUND,"1",[no overflow workaround])
135: fi
136: ])
137:
138: #####################################################################
139: ##
140: ## curses
141: ##
142: #####################################################################
143: AC_ARG_ENABLE(curses,
144: [ --disable-curses Disables curses output],[
145: if test x$enableval = xno; then
146: CURSES="No "
147: fi
148: ])
149:
150: #####################################################################
151: ##
152: ## debug check
153: ##
154: #####################################################################
155: DEBUG=0
156: AC_ARG_ENABLE(debug,
157: [ --enable-debug Enable debug mode (default disabled)],[
158: if test x$enableval = xyes; then
159: AC_DEFINE_UNQUOTED(DEBUG, "1", [enable debugging])
160: DEBUG=1;
161: fi
162: ])
163:
164: #####################################################################
165: ##
166: ## target os eval
167: ##
168: #####################################################################
169: case ${target_os} in
170: linux*)
171: AC_DEFINE_UNQUOTED(SYS_LINUX, "1", [operating system])
172: ;;
173:
174: *solaris*)
175: AC_DEFINE_UNQUOTED(SYS_SUNOS, "1", [operating system])
176: ;;
177:
178: *bsd*|dragonfly*)
179: AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
180: ;;
181:
182: *darwin*)
183: AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
184: ;;
185:
186: *)
187: AC_DEFINE_UNQUOTED(SYS_OTHER, "1", [operating system])
188: ;;
189: esac
190:
191: #####################################################################
192: ##
193: ## export variables
194: ##
195: #####################################################################
196: AC_SUBST(DEBUG)
197: AC_SUBST(STATIC)
198: AC_SUBST(SYS)
199: AC_SUBST(ARCH)
200:
201: AC_SUBST(CURSES)
202:
203: AC_CONFIG_FILES([
204: Makefile
205: include/Makefile
206: src/Makefile
207: man/Makefile
208: examples/Makefile
209: ])
210:
211: AC_OUTPUT
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>