summaryrefslogtreecommitdiff
path: root/mcon/U/ccflags.U
diff options
context:
space:
mode:
Diffstat (limited to 'mcon/U/ccflags.U')
-rw-r--r--mcon/U/ccflags.U57
1 files changed, 47 insertions, 10 deletions
diff --git a/mcon/U/ccflags.U b/mcon/U/ccflags.U
index f047f21..4cbb80a 100644
--- a/mcon/U/ccflags.U
+++ b/mcon/U/ccflags.U
@@ -1,11 +1,11 @@
-?RCS: $Id: ccflags.U 29 2008-06-16 18:11:00Z cbiere $
+?RCS: $Id: ccflags.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS:
-?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
-?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: ccflags.U,v $
@@ -21,7 +21,7 @@
?RCS: patch54: now checks for cc/ccflags/ldflags coherency
?RCS:
?RCS: Revision 3.0.1.6 1994/10/29 16:07:02 ram
-?RCS: patch36: gcc versionning no longer relies on the C compiler's name
+?RCS: patch36: gcc versioning no longer relies on the C compiler's name
?RCS: patch36: simplified check for gcc version checking (ADO)
?RCS:
?RCS: Revision 3.0.1.5 1994/08/29 16:06:35 ram
@@ -45,7 +45,7 @@
?RCS: Revision 3.0 1993/08/18 12:05:31 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
-?MAKE:ccflags ldflags lkflags cppflags optimize locincpth: test cat \
+?MAKE:ccflags ldflags lkflags cppflags optimize pthread locincpth: test cat \
Myread Guess Options Oldconfig gccversion mips_type +usrinc \
package contains rm +cc cppstdin cppminus cpprun cpplast libpth \
loclibpth hint
@@ -62,6 +62,10 @@
?S: This variable contains any optimizer/debugger flag that should be used.
?S: It is up to the Makefile to use it.
?S:.
+?S:pthread:
+?S: This variable contains any thread-specific flag that should be used.
+?S: It is up to the Makefile to use it.
+?S:.
?S:ldflags:
?S: This variable contains any additional C loader flags desired by
?S: the user. It is up to the Makefile to use this.
@@ -83,10 +87,10 @@
?D:ccflags=''
?D:ldflags=''
?D:optimize=''
+?D:pthread=''
?INIT:: Possible local include directories to search.
?INIT:: Set locincpth to "" in a hint file to defeat local include searches.
-?INIT:locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-?INIT:locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+?INIT:locincpth=""
?INIT::
?INIT:: no include file wanted by default
?INIT:inclwanted=''
@@ -130,6 +134,40 @@ case "$optimize" in
'none') optimize=" ";;
esac
+?X: When they are using I_PTHREAD, check whether we need/can supply -pthread
+?X: to the compiler for proper threading support. This is usually necessary
+?X: with gcc, in addition to the required -lpthread that need to be listed
+?X: at link time.
+@if I_PTHREAD
+: see whether we need -pthread at the compile/link stage
+case "$pthread" in
+''|$undef)
+ $cat > try.c <<'EOF'
+int main() { return 0; }
+EOF
+ if $cc -pthread -c try.c >/dev/null 2>&1; then
+ dflt='-pthread'
+ else
+ dflt='none'
+ fi
+ ;;
+*) dflt="$pthread";;
+esac
+$cat <<EOH
+
+Some C compilers need to have special flags supplied at compile and link time
+to be able to generate code that will work correctly with POSIX threads.
+When no specific flags are required, specify the word "none".
+
+EOH
+rp="What thread-support compiler/linker flag should be used?"
+. ./myread
+pthread="$ans"
+case "$pthread" in
+'none') pthread="";;
+esac
+@end
+
dflt=''
: We will not override a previous value, but we might want to
: augment a hint file
@@ -362,7 +400,7 @@ esac
echo " "
echo "Checking your choice of C compiler and flags for coherency..." >&4
?X: Strip extra blanks in case some of the following variables are empty
-set X $cc $optimize $ccflags $ldflags -o try try.c
+set X $cc $optimize $pthread $ccflags $ldflags -o try try.c
shift
$cat >try.msg <<EOM
I've tried to compile and run a simple program with:
@@ -374,8 +412,7 @@ and I got the following output:
EOM
$cat > try.c <<'EOF'
-#include <stdio.h>
-int main() { exit(0); }
+int main() { return 0; }
EOF
dflt=y
?X: Use "sh -c" to avoid error messages tagged with leading "Configure:".