]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - config.if
2003-04-10 Andrew Cagney <cagney@redhat.com>
[thirdparty/binutils-gdb.git] / config.if
CommitLineData
252b5132
RH
1#! /dev/null
2# Don't call it directly. This shell script fragment is called to
3# determine:
4#
264095c3
AO
5# 1. libstcxx_incdir: the interface name for libstdc++.
6# 2. libc_interface: the interface name for libc.
252b5132
RH
7#
8
9# Get the top level src dir.
10if [ -z "${topsrcdir}" -a -z "${top_srcdir}" ]
11then
12 echo "Undefined top level src dir: topsrcdir and top_srcdir are empty" >&2
13 exit 1
14fi
15
16if [ -n "${topsrcdir}" ]
17then
18 if_topsrcdir=${topsrcdir}
19else
20 if_topsrcdir=${top_srcdir}
21fi
22
264095c3
AO
23# Set libstdcxx_incdir.
24# This is the same as gcc/configure.in and libstdc++-v3/acinclude.m4.
25if test -z "$gcc_version"; then
26 if test -z "${gcc_version_trigger}" \
27 && test -f ${if_topsrcdir}/gcc/version.c; then
28 gcc_version_trigger=${if_topsrcdir}/gcc/version.c
29 fi
30 if test -f "${gcc_version_trigger}"; then
31 gcc_version_full=`grep version_string "${gcc_version_trigger}" | sed -e 's/.*"\([^"]*\)".*/\1/'`
32 else
33 gcc_version_full=`$CC -v 2>&1 | sed -n 's/^gcc version //p'`
34 fi
35 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
252b5132 36fi
264095c3 37libstdcxx_incdir=c++/${gcc_version}
252b5132
RH
38
39# The trickiest part is libc_interface.
40if [ -z "${libc_interface}" ]
41then
42 case ${target_os} in
43 *linux*libc1*|*linux*libc5*)
44 case ${target_alias} in
45 *alpha*|*powerpc*)
46 libc_interface=-libc5.9-
47 ;;
48 *)
49 libc_interface=-libc5-
50 ;;
51 esac
52 ;;
53 *linux*gnu*)
54 # We have to work harder to figure it out.
55 if [ ${target_alias} = ${build_alias} ]
56 then
57 dummy=if$$
58 cat >$dummy.c <<EOF
59#include <features.h>
60main(argc, argv)
61 int argc;
62 char *argv[];
63{
64 printf("%d\n", __GLIBC_MINOR__);
65 return 0;
66}
67EOF
68 ${CC-cc} $dummy.c -o $dummy 2>/dev/null
69 if [ "$?" = 0 ]
70 then
71 libc_interface=-libc6.`./$dummy`-
72 rm -f $dummy.c $dummy
73 else
74 # It should never happen.
75 echo "Cannot find the GNU C library minor version number." >&2
76 rm -f $dummy.c $dummy
77 exit 1
78 fi
79 else
264095c3
AO
80 # Cross compiling. Assume glibc 2.1.
81 libc_interface=-libc6.1-
252b5132
RH
82 fi
83 ;;
84 *)
85 libc_interface=-
86 ;;
87 esac
88fi