head 1.2; access; symbols SHTOOL_1_0_0:1.1.1.1 RSE:1.1.1; locks; strict; comment @# @; 1.2 date 99.04.29.11.21.05; author rse; state dead; branches; next 1.1; 1.1 date 99.04.29.11.19.34; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 99.04.29.11.19.34; author rse; state Exp; branches; next ; desc @@ 1.2 log @*** empty log message *** @ text @#!/bin/sh ## ## findcpp -- Find out how to _directly_ run the C Pre-Processor (CPP) ## Copyright (c) 1998-1999 Ralf S. Engelschall ## Originally written for the Apache configuration mechanism ## Usage: findcpp ## # create a test C source: # - has to use extension ".c" because some CPP only accept this one # - uses assert.h because this is a standard header and harmless to include # - contains a Syntax Error to make sure it passes only the preprocessor # but not the real compiler pass cat >conftest.c < Syntax Error EOT # some braindead systems have a CPP define for a directory :-( if [ ".$CPP" != . ]; then if [ -d "$CPP" ]; then CPP='' fi fi if [ ".$CPP" != . ]; then # case 1: user provided a default CPP variable (we only check) (eval "$CPP conftest.c >/dev/null") 2>conftest.out my_error=`grep -v '^ *+' conftest.out` if [ ".$my_error" != . ]; then CPP='' fi else # case 2: no default CPP variable (we have to find one) # 1. try the standard -E option CPP="${CC-cc} -E" (eval "$CPP conftest.c >/dev/null") 2>conftest.out my_error=`grep -v '^ *+' conftest.out` if [ ".$my_error" != . ]; then # 2. try the -E option and GCC's -traditional-ccp option CPP="${CC-cc} -E -traditional-cpp" (eval "$CPP conftest.c >/dev/null") 2>conftest.out my_error=`grep -v '^ *+' conftest.out` if [ ".$my_error" != . ]; then # 3. try a standalone cpp command in $PATH and lib dirs CPP="`./helpers/PrintPath cpp`" if [ ".$CPP" = . ]; then CPP="`./helpers/PrintPath -p/lib:/usr/lib:/usr/local/lib cpp`" fi if [ ".$CPP" != . ]; then (eval "$CPP conftest.c >/dev/null") 2>conftest.out my_error=`grep -v '^ *+' conftest.out` if [ ".$my_error" != . ]; then # ok, we gave up... CPP='' fi fi fi fi fi # cleanup after work rm -f conftest.* # Ok, empty CPP variable now means it's not available if [ ".$CPP" = . ]; then CPP='NOT-AVAILABLE' fi echo $CPP @ 1.1 log @Initial revision @ text @@ 1.1.1.1 log @Import of shtool 1.0.0 @ text @@