Annotation of embedaddon/php/ext/snmp/config.m4, revision 1.1.1.2

1.1       misho       1: dnl
1.1.1.2 ! misho       2: dnl $Id$
1.1       misho       3: dnl
                      4: 
                      5: PHP_ARG_WITH(snmp,for SNMP support,
                      6: [  --with-snmp[=DIR]       Include SNMP support])
                      7: 
                      8: PHP_ARG_WITH(openssl-dir,OpenSSL dir for SNMP,
                      9: [  --with-openssl-dir[=DIR]  SNMP: openssl install prefix], no, no)
                     10: 
                     11: if test "$PHP_SNMP" != "no"; then
                     12: 
                     13:   if test "$PHP_SNMP" = "yes"; then
                     14:     AC_PATH_PROG(SNMP_CONFIG,net-snmp-config,,[/usr/local/bin:$PATH])
                     15:   else
                     16:     SNMP_CONFIG="$PHP_SNMP/bin/net-snmp-config"
                     17:   fi
                     18: 
                     19:   if test -x "$SNMP_CONFIG"; then
                     20:     SNMP_LIBS=`$SNMP_CONFIG --netsnmp-libs`
                     21:     SNMP_LIBS="$SNMP_LIBS `$SNMP_CONFIG --external-libs`"
                     22:     SNMP_PREFIX=`$SNMP_CONFIG --prefix`
1.1.1.2 ! misho      23:     snmp_full_version=`$SNMP_CONFIG --version`
        !            24:     ac_IFS=$IFS
        !            25:     IFS="."
        !            26:     set $snmp_full_version
        !            27:     IFS=$ac_IFS
        !            28:     SNMP_VERSION=`expr [$]1 \* 1000 + [$]2`
        !            29:     if test "$SNMP_VERSION" -ge "5003"; then
        !            30:       if test -n "$SNMP_LIBS" && test -n "$SNMP_PREFIX"; then
        !            31:         PHP_ADD_INCLUDE(${SNMP_PREFIX}/include)
        !            32:         PHP_EVAL_LIBLINE($SNMP_LIBS, SNMP_SHARED_LIBADD)
        !            33:         SNMP_LIBNAME=netsnmp
1.1       misho      34:       else
1.1.1.2 ! misho      35:         AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.])
1.1       misho      36:       fi
1.1.1.2 ! misho      37:     else
        !            38:       AC_MSG_ERROR([Net-SNMP version 5.3 or greater reqired (detected $snmp_full_version).])
1.1       misho      39:     fi
1.1.1.2 ! misho      40:   else 
        !            41:     AC_MSG_ERROR([Could not find net-snmp-config binary. Please check your net-snmp installation.])
1.1       misho      42:   fi
                     43: 
                     44:   dnl Test build.
                     45:   PHP_CHECK_LIBRARY($SNMP_LIBNAME, init_snmp,
                     46:   [
                     47:     AC_DEFINE(HAVE_SNMP,1,[ ])
                     48:   ], [
                     49:     AC_MSG_ERROR([SNMP sanity check failed. Please check config.log for more information.])
                     50:   ], [
                     51:     $SNMP_SHARED_LIBADD
                     52:   ])
                     53: 
1.1.1.2 ! misho      54:   dnl Check whether shutdown_snmp_logging() exists.
        !            55:   PHP_CHECK_LIBRARY($SNMP_LIBNAME, shutdown_snmp_logging,
        !            56:   [
        !            57:     AC_DEFINE(HAVE_SHUTDOWN_SNMP_LOGGING, 1, [ ])
        !            58:   ], [], [
        !            59:     $SNMP_SHARED_LIBADD
        !            60:   ])
        !            61: 
        !            62:   dnl Check for buggy snmp_snprint_value() (net-snmp BUGid 2027834)
        !            63:   AC_CACHE_CHECK([for buggy snmp_snprint_value], ac_cv_buggy_snprint_value,[
        !            64:     save_CFLAGS="$CFLAGS"
        !            65:     CFLAGS="$CFLAGS -I${SNMP_PREFIX}/include $SNMP_SHARED_LIBADD"
        !            66:     AC_TRY_RUN( [
        !            67: #include <stdio.h>
        !            68: #include <stdlib.h>
        !            69: #include <string.h>
        !            70: #include <net-snmp/net-snmp-config.h>
        !            71: #include <net-snmp/net-snmp-includes.h>
        !            72: 
        !            73: u_char uname[] = "Linux nex1.php.net 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:53:09 EST 2011 i686";
        !            74: 
        !            75: int main(int argc, char **argv)
        !            76: {
        !            77:        struct variable_list vars;
        !            78:        char buf1[2048];
        !            79:        char buf2[sizeof(buf1)];
        !            80:        
        !            81:        memset(&(buf1[0]), 0, sizeof(buf1));
        !            82:        memset(&(buf2[0]), 0, sizeof(buf2));
        !            83:        memset(&vars, 0, sizeof(vars));
        !            84:        vars.type = 4;
        !            85:        vars.val.integer = (long *)&(uname[0]);
        !            86:        vars.val.string = &(uname[0]);
        !            87:        vars.val.bitstring = &(uname[0]);
        !            88:        vars.val.counter64 = (struct counter64 *)&(uname[0]);
        !            89:        vars.val.floatVal = (float *)&(uname[0]);
        !            90:        vars.val_len = sizeof(uname),
        !            91:        vars.name_loc[0] = 1;
        !            92:        vars.name_loc[1] = 3;
        !            93:        vars.name_loc[2] = 6;
        !            94:        vars.name_loc[3] = 1;
        !            95:        vars.name_loc[4] = 2;
        !            96:        vars.name_loc[5] = 1;
        !            97:        vars.name_loc[6] = 1;
        !            98:        vars.name_loc[7] = 1;
        !            99:        vars.name = (oid *)&(vars.name_loc);
        !           100:        vars.name_length = 9;
        !           101: 
        !           102:        init_snmp("snmpapp");
        !           103: 
        !           104:        netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_QUICK_PRINT, 0);
        !           105: 
        !           106:        snprint_value(buf1, (sizeof(uname) + 32), vars.name, vars.name_length, &vars);
        !           107:        snprint_value(buf2, sizeof(buf2), vars.name, vars.name_length, &vars);
        !           108:        exit((strncmp(buf1, buf2, sizeof(buf1)) != 0));
        !           109: }
        !           110:     ],[
        !           111:       ac_cv_buggy_snprint_value=no
        !           112:     ],[
        !           113:       ac_cv_buggy_snprint_value=yes
        !           114:     ],[
        !           115:       ac_cv_buggy_snprint_value=no
        !           116:     ])
        !           117:     CFLAGS="$save_CFLAGS"
        !           118:   ])
        !           119:   if test "$ac_cv_buggy_snprint_value" = "yes"; then
        !           120:      AC_DEFINE(BUGGY_SNMPRINT_VALUE, 1, [ ])
1.1       misho     121:   fi
1.1.1.2 ! misho     122: 
1.1       misho     123:   PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared)
                    124:   PHP_SUBST(SNMP_SHARED_LIBADD)
                    125: fi

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