From 8ad147ebef355226c47b7359e3d454eb5ebc1187 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 11 Oct 1998 13:07:23 +0000 Subject: [PATCH] Preliminary (completely untested) multilib support. * automake.texi (Macros): Document AM_ENABLE_MULTILIB. * m4/Makefile.am (m4data_DATA): Added multi.m4. * Makefile.am (amfiles): Added multilib.am. * automake.in (seen_multilib): New global. (scan_one_configure_file): Recognize AM_ENABLE_MULTILIB. (generate_makefile): Call handle_multilib. (handle_multilib): New function. * multilib.am: New file. * m4/multi.m4: New file. --- ChangeLog | 13 +++++++++++++ Makefile.am | 6 +++--- Makefile.in | 6 +++--- automake.in | 16 ++++++++++++++++ automake.texi | 10 ++++++++++ lib/am/Makefile.am | 6 +++--- lib/am/multilib.am | 45 +++++++++++++++++++++++++++++++++++++++++++++ m4/Makefile.am | 5 +++-- m4/Makefile.in | 5 +++-- m4/multi.m4 | 41 +++++++++++++++++++++++++++++++++++++++++ multilib.am | 45 +++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 185 insertions(+), 13 deletions(-) create mode 100644 lib/am/multilib.am create mode 100644 m4/multi.m4 create mode 100644 multilib.am diff --git a/ChangeLog b/ChangeLog index 6fcf9166..0d633711 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +1998-10-11 Tom Tromey + + Preliminary (completely untested) multilib support. + * automake.texi (Macros): Document AM_ENABLE_MULTILIB. + * m4/Makefile.am (m4data_DATA): Added multi.m4. + * Makefile.am (amfiles): Added multilib.am. + * automake.in (seen_multilib): New global. + (scan_one_configure_file): Recognize AM_ENABLE_MULTILIB. + (generate_makefile): Call handle_multilib. + (handle_multilib): New function. + * multilib.am: New file. + * m4/multi.m4: New file. + 1998-10-08 Tom Tromey * automake.in (handle_dist): Always include configure.in and diff --git a/Makefile.am b/Makefile.am index b44d5e91..954ee739 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,9 +14,9 @@ amfiles = clean-hdr.am clean-kr.am clean.am comp-vars.am compile.am \ data-clean.am data.am dejagnu.am depend.am depend2.am dist-vars.am \ footer.am header-vars.am header.am java-clean.am java.am kr-extra.am \ library.am libs-clean.am libs.am libtool.am lisp-clean.am lisp.am \ -ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am program.am \ -progs-clean.am progs.am remake-hdr.am remake.am scripts.am subdirs.am \ -tags-clean.am tags.am texi-vers.am texinfos.am +ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am multilib.am \ +program.am progs-clean.am progs.am remake-hdr.am remake.am scripts.am \ +subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 $(amfiles) diff --git a/Makefile.in b/Makefile.in index 05031dec..da512d35 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,9 +75,9 @@ amfiles = clean-hdr.am clean-kr.am clean.am comp-vars.am compile.am \ data-clean.am data.am dejagnu.am depend.am depend2.am dist-vars.am \ footer.am header-vars.am header.am java-clean.am java.am kr-extra.am \ library.am libs-clean.am libs.am libtool.am lisp-clean.am lisp.am \ -ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am program.am \ -progs-clean.am progs.am remake-hdr.am remake.am scripts.am subdirs.am \ -tags-clean.am tags.am texi-vers.am texinfos.am +ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am multilib.am \ +program.am progs-clean.am progs.am remake-hdr.am remake.am scripts.am \ +subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 $(amfiles) diff --git a/automake.in b/automake.in index ebe79d88..2ae6320f 100755 --- a/automake.in +++ b/automake.in @@ -210,6 +210,9 @@ $seen_exeext = 0; # TRUE if we've seen AC_OBJEXT. $seen_objext = 0; +# TRUE if we've seen AC_ENABLE_MULTILIB. +$seen_multilib = 0; + # Hash table of discovered configure substitutions. Keys are names, # values are `FILE:LINE' strings which are used by error message # generation. @@ -608,6 +611,7 @@ sub generate_makefile $contents{'SOURCES'} = join (' ', @sources); $contents{'OBJECTS'} = join (' ', @objects); + &handle_multilib; &handle_texinfo; &handle_emacs_lisp; &handle_java; @@ -2211,6 +2215,16 @@ sub handle_tags } } +# Handle multilib support. +sub handle_multilib +{ + return unless $seen_multilib; + + $output_rules .= &file_contents ('multilib.am'); + &push_phony_cleaners ('multi'); + push (@phony, 'all-multi', 'install-multi'); +} + # Worker for handle_dist. sub handle_dist_worker { @@ -4186,6 +4200,8 @@ sub scan_one_configure_file $seen_canonical = $AC_CANONICAL_HOST if ! $seen_canonical; } + $seen_multilib = 1 if (/AM_ENABLE_MULTILIB/); + if (/$AM_CONDITIONAL_PATTERN/o) { $configure_cond{$1} = 1; diff --git a/automake.texi b/automake.texi index c68c43a8..775ed002 100644 --- a/automake.texi +++ b/automake.texi @@ -1113,6 +1113,16 @@ whose names end in @samp{.exe}, even if this was not specified on the command line. Automake adds special code to @file{Makefile.in} to gracefully deal with this. +@item AM_ENABLE_MULTILIB +This is used when a ``multilib'' library is being built. A +@dfn{multilib} library is one that is built multiple times, once per +target flag combination. This is only useful when the library is +intended to be cross-compiled. The first optional argument is the name +of the @file{Makefile} being generated; it defaults to @samp{Makefile}. +The second option argument is used to find the top source directory; it +defaults to the empty string (generally this should not be used unless +you are familiar with the internals). + @item AM_FUNC_STRTOD If the @code{strtod} function is not available, or does not work correctly (like the one on SunOS 5.4), add @file{strtod.o} to output diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index b44d5e91..954ee739 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -14,9 +14,9 @@ amfiles = clean-hdr.am clean-kr.am clean.am comp-vars.am compile.am \ data-clean.am data.am dejagnu.am depend.am depend2.am dist-vars.am \ footer.am header-vars.am header.am java-clean.am java.am kr-extra.am \ library.am libs-clean.am libs.am libtool.am lisp-clean.am lisp.am \ -ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am program.am \ -progs-clean.am progs.am remake-hdr.am remake.am scripts.am subdirs.am \ -tags-clean.am tags.am texi-vers.am texinfos.am +ltlib-clean.am ltlib.am ltlibrary.am mans-vars.am mans.am multilib.am \ +program.am progs-clean.am progs.am remake-hdr.am remake.am scripts.am \ +subdirs.am tags-clean.am tags.am texi-vers.am texinfos.am pkgdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 $(amfiles) diff --git a/lib/am/multilib.am b/lib/am/multilib.am new file mode 100644 index 00000000..728a78dc --- /dev/null +++ b/lib/am/multilib.am @@ -0,0 +1,45 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1998 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +## Multilib support variables. +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +all-multi: + $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do +install-multi: + $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do +mostlyclean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean +clean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean +distclean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean +maintainer-clean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean + +## FIXME: this is probably broken. +all-recursive: all-multi +install-recursive: install-multi +mostlyclean-recursive: mostlyclean-multi +clean-recursive: clean-multi +distclean-recursive: distclean-multi +maintainer-clean-recursive: maintainer-clean-multi diff --git a/m4/Makefile.am b/m4/Makefile.am index b28da947..8e6cbcf1 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -5,7 +5,8 @@ MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 header.m4 init.m4 \ -lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 obstack.m4 \ -protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4 +lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 \ +obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \ +termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) diff --git a/m4/Makefile.in b/m4/Makefile.in index 6ff3e096..7a7f12e5 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -68,8 +68,9 @@ MAINT_CHARSET = latin1 m4datadir = $(datadir)/aclocal m4data_DATA = ccstdc.m4 cond.m4 dmalloc.m4 error.m4 header.m4 init.m4 \ -lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 obstack.m4 \ -protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 termios.m4 winsz.m4 +lex.m4 lispdir.m4 maintainer.m4 missing.m4 mktime.m4 multi.m4 \ +obstack.m4 protos.m4 ptrdiff.m4 regex.m4 sanity.m4 strtod.m4 \ +termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff --git a/m4/multi.m4 b/m4/multi.m4 new file mode 100644 index 00000000..b0e65912 --- /dev/null +++ b/m4/multi.m4 @@ -0,0 +1,41 @@ +dnl Add --enable-multilib to configure. +dnl Usage: AM_ENABLE_MULTILIB([makefile, [rel-to-top-srcdir]]) + +AC_DEFUN(AM_ENABLE_MULTILIB, [ +dnl Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "${enableval}" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; + esac], [multilib=yes] + +dnl We may get other options which we are undocumented: +dnl --with-target-subdir, --with-multisrctop, --with-multisubdir + +if test "[$]{srcdir}" = "."; then + if test "[$]{with_target_subdir}" != "."; then + multi_basedir="[$]{srcdir}/[$]{with_multisrctop}../ifelse([$2],,,[$2])" + else + multi_basedir="[$]{srcdir}/[$]{with_multisrctop}ifelse([$2],,,[$2])" + fi +else + multi_basedir="[$]{srcdir}/ifelse([$2],,,[$2])" +fi +AC_SUBST(multi_basedir) + +AC_OUTPUT_COMMANDS([ +if test -n "$CONFIG_FILES"; then + ac_file=ifelse([$1],,Makefile,[$1]) . ..ifelse([$2],,,/[$2])/config-ml.in +fi], [ +srcdir="$srcdir" +host="$host" +target="$target" +with_multisubdir="$with_multisubdir" +with_multisrctop="$with_multisrctop" +with_target_subdir="$with_target_subdir" +ac_configure_args="${multilib_arg} ${ac_configure_args}" +multi_basedir="$multi_basedir" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +CC="$CC"]))dnl diff --git a/multilib.am b/multilib.am new file mode 100644 index 00000000..728a78dc --- /dev/null +++ b/multilib.am @@ -0,0 +1,45 @@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1998 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. +## Multilib support variables. +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +all-multi: + $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do +install-multi: + $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do +mostlyclean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean +clean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean +distclean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean +maintainer-clean-multi: + $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean + +## FIXME: this is probably broken. +all-recursive: all-multi +install-recursive: install-multi +mostlyclean-recursive: mostlyclean-multi +clean-recursive: clean-multi +distclean-recursive: distclean-multi +maintainer-clean-recursive: maintainer-clean-multi -- 2.43.5