* config/alpha/x-vms (USE_COLLECT2): Set to empty.
[official-gcc.git] / gcc / mkconfig.sh
blobb63e40a7087435feb727fa72ec8d324b22b985a0
1 #! /bin/sh
3 # Generate gcc's config.h, which is not your normal autoconf-generated
4 # config.h (that's auto-(host|build).h). $1 is the file to generate.
5 # HEADERS, DEFINES, and possibly TARGET_CPU_DEFAULT are expected to be
6 # set in the environment.
8 if [ -z "$1" ]; then
9 echo "Usage: HEADERS='list' DEFINES='list' mkconfig.sh FILE" >&2
10 exit 1
13 output=$1
14 rm -f $output.T
16 # We used to exec > $output.T but apparently this has bugs.
17 # Use a redirected subshell instead.
20 # Define TARGET_CPU_DEFAULT if the system wants one.
21 # This substitutes for lots of *.h files.
22 if [ "$TARGET_CPU_DEFAULT" != "" ]; then
23 echo "#define TARGET_CPU_DEFAULT ($TARGET_CPU_DEFAULT)"
26 # The first entry in HEADERS may be auto-host.h or auto-build.h;
27 # it wants to be included even when not -DIN_GCC.
28 if [ -n "$HEADERS" ]; then
29 set $HEADERS; first=$1
30 case $first in auto-* )
31 echo "#include \"$first\""
32 shift
33 HEADERS=$*
35 esac
38 # Provide three core typedefs used by everything, if we are compiling
39 # GCC. These used to be found in rtl.h and tree.h, but this is no
40 # longer practical. Providing these in config.h/tconfig.h/hconfig.h
41 # rather than system.h allows the typedefs to be used anywhere in GCC.
42 case $output in
43 *config.h | *hconfig.h | *tconfig.h)
44 echo "#ifdef IN_GCC"
45 echo "/* Provide three core typedefs used by everything, if we are compiling"
46 echo " GCC. These used to be found in rtl.h and tree.h, but this is no"
47 echo " longer practical. Providing these here rather that system.h allows"
48 echo " the typedefs to be used everywhere within GCC. */"
49 echo "struct rtx_def;"
50 echo "typedef struct rtx_def *rtx;"
51 echo "struct rtvec_def;"
52 echo "typedef struct rtvec_def *rtvec;"
53 echo "union tree_node;"
54 echo "typedef union tree_node *tree;"
55 echo "#endif"
57 esac
59 if [ -n "$HEADERS" ]; then
60 echo '#ifdef IN_GCC'
61 for file in $HEADERS; do
62 echo "# include \"$file\""
63 done
64 echo '#endif'
67 for def in $DEFINES; do
68 echo "#ifndef $def" | sed 's/=.*//'
69 echo "# define $def" | sed 's/=/ /'
70 echo "#endif"
71 done
73 # If this is tm_p.h, include tm-preds.h unconditionally.
74 # If this is tconfig.h or hconfig.h, include no more files.
75 # Otherwise, include insn-constants.h and insn-flags.h,
76 # but only if GENERATOR_FILE is not defined.
77 case $output in
78 *tm_p.h)
79 echo "#include \"tm-preds.h\""
81 *tconfig.h | *hconfig.h)
84 echo "#ifndef GENERATOR_FILE"
85 echo "# include \"insn-constants.h\""
86 echo "# include \"insn-flags.h\""
87 echo "#endif"
89 esac
91 # Prevent obstack.c from thinking it can do i18n of its error message
92 # when it's being linked against a build-side program.
93 echo '#ifdef GENERATOR_FILE'
94 echo '# undef ENABLE_NLS'
95 echo '#endif'
97 ) > $output.T
99 # Avoid changing the actual file if possible.
100 if [ -f $output ] && cmp $output.T $output >/dev/null 2>&1; then
101 echo $output is unchanged >&2
102 rm -f $output.T
103 else
104 mv -f $output.T $output
107 # Touch a stamp file for Make's benefit.
108 rm -f cs-$output
109 echo timestamp > cs-$output