summaryrefslogtreecommitdiff
path: root/U/ccflags.U
diff options
context:
space:
mode:
Diffstat (limited to 'U/ccflags.U')
-rw-r--r--U/ccflags.U241
1 files changed, 241 insertions, 0 deletions
diff --git a/U/ccflags.U b/U/ccflags.U
new file mode 100644
index 0000000000..e9e33042e2
--- /dev/null
+++ b/U/ccflags.U
@@ -0,0 +1,241 @@
+?X: These units are based on the ones supplied with dist-3.0
+?X: patchlevel 22. They have been changed or enhanced to work with
+?X: perl5alpha. I would appreciate hearing about any changes,
+?X: corrections, or enhancements.
+?X: Andy Dougherty doughera@lafcol.lafayette.edu
+?X: Dept. of Physics
+?X: Lafayette College
+?X: Easton, PA 18042-1782
+?X: Sat Apr 2 15:45:17 EST 1994
+?RCS: $Id: ccflags.U,v 3.0.1.3 1993/09/13 15:58:29 ram Exp $
+?RCS:
+?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?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: of the source tree for dist 3.0.
+?RCS:
+?RCS: $Log: ccflags.U,v $
+?RCS: Revision 3.0.1.3 1993/09/13 15:58:29 ram
+?RCS: patch10: explicitely mention -DDEBUG just in case they need it (WAD)
+?RCS: patch10: removed all the "tans" variable usage (WAD)
+?RCS:
+?RCS: Revision 3.0.1.2 1993/08/27 14:39:38 ram
+?RCS: patch7: added support for OSF/1 machines
+?RCS:
+?RCS: Revision 3.0.1.1 1993/08/25 14:00:24 ram
+?RCS: patch6: added defaults for cppflags, ccflags and ldflags
+?RCS:
+?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: test cat Myread Guess \
+ Oldconfig cc gccversion mips_type +usrinc package contains
+?MAKE: -pick add $@ %<
+?S:ccflags:
+?S: This variable contains any additional C compiler flags desired by
+?S: the user. It is up to the Makefile to use this.
+?S:.
+?S:cppflags:
+?S: This variable holds the flags that will be passed to the C pre-
+?S: processor. It is up to the Makefile to use it.
+?S:.
+?S:optimize:
+?S: This variable contains any optimizer/debugger 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.
+?S:.
+?S:lkflags:
+?S: This variable contains any additional C partial linker flags desired by
+?S: the user. It is up to the Makefile to use this.
+?S:.
+?T:inctest thisincl xxx flag inclwanted
+?D:cppflags=''
+?D:ccflags=''
+?D:ldflags=''
+?INIT:: no include file wanted by default
+?INIT:inclwanted=''
+?INIT:
+: determine optimize, if desired, or use for debug flag also
+case "$optimize" in
+' ') dflt="none";;
+'') dflt="-g";;
+*) dflt="$optimize";;
+esac
+$cat <<EOH
+
+Some C compilers have problems with their optimizers, by default, $package
+compiles with the -O flag to use the optimizer. Alternately, you might want
+to use the symbolic debugger, which uses the -g flag (on traditional Unix
+systems). Either flag can be specified here. To use neither flag, specify
+the word "none".
+
+EOH
+rp="What optimizer/debugger flag should be used?"
+. ./myread
+optimize="$ans"
+case "$optimize" in
+'none') optimize=" ";;
+esac
+
+case "$ccflags" in
+'') case "$cc" in
+ *gcc*) if $test "$gccversion" = "1"; then
+ dflt='-fpcc-struct-return'
+ fi ;;
+ *) dflt='';;
+ esac
+ case "$optimize" in
+ *-g*) dflt="$dflt -DDEBUGGING";;
+ esac
+?X: check for POSIXized ISC
+ case "$cc" in
+ *gcc*) if test -d /etc/conf/kconfig.d &&
+ $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
+ then
+ dflt="$dflt -posix"
+ fi
+ ;;
+ esac
+ ;;
+*) dflt="$ccflags" ;;
+esac
+
+?X: In USG mode, a MIPS system may need some BSD includes
+case "$mips_type" in
+*BSD*) ;;
+'') ;;
+*) inclwanted="$inclwanted $usrinc/bsd";;
+esac
+for thisincl in $inclwanted; do
+ if $test -d $thisincl; then
+ if $test x$thisincl != x$usrinc; then
+ case "$dflt" in
+ *$thisincl*);;
+ *) dflt="$dflt -I$thisincl";;
+ esac
+ fi
+ fi
+done
+
+?X: Include test function (header, symbol)
+inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
+ xxx=true;
+elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
+ xxx=true;
+else
+ xxx=false;
+fi;
+if $xxx; then
+ case "$dflt" in
+ *$2*);;
+ *) dflt="$dflt -D$2";;
+ esac;
+fi'
+
+?X:
+?X: SCO unix uses NO_PROTOTYPE instead of _NO_PROTO
+?X: OSF/1 uses __LANGUAGE_C__ instead of LANGUAGE_C
+?X:
+if ./osf1; then
+ set signal.h __LANGUAGE_C__; eval $inctest
+else
+ set signal.h LANGUAGE_C; eval $inctest
+fi
+set signal.h NO_PROTOTYPE; eval $inctest
+set signal.h _NO_PROTO; eval $inctest
+
+case "$dflt" in
+'') dflt=none;;
+esac
+$cat <<EOH
+
+Your C compiler may want other flags. For this question you should include
+-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
+but you should NOT include libraries or ld flags like -lwhatever. If you
+want $package to honor its debug switch, you should include -DDEBUGGING here.
+To use no flags, specify the word "none".
+
+Your C compiler might also need additional flags, such as -DJMPCLOBBER
+or -DCRIPPLED_CC.
+EOH
+?X: strip leading space
+set X $dflt
+shift
+dflt=${1+"$@"}
+rp="Any additional cc flags?"
+. ./myread
+case "$ans" in
+none) ccflags='';;
+*) ccflags="$ans";;
+esac
+
+: the following weeds options from ccflags that are of no interest to cpp
+cppflags="$ccflags"
+case "$cc" in
+*gcc*) if $test "$gccversion" = "1"; then
+ cppflags="$cppflags -D__GNUC__"
+ fi ;;
+esac
+case "$mips_type" in
+'');;
+*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
+esac
+case "$cppflags" in
+'');;
+*) set X $cppflags
+ cppflags=''
+ for flag
+ do
+ case $flag in
+ -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
+ esac
+ done
+ case "$cppflags" in
+ *-*) echo "(C preprocessor flags: $cppflags)";;
+ esac
+ ;;
+esac
+
+: flags used in final linking phase
+case "$ldflags" in
+'') if venix; then
+ dflt='-i -z'
+ else
+ dflt='none'
+ fi
+ ;;
+*) dflt="$ldflags";;
+esac
+echo " "
+rp="Any additional ld flags (NOT including libraries)?"
+. ./myread
+case "$ans" in
+none) ldflags='';;
+*) ldflags="$ans";;
+esac
+rmlist="$rmlist pdp11"
+
+@if lkflags
+: partial linking may need other flags
+case "$lkflags" in
+'') case "$ldflags" in
+ '') dflt='none';;
+ *) dflt="$ldflags";;
+ esac;;
+*) dflt="$lkflags";;
+esac
+echo " "
+rp="Partial linking flags to be used (NOT including -r)?"
+. ./myread
+case "$ans" in
+none) lkflags='';;
+*) lkflags="$ans";;
+esac
+
+@end