File: snmp.m4

package info (click to toggle)
php3 3%3A3.0.18-0potato1.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,736 kB
  • ctags: 11,198
  • sloc: ansic: 108,120; sh: 2,512; php: 2,024; yacc: 1,887; makefile: 1,038; perl: 537; pascal: 238; awk: 90; cpp: 28; sql: 11
file content (135 lines) | stat: -rw-r--r-- 3,834 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
dnl $Id: snmp.m4,v 1.1 2000/03/29 17:45:33 sas Exp $

AC_ARG_WITH(openssl,
[  --with-openssl[=DIR]    Include OpenSSL support in SNMP.],[
  PHP_OPENSSL=$withval
],[
  PHP_OPENSSL=no
])

AC_DEFUN(PHP_SETUP_OPENSSL,[
  for i in /usr/local/ssl /usr/local /usr /usr/local/openssl $PHP_OPENSSL; do
    if test -r $i/include/openssl/evp.h; then
      OPENSSL_DIR=$i
      OPENSSL_INC=$i/include/openssl
    elif test -r $i/include/evp.h; then
      OPENSSL_DIR=$i
      OPENSSL_INC=$i/include
    fi
  done

  AC_MSG_CHECKING(for OpenSSL)

  if test -z "$OPENSSL_DIR"; then
    AC_MSG_ERROR(Cannot find OpenSSL's <evp.h>)
  fi

  AC_MSG_RESULT($OPENSSL_DIR, Include files in $OPENSSL_INC)

  AC_ADD_LIBPATH($OPENSSL_DIR/lib)
  AC_ADD_LIBRARY(ssl, yes)
  AC_ADD_LIBRARY(crypto, yes)
  AC_ADD_INCLUDE($OPENSSL_INC)
])

AC_MSG_CHECKING(for SNMP support)
AC_ARG_WITH(snmp,
[  --with-snmp[=DIR]       Include SNMP support.  DIR is the SNMP base
                          install directory, defaults to searching through
                          a number of common locations for the snmp install.
                          Set DIR to "shared" to build as a dl, or "shared,DIR"
                          to build as a dl and still specify DIR.],
[
  case $withval in
    shared)
      shared=yes
      withval=yes
      ;;
    shared,*)
      shared=yes
      withval=`echo $withval | sed -e 's/^shared,//'`      
      ;;
    *)
      shared=no
      ;;
  esac
  if test "$withval" != "no"; then
    if test "$withval" = "yes"; then
      SNMP_INCDIR=/usr/local/include
      SNMP_LIBDIR=/usr/local/lib
      test -f /usr/local/include/ucd-snmp/snmp.h && SNMP_INCDIR=/usr/local/include/ucd-snmp
	  test -f /usr/include/ucd-snmp/snmp.h && SNMP_INCDIR=/usr/include/ucd-snmp
	  test -f /usr/include/snmp/snmp.h && SNMP_INCDIR=/usr/include/snmp
	  test -f /usr/include/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=/usr/include/snmp/include/ucd-snmp
	  test -f /usr/lib/libsnmp.a && SNMP_LIBDIR=/usr/lib
	  test -f /usr/lib/libsnmp.so && SNMP_LIBDIR=/usr/lib
	  test -f /usr/local/lib/libsnmp.a && SNMP_LIBDIR=/usr/local/lib
	  test -f /usr/local/lib/libsnmp.so && SNMP_LIBDIR=/usr/local/lib
	  test -f /usr/local/snmp/lib/libsnmp.a && SNMP_LIBDIR=/usr/local/snmp/lib
	  test -f /usr/local/snmp/lib/libsnmp.so && SNMP_LIBDIR=/usr/local/snmp/lib
    else
      SNMP_INCDIR=$withval/include
      test -d $withval/include/ucd-snmp && SNMP_INCDIR=$withval/include/ucd-snmp
      SNMP_LIBDIR=$withval/lib
    fi
    AC_DEFINE(HAVE_SNMP,1,[ ])
    if test "$shared" = "yes"; then
      AC_MSG_RESULT(yes (shared))
      SNMP_INCLUDE="-I$SNMP_INCDIR"
      SNMP_SHARED="snmp.la"
    else
      AC_MSG_RESULT(yes (static))
      AC_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR)
      AC_ADD_INCLUDE($SNMP_INCDIR)
      SNMP_STATIC="libphpext_snmp.la"
    fi
	old_CPPFLAGS="$CPPFLAGS"
	CPPFLAGS="$INCLUDES $CPPFLAGS"
	AC_CHECK_HEADERS(default_store.h)
	if test "$ac_cv_header_default_store_h" = "yes"; then
		dnl UCD SNMP 4.1.x
		AC_TRY_RUN([
#include <ucd-snmp-config.h>
main() { exit(USE_OPENSSL != 1); }
		],[
			SNMP_SSL=yes
		],[
			SNMP_SSL=no
		],[
			SNMP_SSL=no
		])
		if test "$SNMP_SSL" = "yes"; then
			PHP_SETUP_OPENSSL
		fi
	fi
	CPPFLAGS="$old_CPPFLAGS"
	PHP_EXTENSION(snmp,$shared)
	AC_CHECK_LIB(kstat, kstat_read, [
	  if test "$shared" = yes; then
	    KSTAT_LIBS="-lkstat"
	  else 
	    AC_ADD_LIBRARY(kstat)
	  fi
        ])
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
PHP_SUBST(SNMP_LIBDIR)
PHP_SUBST(SNMP_INCLUDE)
PHP_SUBST(KSTAT_LIBS)

AC_MSG_CHECKING(whether to enable UCD SNMP hack)
AC_ARG_ENABLE(ucd-snmp-hack,
[  --enable-ucd-snmp-hack  Enable UCD SNMP hack],[
  if test "$enableval" = "yes" ; then
    AC_DEFINE(UCD_SNMP_HACK, 1, [ ])
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])