Brad Bishop | f6355e4 | 2020-12-08 14:30:50 -0500 | [diff] [blame^] | 1 | 1)add --with-pcap-config option to use libpcap's pcap-config |
| 2 | 2)add AC_CHECK_LIB if user didn't specify PCAP_ROOT and pcap-config |
| 3 | put it before host check to make cross-compiling easier. |
| 4 | pcap doesn't need extra include and libs so it is fine. |
| 5 | 3)remove old rrd configure code but use pkg-config to config rrd |
| 6 | rrdtool should have the pkg-config file installed. |
| 7 | 4)fix python-config |
| 8 | 5)change AC_TRY_RUN to AC_COMPILE_IFELSE for pthread_rwlock_t checking |
| 9 | 6)fix a net-snmp-config bug |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | |
| 13 | Signed-off-by: Yao Zhao <yao.zhao@windriver.com> |
| 14 | --- |
| 15 | diff --git a/configure.in b/configure.in |
| 16 | index 0c7c0a5..cad40be 100644 |
| 17 | --- a/configure.in |
| 18 | +++ b/configure.in |
| 19 | @@ -230,14 +230,14 @@ dnl> |
| 20 | AC_ARG_WITH(void, |
| 21 | [ +-External-source-locations:-------------------------------------------------+]) |
| 22 | |
| 23 | -AC_ARG_WITH( rrd-home, |
| 24 | - [ --with-rrd-home=DIR Usually /usr/local/rrdtool-1.2.x], |
| 25 | - RRD_HOME="$withval", |
| 26 | - RRD_HOME=/usr/local/rrdtool-1.2.19) |
| 27 | AC_ARG_WITH( pcap-root, |
| 28 | [ --with-pcap-root=DIR LBNL pcap located in DIR], |
| 29 | PCAP_ROOT="$withval", |
| 30 | PCAP_ROOT=) |
| 31 | +AC_ARG_WITH( pcap-config, |
| 32 | + [ --with-pcap-config=path/pcap-config where to find pcap-config], |
| 33 | + PCAP_CONFIG="$withval", |
| 34 | + PCAP_CONFIG=) |
| 35 | AC_ARG_WITH( gdbm-root, |
| 36 | [ --with-gdbm-root=DIR gdbm located in DIR], |
| 37 | GDBM_DIRECTORY="$withval", |
| 38 | @@ -556,6 +556,7 @@ if test ".${PCAPRING_DIR}" != .; then |
| 39 | else |
| 40 | |
| 41 | TMP_ROOT=${HOME}/PF_RING/userland/libpcap/ |
| 42 | +FOUND_PCAP=1 |
| 43 | if test ".${PCAP_ROOT}" == . && |
| 44 | test -d ${TMP_ROOT} && |
| 45 | test -r ${TMP_ROOT}/libpcap.a; then |
| 46 | @@ -563,6 +564,18 @@ if test ".${PCAP_ROOT}" == . && |
| 47 | CORELIBS="${CORELIBS} -L${TMP_ROOT} -L${HOME}/PF_RING/userland/lib -lpfring -lpcap " |
| 48 | INCS="${INCS} -I ${PCAP_ROOT}" |
| 49 | AC_MSG_RESULT([found in $PCAP_ROOT]) |
| 50 | +elif test -n "${PCAP_CONFIG}" && test -x "${PCAP_CONFIG}"; then |
| 51 | + CORELIBS="${CORELIBS} $(${PCAP_CONFIG} --libs)" |
| 52 | + INCS="${INCS} $(${PCAP_CONFIG} --cflags)" |
| 53 | + AC_DEFINE_UNQUOTED(HAVE_LIBPCAP, 1, [have libpcap ]) |
| 54 | + AC_MSG_RESULT([found pcap-config: $PCAP_CONFIG, libs:$(${PCAP_CONFIG} --libs) cflags:$(${PCAP_CONFIG} --cflags)]) |
| 55 | +else |
| 56 | + AC_CHECK_LIB(pcap, pcap_lookupdev, , |
| 57 | + [FOUND_PCAP=]) |
| 58 | +fi |
| 59 | + |
| 60 | +if test -n "$FOUND_PCAP"; then |
| 61 | + : |
| 62 | elif test ".${PCAP_ROOT}" != .; then |
| 63 | if test -d $PCAP_ROOT && |
| 64 | test -r $PCAP_ROOT/lib/libpcap.a && |
| 65 | @@ -880,44 +893,11 @@ AC_CHECK_LIB([z], [zlibVersion], [], [ |
| 66 | exit -1 |
| 67 | ]) |
| 68 | |
| 69 | -# RRD |
| 70 | -if test -d "$RRD_HOME"; then |
| 71 | - AC_MSG_RESULT(checking for RRD home... yes) |
| 72 | -else |
| 73 | - RRD_HOME=/usr/local/rrdtool |
| 74 | - if test -d "$RRD_HOME"; then |
| 75 | - AC_MSG_RESULT(Checking rrdtool in $RRD_HOME) |
| 76 | - else |
| 77 | - RRD_HOME=/usr/local |
| 78 | - fi |
| 79 | -fi |
| 80 | - |
| 81 | -RRD_LIB="-L${RRD_HOME}/lib -lrrd_th" |
| 82 | - |
| 83 | -if test -f "$RRD_HOME/lib/librrd_th.so"; then |
| 84 | - AC_MSG_RESULT(checking for rrdtool... yes) |
| 85 | -else |
| 86 | - if test -f "$RRD_HOME/lib/librrd_th.dylib"; then # OSX |
| 87 | - AC_MSG_RESULT(checking for rrdtool... yes) |
| 88 | - else |
| 89 | - if test -f "$RRD_HOME/lib/librrd_th.a"; then |
| 90 | - AC_MSG_RESULT(checking for rrdtool... yes) |
| 91 | - else |
| 92 | - AC_CHECK_LIB([rrd_th], [main]) |
| 93 | - if test ".${ac_cv_lib_rrd_th_main}" != ".yes"; then |
| 94 | - AC_MSG_ERROR(Unable to find RRD at $RRD_HOME: please use --with-rrd-home=DIR); |
| 95 | - AC_MSG_ERROR(RRD source can be downloaded from http://www.rrdtool.org/); |
| 96 | - else |
| 97 | - RRD_LIB= |
| 98 | - fi |
| 99 | - fi |
| 100 | - fi |
| 101 | -fi |
| 102 | - |
| 103 | -RRD_INC= |
| 104 | -if test -d "${RRD_HOME}/include"; then |
| 105 | - RRD_INC="-I${RRD_HOME}/include" |
| 106 | -fi |
| 107 | +PKG_CHECK_MODULES( [RRD], [librrd] ) |
| 108 | +AC_SUBST(RRD_CFLAGS) |
| 109 | +AC_SUBST(RRD_LIBS) |
| 110 | +RRD_INC=$RRD_FLAGS |
| 111 | +RRD_LIB=$RRD_LIBS |
| 112 | |
| 113 | dnl> The failed recheck stuff below is courtesy of Chris Turbeville [turbo@verio.net] |
| 114 | dnl> Chris developed this for Solaris 9, confirming work I had done earlier for FreeBSD |
| 115 | @@ -1041,7 +1021,7 @@ AC_CHECK_HEADERS([sched.h sys/sched.h]) |
| 116 | AC_CHECK_HEADERS([pthread.h]) |
| 117 | |
| 118 | AC_MSG_CHECKING([if r/w locks are supported]) |
| 119 | -AC_TRY_RUN([ |
| 120 | +AC_COMPILE_IFELSE([ |
| 121 | #include <pthread.h> |
| 122 | |
| 123 | int main() |
| 124 | @@ -1443,15 +1423,15 @@ dnl> NET-SNMP |
| 125 | dnl> |
| 126 | if test ".${ac_disable_snmp}" != ".yes"; then |
| 127 | AC_CHECK_TOOL(NETSNMP, net-snmp-config) |
| 128 | - if test "x$ac_cv_prog_ac_ct_NETSNMP" = "xnet-snmp-config"; then |
| 129 | + if test -n "$NETSNMP"; then |
| 130 | AC_DEFINE_UNQUOTED(HAVE_SNMP, 1, [SNMP is supported]) |
| 131 | - SNMPLIBS="`net-snmp-config --libs`" |
| 132 | + SNMPLIBS="`$NETSNMP --libs`" |
| 133 | SNMPLIBS="`echo ${SNMPLIBS}|sed -e s,'-R../lib',,g`" |
| 134 | echo "net-snmp libs: ${SNMPLIBS}" |
| 135 | LIBS="${LIBS} ${SNMPLIBS}" |
| 136 | dnl remove unecessary path |
| 137 | LIBS=`echo ${LIBS}|sed -e s,'-R../lib',,g` |
| 138 | - INCS="${INCS} `net-snmp-config --cflags`" |
| 139 | + INCS="${INCS} `$NETSNMP --cflags`" |
| 140 | else |
| 141 | AC_MSG_RESULT(NETSNMP is not present: SNMP support is disabled) |
| 142 | fi |
| 143 | @@ -1464,10 +1444,9 @@ SAVED_LIBS=$LIBS |
| 144 | dnl> |
| 145 | dnl> PYTHON |
| 146 | dnl> |
| 147 | - AC_CHECK_TOOL(PYTHON, python-config) |
| 148 | - PYTHON_CONFIG="" |
| 149 | + AC_CHECK_TOOL(PYTHON_CONFIG, python-config) |
| 150 | |
| 151 | - if test "x$ac_cv_prog_ac_ct_PYTHON" != "xpython-config"; then |
| 152 | + if test -z "$PYTHON_CONFIG"; then |
| 153 | if test -f "/etc/debian_version"; then |
| 154 | AC_MSG_RESULT(Please install python-dev and rerun configure) |
| 155 | exit 1 |
| 156 | @@ -1481,8 +1460,6 @@ dnl> |
| 157 | PYTHON_CONFIG="python-config" |
| 158 | fi |
| 159 | fi |
| 160 | - else |
| 161 | - PYTHON_CONFIG="python-config" |
| 162 | fi |
| 163 | |
| 164 | if test "x$PYTHON_CONFIG" != "x"; then |