@matheusbsbs / matheus-bagliano / commits / 60a144f280
Fork 0

Fix compilation with Sun CC

- Add the CFLAGS variable to config.mak.in to override the Makefile's default, which is gcc-specific and won't work with Sun CC. - Prefer "cc" over "gcc", because Pasky's Git.pm will not compile with gcc on Solaris at all. On Linux and the free BSDs "cc" is linked to "gcc" anyway. - Set correct flag to generate position-independent code. - Add "-xO3" (= use default optimization level) to CFLAGS. Signed-off-by: Dennis Stosberg <dennis@stosberg.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Dennis Stosberg committed Aug 15, 2006 at 11:01 UTC 60a144f28047b4fa0e4a795972c483fa85a7d3c8
3 files changed +15 -2
Makefile
+5 -1
@@ -112,6 +112,7 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
112 # CFLAGS and LDFLAGS are for the users to override from the command line.
113
114 CFLAGS = -g -O2 -Wall
115 +PIC_FLAG = -fPIC
116 LDFLAGS =
117 ALL_CFLAGS = $(CFLAGS)
118 ALL_LDFLAGS = $(LDFLAGS)
@@ -402,6 +403,9 @@ endif
403 ifneq (,$(findstring arm,$(uname_M)))
404 ARM_SHA1 = YesPlease
405 endif
406 +ifeq ($(uname_M),sun4u)
407 + USE_PIC = YesPlease
408 +endif
409 ifeq ($(uname_M),x86_64)
410 USE_PIC = YesPlease
411 endif
@@ -544,7 +548,7 @@ endif
548 endif
549 endif
550 ifdef USE_PIC
547 - ALL_CFLAGS += -fPIC
551 + ALL_CFLAGS += $(PIC_FLAG)
552 endif
553 ifdef NO_ACCURATE_DIFF
554 BASIC_CFLAGS += -DNO_ACCURATE_DIFF
config.mak.in
+2
@@ -2,6 +2,8 @@
2 # @configure_input@
3
4 CC = @CC@
5 +CFLAGS = @CFLAGS@
6 +PIC_FLAG = @PIC_FLAG@
7 AR = @AR@
8 TAR = @TAR@
9 #INSTALL = @INSTALL@ # needs install-sh or install.sh in sources
configure.ac
+8 -1
@@ -95,7 +95,14 @@ AC_SUBST(PYTHON_PATH)
95 ## Checks for programs.
96 AC_MSG_NOTICE([CHECKS for programs])
97 #
98 -AC_PROG_CC
98 +AC_PROG_CC([cc gcc])
99 +if test -n "$GCC"; then
100 + PIC_FLAG="-fPIC"
101 +else
102 + AC_CHECK_DECL(__SUNPRO_C, [CFLAGS="$CFLAGS -xO3"; PIC_FLAG="-KPIC"])
103 +fi
104 +AC_SUBST(PIC_FLAG)
105 +
106 #AC_PROG_INSTALL # needs install-sh or install.sh in sources
107 AC_CHECK_TOOL(AR, ar, :)
108 AC_CHECK_PROGS(TAR, [gtar tar])