From d520e7c39b6e4e66524c7ba9e093e6e3d1f763da Mon Sep 17 00:00:00 2001 From: Martin Vit Date: Tue, 23 Dec 2014 16:22:15 +0100 Subject: [PATCH 1/8] 10.1.23 --- ChangeLog | 5 +++++ pcap_queue.cpp | 8 +++++++- voipmonitor.h | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c36edc5f..8c5605f4e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +10.1.23 23.12.2014 +================== +- do not use more memory then set in packetbuffer_total_maxheap in case the sniffer is in receiver mode and remote sniffer reconnect to the receiver and sends all traffic in burst (receiver will slow down) + + 10.1.22 11.12.2014 ================== - fix bad arithmetic when writing time of RTP packets (in wors case it was +- 1 sec) which can lead to show RTP packets before SIP packets in SIP history diff --git a/pcap_queue.cpp b/pcap_queue.cpp index 3feb6d481..63ddb0f5e 100644 --- a/pcap_queue.cpp +++ b/pcap_queue.cpp @@ -3169,7 +3169,13 @@ void *PcapQueue_readFromFifo::threadFunction(void *arg, unsigned int arg2) { while(offsetBuffer < bufferLen) { if(blockStore->addRestoreChunk(buffer, bufferLen, &offsetBuffer)) { endBlock = true; - this->pcapStoreQueue.push(blockStore, this->blockStoreTrash_size); + while(!this->pcapStoreQueue.push(blockStore, this->blockStoreTrash_size)) { + if(TERMINATING || forceStop) { + break; + } else { + usleep(1000); + } + } sumPacketsCounterIn[0] += blockStore->count; sumPacketsSize[0] += blockStore->size; sumPacketsSizeCompress[0] += blockStore->size_compress; diff --git a/voipmonitor.h b/voipmonitor.h index 6a2c2a161..923de538d 100644 --- a/voipmonitor.h +++ b/voipmonitor.h @@ -4,7 +4,7 @@ #ifndef VOIPMONITOR_H #define VOIPMONITOR_H -#define RTPSENSOR_VERSION "10.1.22" +#define RTPSENSOR_VERSION "10.1.23" #define NAT #define FORMAT_WAV 1 From 28646bfc616d8765d98b8ebf3f3a9bd6c31f2dfb Mon Sep 17 00:00:00 2001 From: Martin Vit Date: Tue, 27 Jan 2015 19:26:00 +0100 Subject: [PATCH 2/8] 10.1.24 --- ChangeLog | 5 +++++ rtp.cpp | 37 ++++++++++++++++++++++++++++++++----- voipmonitor.h | 2 +- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c5605f4e..a2ea81c9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +10.1.24 27.01.2015 +================== +- fix G729 audio decode for 10ms variant + + 10.1.23 23.12.2014 ================== - do not use more memory then set in packetbuffer_total_maxheap in case the sniffer is in receiver mode and remote sniffer reconnect to the receiver and sends all traffic in burst (receiver will slow down) diff --git a/rtp.cpp b/rtp.cpp index 3d52a4fac..57a055786 100644 --- a/rtp.cpp +++ b/rtp.cpp @@ -745,7 +745,6 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s } int curpayload = getPayload(); -// printf("p[%d]\n", curpayload); if((codec == -1 || (curpayload != prev_payload))) { if(curpayload >= 96 && curpayload <= 127) { @@ -831,7 +830,7 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s lastcng = 1; return; } - if(curpayload == PAYLOAD_G729 and (payload_len <= (packetization == 10 ? 9 : 12) or payload_len == 22)) { + if(curpayload == PAYLOAD_G729 and (payload_len <= (packetization == 10 or packetization == 0 ? 9 : 12) or payload_len == 22)) { last_seq = seq; if(update_seq(seq)) { update_stats(); @@ -1059,6 +1058,8 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s // if G729 packet len is 20, packet len is 20ms. In other cases - will be added later (do not have 40ms packetizations samples right now) if(payload_len == 20) { packetization = 20; + } else if(payload_len == 10) { + packetization = 10; } else { packetization = (getTimestamp() - last_ts) / 8; } @@ -1066,7 +1067,6 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s if(payload_len == 24) { packetization = 30; } else if(payload_len == 24*2) { - printf("pack:60\n"); packetization = 60; } else if(payload_len == 24*3) { packetization = 90; @@ -1129,7 +1129,18 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s /* for recording, we cannot loose any packet */ if(opt_saveRAW || opt_savewav_force || (owner->flags & FLAG_SAVEWAV) || (owner && (owner->audiobuffer1 || owner->audiobuffer2))) { // if recording requested if(packetization < 10) { - packetization = channel_record->packetization = default_packetization; + if(curpayload == PAYLOAD_G729) { + // if G729 packet len is 20, packet len is 20ms. In other cases - will be added later (do not have 40ms packetizations samples right now) + if(payload_len == 20) { + packetization = channel_record->packetization = 20; + } else if(payload_len == 10) { + packetization = channel_record->packetization = 10; + } else { + packetization = channel_record->packetization = default_packetization; + } + } else { + packetization = channel_record->packetization = default_packetization; + } } if(owner->flags & FLAG_RUNAMOSLQO or owner->flags & FLAG_RUNBMOSLQO) { if(owner->connect_time) { @@ -1146,6 +1157,8 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s // if G729 packet len is 20, packet len is 20ms. In other cases - will be added later (do not have 40ms packetizations samples right now) if(payload_len == 20) { packetization = 20; + } else if(payload_len == 10) { + packetization = 10; } else { packetization = (getTimestamp() - last_ts) / 8; } @@ -1202,7 +1215,19 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s if(opt_saveRAW || opt_savewav_force || (owner->flags & FLAG_SAVEWAV) || (owner && (owner->audiobuffer1 || owner->audiobuffer2))// if recording requested ){ - packetization = channel_record->packetization = default_packetization; + if(curpayload == PAYLOAD_G729) { + // if G729 packet len is 20, packet len is 20ms. In other cases - will be added later (do not have 40ms packetizations samples right now) + if(payload_len == 20) { + packetization = channel_record->packetization = 20; + } else if(payload_len == 10) { + packetization = channel_record->packetization = 10; + } else { + packetization = channel_record->packetization = default_packetization; + } + } else { + packetization = channel_record->packetization = default_packetization; + } + if(owner->flags & FLAG_RUNAMOSLQO or owner->flags & FLAG_RUNBMOSLQO) { if(owner->connect_time) { jitterbuffer(channel_record, 1); @@ -1221,6 +1246,8 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s // if G729 packet len is 20, packet len is 20ms. In other cases - will be added later (do not have 40ms packetizations samples right now) if(payload_len == 20) { curpacketization = 20; + } else if(payload_len == 10) { + curpacketization = 10; } else { curpacketization = (getTimestamp() - last_ts) / 8; } diff --git a/voipmonitor.h b/voipmonitor.h index 923de538d..cd59ba8aa 100644 --- a/voipmonitor.h +++ b/voipmonitor.h @@ -4,7 +4,7 @@ #ifndef VOIPMONITOR_H #define VOIPMONITOR_H -#define RTPSENSOR_VERSION "10.1.23" +#define RTPSENSOR_VERSION "10.1.24" #define NAT #define FORMAT_WAV 1 From 41ae25d7208ee5749ba8a551ce127312929414aa Mon Sep 17 00:00:00 2001 From: Martin Vit Date: Fri, 30 Jan 2015 12:35:35 +0100 Subject: [PATCH 3/8] 10.1.25 --- ChangeLog | 5 +++++ manager.cpp | 8 +++++--- voipmonitor.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2ea81c9d..30311dba4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +10.1.25 27.01.2015 +================== +- fix TCP manager racecondition when quick connections are made which leads to communication errors (and lags in the GUI when loading charts) + + 10.1.24 27.01.2015 ================== - fix G729 audio decode for 10ms variant diff --git a/manager.cpp b/manager.cpp index 6fb147766..da52b1e56 100644 --- a/manager.cpp +++ b/manager.cpp @@ -1692,6 +1692,7 @@ void *manager_read_thread(void * arg) { int size; unsigned int client; client = *(unsigned int *)arg; + delete (unsigned int*)arg; //cout << "New manager connect from: " << inet_ntoa((in_addr)clientInfo.sin_addr) << endl; if ((size = recv(client, buf, BUFSIZE - 1, 0)) == -1) { @@ -1734,6 +1735,7 @@ void *manager_read_thread(void * arg) { } else { close(client); } + return 0; } @@ -1890,7 +1892,6 @@ void *manager_server(void *dummy) { cerr << "Cannot create manager queue" << endl; return 0; } - unsigned int ids; pthread_t threads; pthread_attr_t attr; fd_set rfds; @@ -1916,12 +1917,13 @@ void *manager_server(void *dummy) { } pthread_attr_init(&attr); - ids = client; + unsigned int *_ids = new unsigned int; + *_ids = client; int rslt = pthread_create ( /* Create a child thread */ &threads, /* Thread ID (system assigned) */ &attr, /* Default thread attributes */ manager_read_thread, /* Thread routine */ - &ids); /* Arguments to be passed */ + _ids); /* Arguments to be passed */ pthread_detach(threads); pthread_attr_destroy(&attr); if(rslt != 0) { diff --git a/voipmonitor.h b/voipmonitor.h index cd59ba8aa..11e574157 100644 --- a/voipmonitor.h +++ b/voipmonitor.h @@ -4,7 +4,7 @@ #ifndef VOIPMONITOR_H #define VOIPMONITOR_H -#define RTPSENSOR_VERSION "10.1.24" +#define RTPSENSOR_VERSION "10.1.25" #define NAT #define FORMAT_WAV 1 From 933d97bf11fda9642f80c0508f8fbe9a5deb34df Mon Sep 17 00:00:00 2001 From: Martin Vit Date: Fri, 30 Jan 2015 17:35:28 +0100 Subject: [PATCH 4/8] backport --- calltable.cpp | 2 ++ rtp.cpp | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/calltable.cpp b/calltable.cpp index 8960538bb..b05fcaa64 100644 --- a/calltable.cpp +++ b/calltable.cpp @@ -724,6 +724,8 @@ Call::read_rtp(unsigned char* data, int datalen, int dataoffset, struct pcap_pkt #if RTP_BY_SRC_IP && rtp[i]->saddr == saddr #endif + && rtp[i]->dport == dport + ) { // found if(opt_dscp) { diff --git a/rtp.cpp b/rtp.cpp index 57a055786..2b5cd14e2 100644 --- a/rtp.cpp +++ b/rtp.cpp @@ -965,9 +965,6 @@ RTP::read(unsigned char* data, int len, struct pcap_pkthdr *header, u_int32_t s prevrtp->data = data; prevrtp->len = len; prevrtp->header = header; - prevrtp->saddr = saddr; - prevrtp->daddr = daddr; - prevrtp->dport = dport; prevrtp->codec = prevrtp->prev_codec; if(owner->flags & FLAG_RUNAMOSLQO or owner->flags & FLAG_RUNBMOSLQO) { // MOS LQO is calculated only if the call is connected From 2be777d0f66bcac7c372b82bbe7498bb8ca8b31b Mon Sep 17 00:00:00 2001 From: Martin Vit Date: Fri, 30 Jan 2015 17:36:35 +0100 Subject: [PATCH 5/8] 10.1.26 --- ChangeLog | 7 ++++++- voipmonitor.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30311dba4..f1d9343b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -10.1.25 27.01.2015 +10.1.26 30.01.2015 +================== +- if RTP changes destination port but SSRC is the same create new RTP so the GUI can see that the change happened [VS-168] + + +10.1.25 30.01.2015 ================== - fix TCP manager racecondition when quick connections are made which leads to communication errors (and lags in the GUI when loading charts) diff --git a/voipmonitor.h b/voipmonitor.h index 11e574157..2e2883675 100644 --- a/voipmonitor.h +++ b/voipmonitor.h @@ -4,7 +4,7 @@ #ifndef VOIPMONITOR_H #define VOIPMONITOR_H -#define RTPSENSOR_VERSION "10.1.25" +#define RTPSENSOR_VERSION "10.1.26" #define NAT #define FORMAT_WAV 1 From be9db42026b16739ec4f538358d9485ae6c1721e Mon Sep 17 00:00:00 2001 From: Claus Andersen Date: Mon, 2 Feb 2015 13:52:39 +0100 Subject: [PATCH 6/8] Adapt autotools for FreeBSD --- Makefile.in | 16 +++++++++------- configure.in | 14 ++++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Makefile.in b/Makefile.in index a40cddee9..a7a936ff7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -36,8 +36,8 @@ objects = $(shell ls -1 *.cpp | sed 's/\.cpp/.o/' | tr "\n" " ") $(shell ls -1 j #headers = $(shell ls -1 *.h | tr "\n" " ") $(shell ls -1 jitterbuffer/*.h | tr "\n" " ") $(shell ls -1 jitterbuffer/asterisk/*.h | tr "\n" " ") -JSONLIB = $(shell pkg-config --libs json) -JSONCFLAGS = $(shell pkg-config --cflags json) +JSONLIB = $(shell pkg-config --libs @LIBJSON_NAME@) +JSONCFLAGS = $(shell pkg-config --cflags @LIBJSON_NAME@) MYSQLLIB = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --libs) MYSQLINC = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --include) @@ -45,12 +45,13 @@ MYSQLINC = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --include) GLIBCFLAGS =$(shell pkg-config --cflags glib-2.0) GLIBLIB =$(shell pkg-config --libs glib-2.0) +LIBLD=@LIBLD@ LIBLZMA=@LIBLZMA@ LIBSSH=@LIBSSH@ LIBGNUTLS=@LIBGNUTLS@ LIBGNUTLSSTATIC=@LIBGNUTLSSTATIC@ -SHARED_LIBS = -ldl -lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc ${MYSQLLIB} -lrt -lsnappy -lcurl -lssl -lcrypto ${JSONLIB} ${LIBSSH} -lxml2 -lrrd ${LIBGNUTLS} @LIBTCMALLOC@ ${GLIBLIB} ${LIBLZMA} -STATIC_LIBS = -static @LIBTCMALLOC@ -lodbc -lltdl -ldl -lrt -lz ${LIBSSH} -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -lpthread ${MYSQLLIB} -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy ${JSONLIB} -lrrd -lxml2 ${GLIBLIB} -lz -ldbi -llzma ${LIBGNUTLSSTATIC} +SHARED_LIBS = ${LIBLD} -lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc ${MYSQLLIB} -lrt -lsnappy -lcurl -lssl -lcrypto ${JSONLIB} ${LIBSSH} -lxml2 -lrrd ${LIBGNUTLS} @LIBTCMALLOC@ ${GLIBLIB} ${LIBLZMA} +STATIC_LIBS = -static @LIBTCMALLOC@ -lodbc -lltdl ${LIBLD} -lrt -lz ${LIBSSH} -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -lpthread ${MYSQLLIB} -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy ${JSONLIB} -lrrd -lxml2 ${GLIBLIB} -lz -ldbi -llzma ${LIBGNUTLSSTATIC} INCLUDES = -I/usr/local/include ${MYSQLINC} -I jitterbuffer/ ${JSONCFLAGS} ${GLIBCFLAGS} LIBS_PATH = -L/usr/local/lib/ CXXFLAGS += -Wall -fPIC -g3 -O2 -march=$(GCCARCH) -mtune=${GCCARCH} ${INCLUDES} @@ -58,12 +59,13 @@ CFLAGS += ${CXXFLAGS} LIBS = ${SHARED_LIBS} LIBS2 = @LIBS2@ - +shared: LDFLAGS += -Wl,--allow-multiple-definition shared: cleantest $(objects) - ${CXX} $(objects) ${CXXFLAGS} -o voipmonitor ${LIBS} ${LIBS_PATH} + ${CXX} $(objects) ${LDFLAGS} -o voipmonitor ${LIBS} ${LIBS_PATH} +static: LDFLAGS += -Wl,--allow-multiple-definition static: cleantest $(objects) - ${CXX} $(objects) ${CXXFLAGS} -o voipmonitor ${STATIC_LIBS} ${LIBS_PATH} -Wl,--allow-multiple-definition + ${CXX} $(objects) ${LDFLAGS} -o voipmonitor ${STATIC_LIBS} ${LIBS_PATH} core2: cleantest static diff --git a/configure.in b/configure.in index 4fb660a19..180cd348b 100644 --- a/configure.in +++ b/configure.in @@ -12,8 +12,8 @@ AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET -LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/mysql/lib" -LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/local/lib -L/usr/lib64/mysql/ -L/usr/lib/mysql/" +LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/mysql/lib:/usr/local/lib/mysql" +LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/local/lib -L/usr/lib64/mysql/ -L/usr/lib/mysql/ -L /usr/local/lib/mysql" # Checks for libraries. # FIXME: Replace `main' with a function in `-lc': @@ -21,7 +21,7 @@ AC_CHECK_LIB([c], [main]) # FIXME: Replace `main' with a function in `-lcrypt': AC_CHECK_LIB([crypt], [main]) # FIXME: Replace `main' with a function in `-ldl': -AC_CHECK_LIB([dl], [main]) +AC_CHECK_LIB([dl], [main], AC_SUBST([LIBLD],["-ldl"]), AC_MSG_NOTICE([Unable to find libdl. Safe to ignore on FreeBSD as the functionality is provided by libc.])) # FIXME: Replace `main' with a function in `-lltdl': AC_CHECK_LIB([ltdl], [main]) # FIXME: Replace `main' with a function in `-lm': @@ -46,7 +46,13 @@ AC_CHECK_LIB([vorbisenc], [main], ,AC_MSG_ERROR([Unable to find VORBISENC librar AC_CHECK_LIB([snappy], [main], ,AC_MSG_ERROR([Unable to find snappy library. apt-get install libsnappy-dev | or compile from source: https://snappy.googlecode.com/files/snappy-1.1.0.tar.gz])) AC_CHECK_LIB([curl], [main], , AC_MSG_ERROR([Unable to find curl library. apt-get libcurl4-openssl-dev | yum curl-devel])) AC_CHECK_LIB([ssh], [ssh_forward_accept], HAVE_LIBSSH=1, AC_MSG_NOTICE([Your libssh is old or missing - cloud feature is disabled. apt-get install libssh-dev | yum install libssh-devel | or compile from source https://red.libssh.org/projects/libssh/files])) -AC_CHECK_LIB([json], [main], , AC_MSG_ERROR([Unable to find json-c library. apt-get install libjson0-dev | yum install json-c-devel (RPM from EPEL) | or compile from source: git clone https://github.com/json-c/json-c.git; cd json-c; sh autogen.sh; ./configure; make; make install;ldconfig])) +AC_CHECK_LIB([json], [main], LIBJSON_NAME='json', AC_MSG_NOTICE([Unable to find json library - then you must use json-c])) +AC_CHECK_LIB([json-c], [main], LIBJSON_NAME='json-c', AC_MSG_NOTICE([Unable to find json-c library - this is a problem if json was not found])) +if test "x$LIBJSON_NAME" = "x"; then + AC_MSG_ERROR([Unable to find json(-c) library. apt-get install libjson0-dev | yum install json-c-devel (RPM from EPEL) | pkg install json-c | or compile from source: git clone https://github.com/json-c/json-c.git; cd json-c; sh autogen.sh; ./configure; make; make install;ldconfig]) +else + AC_SUBST([LIBJSON_NAME],["$LIBJSON_NAME"]) +fi AC_CHECK_LIB([rrd], [main], , AC_MSG_ERROR([Unable to find librrd library. apt-get install librrd-dev | yum install rrdtool-devel | or compile from source http://oss.oetiker.ch/rrdtool/doc/librrd.en.html])) AC_CHECK_LIB([glib-2.0], [main], , AC_MSG_ERROR([Unable to find libglib library. apt-get install libglib2.0-dev | yum install glib2-devel])) AC_CHECK_LIB([xml2], [main], , AC_MSG_ERROR([Unable to find xml2 library. apt-get install libxml2-dev | yum install libxml2-devel])) From f8111a3dcdbc2ac5193236b3ae1b0ef42ea998e1 Mon Sep 17 00:00:00 2001 From: Claus Andersen Date: Mon, 2 Feb 2015 15:54:19 +0100 Subject: [PATCH 7/8] Change autotools to detect mysql_config and share between configure and Makefile --- Makefile.in | 4 ++-- configure.in | 40 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index a7a936ff7..9d301088d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,8 +39,8 @@ objects = $(shell ls -1 *.cpp | sed 's/\.cpp/.o/' | tr "\n" " ") $(shell ls -1 j JSONLIB = $(shell pkg-config --libs @LIBJSON_NAME@) JSONCFLAGS = $(shell pkg-config --cflags @LIBJSON_NAME@) -MYSQLLIB = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --libs) -MYSQLINC = $(shell PATH=$$PATH:/usr/local/mysql/bin/ mysql_config --include) +MYSQLLIB=@MYSQLLIB@ +MYSQLINC=@MYSQLINCLUDE@ GLIBCFLAGS =$(shell pkg-config --cflags glib-2.0) GLIBLIB =$(shell pkg-config --libs glib-2.0) diff --git a/configure.in b/configure.in index 180cd348b..329dbce76 100644 --- a/configure.in +++ b/configure.in @@ -12,8 +12,8 @@ AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET -LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib:/usr/local/mysql/lib:/usr/local/lib/mysql" -LDFLAGS="$LDFLAGS -L/usr/local/mysql/lib -L/usr/local/lib -L/usr/lib64/mysql/ -L/usr/lib/mysql/ -L /usr/local/lib/mysql" +LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" +LDFLAGS="$LDFLAGS -L/usr/local/lib" # Checks for libraries. # FIXME: Replace `main' with a function in `-lc': @@ -56,7 +56,41 @@ fi AC_CHECK_LIB([rrd], [main], , AC_MSG_ERROR([Unable to find librrd library. apt-get install librrd-dev | yum install rrdtool-devel | or compile from source http://oss.oetiker.ch/rrdtool/doc/librrd.en.html])) AC_CHECK_LIB([glib-2.0], [main], , AC_MSG_ERROR([Unable to find libglib library. apt-get install libglib2.0-dev | yum install glib2-devel])) AC_CHECK_LIB([xml2], [main], , AC_MSG_ERROR([Unable to find xml2 library. apt-get install libxml2-dev | yum install libxml2-devel])) -AC_CHECK_LIB([mysqlclient], [main], , AC_MSG_ERROR([Unable to find libmysqlclient. apt-get install libmysqlclient-dev | yum install mysql-devel])) + +# Check for MySQL libraries (or MariaDB) +AC_MSG_CHECKING(for mysql_config executable) +AC_ARG_WITH(mysql, [ --with-mysql=PATH path to mysql_config binary or mysql prefix dir], [ + if test -x $withval -a -f $withval + then + MYSQL_CONFIG=$withval + elif test -x $withval/bin/mysql_config -a -f $withval/bin/mysql_config + then + MYSQL_CONFIG=$withval/bin/mysql_config + fi +], [ + if test -x /usr/local/mysql/bin/mysql_config -a -f /usr/local/mysql/bin/mysql_config + then + MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config + elif test -x /usr/bin/mysql_config -a -f /usr/bin/mysql_config + then + MYSQL_CONFIG=/usr/bin/mysql_config + elif test -x /usr/local/bin/mysql_config -a -f /usr/local/bin/mysql_config + then + MYSQL_CONFIG=/usr/local/bin/mysql_config + fi +]) +if test "x$MYSQL_CONFIG" = "x" +then + AC_MSG_RESULT(not found) + exit 3 +else + AC_SUBST([MYSQLCFLAGS],[`$MYSQL_CONFIG --cflags`]) + AC_SUBST([MYSQLCXXFLAGS],[`$MYSQL_CONFIG --cxxflags`]) + AC_SUBST([MYSQLLIB],[`$MYSQL_CONFIG --libs`]) + AC_SUBST([MYSQLINCLUDE],[`$MYSQL_CONFIG --include`]) + AC_MSG_RESULT($MYSQL_CONFIG) +fi + AC_CHECK_LIB([z], [main], , AC_MSG_ERROR([Unable to find libz. apt-get install zlib1g-dev | yum install zlib-devel])) AC_CHECK_LIB([lzma], [main], HAVE_LIBLZMA=1, AC_MSG_NOTICE([Unable to find lzma. apt-get install liblzma-dev | yum install lzma-devel])) AC_CHECK_LIB([gnutls], [gnutls_init], HAVE_LIBGNUTLS=1, AC_MSG_NOTICE([Unable to find gnutls disabling SIP TLS decoder. apt-get install libgnutls-dev | yum install gnutls-devel])) From 73203736de2b03e20ec8b14939ab5fea6350ab71 Mon Sep 17 00:00:00 2001 From: Claus Andersen Date: Mon, 2 Feb 2015 16:27:51 +0100 Subject: [PATCH 8/8] Portable detection of mysql libraries --- configure.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 329dbce76..6c07885d8 100644 --- a/configure.in +++ b/configure.in @@ -46,8 +46,8 @@ AC_CHECK_LIB([vorbisenc], [main], ,AC_MSG_ERROR([Unable to find VORBISENC librar AC_CHECK_LIB([snappy], [main], ,AC_MSG_ERROR([Unable to find snappy library. apt-get install libsnappy-dev | or compile from source: https://snappy.googlecode.com/files/snappy-1.1.0.tar.gz])) AC_CHECK_LIB([curl], [main], , AC_MSG_ERROR([Unable to find curl library. apt-get libcurl4-openssl-dev | yum curl-devel])) AC_CHECK_LIB([ssh], [ssh_forward_accept], HAVE_LIBSSH=1, AC_MSG_NOTICE([Your libssh is old or missing - cloud feature is disabled. apt-get install libssh-dev | yum install libssh-devel | or compile from source https://red.libssh.org/projects/libssh/files])) -AC_CHECK_LIB([json], [main], LIBJSON_NAME='json', AC_MSG_NOTICE([Unable to find json library - then you must use json-c])) -AC_CHECK_LIB([json-c], [main], LIBJSON_NAME='json-c', AC_MSG_NOTICE([Unable to find json-c library - this is a problem if json was not found])) +AC_CHECK_LIB([json], [main], LIBJSON_NAME='json') +AC_CHECK_LIB([json-c], [main], LIBJSON_NAME='json-c') if test "x$LIBJSON_NAME" = "x"; then AC_MSG_ERROR([Unable to find json(-c) library. apt-get install libjson0-dev | yum install json-c-devel (RPM from EPEL) | pkg install json-c | or compile from source: git clone https://github.com/json-c/json-c.git; cd json-c; sh autogen.sh; ./configure; make; make install;ldconfig]) else @@ -86,10 +86,13 @@ then else AC_SUBST([MYSQLCFLAGS],[`$MYSQL_CONFIG --cflags`]) AC_SUBST([MYSQLCXXFLAGS],[`$MYSQL_CONFIG --cxxflags`]) - AC_SUBST([MYSQLLIB],[`$MYSQL_CONFIG --libs`]) + MYSQLLDFLAGS=`$MYSQL_CONFIG --libs` + LDFLAGS="$LDFLAGS $MYSQLLDFLAGS" + AC_SUBST([MYSQLLIB],[$MYSQLLDFLAGS]) AC_SUBST([MYSQLINCLUDE],[`$MYSQL_CONFIG --include`]) AC_MSG_RESULT($MYSQL_CONFIG) fi +AC_CHECK_LIB([mysqlclient], [main], , AC_MSG_ERROR([Unable to find libmysqlclient. apt-get install libmysqlclient-dev | yum install mysql-devel | pkg install mysql56-client])) AC_CHECK_LIB([z], [main], , AC_MSG_ERROR([Unable to find libz. apt-get install zlib1g-dev | yum install zlib-devel])) AC_CHECK_LIB([lzma], [main], HAVE_LIBLZMA=1, AC_MSG_NOTICE([Unable to find lzma. apt-get install liblzma-dev | yum install lzma-devel]))