| 1 | #! /dev/null | 
|---|
| 2 | # Don't call it directly. This shell script fragment is called to | 
|---|
| 3 | # determine: | 
|---|
| 4 | # | 
|---|
| 5 | #       1. libstcxx_incdir: the interface name for libstdc++. | 
|---|
| 6 | #       2. libc_interface: the interface name for libc. | 
|---|
| 7 | # | 
|---|
| 8 |  | 
|---|
| 9 | # Get the top level src dir. | 
|---|
| 10 | if [ -z "${topsrcdir}" -a -z "${top_srcdir}" ] | 
|---|
| 11 | then | 
|---|
| 12 | echo "Undefined top level src dir: topsrcdir and top_srcdir are empty" >&2 | 
|---|
| 13 | exit 1 | 
|---|
| 14 | fi | 
|---|
| 15 |  | 
|---|
| 16 | if [ -n "${topsrcdir}" ] | 
|---|
| 17 | then | 
|---|
| 18 | if_topsrcdir=${topsrcdir} | 
|---|
| 19 | else | 
|---|
| 20 | if_topsrcdir=${top_srcdir} | 
|---|
| 21 | fi | 
|---|
| 22 |  | 
|---|
| 23 | # Set libstdcxx_incdir. | 
|---|
| 24 | # This is the same as gcc/configure.in and libstdc++-v3/acinclude.m4. | 
|---|
| 25 | if 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/'` | 
|---|
| 36 | fi | 
|---|
| 37 | libstdcxx_incdir=c++/${gcc_version} | 
|---|
| 38 |  | 
|---|
| 39 | # The trickiest part is libc_interface. | 
|---|
| 40 | if [ -z "${libc_interface}" ] | 
|---|
| 41 | then | 
|---|
| 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> | 
|---|
| 60 | main(argc, argv) | 
|---|
| 61 | int argc; | 
|---|
| 62 | char *argv[]; | 
|---|
| 63 | { | 
|---|
| 64 | printf("%d\n", __GLIBC_MINOR__); | 
|---|
| 65 | return 0; | 
|---|
| 66 | } | 
|---|
| 67 | EOF | 
|---|
| 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 | 
|---|
| 80 | # Cross compiling. Assume glibc 2.1. | 
|---|
| 81 | libc_interface=-libc6.1- | 
|---|
| 82 | fi | 
|---|
| 83 | ;; | 
|---|
| 84 | *) | 
|---|
| 85 | libc_interface=- | 
|---|
| 86 | ;; | 
|---|
| 87 | esac | 
|---|
| 88 | fi | 
|---|