config.if 2.1 KB

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