git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Stosberg <dennis@stosberg.net>
To: git@vger.kernel.org
Subject: [PATCH 6/6] Fix compilation with Sun CC
Date: Tue, 15 Aug 2006 11:01:31 +0200	[thread overview]
Message-ID: <20060815090131.5223.62594.stgit@leonov.stosberg.net> (raw)
In-Reply-To: <20060815090031.5223.27458.stgit@leonov.stosberg.net>

- 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>
---

 Makefile      |    6 +++++-
 config.mak.in |    2 ++
 configure.ac  |    9 ++++++++-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index d352901..aeefc4e 100644
--- a/Makefile
+++ b/Makefile
@@ -114,6 +114,7 @@ uname_P := $(shell sh -c 'uname -p 2>/de
 # CFLAGS and LDFLAGS are for the users to override from the command line.
 
 CFLAGS = -g -O2 -Wall
+PIC_FLAG = -fPIC
 LDFLAGS =
 ALL_CFLAGS = $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
@@ -408,6 +409,9 @@ endif
 ifneq (,$(findstring arm,$(uname_M)))
 	ARM_SHA1 = YesPlease
 endif
+ifeq ($(uname_M),sun4u)
+	USE_PIC = YesPlease
+endif
 ifeq ($(uname_M),x86_64)
 	USE_PIC = YesPlease
 endif
@@ -554,7 +558,7 @@ endif
 endif
 endif
 ifdef USE_PIC
-	ALL_CFLAGS += -fPIC
+	ALL_CFLAGS += $(PIC_FLAG)
 endif
 ifdef NO_ACCURATE_DIFF
 	BASIC_CFLAGS += -DNO_ACCURATE_DIFF
diff --git a/config.mak.in b/config.mak.in
index 038767e..1fd5f7e 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -2,6 +2,8 @@ # git Makefile configuration, included i
 # @configure_input@
 
 CC = @CC@
+CFLAGS = @CFLAGS@
+PIC_FLAG = @PIC_FLAG@
 AR = @AR@
 TAR = @TAR@
 #INSTALL = @INSTALL@		# needs install-sh or install.sh in sources
diff --git a/configure.ac b/configure.ac
index 6f1d87a..427ac23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,14 @@ AC_SUBST(PYTHON_PATH)
 ## Checks for programs.
 AC_MSG_NOTICE([CHECKS for programs])
 #
-AC_PROG_CC
+AC_PROG_CC([cc gcc])
+if test -n "$GCC"; then
+	PIC_FLAG="-fPIC"
+else
+	AC_CHECK_DECL(__SUNPRO_C, [CFLAGS="$CFLAGS -xO3"; PIC_FLAG="-KPIC"])
+fi
+AC_SUBST(PIC_FLAG)
+
 #AC_PROG_INSTALL		# needs install-sh or install.sh in sources
 AC_CHECK_TOOL(AR, ar, :)
 AC_CHECK_PROGS(TAR, [gtar tar])

      parent reply	other threads:[~2006-08-15  9:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-15  9:00 [PATCH 0/6] Configuration tweaks for Solaris Dennis Stosberg
2006-08-15  9:01 ` [PATCH 1/6] Solaris has strlcpy() at least since version 8 Dennis Stosberg
2006-08-15  9:01 ` [PATCH 2/6] Solaris does not support C99 format strings before version 10 Dennis Stosberg
2006-08-15  9:01 ` [PATCH 3/6] Look for sockaddr_storage in sys/socket.h Dennis Stosberg
2006-08-15  9:01 ` [PATCH 4/6] Fix detection of ipv6 on Solaris Dennis Stosberg
2006-08-15  9:01 ` [PATCH 5/6] On Solaris nanosleep() is not in libc but in librt Dennis Stosberg
2006-08-15 10:35   ` Junio C Hamano
2006-07-31 16:55     ` Fix double "close()" in ce_compare_data Linus Torvalds
2006-07-31 19:05       ` Junio C Hamano
2006-08-05 11:20       ` [PATCH] Racy git: avoid having to be always too careful Junio C Hamano
2006-08-08 15:43         ` Johannes Schindelin
2006-08-08 17:25           ` Junio C Hamano
2006-08-08 22:30             ` Johannes Schindelin
2006-08-08 23:07               ` Junio C Hamano
2006-08-08 23:44                 ` Johannes Schindelin
2006-08-15 20:12       ` [PATCH] Documentation/technical/racy-git.txt Junio C Hamano
2006-08-15 11:18     ` [PATCH 5/6] On Solaris nanosleep() is not in libc but in librt Alex Riesen
2006-08-15  9:01 ` Dennis Stosberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060815090131.5223.62594.stgit@leonov.stosberg.net \
    --to=dennis@stosberg.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).