aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/mkc++config
blob: b7a11a46da679f04425d698b4141679930cc89e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /bin/sh

# 2000-02-01 bkoz 
# Script to take the generated "config.h" from autoconf and make the
# macros within it namespace safe (ie wrapping them in _GLIBCPP_ so
# that "HAVE_LC_MESSAGES" becomes "_GLIBCPP_HAVE_LC_MESSAGES" etc etc.

echo "running mkc++config"

BUILD_DIR=$1
if [ ! -d "$BUILD_DIR" ]; then
  echo "build directory $BUILD_DIR not found, exiting."
  exit 1
fi

SRC_DIR=$2
if [ ! -d "$SRC_DIR" ]; then
  echo "source directory $SRC_DIR not found, exiting."
  exit 1
fi

BASE_H="$SRC_DIR/include/bits/c++config"
IN_H="$BUILD_DIR/config.h"
OUT_H="$BUILD_DIR/include/bits/c++config.h"

if [ ! -f $IN_H ]; then
  echo "necessary file $IN_H not found, exiting"
  exit 1
fi

if [ ! -d "$BUILD_DIR/include" ]; then
  mkdir  "$BUILD_DIR/include"
fi

if [ ! -d "$BUILD_DIR/include/bits" ]; then
  mkdir  "$BUILD_DIR/include/bits"
fi


# Part 1
# sed config.h from autoconf and make it namespace safe.
sed 's/HAVE_/_GLIBCPP_HAVE_/g' < $IN_H > temp-1
sed 's/PACKAGE/_GLIBCPP_PACKAGE/g' < temp-1 > temp-2
sed 's/VERSION/_GLIBCPP_VERSION/g' < temp-2 > temp-3
sed 's/WORDS_/_GLIBCPP_WORDS_/g' < temp-3 > temp-4


# Part 2
# cat this into generated bits/c++config.h
cat $BASE_H temp-4 > $OUT_H
rm temp-1 temp-2 temp-3 temp-4


# Part 3
# complete macro guards for resulting file
cat <<EOF >> $OUT_H

#endif // _CPP_CPPCONFIG_
EOF

exit 0