| 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 | |
| 24 | if [ -f ${if_topsrcdir}/libstdc++/Makefile.in ]; then |
| 25 | # We check libstdc++ for libstdcxx_interface. |
| 26 | libstdcxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/libstdc++/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'` |
| 27 | else |
| 28 | libstdcxx_interface= |
| 29 | fi |
| 30 | |
| 31 | if [ -f ${if_topsrcdir}/gcc/cp/Makefile.in ]; then |
| 32 | # We check gcc/cp for cxx_interface. |
| 33 | cxx_interface=`grep "^INTERFACE" ${if_topsrcdir}/gcc/cp/Makefile.in | sed 's/INTERFACE[ ]*=[ ]*\(.*\)/\1/'` |
| 34 | else |
| 35 | cxx_interface= |
| 36 | fi |
| 37 | |
| 38 | # The trickiest part is libc_interface. |
| 39 | if [ -z "${libc_interface}" ] |
| 40 | then |
| 41 | case ${target_os} in |
| 42 | *linux*libc1*|*linux*libc5*) |
| 43 | case ${target_alias} in |
| 44 | *alpha*|*powerpc*) |
| 45 | libc_interface=-libc5.9- |
| 46 | ;; |
| 47 | *) |
| 48 | libc_interface=-libc5- |
| 49 | ;; |
| 50 | esac |
| 51 | ;; |
| 52 | *linux*gnu*) |
| 53 | # We have to work harder to figure it out. |
| 54 | if [ ${target_alias} = ${build_alias} ] |
| 55 | then |
| 56 | dummy=if$$ |
| 57 | cat >$dummy.c <<EOF |
| 58 | #include <features.h> |
| 59 | main(argc, argv) |
| 60 | int argc; |
| 61 | char *argv[]; |
| 62 | { |
| 63 | printf("%d\n", __GLIBC_MINOR__); |
| 64 | return 0; |
| 65 | } |
| 66 | EOF |
| 67 | ${CC-cc} $dummy.c -o $dummy 2>/dev/null |
| 68 | if [ "$?" = 0 ] |
| 69 | then |
| 70 | libc_interface=-libc6.`./$dummy`- |
| 71 | rm -f $dummy.c $dummy |
| 72 | else |
| 73 | # It should never happen. |
| 74 | echo "Cannot find the GNU C library minor version number." >&2 |
| 75 | rm -f $dummy.c $dummy |
| 76 | exit 1 |
| 77 | fi |
| 78 | else |
| 79 | # Cross compiling. Assume glibc 2.1. |
| 80 | libc_interface=-libc6.1- |
| 81 | fi |
| 82 | ;; |
| 83 | *) |
| 84 | libc_interface=- |
| 85 | ;; |
| 86 | esac |
| 87 | fi |