Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!

Sat, 14 Feb 2009 15:38:37 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 14 Feb 2009 15:38:37 +0000
changeset 798
2a92b58144a9
parent 797
6ea01e05b004
child 800
5e12bca2a4f8

Use $CC, $LD in Makefile. Add --c-compiler, --linker flags to ./configure script. Add --lflags to ./configure script. Thanks to Lorenzo for the initial patch!

configure file | annotate | diff | comparison | revisions
util-src/Makefile file | annotate | diff | comparison | revisions
--- a/configure	Fri Feb 13 16:43:44 2009 +0000
+++ b/configure	Sat Feb 14 15:38:37 2009 +0000
@@ -12,6 +12,8 @@
 LUA_LIBDIR="/usr/lib"
 IDN_LIB=idn
 OPENSSL_LIB=crypto
+CC=gcc
+LD=gcc
 
 CFLAGS="-fPIC"
 LFLAGS="-shared"
@@ -45,6 +47,12 @@
                             Default is $OPENSSL_LIB
 --cflags=FLAGS              Flags to pass to the compiler
                             Default is $CFLAGS
+--lflags=FLAGS              Flags to pass to the linker
+                            Default is $LFLAGS
+--c-compiler=CC             The C compiler to use when building modules.
+                            Default is $CC
+--linker=CC                 The linker to use when building modules.
+                            Default is $LD
 --require-config            Will cause Prosody to refuse to run when
                             it fails to find a configuration file
 EOF
@@ -105,6 +113,12 @@
    --cflags=*)
       CFLAGS="$value"
       ;;      
+   --c-compiler=*)
+      CC="$value"
+      ;;      
+   --linker=*)
+      LD="$value"
+      ;;      
    *)
       echo "Error: Unknown flag: $1"
       exit 1
@@ -279,6 +293,8 @@
 OPENSSL_LIB=$OPENSSL_LIB
 CFLAGS=$CFLAGS
 LFLAGS=$LFLAGS
+CC=$CC
+LD=$LD
 
 EOF
 
--- a/util-src/Makefile	Fri Feb 13 16:43:44 2009 +0000
+++ b/util-src/Makefile	Sat Feb 14 15:38:37 2009 +0000
@@ -6,7 +6,8 @@
 LUA_LIB?=lua$(LUA_SUFFIX)
 IDN_LIB?=idn
 OPENSSL_LIB?=crypto
-
+CC?=gcc
+LD?=gcc
 
 
 all: encodings.so hashes.so pposix.so
@@ -21,18 +22,18 @@
 	rm -f ../util/*.so
 
 encodings.o: encodings.c
-	gcc $(CFLAGS) -I$(LUA_INCDIR) -c -o encodings.o encodings.c
+	$(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o encodings.o encodings.c
 encodings.so: encodings.o
-	export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc $(LFLAGS) -o encodings.so encodings.o -L/usr/local/lib -llua$(LUA_SUFFIX) -lidn
+	export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o encodings.so encodings.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lidn
 	
 
 hashes.o: hashes.c
-	gcc $(CFLAGS) -I$(LUA_INCDIR) -c -o hashes.o hashes.c
+	$(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o hashes.o hashes.c
 hashes.so: hashes.o
-	export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc $(LFLAGS) -o hashes.so hashes.o -L/usr/local/lib -llua$(LUA_SUFFIX) -lcrypto
+	export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o hashes.so hashes.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX) -lcrypto
 
 pposix.o: pposix.c
-	gcc $(CFLAGS) -I$(LUA_INCDIR) -c -o pposix.o pposix.c
+	$(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o pposix.o pposix.c
 pposix.so: pposix.o
-	export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc $(LFLAGS) -o pposix.so pposix.o -L/usr/local/lib -llua$(LUA_SUFFIX)
+	export MACOSX_DEPLOYMENT_TARGET="10.3"; $(LD) $(LFLAGS) -o pposix.so pposix.o -L$(LUA_LIBDIR) -llua$(LUA_SUFFIX)
 	

mercurial