Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msteveb/5202307 to your computer and use it in GitHub Desktop.
Save msteveb/5202307 to your computer and use it in GitHub Desktop.
autosetup fix for -gstabs on newer Darwin
From d55926cb188d39bb0466490aedd3d9f3b5894178 Mon Sep 17 00:00:00 2001
From: Steve Bennett <steveb@workware.net.au>
Date: Wed, 20 Mar 2013 14:23:17 +1000
Subject: [PATCH] Some versions of cc on Darwin don't support -gstabs
Reported-by: ksjogo
Signed-off-by: Steve Bennett <steveb@workware.net.au>
---
lib/cc.tcl | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/lib/cc.tcl b/lib/cc.tcl
index 7410d60..cd033c6 100644
--- a/lib/cc.tcl
+++ b/lib/cc.tcl
@@ -501,14 +501,8 @@ proc cctest {args} {
set tmp conftest__.o
lappend cmdline -c
}
- lappend cmdline {*}$opts(-cflags)
+ lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""]
- switch -glob -- [get-define host] {
- *-*-darwin* {
- # Don't generate .dSYM directories
- lappend cmdline -gstabs
- }
- }
lappend cmdline $src -o $tmp {*}$opts(-libs)
# At this point we have the complete command line and the
@@ -688,6 +682,16 @@ if {[get-define CXX] ne "false"} {
}
msg-result "Build C compiler...[get-define CC_FOR_BUILD]"
+# On Darwin, we prefer to use -gstabs to avoid creating .dSYM directories
+# but some compilers don't support -gstabs, so test for it here.
+switch -glob -- [get-define host] {
+ *-*-darwin* {
+ if {[cctest -cflags {-gstabs}]} {
+ define cc-default-debug -gstabs
+ }
+ }
+}
+
if {![cc-check-includes stdlib.h]} {
user-error "Compiler does not work. See config.log"
}
--
1.7.4.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment