aboutsummaryrefslogtreecommitdiff
path: root/xiberty/configure.in
blob: 2729c096a4958267325ff57acfb5c2e5083e4a4f (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This file is a shell script fragment that supplies the information
# necessary for a configure script to process the program in
# this directory.  For more information, look at ../configure.

# We need multilib support.
. ${srcdir}/../cfg-ml-com.in

configdirs=
srctrigger=../libiberty/getopt1.c
srcname="cross -liberty library"
Makefile_in=../libiberty/Makefile.in

case "$srcdir" in
    ".") ;;
    *) srcdir=${srcdir}/../libiberty ;;
esac

# per-host:

# per-target:

files="../libiberty/alloca-norm.h"
links="alloca-conf.h"

xhost=${target}
xsrcdir=../libiberty/
. ${srcdir}/../libiberty/config.table
target_makefile_frag=${frag}

case "$srcdir" in
    ".")
	# Make sure we also make links to all the source files
	source_files=`echo ../libiberty/*.[ch] ../libiberty/functions.def`
	files="${files} ${source_files}"
	source_links=`echo "$source_files" | sed -e 's|../libiberty/||g'`
	links="${links} ${source_links}"
	;;
    *)
	;;
esac

# post-target:

# if we are candian crossing the we need to pick up host copies of
# the tools, otherwise we can look in the current tree
# but we shouldn't build xiberty if we're not canadian crossing.
if [ "${host}" != "${target}" ] ; then
	echo "CC = ${target_alias}-gcc" > Makefile.tem
	echo "AR = ${target_alias}-ar " >> Makefile.tem
	echo "RANLIB = ${target_alias}-ranlib " >> Makefile.tem
else
	echo > Makefile.tem
fi	

echo "INSTALL_DEST = tooldir" >> Makefile.tem

# If we are cross-compiling, check at compile time whether we are
# using newlib.  If we are, we already know the files we need, since
# the linker will fail when run on some of the newlib targets.
if [ "${host}" != "${target}" ] ; then
  cat > Makefile.tem2 <<'!EOF!'
CONFIG_H = xconfig.h
NEEDED_LIST = xneeded-list

xconfig.h: Makefile
	if [ -f ../newlib/Makefile ]; then \
	  echo "#define NEED_sys_nerr 1" >xconfig.h; \
	  echo "#define NEED_sys_errlist 1" >>xconfig.h; \
	  echo "#define NEED_sys_siglist 1" >>xconfig.h; \
	  echo "#define NEED_psignal 1" >>xconfig.h; \
	else \
	  $(MAKE) $(FLAGS_TO_PASS) lconfig.h; \
	  cp lconfig.h xconfig.h; \
	fi

xneeded-list: Makefile
	if [ -f ../newlib/Makefile ]; then \
	  echo insque.o random.o strdup.o alloca.o >xneeded-list; \
	else \
	  $(MAKE) $(FLAGS_TO_PASS) lneeded-list; \
	  cp lneeded-list xneeded-list; \
	fi
!EOF!
fi
sed -e "/^####/  r Makefile.tem" -e "/^####/  r Makefile.tem2" ${Makefile} > Makefile.tem3
mv Makefile.tem3 ${Makefile}
rm -f Makefile.tem Makefile.tem2

if [ "${srcdir}" = "." ] ; then
  echo "EXTRA_LINKS = ${source_links}" >>Makefile
fi
mv Makefile Makefile.tmp
# Patch 'install' and 'Makefile' rules in Makefile
# (The latter is only needed when "$srcdir" = ".".)
sed <Makefile.tmp -e '/INSTALL_DEST =/s/libdir/tooldir/' \
  -e '/Makefile/s|(srcdir)/Makefile.in|(srcdir)/../libiberty/Makefile.in|' \
  >Makefile
rm -f Makefile.tmp

# We need multilib support.
. ${srcdir}/../cfg-ml-pos.in