Annotation of embedaddon/bmon/configure.ac, revision 1.1

1.1     ! misho       1: #
        !             2: # configure.in      Configure Script
        !             3: #
        !             4: # Copyright (c) 2001-2005 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, 2.1.0, tgraf@suug.ch)
        !            25: AC_CONFIG_HEADER(include/bmon/defs.h)
        !            26: 
        !            27: AC_CANONICAL_SYSTEM
        !            28: 
        !            29: save_CFLAGS="${CFLAGS}"
        !            30: save_LDFLAGS="${LDFLAGS}"
        !            31: save_CPPFLAGS="${CPPFLAGS}"
        !            32: 
        !            33: AC_ISC_POSIX
        !            34: AC_PROG_CC
        !            35: AC_PROG_CC_STDC
        !            36: AC_PROG_CPP
        !            37: AC_PROG_MAKE_SET
        !            38: AC_PROG_INSTALL
        !            39: 
        !            40: AC_C_CONST
        !            41: AC_C_INLINE
        !            42: 
        !            43: AC_HEADER_TIME
        !            44: AC_HEADER_DIRENT
        !            45: 
        !            46: AC_TYPE_SIZE_T
        !            47: AC_TYPE_SIGNAL
        !            48: AC_TYPE_PID_T
        !            49: 
        !            50: AC_FUNC_FORK
        !            51: 
        !            52: AC_CHECK_HEADERS(getopt.h ncurses/ncurses.h ncurses.h curses.h)
        !            53: AC_CHECK_HEADERS(dirent.h sys/utsname.h sys/sockio.h netinet6/in6.h)
        !            54: AC_CHECK_HEADERS(rrd.h fcntl.h netdb.h netinet/in.h sysctl/ioctl.h)
        !            55: AC_CHECK_HEADERS(sys/param.h sys/socket.h)
        !            56: 
        !            57: AC_CHECK_TYPES(suseconds_t)
        !            58: 
        !            59: AC_CHECK_FUNCS(atexit gettimeofday memset pow socket strcasecmp)
        !            60: AC_CHECK_FUNCS(strchr strdup strerror strncasecmp strstr strtol)
        !            61: AC_CHECK_FUNCS(uname)
        !            62: 
        !            63: #
        !            64: # Check if -lsocket is needed
        !            65: #
        !            66: AC_CHECK_FUNC(connect,,[
        !            67:        AC_CHECK_LIB(socket,connect,LIB_INET="${LIB_INET} -lsocket")
        !            68: ])
        !            69: 
        !            70: #
        !            71: # Check if -lnsl is needed
        !            72: #
        !            73: AC_CHECK_FUNC(gethostbyname,,[
        !            74:        AC_CHECK_LIB(nsl,gethostbyname,LIB_INET="${LIB_INET} -lnsl")
        !            75: ])
        !            76: 
        !            77: #
        !            78: # Check if -lresolv is needed
        !            79: #
        !            80: AC_CHECK_FUNC(inet_aton,,[
        !            81:        AC_CHECK_LIB(resolv, inet_aton,LIB_INET="${LIB_INET} -lresolv")
        !            82: ])
        !            83: 
        !            84: AC_CHECK_FUNC(fcloseall,[
        !            85:        AC_DEFINE_UNQUOTED(HAVE_FCLOSEALL, "1", [have fcloseall])
        !            86: ])
        !            87: 
        !            88: 
        !            89: #####################################################################
        !            90: ##
        !            91: ## libcurses check
        !            92: ##
        !            93: #####################################################################
        !            94: CURSES="No "
        !            95: AC_CHECK_LIB(ncurses, initscr, [
        !            96:   AC_DEFINE_UNQUOTED(HAVE_NCURSES, "1", [have ncurses])
        !            97:   LCURSES="ncurses"
        !            98:   CURSES="Yes"
        !            99: ],[
        !           100:        AC_CHECK_LIB(curses,initscr, [
        !           101:                AC_DEFINE_UNQUOTED(HAVE_CURSES, "1", [have curses])
        !           102:                LCURSES="curses"
        !           103:                  CURSES="Yes"
        !           104:        ],[
        !           105:                echo
        !           106:                echo "*** Warning: Building bmon w/o curses support ***"
        !           107:                echo
        !           108:        ])
        !           109: ])
        !           110: 
        !           111: LIBCURSES="-l$LCURSES"
        !           112: 
        !           113: AC_CHECK_LIB($LCURSES, redrawwin, [
        !           114:        AC_DEFINE_UNQUOTED(HAVE_REDRAWWIN, "1", [have redrawwin])
        !           115: ])
        !           116: 
        !           117: AC_CHECK_LIB($LCURSES, use_default_colors, [
        !           118:          AC_DEFINE_UNQUOTED(HAVE_USE_DEFAULT_COLORS, "1", [have udc])
        !           119: ])
        !           120: 
        !           121: #####################################################################
        !           122: ##
        !           123: ## librrd check
        !           124: ##
        !           125: #####################################################################
        !           126: RRD="No "
        !           127: AC_CHECK_LIB(rrd, rrd_create, [
        !           128:        AC_DEFINE_UNQUOTED(HAVE_RRD, "1", [have rrd])
        !           129:        LIBRRD="-lrrd"
        !           130:        RRD="Yes"
        !           131: ],[
        !           132:        echo
        !           133:        echo "*** Warning: Building bmon w/o rrd support ***"
        !           134:        echo
        !           135: ])
        !           136: 
        !           137: #####################################################################
        !           138: ##
        !           139: ## libdbi check
        !           140: ##
        !           141: #####################################################################
        !           142: DBI="No "
        !           143: AC_CHECK_LIB(dbi, dbi_initialize, [
        !           144:        AC_DEFINE_UNQUOTED(HAVE_DBI, "1", [have dbi])
        !           145:        LIBDBI="-ldbi"
        !           146:        DBI="Yes"
        !           147: ],[
        !           148:        echo
        !           149:        echo "*** Warning: Building bmon w/o DBI support ***"
        !           150:        echo
        !           151: ])
        !           152: 
        !           153: #####################################################################
        !           154: ##
        !           155: ## libasound check
        !           156: ##
        !           157: #####################################################################
        !           158: ASOUND="No "
        !           159: AC_CHECK_LIB(asound, snd_seq_open, [
        !           160:        AC_DEFINE_UNQUOTED(HAVE_ASOUND, "1", [have asound])
        !           161:        LIBASOUND="-lasound"
        !           162:        ASOUND="Yes"
        !           163: ],[
        !           164:        echo
        !           165:        echo "*** Warning: Building bmon w/o libasound support ***"
        !           166:        echo
        !           167: ])
        !           168: 
        !           169: #####################################################################
        !           170: ##
        !           171: ## libkstat check
        !           172: ##
        !           173: #####################################################################
        !           174: KSTAT="No "
        !           175: AC_CHECK_LIB(kstat, kstat_open, [
        !           176:        AC_DEFINE_UNQUOTED(HAVE_KSTAT, "1", [have kstat])
        !           177:        LIBKSTAT="-lkstat"
        !           178:        KSTAT="Yes"
        !           179: ],[
        !           180:        case ${target_os} in
        !           181:            *solaris*)
        !           182:                echo
        !           183:                echo "*** Warning: Building bmon on SunOS w/o libkstat ***"
        !           184:                echo
        !           185:            ;;
        !           186:        esac
        !           187: ])
        !           188: 
        !           189: #####################################################################
        !           190: ##
        !           191: ## libnl check
        !           192: ##
        !           193: #####################################################################
        !           194: NL="No "
        !           195: AC_CHECK_LIB(nl, nl_connect, [
        !           196:        AC_DEFINE_UNQUOTED(HAVE_NL, "1", [have libnl])
        !           197:        LIBNL="-lnl"
        !           198:        NL="Yes"
        !           199: ],[
        !           200:        case ${target_os} in
        !           201:            *linux*)
        !           202:                echo
        !           203:                echo "*** Warning: Building bmon on Linuxx w/o libnl ***"
        !           204:                echo
        !           205:            ;;
        !           206:        esac
        !           207: ])
        !           208: 
        !           209: #####################################################################
        !           210: ##
        !           211: ## libm check
        !           212: ##
        !           213: #####################################################################
        !           214: M="No "
        !           215: AC_CHECK_LIB(m, pow, [
        !           216:        LIBM="-lm"
        !           217:        M="Yes"
        !           218: ],[
        !           219:        echo
        !           220:        echo "*** Error: libm required ***"
        !           221:        echo
        !           222:        exit
        !           223: ])
        !           224: 
        !           225: #####################################################################
        !           226: ##
        !           227: ## interface counter overflow workaround
        !           228: ##
        !           229: #####################################################################
        !           230: AC_ARG_ENABLE(cnt-workaround,
        !           231: [  --disable-cnt-workaround Disables interface counter overflow workaround],[
        !           232:        if test x$enableval = xno; then
        !           233:                AC_DEFINE_UNQUOTED(DISABLE_OVERFLOW_WORKAROUND,"1",[no overflow workaround])
        !           234:        fi
        !           235: ])
        !           236: 
        !           237: #####################################################################
        !           238: ##
        !           239: ## librrd
        !           240: ##
        !           241: #####################################################################
        !           242: AC_ARG_ENABLE(rrd,
        !           243: [  --disable-rrd           Disables rrd output],[
        !           244:        if test x$enableval = xno; then
        !           245:                RRD="No "
        !           246:        fi
        !           247: ])
        !           248: 
        !           249: #####################################################################
        !           250: ##
        !           251: ## libasound
        !           252: ##
        !           253: #####################################################################
        !           254: AC_ARG_ENABLE(asound,
        !           255: [  --disable-asound        Disables asound output],[
        !           256:        if test x$enableval = xno; then
        !           257:                ASOUND="No "
        !           258:        fi
        !           259: ])
        !           260: 
        !           261: #####################################################################
        !           262: ##
        !           263: ## libdbi
        !           264: ##
        !           265: #####################################################################
        !           266: AC_ARG_ENABLE(dbi,
        !           267: [  --disable-dbi           Disables DBI output],[
        !           268:        if test x$enableval = xno; then
        !           269:                DBI="No "
        !           270:        fi
        !           271: ])
        !           272: 
        !           273: #####################################################################
        !           274: ##
        !           275: ## curses
        !           276: ##
        !           277: #####################################################################
        !           278: AC_ARG_ENABLE(curses,
        !           279: [  --disable-curses        Disables curses output],[
        !           280:        if test x$enableval = xno; then
        !           281:                CURSES="No "
        !           282:        fi
        !           283: ])
        !           284: 
        !           285: #####################################################################
        !           286: ##
        !           287: ## debug check
        !           288: ##
        !           289: #####################################################################
        !           290: DEBUG=0
        !           291: AC_ARG_ENABLE(debug,
        !           292: [  --enable-debug          Enable debug mode (default disabled)],[
        !           293:        if test x$enableval = xyes; then
        !           294:                DEBUG=1;
        !           295:        fi
        !           296: ])
        !           297: 
        !           298: #####################################################################
        !           299: ##
        !           300: ## static check
        !           301: ##
        !           302: #####################################################################
        !           303: STATIC=0
        !           304: AC_ARG_ENABLE(static,
        !           305: [  --enable-static         Enable static linking (default disabled)],[
        !           306:        if test x$enableval = xyes; then
        !           307:                STATIC=1;
        !           308:        fi
        !           309: ])
        !           310: 
        !           311: #####################################################################
        !           312: ##
        !           313: ## target os eval
        !           314: ##
        !           315: #####################################################################
        !           316: case ${target_os} in
        !           317:     linux*)
        !           318:        AC_DEFINE_UNQUOTED(SYS_LINUX, "1", [operating system])
        !           319:     ;;
        !           320: 
        !           321:     *solaris*)
        !           322:        AC_DEFINE_UNQUOTED(SYS_SUNOS, "1", [operating system])
        !           323:     ;;
        !           324: 
        !           325:     *bsd*)
        !           326:        AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
        !           327:     ;;
        !           328: 
        !           329:     *darwin*)
        !           330:        AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
        !           331:     ;;
        !           332: 
        !           333:     *)
        !           334:        AC_DEFINE_UNQUOTED(SYS_OTHER, "1", [operating system])
        !           335:     ;;
        !           336: esac
        !           337: 
        !           338: #####################################################################
        !           339: ##
        !           340: ## compile decisions
        !           341: ##
        !           342: #####################################################################
        !           343: COMPILE_BMON="Yes "
        !           344: BMON_LIB="$LIB_INET $LIBM"
        !           345: if test x$CURSES = xYes; then
        !           346:        BMON_LIB="$BMON_LIB $LIBCURSES"
        !           347: fi;
        !           348: 
        !           349: if test x$NL = xYes; then
        !           350:        BMON_LIB="$BMON_LIB $LIBNL"
        !           351: fi;
        !           352: 
        !           353: if test x$KSTAT = xYes; then
        !           354:        BMON_LIB="$BMON_LIB $LIBKSTAT"
        !           355: fi;
        !           356: 
        !           357: if test x$RRD = xYes; then
        !           358:        BMON_LIB="$BMON_LIB $LIBRRD"
        !           359: fi;
        !           360: 
        !           361: if test x$ASOUND = xYes; then
        !           362:        BMON_LIB="$BMON_LIB $LIBASOUND"
        !           363: fi;
        !           364: 
        !           365: if test x$DBI = xYes; then
        !           366:        BMON_LIB="$BMON_LIB $LIBDBI"
        !           367: fi;
        !           368:        
        !           369: 
        !           370: #####################################################################
        !           371: ##
        !           372: ## export variables
        !           373: ##
        !           374: #####################################################################
        !           375: AC_SUBST(COMPILE_BMON)
        !           376: AC_SUBST(BMON_LIB)
        !           377: 
        !           378: AC_SUBST(DEBUG)
        !           379: AC_SUBST(STATIC)
        !           380: AC_SUBST(SYS)
        !           381: AC_SUBST(ARCH)
        !           382: 
        !           383: AC_SUBST(CURSES)
        !           384: AC_SUBST(RRD)
        !           385: AC_SUBST(ASOUND)
        !           386: AC_SUBST(DBI)
        !           387: 
        !           388: AC_OUTPUT([Makefile.opts])
        !           389: 
        !           390: #####################################################################
        !           391: ##
        !           392: ## status report
        !           393: ##
        !           394: #####################################################################
        !           395: echo "
        !           396: ----------------------------------------------------------------------
        !           397: SUMMARY:
        !           398: 
        !           399: OS: $target_os
        !           400: 
        !           401: Included in Compilation:
        !           402:   bmon:   $COMPILE_BMON $BMON_LIB
        !           403: 
        !           404: Dependencies:
        !           405: bmon:
        !           406:   libm             $M       (required)
        !           407:   lib(n)curses     $CURSES       (suggested)
        !           408:   librrd           $RRD       (suggested)
        !           409:   libdbi           $DBI       (suggested)
        !           410:   libasound        $ASOUND       (toy)"
        !           411: case ${target_os} in
        !           412:   *linux*)
        !           413:    echo "  libnl            $NL       (suggested)"
        !           414:    ;;
        !           415: esac
        !           416: if test x$target_os = xsolaris; then
        !           417:    echo "  libkstat         $KSTAT     (required on SunOS)"
        !           418: fi
        !           419: echo "
        !           420: ----------------------------------------------------------------------
        !           421: 
        !           422: WARNING:
        !           423:    Please do not install the bmon executable as SUID root. This
        !           424:    software package was written with portability and configurability
        !           425:    in mind and will never fulfill the requirements to be installed
        !           426:    as SUID root executable.
        !           427: 
        !           428:    If you do please be aware that every user will be able to run
        !           429:    arbitary commands as root via the key bind interface or by
        !           430:    providing a malicious netstat binary.
        !           431: 
        !           432:    In fact there is no reason to do so, all supported input modules
        !           433:    will work fine without superuser privileges. There is probably a
        !           434:    good reason if your operating system requires special privileges
        !           435:    which is that a normal user is not supposed to read the statistics
        !           436:    which should not be worked around using the SUID bit.
        !           437: 
        !           438:    Thanks.
        !           439: "

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>