| [10] | 1 | # Configure fragment invoked in the post-target section for subdirs
|
|---|
| 2 | # wanting multilib support.
|
|---|
| 3 | #
|
|---|
| 4 | # It is advisable to support a few --enable/--disable options to let the
|
|---|
| 5 | # user select which libraries s/he really wants.
|
|---|
| 6 | #
|
|---|
| 7 | # Subdirectories wishing to use multilib should put the following lines
|
|---|
| 8 | # in the "post-target" section of configure.in.
|
|---|
| 9 | #
|
|---|
| 10 | # if [ "${srcdir}" = "." ] ; then
|
|---|
| 11 | # if [ "${with_target_subdir}" != "." ] ; then
|
|---|
| 12 | # . ${with_multisrctop}../../config-ml.in
|
|---|
| 13 | # else
|
|---|
| 14 | # . ${with_multisrctop}../config-ml.in
|
|---|
| 15 | # fi
|
|---|
| 16 | # else
|
|---|
| 17 | # . ${srcdir}/../config-ml.in
|
|---|
| 18 | # fi
|
|---|
| 19 | #
|
|---|
| 20 | # See librx/configure.in in the libg++ distribution for an example of how
|
|---|
| 21 | # to handle autoconf'd libraries.
|
|---|
| 22 | #
|
|---|
| 23 | # Things are complicated because 6 separate cases must be handled:
|
|---|
| 24 | # 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
|
|---|
| 25 | #
|
|---|
| 26 | # srcdir=. is special. It must handle make programs that don't handle VPATH.
|
|---|
| 27 | # To implement this, a symlink tree is built for each library and for each
|
|---|
| 28 | # multilib subdir.
|
|---|
| 29 | #
|
|---|
| 30 | # The build tree is layed out as
|
|---|
| 31 | #
|
|---|
| 32 | # ./
|
|---|
| 33 | # libg++
|
|---|
| 34 | # newlib
|
|---|
| 35 | # m68020/
|
|---|
| 36 | # libg++
|
|---|
| 37 | # newlib
|
|---|
| 38 | # m68881/
|
|---|
| 39 | # libg++
|
|---|
| 40 | # newlib
|
|---|
| 41 | #
|
|---|
| 42 | # The nice feature about this arrangement is that inter-library references
|
|---|
| 43 | # in the build tree work without having to care where you are. Note that
|
|---|
| 44 | # inter-library references also work in the source tree because symlink trees
|
|---|
| 45 | # are built when srcdir=.
|
|---|
| 46 | #
|
|---|
| 47 | # Unfortunately, trying to access the libraries in the build tree requires
|
|---|
| 48 | # the user to manually choose which library to use as GCC won't be able to
|
|---|
| 49 | # find the right one. This is viewed as the lesser of two evils.
|
|---|
| 50 | #
|
|---|
| 51 | # Configure variables:
|
|---|
| 52 | # ${with_target_subdir} = "." for native, or ${target_alias} for cross.
|
|---|
| 53 | # Set by top level Makefile.
|
|---|
| 54 | # ${with_multisrctop} = how many levels of multilibs there are in the source
|
|---|
| 55 | # tree. It exists to handle the case of configuring in the source tree:
|
|---|
| 56 | # ${srcdir} is not constant.
|
|---|
| 57 | # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
|
|---|
| 58 | #
|
|---|
| 59 | # Makefile variables:
|
|---|
| 60 | # MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
|
|---|
| 61 | # (FIXME: note that this is different than ${with_multisrctop}. Check out.).
|
|---|
| 62 | # MULTIBUILDTOP = number of multilib levels in build tree
|
|---|
| 63 | # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
|
|---|
| 64 | # (only defined in each library's main Makefile).
|
|---|
| 65 | # MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
|
|---|
| 66 | # (only defined in each multilib subdir).
|
|---|
| 67 |
|
|---|
| 68 | # FIXME: Multilib is currently disabled by default for everything other than
|
|---|
| 69 | # newlib. It is up to each target to turn on multilib support for the other
|
|---|
| 70 | # libraries as desired.
|
|---|
| 71 |
|
|---|
| 72 | # We have to handle being invoked by both Cygnus configure and Autoconf.
|
|---|
| 73 | #
|
|---|
| 74 | # Cygnus configure incoming variables:
|
|---|
| 75 | # srcdir, subdir, host, arguments
|
|---|
| 76 | #
|
|---|
| 77 | # Autoconf incoming variables:
|
|---|
| 78 | # srcdir, host, ac_configure_args
|
|---|
| 79 | #
|
|---|
| 80 | # We *could* figure srcdir and host out, but we'd have to do work that
|
|---|
| 81 | # our caller has already done to figure them out and requiring these two
|
|---|
| 82 | # seems reasonable.
|
|---|
| 83 | # Note that `host' in this case is GCC's `target'. Target libraries are
|
|---|
| 84 | # configured for a particular host.
|
|---|
| 85 |
|
|---|
| 86 | if [ -n "${ac_configure_args}" ]; then
|
|---|
| 87 | Makefile=${ac_file-Makefile}
|
|---|
| 88 | ml_config_shell=${CONFIG_SHELL-/bin/sh}
|
|---|
| 89 | ml_arguments="${ac_configure_args}"
|
|---|
| 90 | ml_realsrcdir=${srcdir}
|
|---|
| 91 | else
|
|---|
| 92 | Makefile=${Makefile-Makefile}
|
|---|
| 93 | ml_config_shell=${config_shell-/bin/sh}
|
|---|
| 94 | ml_arguments="${arguments}"
|
|---|
| 95 | if [ -n "${subdir}" -a "${subdir}" != "." ] ; then
|
|---|
| 96 | ml_realsrcdir=${srcdir}/${subdir}
|
|---|
| 97 | else
|
|---|
| 98 | ml_realsrcdir=${srcdir}
|
|---|
| 99 | fi
|
|---|
| 100 | fi
|
|---|
| 101 |
|
|---|
| 102 | # Scan all the arguments and set all the ones we need.
|
|---|
| 103 |
|
|---|
| 104 | ml_verbose=--verbose
|
|---|
| 105 | for option in ${ml_arguments}
|
|---|
| 106 | do
|
|---|
| 107 | case $option in
|
|---|
| 108 | --*) ;;
|
|---|
| 109 | -*) option=-$option ;;
|
|---|
| 110 | esac
|
|---|
| 111 |
|
|---|
| 112 | case $option in
|
|---|
| 113 | --*=*)
|
|---|
| 114 | optarg=`echo $option | sed -e 's/^[^=]*=//'`
|
|---|
| 115 | ;;
|
|---|
| 116 | esac
|
|---|
| 117 |
|
|---|
| 118 | case $option in
|
|---|
| 119 | --disable-*)
|
|---|
| 120 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
|
|---|
| 121 | eval $enableopt=no
|
|---|
| 122 | ;;
|
|---|
| 123 | --enable-*)
|
|---|
| 124 | case "$option" in
|
|---|
| 125 | *=*) ;;
|
|---|
| 126 | *) optarg=yes ;;
|
|---|
| 127 | esac
|
|---|
| 128 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
|---|
| 129 | eval $enableopt="$optarg"
|
|---|
| 130 | ;;
|
|---|
| 131 | --norecursion | --no*)
|
|---|
| 132 | ml_norecursion=yes
|
|---|
| 133 | ;;
|
|---|
| 134 | --silent | --sil* | --quiet | --q*)
|
|---|
| 135 | ml_verbose=--silent
|
|---|
| 136 | ;;
|
|---|
| 137 | --verbose | --v | --verb*)
|
|---|
| 138 | ml_verbose=--verbose
|
|---|
| 139 | ;;
|
|---|
| 140 | --with-*)
|
|---|
| 141 | case "$option" in
|
|---|
| 142 | *=*) ;;
|
|---|
| 143 | *) optarg=yes ;;
|
|---|
| 144 | esac
|
|---|
| 145 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
|
|---|
| 146 | eval $withopt="$optarg"
|
|---|
| 147 | ;;
|
|---|
| 148 | --without-*)
|
|---|
| 149 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
|
|---|
| 150 | eval $withopt=no
|
|---|
| 151 | ;;
|
|---|
| 152 | esac
|
|---|
| 153 | done
|
|---|
| 154 |
|
|---|
| 155 | # Only do this if --enable-multilib.
|
|---|
| 156 | if [ "${enable_multilib}" = yes ]; then
|
|---|
| 157 |
|
|---|
| 158 | # Compute whether this is the library's top level directory
|
|---|
| 159 | # (ie: not a multilib subdirectory, and not a subdirectory like libg++/src).
|
|---|
| 160 | # ${with_multisubdir} tells us we're in the right branch, but we could be
|
|---|
| 161 | # in a subdir of that.
|
|---|
| 162 | # ??? The previous version could void this test by separating the process into
|
|---|
| 163 | # two files: one that only the library's toplevel configure.in ran (to
|
|---|
| 164 | # configure the multilib subdirs), and another that all configure.in's ran to
|
|---|
| 165 | # update the Makefile. It seemed reasonable to collapse all multilib support
|
|---|
| 166 | # into one file, but it does leave us with having to perform this test.
|
|---|
| 167 | ml_toplevel_p=no
|
|---|
| 168 | if [ -z "${with_multisubdir}" ]; then
|
|---|
| 169 | if [ "${srcdir}" = "." ]; then
|
|---|
| 170 | # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
|
|---|
| 171 | # ${with_target_subdir} = "." for native, otherwise target alias.
|
|---|
| 172 | if [ "${with_target_subdir}" = "." ]; then
|
|---|
| 173 | if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
|
|---|
| 174 | ml_toplevel_p=yes
|
|---|
| 175 | fi
|
|---|
| 176 | else
|
|---|
| 177 | if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
|
|---|
| 178 | ml_toplevel_p=yes
|
|---|
| 179 | fi
|
|---|
| |
|---|