Merge branch 'maint' into master.
[platform/upstream/automake.git] / m4 / multi.m4
1 ##                                                          -*- Autoconf -*-
2 # Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2011
3 # Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # serial 8
10
11 # AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
12 # ---------------------------------------------------
13 # Add --enable-multilib to configure.
14 AC_DEFUN([AM_ENABLE_MULTILIB],
15 [# Default to --enable-multilib
16 AC_ARG_ENABLE([multilib],
17 [AS_HELP_STRING(
18    [--enable-multilib],
19    [build many library versions (default)])],
20 [case "$enableval" in
21   yes) multilib=yes ;;
22   no)  multilib=no ;;
23   *)   AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
24  esac],
25               [multilib=yes])
26
27 # We may get other options which we leave undocumented:
28 # --with-target-subdir, --with-multisrctop, --with-multisubdir
29 # See config-ml.in if you want the gory details.
30
31 if test "$srcdir" = "."; then
32   if test "$with_target_subdir" != "."; then
33     multi_basedir="$srcdir/$with_multisrctop../$2"
34   else
35     multi_basedir="$srcdir/$with_multisrctop$2"
36   fi
37 else
38   multi_basedir="$srcdir/$2"
39 fi
40 AC_SUBST([multi_basedir])
41
42 # Even if the default multilib is not a cross compilation,
43 # it may be that some of the other multilibs are.
44 if test $cross_compiling = no && test $multilib = yes \
45    && test "x${with_multisubdir}" != x ; then
46    cross_compiling=maybe
47 fi
48
49 AC_OUTPUT_COMMANDS([
50 # Only add multilib support code if we just rebuilt the top-level
51 # Makefile.
52 case " $CONFIG_FILES " in
53  *" ]m4_default([$1],Makefile)[ "*)
54    ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
55    ;;
56 esac],
57                    [
58 srcdir="$srcdir"
59 host="$host"
60 target="$target"
61 with_multisubdir="$with_multisubdir"
62 with_multisrctop="$with_multisrctop"
63 with_target_subdir="$with_target_subdir"
64 ac_configure_args="${multilib_arg} ${ac_configure_args}"
65 multi_basedir="$multi_basedir"
66 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
67 CC="$CC"])])dnl