?RCS: $Id: Cppsym.U,v 3.0.1.5 1995/05/12 11:59:11 ram Exp $
?RCS:
?RCS: Copyright (c) 1991-1993, Raphael Manfredi
-?RCS:
-?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS:
+?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 3.0.
?RCS:
?RCS: $Log: Cppsym.U,v $
?RCS: Revision 3.0.1.5 1995/05/12 11:59:11 ram
-?RCS: patch54: split awk command onto two lines for older awks (ADO)
+?RCS: patch54: split awk command onto two lines for older awk's (ADO)
?RCS:
?RCS: Revision 3.0.1.4 1995/01/11 14:55:57 ram
?RCS: patch45: new cc vs. cpp symbol checking suggested by JHI
?RCS: Revision 3.0 1993/08/18 12:04:50 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
-?X:
?X: This unit produces a shell script called Cppsym, which can be used to
?X: determine whether any in a list of symbols is defined by the C compilation
?X: chain (C preprocessor symbols plus C compiler native ones).
?X: It can determine the status of any symbol, though the symbols in $al
?X: are more easily determined. If you want to add to $al you can do
?X: it in Myinit.U.
-?X:
?MAKE:Cppsym ccsymbols cppsymbols cppccsymbols: run \
- eunicefix Guess awk cat tr sed sort rm startsh osname \
+ eunicefix Guess awk cat tr sed sort rm rm_try startsh osname \
+cc +gccversion test comm uniq echo Options trnl \
- optimize ccflags ldflags libs
+ optimize ccflags ldflags libs cpp_stuff cpp
?MAKE: -pick add $@ %<
-?T:also symbols i postprocess_cc_v
+?T:also symbols i postprocess_cc_v tHdrH
?X:
?X: The symbol list is in alpha order for ease of maintenance...
?X:
?S: The list is a space-separated list of symbol=value tokens.
?S:.
?F:./Cppsym
+?F:./Cppsym.know
?F:!Cppsym.true
?F:!ccsym.com
?F:!ccsym.cpp
?F:!ccsym.own
?X: fake LINT hints
-?LINT:change cc
-?LINT:change optimize
?LINT:change ccflags
-?LINT:change ldflags
-?LINT:change libs
?LINT:extern s
-?LINT:change s
?LINT:extern s__
-?LINT:change s__
+: Preprocessor symbols
echo " "
-$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
+$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
?X: If your symbol is mixed case, just add it as-is.
?X: All symbols will be transformed to both all-lower and all-upper.
?X: Also drop any leading/trailing underscores, the scan will try all those.
INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
-Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
+LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
pc532 pdp11 PGC PIC plexus PORTAR posix
POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
POSIX_C_SOURCE POSIX_SOURCE POWER
-PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
+PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
sony sony_news sonyrisc sparc sparclite spectrum
EOSH
chmod +x Cppsym.try
$eunicefix Cppsym.try
-./Cppsym < Cppsym.know > Cppsym.true
+./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
+: Add in any Linux cpp "predefined macros":
+case "$osname::$gccversion" in
+ *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
+ tHdrH=_tmpHdr
+ rm -f $tHdrH'.h' $tHdrH
+ touch $tHdrH'.h'
+ # Filter out macro arguments, such as Linux's __INT8_C(c)
+ if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
+ sed -e 's/#define[\ \ ]*//;s/[\ \ ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+ if [ -s $tHdrH'_cppsym.real' ]; then
+ cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
+ fi
+ fi
+ rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
+ ;;
+esac
: now check the C compiler for additional symbols
?X: suggested by Jarkko Hietaniemi <jhi@snakemail.hut.fi>, thanks!
postprocess_cc_v=''
-A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
esac
done
-$rm -f try.c
+$rm_try
EOS
postprocess_cc_v=''
chmod +x ccsym