Module: sip-router Branch: master Commit: 54306955b4eac0dfcfc66d82e0eceb8551b52bb2 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=54306955...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Tue Mar 29 11:18:08 2011 +0200
db_mysql: use mysql_config to detect include and libs
---
modules/db_mysql/Makefile | 30 +++++++++++++++++++++++++----- 1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/modules/db_mysql/Makefile b/modules/db_mysql/Makefile index c6458e0..d71ca94 100644 --- a/modules/db_mysql/Makefile +++ b/modules/db_mysql/Makefile @@ -6,18 +6,38 @@ include ../../Makefile.defs auto_gen= NAME=db_mysql.so
-# mysql.h locations (freebsd,openbsd solaris) -DEFS +=-DSER_MOD_INTERFACE -I$(LOCALBASE)/include -I$(LOCALBASE)/include/mysql \ +DEFS +=-DSER_MOD_INTERFACE + +# set CROSS_COMPILE to true if you want to skip +# the autodetection +# CROSS_COMPILE=true + +ifeq ($(CROSS_COMPILE),) +MYSQLCFG=$(shell which mysql_config) +endif + +ifneq ($(MYSQLCFG),) + + # use autodetection + DEFS += $(shell $(MYSQLCFG) --include | sed 's/(-I.*)/mysql/\1/g' ) + LIBS = $(shell $(MYSQLCFG) --libs) + +else + + # mysql.h locations (freebsd,openbsd solaris) + DEFS +=-DSER_MOD_INTERFACE -I$(LOCALBASE)/include \ + -I$(LOCALBASE)/include/mysql \ -I$(LOCALBASE)/mysql/include \ -I/usr/include/mysql
-# libmysqlclient locations on RH/Suse, Solaris /OpenBSD, FreeBSD -# (Debian does the right thing and puts it in /usr/lib) -LIBS=-L/usr/lib/mysql -L$(LOCALBASE)/lib -L$(LOCALBASE)/lib/mysql \ + # libmysqlclient locations on RH/Suse, Solaris /OpenBSD, FreeBSD + # (Debian does the right thing and puts it in /usr/lib) + LIBS=-L/usr/lib/mysql -L$(LOCALBASE)/lib -L$(LOCALBASE)/lib/mysql \ -L$(LOCALBASE)/mysql/lib/mysql/ \ -L$(LOCALBASE)/mysql/lib \ -L/usr/lib64/mysql \ -lmysqlclient -lz +endif
SERLIBPATH=../../lib SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1