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