OSDN Git Service

2000-11-29 Benjamin Kosnik <bkoz@redhat.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / mkc++config
1 #! /bin/sh
2
3 # 2000-02-01 bkoz 
4 # Script to take the generated "config.h" from autoconf and make the
5 # macros within it namespace safe (ie wrapping them in _GLIBCPP_ so
6 # that "HAVE_LC_MESSAGES" becomes "_GLIBCPP_HAVE_LC_MESSAGES" etc etc.
7
8 echo "running mkc++config"
9
10 BUILD_DIR=$1
11 if [ ! -d "$BUILD_DIR" ]; then
12   echo "build directory $BUILD_DIR not found, exiting."
13   exit 1
14 fi
15
16 SRC_DIR=$2
17 if [ ! -d "$SRC_DIR" ]; then
18   echo "source directory $SRC_DIR not found, exiting."
19   exit 1
20 fi
21
22 BASE_H="$SRC_DIR/include/bits/c++config"
23 IN_H="$BUILD_DIR/config.h"
24 OUT_H="$BUILD_DIR/include/bits/c++config.h"
25
26 if [ ! -f $IN_H ]; then
27   echo "necessary file $IN_H not found, exiting"
28   exit 1
29 fi
30
31 if [ ! -d "$BUILD_DIR/include" ]; then
32   mkdir  "$BUILD_DIR/include"
33 fi
34
35 if [ ! -d "$BUILD_DIR/include/bits" ]; then
36   mkdir  "$BUILD_DIR/include/bits"
37 fi
38
39
40 # Part 1
41 # sed config.h from autoconf and make it namespace safe.
42 sed 's/HAVE_/_GLIBCPP_HAVE_/g' < $IN_H > temp-1
43 sed 's/PACKAGE/_GLIBCPP_PACKAGE/g' < temp-1 > temp-2
44 sed 's/VERSION/_GLIBCPP_VERSION/g' < temp-2 > temp-3
45 sed 's/WORDS_/_GLIBCPP_WORDS_/g' < temp-3 > temp-4
46
47
48 # Part 2
49 # cat this into generated bits/c++config.h
50 cat $BASE_H temp-4 > $OUT_H
51 rm temp-1 temp-2 temp-3 temp-4
52
53
54 # Part 3
55 # complete macro guards for resulting file
56 cat <<EOF >> $OUT_H
57
58 #endif // _CPP_CPPCONFIG_
59 EOF
60
61 exit 0
62