0e9df41fc8d27ac6b7a5e2769951dbd295f46b1a hiram Wed Oct 16 13:55:40 2013 -0700 avoid dynamic MySQL libraries on Mac OSX refs #11899 149 diff --git src/inc/common.mk src/inc/common.mk index f4776cb..c6a1f1f 100644 --- src/inc/common.mk +++ src/inc/common.mk @@ -1,26 +1,29 @@ CC=gcc # to build on sundance: CC=gcc -mcpu=v9 -m64 ifeq (${COPT},) COPT=-O -g endif ifeq (${CFLAGS},) CFLAGS= endif HG_DEFS=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DMACHTYPE_${MACHTYPE} HG_INC=-I../inc -I../../inc -I../../../inc -I../../../../inc -I../../../../../inc +# to check for Mac OSX Darwin specifics: +UNAME_S := $(shell uname -s) + #global external libraries L= # pthreads is required L+=-pthread # autodetect if openssl is installed ifeq (${SSLDIR},) SSLDIR = /usr/include/openssl endif ifeq (${USE_SSL},) ifneq ($(wildcard ${SSLDIR}),) USE_SSL=1 endif endif @@ -69,38 +72,41 @@ PNGLIB=/opt/local/lib/libpng.a endif endif ifeq (${PNGLIB},) PNGLIB=-lpng endif ifeq (${PNGINCL},) ifneq ($(wildcard /opt/local/include/png.h),) PNGINCL=-I/opt/local/include endif endif # autodetect where mysql includes and libraries are installed # do not need to do this during 'clean' target (this is very slow for 'clean') ifneq ($(MAKECMDGOALS),clean) + # this does *not* work on Mac OSX with the dynamic libraries + ifneq ($(UNAME_S),Darwin) ifeq (${MYSQLINC},) MYSQLINC := $(shell mysql_config --include | sed -e 's/-I//' || true) # $(info using mysql_config to set MYSQLINC: ${MYSQLINC}) endif ifeq (${MYSQLLIBS},) MYSQLLIBS := $(shell mysql_config --libs || true) # $(info using mysql_config to set MYSQLLIBS: ${MYSQLLIBS}) endif + endif ifeq (${MYSQLINC},) ifneq ($(wildcard /usr/local/mysql/include/mysql.h),) MYSQLINC=/usr/local/mysql/include endif endif ifeq (${MYSQLINC},) ifneq ($(wildcard /usr/include/mysql/mysql.h),) MYSQLINC=/usr/include/mysql endif endif ifeq (${MYSQLINC},) ifneq ($(wildcard /opt/local/include/mysql55/mysql/mysql.h),) MYSQLINC=/opt/local/include/mysql55/mysql endif @@ -137,32 +143,30 @@ endif ifeq ($(findstring src/hg/,${CURDIR}),src/hg/) ifeq (${MYSQLINC},) $(error can not find installed mysql development system) endif endif # last resort, hoping the compiler can find it in standard locations ifeq (${MYSQLLIBS},) MYSQLLIBS="-lmysqlclient" endif endif # $(info have MYSQLINC: ${MYSQLINC}) # $(info have MYSQLLIBS: ${MYSQLLIBS}) -UNAME_S := $(shell uname -s) - # OK to add -lstdc++ to all MYSQLLIBS just in case it is # MySQL version 5.6 libraries, but no 'librt' on Mac OSX ifeq ($(UNAME_S),Darwin) MYSQLLIBS += -lstdc++ else MYSQLLIBS += -lstdc++ -lrt endif L+=${PNGLIB} HG_INC+=${PNGINCL} # 32-bit color enabled by default ifneq (${COLOR32},0) HG_DEFS+=-DCOLOR32 endif