--- embedaddon/bmon/configure.ac 2012/02/21 22:19:56 1.1.1.1 +++ embedaddon/bmon/configure.ac 2014/07/30 07:55:27 1.1.1.2 @@ -1,7 +1,7 @@ # # configure.in Configure Script # -# Copyright (c) 2001-2005 Thomas Graf +# Copyright (c) 2001-2013 Thomas Graf # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -21,14 +21,16 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -AC_INIT(bmon, 2.1.0, tgraf@suug.ch) -AC_CONFIG_HEADER(include/bmon/defs.h) +AC_INIT(bmon, 3.3, [], [], [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 -save_CFLAGS="${CFLAGS}" -save_LDFLAGS="${LDFLAGS}" -save_CPPFLAGS="${CPPFLAGS}" +AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) AC_ISC_POSIX AC_PROG_CC @@ -51,40 +53,32 @@ 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(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_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) +AC_CHECK_FUNCS(uname getdate) -# -# Check if -lsocket is needed -# -AC_CHECK_FUNC(connect,,[ - AC_CHECK_LIB(socket,connect,LIB_INET="${LIB_INET} -lsocket") -]) +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 -# -# Check if -lnsl is needed -# -AC_CHECK_FUNC(gethostbyname,,[ - 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") -]) +case ${target_os} in + linux*) + 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_FUNC(fcloseall,[ - AC_DEFINE_UNQUOTED(HAVE_FCLOSEALL, "1", [have fcloseall]) -]) +AC_CHECK_LIB(m, pow, [], AC_MSG_ERROR([requires libm])) +BMON_LIB="" ##################################################################### ## @@ -120,110 +114,6 @@ 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 ## ##################################################################### @@ -236,42 +126,6 @@ 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 ## ##################################################################### @@ -291,25 +145,13 @@ 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 ]) ##################################################################### ## -## 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 ## ##################################################################### @@ -337,103 +179,22 @@ 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 ## ##################################################################### -AC_SUBST(COMPILE_BMON) -AC_SUBST(BMON_LIB) - AC_SUBST(DEBUG) AC_SUBST(STATIC) AC_SUBST(SYS) AC_SUBST(ARCH) 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 +]) -##################################################################### -## -## 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. -" +AC_OUTPUT