|
version 1.1.1.1, 2012/02/21 22:19:56
|
version 1.1.1.3, 2019/10/21 14:58:35
|
|
Line 1
|
Line 1
|
| # |
# |
| # configure.in Configure Script |
# configure.in Configure Script |
| # |
# |
| # Copyright (c) 2001-2005 Thomas Graf <tgraf@suug.ch> | # Copyright (c) 2001-2016 Thomas Graf <tgraf@suug.ch> |
| # |
# |
| # Permission is hereby granted, free of charge, to any person obtaining a |
# Permission is hereby granted, free of charge, to any person obtaining a |
| # copy of this software and associated documentation files (the "Software"), |
# copy of this software and associated documentation files (the "Software"), |
|
Line 21
|
Line 21
|
| # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| # DEALINGS IN THE SOFTWARE. |
# DEALINGS IN THE SOFTWARE. |
| |
|
| AC_INIT(bmon, 2.1.0, tgraf@suug.ch) | AC_INIT(bmon, 4.0, [], [], [https://github.com/tgraf/bmon]) |
| AC_CONFIG_HEADER(include/bmon/defs.h) | AC_CONFIG_HEADERS(include/bmon/defs.h) |
| | AC_CONFIG_AUX_DIR([build-aux]) |
| | AC_CONFIG_MACRO_DIR([m4]) |
| |
|
| |
AC_CANONICAL_TARGET |
| AC_CANONICAL_SYSTEM |
AC_CANONICAL_SYSTEM |
| |
|
| save_CFLAGS="${CFLAGS}" | AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) |
| save_LDFLAGS="${LDFLAGS}" | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) |
| save_CPPFLAGS="${CPPFLAGS}" | |
| |
|
| AC_ISC_POSIX |
AC_ISC_POSIX |
| AC_PROG_CC |
AC_PROG_CC |
|
Line 51 AC_FUNC_FORK
|
Line 53 AC_FUNC_FORK
|
| |
|
| AC_CHECK_HEADERS(getopt.h ncurses/ncurses.h ncurses.h curses.h) |
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(dirent.h sys/utsname.h sys/sockio.h netinet6/in6.h) |
| AC_CHECK_HEADERS(rrd.h fcntl.h netdb.h netinet/in.h sysctl/ioctl.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_HEADERS(sys/param.h sys/socket.h) |
| |
|
| AC_CHECK_TYPES(suseconds_t) |
AC_CHECK_TYPES(suseconds_t) |
| |
|
| AC_CHECK_FUNCS(atexit gettimeofday memset pow socket strcasecmp) | AC_CHECK_FUNCS(atexit clock_gettime memset pow socket strcasecmp) |
| AC_CHECK_FUNCS(strchr strdup strerror strncasecmp strstr strtol) |
AC_CHECK_FUNCS(strchr strdup strerror strncasecmp strstr strtol) |
| AC_CHECK_FUNCS(uname) | AC_CHECK_FUNCS(uname getdate) |
| |
|
| # | AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no]) |
| # Check if -lsocket is needed | AS_IF([test "x$PKG_CONFIG" = "xno"],[ |
| # | AC_MSG_ERROR([ |
| AC_CHECK_FUNC(connect,,[ | *** The pkg-config script could not be found. Make sure it is |
| AC_CHECK_LIB(socket,connect,LIB_INET="${LIB_INET} -lsocket") | *** in your path, or set the PKG_CONFIG environment variable |
| ]) | *** to the full path to pkg-config.]) |
| | ]) |
| |
|
| # | AX_WITH_CURSES |
| # Check if -lnsl is needed | 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]) |
| AC_CHECK_FUNC(gethostbyname,,[ | fi |
| AC_CHECK_LIB(nsl,gethostbyname,LIB_INET="${LIB_INET} -lnsl") | |
| ]) | |
| |
|
| # | PKG_CHECK_MODULES([CONFUSE], [libconfuse], [], AC_MSG_ERROR([requires libconfuse])) |
| # Check if -lresolv is needed | |
| # | |
| AC_CHECK_FUNC(inet_aton,,[ | |
| AC_CHECK_LIB(resolv, inet_aton,LIB_INET="${LIB_INET} -lresolv") | |
| ]) | |
| |
|
| AC_CHECK_FUNC(fcloseall,[ | case ${target_os} in |
| AC_DEFINE_UNQUOTED(HAVE_FCLOSEALL, "1", [have fcloseall]) | 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])) |
| |
|
| |
# Don't fail if not found (for instance, OS X does not have clock_gettime) |
| |
AC_CHECK_LIB(rt, clock_gettime, [], []) |
| |
|
| |
BMON_LIB="" |
| |
|
| ##################################################################### |
##################################################################### |
| ## |
## |
| ## libcurses check |
## libcurses check |
|
Line 120 AC_CHECK_LIB($LCURSES, use_default_colors, [
|
Line 125 AC_CHECK_LIB($LCURSES, use_default_colors, [
|
| |
|
| ##################################################################### |
##################################################################### |
| ## |
## |
| ## librrd check |
|
| ## |
|
| ##################################################################### |
|
| RRD="No " |
|
| AC_CHECK_LIB(rrd, rrd_create, [ |
|
| AC_DEFINE_UNQUOTED(HAVE_RRD, "1", [have rrd]) |
|
| LIBRRD="-lrrd" |
|
| RRD="Yes" |
|
| ],[ |
|
| echo |
|
| echo "*** Warning: Building bmon w/o rrd support ***" |
|
| echo |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libdbi check |
|
| ## |
|
| ##################################################################### |
|
| DBI="No " |
|
| AC_CHECK_LIB(dbi, dbi_initialize, [ |
|
| AC_DEFINE_UNQUOTED(HAVE_DBI, "1", [have dbi]) |
|
| LIBDBI="-ldbi" |
|
| DBI="Yes" |
|
| ],[ |
|
| echo |
|
| echo "*** Warning: Building bmon w/o DBI support ***" |
|
| echo |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libasound check |
|
| ## |
|
| ##################################################################### |
|
| ASOUND="No " |
|
| AC_CHECK_LIB(asound, snd_seq_open, [ |
|
| AC_DEFINE_UNQUOTED(HAVE_ASOUND, "1", [have asound]) |
|
| LIBASOUND="-lasound" |
|
| ASOUND="Yes" |
|
| ],[ |
|
| echo |
|
| echo "*** Warning: Building bmon w/o libasound support ***" |
|
| echo |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libkstat check |
|
| ## |
|
| ##################################################################### |
|
| KSTAT="No " |
|
| AC_CHECK_LIB(kstat, kstat_open, [ |
|
| AC_DEFINE_UNQUOTED(HAVE_KSTAT, "1", [have kstat]) |
|
| LIBKSTAT="-lkstat" |
|
| KSTAT="Yes" |
|
| ],[ |
|
| case ${target_os} in |
|
| *solaris*) |
|
| echo |
|
| echo "*** Warning: Building bmon on SunOS w/o libkstat ***" |
|
| echo |
|
| ;; |
|
| esac |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libnl check |
|
| ## |
|
| ##################################################################### |
|
| NL="No " |
|
| AC_CHECK_LIB(nl, nl_connect, [ |
|
| AC_DEFINE_UNQUOTED(HAVE_NL, "1", [have libnl]) |
|
| LIBNL="-lnl" |
|
| NL="Yes" |
|
| ],[ |
|
| case ${target_os} in |
|
| *linux*) |
|
| echo |
|
| echo "*** Warning: Building bmon on Linuxx w/o libnl ***" |
|
| echo |
|
| ;; |
|
| esac |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libm check |
|
| ## |
|
| ##################################################################### |
|
| M="No " |
|
| AC_CHECK_LIB(m, pow, [ |
|
| LIBM="-lm" |
|
| M="Yes" |
|
| ],[ |
|
| echo |
|
| echo "*** Error: libm required ***" |
|
| echo |
|
| exit |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## interface counter overflow workaround |
## interface counter overflow workaround |
| ## |
## |
| ##################################################################### |
##################################################################### |
|
Line 236 AC_ARG_ENABLE(cnt-workaround,
|
Line 137 AC_ARG_ENABLE(cnt-workaround,
|
| |
|
| ##################################################################### |
##################################################################### |
| ## |
## |
| ## librrd |
|
| ## |
|
| ##################################################################### |
|
| AC_ARG_ENABLE(rrd, |
|
| [ --disable-rrd Disables rrd output],[ |
|
| if test x$enableval = xno; then |
|
| RRD="No " |
|
| fi |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libasound |
|
| ## |
|
| ##################################################################### |
|
| AC_ARG_ENABLE(asound, |
|
| [ --disable-asound Disables asound output],[ |
|
| if test x$enableval = xno; then |
|
| ASOUND="No " |
|
| fi |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## libdbi |
|
| ## |
|
| ##################################################################### |
|
| AC_ARG_ENABLE(dbi, |
|
| [ --disable-dbi Disables DBI output],[ |
|
| if test x$enableval = xno; then |
|
| DBI="No " |
|
| fi |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## curses |
## curses |
| ## |
## |
| ##################################################################### |
##################################################################### |
|
Line 291 DEBUG=0
|
Line 156 DEBUG=0
|
| AC_ARG_ENABLE(debug, |
AC_ARG_ENABLE(debug, |
| [ --enable-debug Enable debug mode (default disabled)],[ |
[ --enable-debug Enable debug mode (default disabled)],[ |
| if test x$enableval = xyes; then |
if test x$enableval = xyes; then |
| |
AC_DEFINE_UNQUOTED(DEBUG, "1", [enable debugging]) |
| DEBUG=1; |
DEBUG=1; |
| fi |
fi |
| ]) |
]) |
| |
|
| ##################################################################### |
##################################################################### |
| ## |
## |
| ## static check |
|
| ## |
|
| ##################################################################### |
|
| STATIC=0 |
|
| AC_ARG_ENABLE(static, |
|
| [ --enable-static Enable static linking (default disabled)],[ |
|
| if test x$enableval = xyes; then |
|
| STATIC=1; |
|
| fi |
|
| ]) |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## target os eval |
## target os eval |
| ## |
## |
| ##################################################################### |
##################################################################### |
|
Line 322 case ${target_os} in
|
Line 175 case ${target_os} in
|
| AC_DEFINE_UNQUOTED(SYS_SUNOS, "1", [operating system]) |
AC_DEFINE_UNQUOTED(SYS_SUNOS, "1", [operating system]) |
| ;; |
;; |
| |
|
| *bsd*) | *bsd*|dragonfly*) |
| AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system]) |
AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system]) |
| ;; |
;; |
| |
|
|
Line 337 esac
|
Line 190 esac
|
| |
|
| ##################################################################### |
##################################################################### |
| ## |
## |
| ## compile decisions |
|
| ## |
|
| ##################################################################### |
|
| COMPILE_BMON="Yes " |
|
| BMON_LIB="$LIB_INET $LIBM" |
|
| if test x$CURSES = xYes; then |
|
| BMON_LIB="$BMON_LIB $LIBCURSES" |
|
| fi; |
|
| |
|
| if test x$NL = xYes; then |
|
| BMON_LIB="$BMON_LIB $LIBNL" |
|
| fi; |
|
| |
|
| if test x$KSTAT = xYes; then |
|
| BMON_LIB="$BMON_LIB $LIBKSTAT" |
|
| fi; |
|
| |
|
| if test x$RRD = xYes; then |
|
| BMON_LIB="$BMON_LIB $LIBRRD" |
|
| fi; |
|
| |
|
| if test x$ASOUND = xYes; then |
|
| BMON_LIB="$BMON_LIB $LIBASOUND" |
|
| fi; |
|
| |
|
| if test x$DBI = xYes; then |
|
| BMON_LIB="$BMON_LIB $LIBDBI" |
|
| fi; |
|
| |
|
| |
|
| ##################################################################### |
|
| ## |
|
| ## export variables |
## export variables |
| ## |
## |
| ##################################################################### |
##################################################################### |
| AC_SUBST(COMPILE_BMON) |
|
| AC_SUBST(BMON_LIB) |
|
| |
|
| AC_SUBST(DEBUG) |
AC_SUBST(DEBUG) |
| AC_SUBST(STATIC) |
AC_SUBST(STATIC) |
| AC_SUBST(SYS) |
AC_SUBST(SYS) |
| AC_SUBST(ARCH) |
AC_SUBST(ARCH) |
| |
|
| AC_SUBST(CURSES) |
AC_SUBST(CURSES) |
| AC_SUBST(RRD) |
|
| AC_SUBST(ASOUND) |
|
| AC_SUBST(DBI) |
|
| |
|
| AC_OUTPUT([Makefile.opts]) | AC_CONFIG_FILES([ |
| | Makefile |
| | include/Makefile |
| | src/Makefile |
| | man/Makefile |
| | examples/Makefile |
| | ]) |
| |
|
| ##################################################################### | AC_OUTPUT |
| ## | |
| ## status report | |
| ## | |
| ##################################################################### | |
| echo " | |
| ---------------------------------------------------------------------- | |
| SUMMARY: | |
| |
| OS: $target_os | |
| |
| Included in Compilation: | |
| bmon: $COMPILE_BMON $BMON_LIB | |
| |
| Dependencies: | |
| bmon: | |
| libm $M (required) | |
| lib(n)curses $CURSES (suggested) | |
| librrd $RRD (suggested) | |
| libdbi $DBI (suggested) | |
| libasound $ASOUND (toy)" | |
| case ${target_os} in | |
| *linux*) | |
| echo " libnl $NL (suggested)" | |
| ;; | |
| esac | |
| if test x$target_os = xsolaris; then | |
| echo " libkstat $KSTAT (required on SunOS)" | |
| fi | |
| echo " | |
| ---------------------------------------------------------------------- | |
| |
| WARNING: | |
| Please do not install the bmon executable as SUID root. This | |
| software package was written with portability and configurability | |
| in mind and will never fulfill the requirements to be installed | |
| as SUID root executable. | |
| |
| If you do please be aware that every user will be able to run | |
| arbitary commands as root via the key bind interface or by | |
| providing a malicious netstat binary. | |
| |
| In fact there is no reason to do so, all supported input modules | |
| will work fine without superuser privileges. There is probably a | |
| good reason if your operating system requires special privileges | |
| which is that a normal user is not supposed to read the statistics | |
| which should not be worked around using the SUID bit. | |
| |
| Thanks. | |
| " | |