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