Skip to content

Commit

Permalink
redesign configure / makefile and do not require libssh for ordinary …
Browse files Browse the repository at this point in the history
…build (it is used only for cloud)
  • Loading branch information
voipmonitor committed Nov 30, 2014
1 parent 21d5be1 commit 12b820b
Show file tree
Hide file tree
Showing 10 changed files with 684 additions and 666 deletions.
203 changes: 49 additions & 154 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,182 +24,77 @@ ifeq "$(GCCVERSION)" "4.1"
GCCARCH = core2
endif



version = $(shell grep RTPSENSOR_VERSION voipmonitor.h | cut -d" " -f 3 | tr -d "\"")

objects = config_mysql.o regcache.o codec_alaw.o codec_ulaw.o format_slinear.o format_wav.o format_ogg.o calltable.o rtp.o voipmonitor.o sniff.o jitterbuffer/astmm.o jitterbuffer/utils.o jitterbuffer/fixedjitterbuf.o jitterbuffer/jitterbuf.o jitterbuffer/abstract_jb.o jitterbuffer/frame.o manager.o tools.o filter_mysql.o hash.o mos_g729.o odbc.o rtcp.o pcap_queue.o sql_db.o md5.o mirrorip.o ipaccount.o skinny.o pstat.o generator.o tcpreassembly.o http.o cleanspool.o fraud.o rrd.o webrtc.o
objects = $(shell ls -1 *.cpp | sed 's/\.cpp/.o/' | tr "\n" " ") $(shell ls -1 jitterbuffer/*.c | sed 's/\.c/.o/' | tr "\n" " ")

headers = $(shell ls -1 *.h | tr "\n" " ") sniff_inline.cpp
#headers = $(shell ls -1 *.h | tr "\n" " ") $(shell ls -1 jitterbuffer/*.h | tr "\n" " ") $(shell ls -1 jitterbuffer/asterisk/*.h | tr "\n" " ")

#args = -g3 -Wall -march=$(GCCARCH)
#args = -O2 -Wall -march=$(GCCARCH)
#CFLAGS+=-I /usr/local/include/mysql++/ -I /usr/include/mysql++/ -I /usr/include/mysql/ -g3 -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC

#LDFLAGS := $(LDFLAGS) -static -static-libgcc
LIBSSH=@LIBSSH@
SHARED_LIBS = -lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc -lmysqlclient -lrt -lsnappy -lcurl -lssl -lcrypto -ljson ${LIBSSH} -lxml2 -lrrd
STATIC_LIBS = -static -lodbc -lltdl -ldl -lrt -lz ${LIBSSH} -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -lpthread -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
INCLUDES = -I/usr/local/include -I/usr/include/mysql/ -I/usr/local/mysql/include -I jitterbuffer/
LIBS_PATH = -L/usr/local/lib/mysql -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/local/lib/ -L/usr/lib64/mysql
CXXFLAGS += -DQUEUE_NONBLOCK2 -Wall -fPIC -g3 -O2 -march=$(GCCARCH) -mtune=${GCCARCH} ${INCLUDES}
CFLAGS += ${CXXFLAGS}
LIBS = ${SHARED_LIBS}

shared: LIBS=-lpthread -lpcap -lz -lvorbis -lvorbisenc -logg -lodbc -lmysqlclient -lrt -lsnappy -lcurl -lssl -lcrypto -ljson -lssh -lssh_threads -lxml2 -lrrd
shared: CFLAGS+= -DQUEUE_NONBLOCK2 -I/usr/local/include -I/usr/include/mysql/ -I/usr/local/mysql/include -Wall -I jitterbuffer/ -L/usr/local/lib/mysql -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/local/lib/ -L/usr/lib64/mysql -fPIC -g3 -O2
shared: args = -g3 -Wall -march=$(GCCARCH) -mtune=${GCCARCH} -O2

static: LIBS=-static -L/usr/local/mysql/lib -L/usr/local/lib/ -L/usr/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql -lodbc -lltdl -ldl -lrt -lz -lssh -lssh_threads -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -L/usr/lib/mysql -lpthread -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
static: CFLAGS+= -DQUEUE_NONBLOCK2 -I/usr/local/include -I/usr/local/mysql/include/ -I/usr/include/mysql/ -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC -O2
static: args = -O2 -Wall -march=$(GCCARCH) -mtune=${GCCARCH}
shared: cleantest $(objects)
${CXX} $(objects) ${CXXFLAGS} -o voipmonitor ${LIBS} ${LIBS_PATH}

staticlibc: LIBS=-static -L/opt/libc/lib/ -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql -lc_nonshared -lodbc -lltdl -ldl -lrt -lz -lssh -lssh_threads -lcurl -lcrypt -lm -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -L/usr/lib/mysql -lpthread -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
staticlibc: CFLAGS+= -DQUEUE_NONBLOCK2 -I/opt/libc/include -L/opt/libc/lib/ -I/usr/local/include -I /usr/local/mysql/include -I /usr/include/mysql/ -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC -O2
staticlibc: args = -O2 -Wall -march=$(GCCARCH) -mtune=${GCCARCH}
static: cleantest $(objects)
${CXX} $(objects) ${CXXFLAGS} -o voipmonitor ${STATIC_LIBS} ${LIBS_PATH}

armv5shared: LIBS=-lpthread -lpcap -lz -lcurl -lssl -lcrypto -lvorbis -lvorbisenc -logg -lodbc -lmysqlclient -lrt -lsnappy -ljson -lssh -lssh_threads
armv5shared: CFLAGS+= -DQUEUE_NONBLOCK2 -DPACKED -I /usr/local/mysql/include -I /usr/include/mysql/ -g3 -Wall -I jitterbuffer/ -L/usr/local/lib/ -L/usr/local/mysql/lib -L/usr/lib64/mysql -fPIC
armv5shared: args = -g3 -Wall
core2: GCCARCH = core2
core2: cleantest shared

armv5static: LIBS=-static -L /usr/local/mysql/lib -L/usr/lib/mysql -lodbc -lltdl -ldl -lrt -lz -lcrypt -lm -lssh -lssh_threads -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -L/usr/lib/mysql -L/usr/lib64/mysql/ -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
armv5static: CFLAGS+= -DQUEUE_NONBLOCK2 -DPACKED -I /usrl/local/mysql/include -I /usr/include/mysql/ -g3 -Wall -I jitterbuffer/ -L/usr/local/lib/ -L/usr/lib64/mysql -fPIC
armv5static: args = -g3 -Wall
armv5shared: CXXFLAGS+= -DPACKED
armv5shared: CFLAGS+= -DPACKED
armv5shared: cleantest shared

core2: LIBS=-static -L/usr/local/lib -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql -lodbc -lltdl -ldl -lrt -lz -lssh -lssh_threads -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -L/usr/lib/mysql -lpthread -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
core2: CFLAGS+= -DQUEUE_NONBLOCK2 -I /usr/local/mysql/include -I /usr/include/mysql/ -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC -O2 -g3
core2: args = -O2 -Wall -march=core2 -mtune=core2 -g3
armv5static: CXXFLAGS+= -DPACKED
armv5static: CFLAGS+= -DPACKED
armv5static: cleantest static

core2cust: LDFLAGS = -nostartfiles -static -Wl,--allow-multiple-definition
core2cust: GLIBCDIR = /opt/libc/lib
core2cust: STARTFILES = $(GLIBCDIR)/crt1.o $(GLIBCDIR)/crti.o $(shell gcc --print-file-name=crtbegin.o)
core2cust: ENDFILES = $(shell gcc --print-file-name=crtend.o) $(GLIBCDIR)/crtn.o
core2cust: LIBGROUP = -Wl,--start-group $(GLIBCDIR)/libc.a -lgcc -lgcc_eh -Wl,--end-group
core2cust: LIBS = -L/opt/libc/lib -L/usr/local/mysql/lib -L/usr/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql -L/usr/local/lib -lodbc -lltdl -ldl -lrt -lz -lssh -lssh_threads -lcrypt -lm -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -L/usr/lib/mysql -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
core2cust: CFLAGS+= -DQUEUE_NONBLOCK2 -I /opt/libc/include -I /usr/local/mysql/include/ -I /usr/include/mysql/ -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC -O2 -g3
core2cust: args = -O2 -Wall -march=core2 -mtune=core2 -g3

core2debug: LIBS=-static -L/usr/lib/mysql -L/usr/lib64/mysql -L/usr/lib/mysql -lodbc -lltdl -ldl -lrt -lz -lcrypt -lm -lssh -lssh_threads -lcurl -lssl -lcrypto -static-libstdc++ -static-libgcc -lpcap -L/usr/lib/mysql -lpthread -lmysqlclient -lpthread -lz -lc -lvorbis -lvorbisenc -logg -lrt -lsnappy -ljson -lrrd -lxml2 -lglib-2.0 -lz
core2debug: CFLAGS+= -DQUEUE_NONBLOCK2 -I /usr/include/mysql/ -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC -O2 -g3
core2debug: args = -O2 -Wall -march=core2 -mtune=core2 -g3

shared: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}

static: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}

core2: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}

core2cust: CXXFLAGS+= -DQUEUE_NONBLOCK2 -I /opt/libc/include -I /usr/local/mysql/include/ -I /usr/include/mysql/ -Wall -I jitterbuffer/ -L/usr/local/lib/ -fPIC -O2 -g3 -march=core2 -mtune=core2
core2cust: CFLAGS += CXXFLAGS
core2cust: cleantest $(objects)
g++ $(LDFLAGS) -o voipmonitor $(STARTFILES) ${objects} $(LIBGROUP) $(ENDFILES) ${LIBS}

core2debug: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}

staticlibc: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}

armv5shared: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}

armv5static: cleantest $(objects)
g++ $(objects) ${CFLAGS} -o voipmonitor ${LIBS}
${CXX} $(LDFLAGS) -o voipmonitor $(STARTFILES) ${objects} $(LIBGROUP) $(ENDFILES) -L/opt/libc/lib ${STATIC_LIBS} ${LIBS_PATH}

DEPENDSC:=${shell find . -type f -name '*.c' -print}
DEPENDSCPP:=${shell find . -type f -name '*.cpp' -print}

-include Makefile.deps

Makefile.deps:
cp /dev/null Makefile.deps
for F in $(DEPENDSC); do \
D=`dirname $$F | sed "s/^\.\///"`; \
echo -n "$$D/" >> Makefile.deps; \
$(CC) $(CFLAGS) -MM -MG $$F \
>> Makefile.deps; \
done
for F in $(DEPENDSCPP); do \
D=`dirname $$F | sed "s/^\.\///"`; \
echo -n "$$D/" >> Makefile.deps; \
$(CXX) $(CXXFLAGS) -MM -MG $$F \
>> Makefile.deps; \
done

cleantest:
@cmp -s .cleancount .lastclean || $(MAKE) clean

rrd.o : rrd.cpp rrd.h ${headers}
g++ -c rrd.cpp $(args) ${CFLAGS}

codec_alaw.o : codec_alaw.cpp codec_alaw.h ${headers}
g++ -c codec_alaw.cpp $(args) ${CFLAGS}

codec_ulaw.o : codec_ulaw.cpp codec_ulaw.h ${headers}
g++ -c codec_ulaw.cpp $(args) ${CFLAGS}

format_slinear.o : format_slinear.cpp format_slinear.h ${headers}
g++ -c format_slinear.cpp $(args) ${CFLAGS}

format_wav.o : format_wav.cpp format_wav.h ${headers}
g++ -c format_wav.cpp $(args) ${CFLAGS}

format_ogg.o : format_ogg.cpp format_ogg.h ${headers}
g++ -c format_ogg.cpp $(args) ${CFLAGS}

calltable.o : calltable.cpp calltable.h ${headers}
g++ -c calltable.cpp $(args) ${CFLAGS}

rtp.o : rtp.cpp rtp.h ${headers}
g++ -c rtp.cpp $(args) ${CFLAGS}

rtcp.o : rtcp.cpp rtcp.h ${headers}
g++ -c rtcp.cpp $(args) ${CFLAGS}

voipmonitor.o : voipmonitor.cpp voipmonitor.h ${headers}
g++ -c voipmonitor.cpp $(args) ${CFLAGS}

sniff.o : sniff.cpp sniff.h ${headers}
g++ -c sniff.cpp $(args) ${CFLAGS}

manager.o : manager.cpp manager.h ${headers}
g++ -c manager.cpp $(args) ${CFLAGS}

tools.o : tools.cpp tools.h ${headers}
g++ -c tools.cpp $(args) ${CFLAGS}

filter_mysql.o : filter_mysql.cpp filter_mysql.h ${headers}
g++ -c filter_mysql.cpp $(args) ${CFLAGS}

hash.o : hash.cpp hash.h ${headers}
g++ -c hash.cpp $(args) ${CFLAGS}

mos_g729.o : mos_g729.cpp mos_g729.h ${headers}
g++ -c mos_g729.cpp $(args) ${CFLAGS}

pcap_queue.o : pcap_queue.cpp pcap_queue.h ${headers}
g++ -c pcap_queue.cpp $(args) ${CFLAGS}

sql_db.o : sql_db.cpp sql_db.h ${headers}
g++ -c sql_db.cpp $(args) ${CFLAGS}

md5.o : md5.cpp md5.h ${headers}
g++ -c md5.cpp $(args) ${CFLAGS}

mirrorip.o : mirrorip.cpp mirrorip.h ${headers}
g++ -c mirrorip.cpp $(args) ${CFLAGS}

ipaccount.o : ipaccount.cpp ipaccount.h ${headers}
g++ -c ipaccount.cpp $(args) ${CFLAGS}

skinny.o : skinny.cpp skinny.h ${headers}
g++ -c skinny.cpp $(args) ${CFLAGS}

http.o : http.cpp http.h ${headers}
g++ -c http.cpp $(args) ${CFLAGS}

tcpreassembly.o : tcpreassembly.cpp tcpreassembly.h ${headers}
g++ -c tcpreassembly.cpp $(args) ${CFLAGS}

cleanspool.o : cleanspool.cpp cleanspool.h ${headers}
g++ -c cleanspool.cpp $(args) ${CFLAGS}

pstat.o : pstat.cpp pstat.h
g++ -c pstat.cpp $(args) ${CFLAGS}

odbc.o : odbc.cpp odbc.h
g++ -c odbc.cpp $(args) ${CFLAGS}

generator.o : generator.cpp generator.h
g++ -c generator.cpp $(args) ${CFLAGS}

regcache.o : regcache.cpp regcache.h
g++ -c regcache.cpp $(args) ${CFLAGS}

sql_mysql.o : sql_mysql.cpp sql_mysql.h
g++ -c sql_mysql.cpp $(args) ${CFLAGS}

config_mysql.o : config_mysql.cpp config_mysql.h
g++ -c config_mysql.cpp $(args) ${CFLAGS}

fraud.o : fraud.cpp fraud.h
g++ -c fraud.cpp $(args) ${CFLAGS}

webrtc.o : webrtc.cpp webrtc.h
g++ -c webrtc.cpp $(args) ${CFLAGS}

clean :
rm -f Makefile.deps
rm -f $(objects) voipmonitor
cp -f .cleancount .lastclean

Expand All @@ -219,7 +114,7 @@ targz64: core2
tar -czf voipmonitor-amd64-${version}-static.tar.gz voipmonitor-amd64-${version}-static
rm -rf voipmonitor-amd64-${version}-static

targz64debug: core2debug
targz64debug: core2
rm -rf voipmonitor-amd64-${version}-static*
mkdir -p voipmonitor-amd64-${version}-static/usr/local/sbin
cp voipmonitor voipmonitor-amd64-${version}-static/usr/local/sbin/
Expand Down
30 changes: 21 additions & 9 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@
/* Define to 1 if you have the `crypt' library (-lcrypt). */
#undef HAVE_LIBCRYPT

/* Define to 1 if you have the `curl' library (-lcurl). */
#undef HAVE_LIBCURL

/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL

/* Define to 1 if you have the `gzstream' library (-lgzstream). */
#undef HAVE_LIBGZSTREAM
/* Define to 1 if you have the `glib-2.0' library (-lglib-2.0). */
#undef HAVE_LIBGLIB_2_0

/* Define to 1 if you have the `lfds' library (-llfds). */
#undef HAVE_LIBLFDS
/* Define to 1 if you have the `json' library (-ljson). */
#undef HAVE_LIBJSON

/* Define to 1 if you have the `ltdl' library (-lltdl). */
#undef HAVE_LIBLTDL
Expand All @@ -63,9 +66,6 @@
/* Define to 1 if you have the `mysqlclient' library (-lmysqlclient). */
#undef HAVE_LIBMYSQLCLIENT

/* Define to 1 if you have the `mysqlpp' library (-lmysqlpp). */
#undef HAVE_LIBMYSQLPP

/* Define to 1 if you have the `odbc' library (-lodbc). */
#undef HAVE_LIBODBC

Expand All @@ -78,18 +78,27 @@
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD

/* Define to 1 if you have the `rrd' library (-lrrd). */
#undef HAVE_LIBRRD

/* Define to 1 if you have the `rt' library (-lrt). */
#undef HAVE_LIBRT

/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL
/* Define to 1 if you have the `snappy' library (-lsnappy). */
#undef HAVE_LIBSNAPPY

/* Define to 1 if you have the `ssh' library (-lssh). */
#undef HAVE_LIBSSH

/* Define to 1 if you have the `vorbis' library (-lvorbis). */
#undef HAVE_LIBVORBIS

/* Define to 1 if you have the `vorbisenc' library (-lvorbisenc). */
#undef HAVE_LIBVORBISENC

/* Define to 1 if you have the `xml2' library (-lxml2). */
#undef HAVE_LIBXML2

/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ

Expand Down Expand Up @@ -259,6 +268,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Define if using libssh */
#undef USE_LIBSSH

/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
Expand Down
Loading

0 comments on commit 12b820b

Please sign in to comment.