autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Support AC_CONFIG_LIBOBJ_DIR


From: Gary V. Vaughan
Subject: Re: [PATCH] Support AC_CONFIG_LIBOBJ_DIR
Date: Mon, 18 Apr 2005 19:05:07 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041103)

Hallo again,

It turns out that the automake patch is not enough :-(

Attached is an improved patch against automake-1.9.5 (applies to branch-1-9
and HEAD with fuzz).  When applied, if configure.ac declares
AC_CONFIG_LIBOBJ_DIR, then automake will look in that directory for
AC_LIBSOURCE declared files.  This allows us to have a single toplevel
Makefile.am, that builds a library in a subdirectory that contains
AC_LIBSOURCE source files.  Without the patch, automake ignores the
AC_CONFIG_LIBOBJ_DIR, and complains that AC_LIBSOURCEs cannot be found in the
top level project directory.

2005-04-18  Gary V. Vaughan  <address@hidden>

        * automake.in (config_libobj_dir): Either `.' or whatever directory is
        given to AC_CONFIG_LIBOBJ_DIR in configure.ac.
        (scan_autoconf_traces): Set config_libobj_dir.
        (require_libobj_with_macro): Use $config_libobj_dir when looking for
        LIBOBJs.
        (handle_LIBOBJS, handle_ALLOCA): Use it.

Also attached is a complementary patch against autoconf-2.59 (porting to HEAD
is trivial) which changes _AC_LIBOBJS_NORMALIZE to prepend the
AC_CONFIG_LIBOBJ_DIR subdirectory to each object named in LIBOBJS and
LTLIBOBJS, so that the substitutions into a toplevel Makefile set up as
described above will build and link the libobjs correctly.

2004-04-18  Gary V. Vaughan  <address@hidden>

        * lib/autoconf/general.m4 (_AC_LIBOBJS_NORMALIZE): Prepend each object
        named in LIBOBJS and LTLIBOBJS with the subdirectory declared by
        AC_CONFIG_LIBOBJ_DIR if any.

I can apply the autoconf patch if approved, but I have no write access to
automake CVS...

Cheers,
        Gary.
-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook
--- automake.in.orig    2005-02-12 10:06:56.000000000 +0000
+++ automake.in 2005-04-18 17:47:45.000000000 +0100
@@ -333,6 +333,10 @@
 # in Makefiles.
 my $am_config_aux_dir = '';
 
+# Directory to search for AC_LIBSOURCE file, as set by AC_CONFIG_LIBOBJ_DIR
+# in configure.ac.
+my $config_libobj_dir = '';
+
 # Whether AM_GNU_GETTEXT has been seen in configure.ac.
 my $seen_gettext = 0;
 # Whether AM_GNU_GETTEXT([external]) is used.
@@ -2067,7 +2071,7 @@
 
       if ($iter =~ /\.h$/)
        {
-         require_file_with_macro ($cond, $var, FOREIGN, $iter);
+         require_libobj_with_macro ($cond, $var, FOREIGN, $iter);
        }
       elsif ($iter ne 'alloca.c')
        {
@@ -2079,7 +2083,7 @@
          my $bs = var ('BUILT_SOURCES');
          if (! $bs || ! grep (/$rewrite/, $bs->value_as_list_recursive))
            {
-             require_file_with_macro ($cond, $var, FOREIGN, $iter);
+             require_libobj_with_macro ($cond, $var, FOREIGN, $iter);
            }
        }
     }
@@ -2092,7 +2096,7 @@
   $lt ||= '';
   $var->requires_variables ("address@hidden@ used", $lt . 'ALLOCA');
   $dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1;
-  require_file_with_macro ($cond, $var, FOREIGN, 'alloca.c');
+  require_libobj_with_macro ($cond, $var, FOREIGN, 'alloca.c');
   &saw_extension ('c');
 }
 
@@ -4636,6 +4640,7 @@
                AC_CONFIG_AUX_DIR => 1,
                AC_CONFIG_FILES => 1,
                AC_CONFIG_HEADERS => 1,
+               AC_CONFIG_LIBOBJ_DIR => 1,
                AC_CONFIG_LINKS => 1,
                AC_INIT => 0,
                AC_LIBSOURCE => 1,
@@ -4731,6 +4736,11 @@
              push @config_headers, $spec;
            }
        }
+      elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
+       {
+         $config_libobj_dir = $args[1];
+         check_directory ($config_libobj_dir, $where);
+       }
       elsif ($macro eq 'AC_CONFIG_LINKS')
        {
          foreach my $spec (split (' ', $args[1]))
@@ -6975,6 +6985,22 @@
     require_file ($macro->rdef ($cond)->location, $mystrict, @files);
 }
 
+# &require_libobj_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# -------------------------------------------------------------
+sub require_libobj_with_macro ($$$@)
+{
+    my ($cond, $macro, $mystrict, @files) = @_;
+    $macro = rvar ($macro) unless ref $macro;
+    if ($config_libobj_dir eq '')
+      {
+       require_file ($macro->rdef ($cond)->location, $mystrict, @files);
+      }
+    else
+      {
+       require_file_internal ($macro->rdef ($cond)->location, $mystrict,
+                              $config_libobj_dir, @files);
+      }
+}
 
 # &require_conf_file ($WHERE, $MYSTRICT, @FILES)
 # ----------------------------------------------
--- lib/autoconf/general.m4.orig        2003-10-27 11:10:56.000000000 +0000
+++ lib/autoconf/general.m4     2005-04-18 18:00:20.000000000 +0100
@@ -1,6 +1,6 @@
 # This file is part of Autoconf.                       -*- Autoconf -*-
 # Parameterized macros.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2005,
 # 2002, 2003, Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -2436,14 +2436,19 @@
 # _AC_LIBOBJS_NORMALIZE
 # ---------------------
 # Clean up LIBOBJS abd LTLIBOBJS so that they work with 1. ac_objext,
-# 2. Automake's ANSI2KNR, 3. Libtool, 4. combination of the three.
+# 2. AC_CONFIG_LIBOBJ_DIR, 3. Automake's ANSI2KNR, 4. Libtool,
+# 5. any combination of the above.
 # Used with AC_CONFIG_COMMANDS_PRE.
 AC_DEFUN([_AC_LIBOBJS_NORMALIZE],
 [ac_libobjs=
 ac_ltlibobjs=
+ac_libobj_dir=
+test "X${ac_config_libobj_dir-.}" != X. &&
+  ac_libobj_dir=`echo "$ac_config_libobj_dir/" | sed 's,/*$,/,'`
 for ac_i in : $LIB@&address@hidden; do test "x$ac_i" = x: && continue
-  # 1. Remove the extension, and $U if already installed.
-  ac_i=`echo "$ac_i" |
+  # 1. Prepend libobj directory if declared and remove the extension
+  #    and $U if already present.
+  ac_i="$ac_libobj_dir"`echo "$ac_i" |
         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
   # 2. Add them.
   ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]