home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / libg++-2.7.1-base.tgz / libg++-2.7.1-src.tar / fsf / libg++ / cfg-ml-com.in next >
Text File  |  1995-11-12  |  13KB  |  420 lines

  1. # Configure fragment invoked in the common section for subdirs
  2. # wanting multilib support.
  3. #
  4. # The common section was chosen because xiberty clobbers $srcdir in the
  5. # common section of its configure.in.
  6. #
  7. # The intent is to keep as much of this in one place as possible (and out
  8. # of each subdirectory, eg: newlib, libio, etc.) until the right way to do
  9. # this (ha ha) is decided upon.
  10. #
  11. # This is where a target selects what multilib directories to build.
  12. # It is advisable to support a few --enable/--disable options to let the
  13. # user select which libraries s/he really wants.
  14. #
  15. # Subdirectories wishing to use multilib should put the following lines
  16. # in the initial ("common") section of configure.in:
  17. #
  18. #if [ -n "${with_multilib_top}" ]; then
  19. #    . ${with_multilib_top}/../cfg-ml-com.in
  20. #else
  21. #    . ${srcdir}/../cfg-ml-com.in
  22. #fi
  23. #
  24. # `with_multilib_top' exists to handle the case of configuring in the source
  25. # tree: ${srcdir} is not constant.
  26. #
  27. # The following should be added to the "post-target" section of configure.in:
  28. #
  29. #if [ -n "${with_multilib_top}" ]; then
  30. #    . ${with_multilib_top}/../cfg-ml-pos.in
  31. #else
  32. #    . ${srcdir}/../cfg-ml-pos.in
  33. #fi
  34.  
  35. # FIXME: Multilib is currently disabled by default for everything other than
  36. # newlib.  It is up to each target to turn on multilib support for the other
  37. # libraries as desired.
  38. #
  39. # FIXME: It would be better if we could use the --print-multi-lib switch to
  40. # gcc to get the list of directories to build, but at this point the compiler
  41. # has not been built.
  42.  
  43. # Only do this if --enable-multilib.
  44. # And only if at the top level, not a multilib subdirectory.
  45.  
  46. if [ "${enable_multilib}" = yes -a -z "${with_multisubdir}" ]; then
  47.  
  48. # Doing this in the common section means ${target} isn't set yet, so compute
  49. # a copy here.  This is a bit kludgey, but again the current (short term) goal
  50. # is to be as unobtrusive (sp?) to the rest of the sources as possible.
  51.  
  52. if result=`${config_shell} ${configsub} ${target_alias}` ; then
  53.     true
  54. else
  55.     echo "Unrecognized target system name ${target_alias}." 1>&2
  56.     exit 1
  57. fi
  58. target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  59. target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  60. target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  61. target=${target_cpu}-${target_vendor}-${target_os}
  62.  
  63. # FIXME: Perhaps we can do something like the following instead.
  64. # Fetch from gcc the multilib directories to use if we can.
  65. # if [ -f ${srcdir}/../gcc/genmultilib -a -f ../gcc/Makefile ]; then
  66. #   options=`grep "^MULTILIB_OPTIONS" ../gcc/Makefile | sed -e 's/^.*=//'`
  67. #   multidirs=`${srcdir}/../gcc/genmultilib "$options" | \
  68. #    sed -e 's/^#define.*//' -e 's/^[.].*//' -e 's/".*//' -e 's/ .*//'`
  69. # else
  70. #   multidirs=""
  71. # fi
  72.  
  73. case "${target}" in
  74. hppa*-*-*)
  75.     multidirs="soft-float"
  76.     ;;
  77. m68*-*-aout* | m68*-*-coff* | m68*-*-elf* | m68*-*-vxworks*)
  78.     multidirs="m68000 m68020 m68881 msoft-float m68000/m68881 m68000/msoft-float m68020/m68881 m68020/msoft-float"
  79.     ;;
  80. i960-*-*)
  81.     multidirs=float
  82.     ;;
  83. sparclite-*-* | sparclitefrw*-*-*)
  84.     multidirs="mfpu msoft-float mflat mno-flat mfpu/mflat mfpu/mno-flat msoft-float/mflat msoft-float/mno-flat"
  85.     ;;
  86. sparc-*-* | sparcfrw*-*-*)
  87.     multidirs="soft v8 soft/v8"
  88.     ;;
  89. z8k-*-coff)
  90.     multidirs="z8001 std z8001/std"
  91.     ;;
  92. h8300-*-*)
  93.     multidirs=h8300h
  94.     ;;
  95. h8500-*-*)
  96.     multidirs="mbig msmall mcompact mmedium"
  97.     ;;
  98. sh-*-*)
  99.     multidirs="ml m2 ml/m2"
  100.     ;;
  101. mips*-*-*)
  102.     # Note that not all of these will be built for a particular
  103.     # target; what is build depends upon the output gcc
  104.     # --print-multi-lib.  We configure them all, to make our life
  105.     # simpler here.  If somebody cares about configuration
  106.     # efficiency, they will need to switch off on the various
  107.     # targets to configure just the directories needed for that
  108.     # target.
  109.     # 
  110.     # In the long run, it would be better to configure based on
  111.     # the output of gcc --print-multi-lib, but, to do that, we
  112.     # would have to build gcc before configuring newlib.
  113.     #
  114.     # Default to including the single-float directories.
  115.     if [ x$enable_single_float = x ]; then
  116.       enable_single_float=yes
  117.     fi
  118.     if [ x$enable_single_float = xyes ]; then
  119.       multidirs="soft-float single el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 single/el single/eb single/mips1 single/mips3 single/el/mips1 single/el/mips3 single/eb/mips1 single/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3"
  120.     else
  121.       multidirs="soft-float el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3"
  122.     fi
  123.     if [ x$enable_biendian = xno ]
  124.     then
  125.       old_multidirs="${multidirs}"
  126.       multidirs=""
  127.       for x in ${old_multidirs}; do
  128.         case "$x" in
  129.           *endian* ) : ;;
  130.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  131.         esac
  132.       done
  133.     fi
  134.     if [ x$enable_softfloat = xno ]
  135.     then
  136.       old_multidirs="${multidirs}"
  137.       multidirs=""
  138.       for x in ${old_multidirs}; do
  139.         case "$x" in
  140.           *soft-float* ) : ;;
  141.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  142.         esac
  143.       done
  144.     fi
  145.     if [ x$enable_relocatable = xno ]
  146.     then
  147.       old_multidirs="${multidirs}"
  148.       multidirs=""
  149.       for x in ${old_multidirs}; do
  150.         case "$x" in
  151.           *relocatable* ) : ;;
  152.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  153.         esac
  154.       done
  155.     fi
  156.     if [ x$enable_sysv = xno ]
  157.     then
  158.       old_multidirs="${multidirs}"
  159.       multidirs=""
  160.       for x in ${old_multidirs}; do
  161.         case "$x" in
  162.           *sysv* ) : ;;
  163.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  164.         esac
  165.       done
  166.     fi
  167.     ;;
  168. powerpc-ibm-aix* | rs6000-ibm-aix*)
  169.     multidirs="soft-float common soft-float/common"
  170.     if [ x$enable_softfloat = xno ]
  171.     then
  172.       old_multidirs="${multidirs}"
  173.       multidirs=""
  174.       for x in ${old_multidirs}; do
  175.         case "$x" in
  176.           *soft-float* ) : ;;
  177.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  178.         esac
  179.       done
  180.     fi
  181.     if [ x$enable_commoncpu = xno ]
  182.     then
  183.       old_multidirs="${multidirs}"
  184.       multidirs=""
  185.       for x in ${old_multidirs}; do
  186.         case "$x" in
  187.           *common* ) : ;;
  188.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  189.         esac
  190.       done
  191.     fi
  192.     ;;
  193. powerpc-*-eabiaix*)
  194.     multidirs="soft-float relocatable little sysv little/sysv relocatable/little relocatable/sysv relocatable/little/sysv soft-float/relocatable soft-float/little soft-float/sysv soft-float/little/sysv soft-float/relocatable/little soft-float/relocatable/sysv soft-float/relocatable/little/sysv"
  195.     if [ x$enable_biendian = xno ]
  196.     then
  197.       old_multidirs="${multidirs}"
  198.       multidirs=""
  199.       for x in ${old_multidirs}; do
  200.         case "$x" in
  201.           *endian* ) : ;;
  202.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  203.         esac
  204.       done
  205.     fi
  206.     if [ x$enable_softfloat = xno ]
  207.     then
  208.       old_multidirs="${multidirs}"
  209.       multidirs=""
  210.       for x in ${old_multidirs}; do
  211.         case "$x" in
  212.           *soft-float* ) : ;;
  213.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  214.         esac
  215.       done
  216.     fi
  217.     if [ x$enable_relocatable = xno ]
  218.     then
  219.       old_multidirs="${multidirs}"
  220.       multidirs=""
  221.       for x in ${old_multidirs}; do
  222.         case "$x" in
  223.           *relocatable* ) : ;;
  224.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  225.         esac
  226.       done
  227.     fi
  228.     if [ x$enable_sysv = xno ]
  229.     then
  230.       old_multidirs="${multidirs}"
  231.       multidirs=""
  232.       for x in ${old_multidirs}; do
  233.         case "$x" in
  234.           *sysv* ) : ;;
  235.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  236.         esac
  237.       done
  238.     fi
  239.     ;;
  240. powerpc-*-eabi* | powerpc-*-elf* | powerpc-*-sysv4*)
  241.     multidirs="soft-float relocatable little aix little/aix relocatable/little relocatable/aix relocatable/little/aix soft-float/relocatable soft-float/little soft-float/aix soft-float/little/aix soft-float/relocatable/little soft-float/relocatable/aix soft-float/relocatable/little/aix aixdesc soft-float/aixdesc"
  242.     if [ x$enable_biendian = xno ]
  243.     then
  244.       old_multidirs="${multidirs}"
  245.       multidirs=""
  246.       for x in ${old_multidirs}; do
  247.         case "$x" in
  248.           *endian* ) : ;;
  249.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  250.         esac
  251.       done
  252.     fi
  253.     if [ x$enable_softfloat = xno ]
  254.     then
  255.       old_multidirs="${multidirs}"
  256.       multidirs=""
  257.       for x in ${old_multidirs}; do
  258.         case "$x" in
  259.           *soft-float* ) : ;;
  260.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  261.         esac
  262.       done
  263.     fi
  264.     if [ x$enable_relocatable = xno ]
  265.     then
  266.       old_multidirs="${multidirs}"
  267.       multidirs=""
  268.       for x in ${old_multidirs}; do
  269.         case "$x" in
  270.           *relocatable* ) : ;;
  271.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  272.         esac
  273.       done
  274.     fi
  275.     if [ x$enable_aix = xno ]
  276.     then
  277.       old_multidirs="${multidirs}"
  278.       multidirs=""
  279.       for x in ${old_multidirs}; do
  280.         case "$x" in
  281.           *aix* ) : ;;
  282.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  283.         esac
  284.       done
  285.     fi
  286.     ;;
  287. powerpcle-*-eabi* | powerpcle-*-elf* | powerpcle-*-sysv4*)
  288.     multidirs="soft-float relocatable big aix big/aix relocatable/big relocatable/aix relocatable/big/aix soft-float/relocatable soft-float/big soft-float/aix soft-float/big/aix soft-float/relocatable/big soft-float/relocatable/aix soft-float/relocatable/big/aix"
  289.     if [ x$enable_biendian = xno ]
  290.     then
  291.       old_multidirs="${multidirs}"
  292.       multidirs=""
  293.       for x in ${old_multidirs}; do
  294.         case "$x" in
  295.           *endian* ) : ;;
  296.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  297.         esac
  298.       done
  299.     fi
  300.     if [ x$enable_softfloat = xno ]
  301.     then
  302.       old_multidirs="${multidirs}"
  303.       multidirs=""
  304.       for x in ${old_multidirs}; do
  305.         case "$x" in
  306.           *soft-float* ) : ;;
  307.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  308.         esac
  309.       done
  310.     fi
  311.     if [ x$enable_relocatable = xno ]
  312.     then
  313.       old_multidirs="${multidirs}"
  314.       multidirs=""
  315.       for x in ${old_multidirs}; do
  316.         case "$x" in
  317.           *relocatable* ) : ;;
  318.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  319.         esac
  320.       done
  321.     fi
  322.     if [ x$enable_aix = xno ]
  323.     then
  324.       old_multidirs="${multidirs}"
  325.       multidirs=""
  326.       for x in ${old_multidirs}; do
  327.         case "$x" in
  328.           *aix* ) : ;;
  329.           *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;;
  330.         esac
  331.       done
  332.     fi
  333.     ;;
  334. *)
  335.     multidirs=
  336.     ;;
  337. esac
  338.  
  339. # We must freshly configure each subdirectory.  This bit of code is
  340. # actually partially stolen from the main configure script.  FIXME.
  341.  
  342. if [ -n "${multidirs}" ] && [ -z "${norecursion}" ]; then
  343.   for dir in ${multidirs}; do
  344.  
  345.     if [ -d ${dir} ]; then true; else mkdir ${dir}; fi
  346.  
  347.     dotdot=../`echo ${dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
  348.  
  349.     case ${srcdir} in
  350.     ".")
  351.       echo Building symlink tree in `pwd`/${dir}
  352.       rm -f tmpconfig
  353.       cat >tmpconfig <<\EOF
  354. #!/bin/sh
  355. for f in `ls -a $1`; do
  356.   if [ -d $1$f ]; then
  357.     found=
  358.     for i in $2; do
  359.       if [ "$f" = "$i" ]; then
  360.     found=yes
  361.       fi
  362.     done
  363.     if [ -z "${found}" ]; then
  364.       if [ -d $f ]; then true; else mkdir $f; fi
  365.       (cd $f; ../$0 ../$1$f/ "$2")
  366.     fi
  367.   else
  368.     rm -f $f
  369.     ln -s $1$f .
  370.   fi
  371. done
  372. EOF
  373.       chmod +x tmpconfig
  374.       (cd ${dir};
  375.        ${dotdot}tmpconfig ${dotdot} ". .. CVS tmpconfig ${multidirs}")
  376.       rm -f tmpconfig
  377.       srcdiroption=
  378.       multilib_top=${dotdot}
  379.       ;;
  380.     *)
  381.       case "${srcdir}" in
  382.       /*) # absolute path
  383.         newsrcdir=${srcdir}/${configdir}
  384.         ;;
  385.       *) # otherwise relative
  386.         newsrcdir=${dotdot}${srcdir}/${configdir}
  387.         ;;
  388.       esac
  389.       srcdiroption="-srcdir=${newsrcdir}"
  390.       multilib_top=${newsrcdir}
  391.       ;;
  392.     esac
  393.  
  394.     case "${progname}" in
  395.     /*)     recprog=${progname} ;;
  396.     *)      recprog=${dotdot}${progname} ;;
  397.     esac
  398.  
  399.     POPDIR=${PWD=`pwd`}
  400.     cd ${dir}
  401.     if eval ${config_shell} ${recprog} ${verbose} \
  402.     --with-multisubdir=${dir} --with-multilib-top=${multilib_top} \
  403.     ${buildopt} --host=${host_alias} --target=${target_alias} \
  404.         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  405.         ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \
  406.     ${program_transform_nameoption} ${site_option} ${withoptions} \
  407.     ${withoutoptions} ${enableoptions} ${disableoptions} \
  408.     ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
  409.       true
  410.     else
  411.       exit 1
  412.     fi
  413.  
  414.     cd ${POPDIR}
  415.  
  416.   done
  417. fi
  418.  
  419. fi # ${enable_multilib = yes -a -z ${with_multisubdir}
  420.