[tlbuild] Bug in libpng affecting Solaris 10
Nelson H. F. Beebe
beebe at math.utah.edu
Fri Jan 22 00:04:24 CET 2016
Karl kindly posted the recipe "gcc ... -E -dD -o /tmp/foo ..." to
trace definitions as they are made during compilation.
Several years ago, I wrote the script below to display the predefined
symbols for assorted compilers; I've found it particularly handy in
porting code to new platforms where it is sometimes necessary to
provide preprocessor-wrapped code fragments specific to particular
systems:
% cat /usr/uumath/share/bin/cc-defs
#! /bin/sh -
### ====================================================================
### Display a sorted list of preprocessor macros known to specified
### C/C++/C# compiler(s) (default: gcc):
###
### Usage:
### cc-defs
### cc-defs compiler1 compiler2 ...
###
### Compiler families known to work with this script:
### cscc gcc lcc mcc mgcc nvcc opencc pathcc pgcc suncc winegcc
###
### Compiler families known NOT to work with this script:
### gmcs [no preprocessor support]
### mcs [no preprocessor support]
### tcc [no way to display preprocessor options]
###
### [16-Jun-2009]
### ====================================================================
IFS='
'
banner=no
test $# -gt 1 && banner=yes
test $# -lt 1 && set -- gcc
for compiler in "$@"
do
CC=${1-gcc}
test "$banner" = yes && echo ==================== CC = $CC
## NB: on tr command, use '\012' instead of '\n', so that this
## also works on Minix
case "$CC" in
cc | c89 | c99 | CC | DCC | NCC | OCC )
## NB: display from -# option is on stderr, not stdout, so redirect stderr to stdout
## The awk filter is needed for Minux, which quotes some definitions
EMPTY=/tmp/empty-$$.c
touch $EMPTY
$CC -v -E $EMPTY < /dev/null 2>&1 |
grep -v '^ *#' |
tr ' ' '\012' |
awk '/^".*"/ {print substr($0,2,length($0)-2)} { print }' |
egrep -e '^-D' |
env LC_ALL=C sort -u
rm -f $EMPTY
;;
*nvcc* )
EMPTY=/tmp/empty-$$.c
touch $EMPTY
$CC -v -E $EMPTY < /dev/null 2>&1 |
sed -e 's/^#[$] //' |
tr ' ' '\012' |
egrep -e '^-D' |
env LC_ALL=C sort -u
rm -f $EMPTY
echo NB: $CC then invokes gcc
;;
*solCC* | *sunCC* | *lcc* )
## NB: display from -# option is on stderr, not stdout, so redirect stderr to stdout
EMPTY=/tmp/empty-$$.c
touch $EMPTY
$CC -v -E $EMPTY < /dev/null 2>&1 |
grep -v '^ *#' |
tr ' ' '\012' |
egrep -e '^-D' |
env LC_ALL=C sort -u
rm -f $EMPTY
;;
*sol* | *sun* )
## NB: display from -# option is on stderr, not stdout, so redirect stderr to stdout
$CC -# -E -- - < /dev/null 2>&1 |
grep -v '^ *#' |
tr ' ' '\012' |
egrep -e '^-D' |
env LC_ALL=C sort -u
;;
*)
## gcc, pathcc, pgcc, opencc recognize -dM option
## pgcc needs --, but gcc complains about it, so redirect complaints
## to /dev/null
( $CC -dM -E - < /dev/null 2>/dev/null || \
$CC -dM -E -- - < /dev/null 2>/dev/null ) | env LC_ALL=C sort -u
;;
esac
shift
done
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah FAX: +1 801 581 4148 -
- Department of Mathematics, 110 LCB Internet e-mail: beebe at math.utah.edu -
- 155 S 1400 E RM 233 beebe at acm.org beebe at computer.org -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------
More information about the tlbuild
mailing list