automake
[Top][All Lists]
Advanced

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

120-language-Name.patch


From: Akim Demaille
Subject: 120-language-Name.patch
Date: Sun, 01 Apr 2001 21:58:17 +0200

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * automake.in (Language): Add attributes `Name' and `config_vars'.
        (&finish): Work properly if there is no _finish.
        (Automake): Register language Names and AC_SUBST dependencies.
        Register Fortran 77 variables upon which ratfor and ppf77 depend.
        (&handle_languages): Once per language, invoke
        `define_linker_variables', and check its config_vars.
        (&lang_cxx_finish, &lang_f77_finish, &lang_objc_finish)
        (&lang_java_finish): Remove.
        (&lang_ppf77_finish, &lang_ratfor_finish): Adjust.
        
        
Index: automake.in
--- automake.in Sun, 01 Apr 2001 22:28:39 +0200 akim (am/f/39_automake.i 1.255 
755)
+++ automake.in Sun, 01 Apr 2001 22:52:29 +0200 akim (am/f/39_automake.i 1.255 
755)
@@ -30,9 +30,19 @@
 package Language;
 use Class::Struct2;
 struct (# Short name of the language (c, f77...).
-        'name'       => '$',
+        'name' => '$',
+        # Nice name of the language (C, Fortran 77...).
+        'Name' => '$',
+
+       # List of configure variables which must be defined.
+       'config_vars' => '@',
 
         'ansi'    => '$',
+       # `pure' is `1' or `'.  A `pure' language is one where, if
+       # all the files in a directory are of that language, then we
+       # do not require the C compiler or any code to call it.
+       'pure'   => '$',
+
        'autodep' => '$',
 
        # Name of the compiling variable (COMPILE).
@@ -57,17 +67,16 @@
 
         # Flag to specify the output file (-o).
         'output_flag' => '$',
-       # `pure' is `1' or `'.  A `pure' language is one where, if
-       # all the files in a directory are of that language, then we
-       # do not require the C compiler or any code to call it.
-       'pure'   => '$',
         '_finish' => '$');
 
 
 sub finish ($)
 {
   my ($self) = @_;
-  &{$self->_finish} ();
+  if (defined $self->_finish)
+    {
+      &{$self->_finish} ();
+    }
 }
 
 
@@ -753,6 +762,8 @@ sub initialize_per_input ()
 
 # C.
 register_language ('name' => 'c',
+                  'Name' => 'C',
+                  'config_vars' => ['CC'],
                   'ansi' => 1,
                   'autodep' => '',
                   'flags' => 'CFLAGS',
@@ -768,6 +779,8 @@ sub initialize_per_input ()
 
 # C++.
 register_language ('name' => 'cxx',
+                  'Name' => 'C++',
+                  'config_vars' => ['CXX'],
                   'linker' => 'CXXLINK',
                   'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
                   'autodep' => 'CXX',
@@ -779,10 +792,11 @@ sub initialize_per_input ()
                   'lder' => 'CXXLD',
                   'ld' => '$(CXX)',
                   'pure' => 1,
-                  'extensions' => ['c++', 'cc', 'cpp', 'cxx', 'C'],
-                  '_finish' => \&lang_cxx_finish);
+                  'extensions' => ['c++', 'cc', 'cpp', 'cxx', 'C']);
 # Objective C.
 register_language ('name' => 'objc',
+                  'Name' => 'Objective C',
+                  'config_vars' => ['OBJC'],
                   'linker' => 'OBJCLINK',
                   'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) 
$(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'autodep' => 'OBJC',
@@ -794,11 +808,11 @@ sub initialize_per_input ()
                   'lder' => 'OBJCLD',
                   'ld' => '$(OBJC)',
                   'pure' => 1,
-                  'extensions' => ['m'],
-                  '_finish' => \&lang_objc_finish);
+                  'extensions' => ['m']);
 
 # Headers.
 register_language ('name' => 'header',
+                  'Name' => 'Header',
                   'extensions' => ['h', 'H', 'hxx', 'h++', 'hh', 'hpp', 'inc'],
                   # Nothing to do.
                   '_finish' => sub { });
@@ -807,11 +821,13 @@ sub initialize_per_input ()
 
 # Yacc (C & C++).
 register_language ('name' => 'yacc',
+                  'Name' => 'Yacc',
                   'ansi' => 1,
                   'derived_autodep' => 'yes',
                   'extensions' => ['y'],
                   '_finish' => \&lang_yacc_finish);
 register_language ('name' => 'yaccxx',
+                  'Name' => 'Yacc (C++)',
                   'linker' => 'CXXLINK',
                   'derived_autodep' => 'yes',
                   'extensions' => ['y++', 'yy', 'yxx', 'ypp'],
@@ -819,11 +835,13 @@ sub initialize_per_input ()
 
 # Lex (C & C++).
 register_language ('name' => 'lex',
+                  'Name' => 'Lex',
                   'ansi' => 1,
                   'derived_autodep' => 'yes',
                   'extensions' => ['l'],
                   '_finish' => \&lang_lex_finish);
 register_language ('name' => 'lexxx',
+                  'Name' => 'Lex (C++)',
                   'linker' => 'CXXLINK',
                   'derived_autodep' => 'yes',
                   'extensions' => ['l++', 'll', 'lxx', 'lpp'],
@@ -831,6 +849,7 @@ sub initialize_per_input ()
 
 # Assembler.
 register_language ('name' => 'asm',
+                  'Name' => 'Assembler',
                   'flags' => 'CFLAGS',
                   # FIXME: asmflags?
                   'compile' => '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
@@ -843,6 +862,7 @@ sub initialize_per_input ()
 
 # Fortran 77
 register_language ('name' => 'f77',
+                  'Name' => 'Fortran 77',
                   'linker' => 'F77LINK',
                   'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
                   'flags' => 'FFLAGS',
@@ -853,15 +873,32 @@ sub initialize_per_input ()
                   'lder' => 'F77LD',
                   'ld' => '$(F77)',
                   'pure' => 1,
-                  'extensions' => ['f', 'for', 'f90'],
-                  '_finish' => \&lang_f77_finish);
+                  'extensions' => ['f', 'for', 'f90']);
 
-# Preprocessed Fortran 77.
+# Preprocessed Fortran 77
+#
+# The current support for preprocessing Fortran 77 just involves passing
+# `$(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)' as additional flags
+# to the Fortran 77 compiler, since this is how GNU Make does it; see
+# the `GNU Make Manual, Edition 0.51 for `make' Version 3.76 Beta'
+# (specifically, from info file `(make)Catalogue of Rules').
+#
+# A better approach would be to write an Autoconf test
+# (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all
+# Fortran 77 compilers know how to do preprocessing.  The Autoconf macro
+# AC_PROG_FPP should test the Fortran 77 compiler first for
+# preprocessing capabilities, and then fall back on cpp (if cpp were
+# available).
 register_language ('name' => 'ppf77',
+                  'Name' => 'Preprocessed Fortran 77',
+                  'config_vars' => ['F77'],
                   'linker' => 'F77LINK',
+                  'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
+                  'lder' => 'F77LD',
+                  'ld' => '$(F77)',
                   'flags' => 'FFLAGS',
-                  'compile' => '$(F77) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
                   'compiler' => 'PPF77COMPILE',
+                  'compile' => '$(F77) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
                   'pure' => 1,
@@ -870,7 +907,12 @@ sub initialize_per_input ()
 
 # Ratfor.
 register_language ('name' => 'ratfor',
+                  'Name' => 'Ratfor',
+                  'config_vars' => ['F77'],
                   'linker' => 'F77LINK',
+                  'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
+                  'lder' => 'F77LD',
+                  'ld' => '$(F77)',
                   'flags' => 'RFLAGS',
                   # FIXME also FFLAGS.
                   'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) 
$(RFLAGS)',
@@ -885,6 +927,8 @@ sub initialize_per_input ()
 # FIXME: for now we can't do dependency tracking for Java.
 # autodep=GCJ
 register_language ('name' => 'java',
+                  'Name' => 'Java',
+                  'config_vars' => ['GCJ'],
                   'linker' => 'GCJLINK',
                   'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS) -o $@',
                   'flags' => 'GCJFLAGS',
@@ -895,8 +939,7 @@ sub initialize_per_input ()
                   'lder' => 'GCJLD',
                   'ld' => '$(GCJ)',
                   'pure' => 1,
-                  'extensions' => ['java', 'class', 'zip', 'jar'],
-                  '_finish' => \&lang_java_finish);
+                  'extensions' => ['java', 'class', 'zip', 'jar']);
 
 ################################################################
 
@@ -1508,6 +1551,19 @@ sub handle_languages
        define_compiler_variable ($lang)
          if ($lang->compile);
 
+       define_linker_variable ($lang)
+         if ($lang->link);
+
+       foreach my $var (@{$lang->config_vars})
+         {
+           if (!exists $configure_vars{$var})
+             {
+               am_error ($lang->Name
+                         . " source seen but `$var' not defined in"
+                         . " `$configure_ac'");
+             }
+         }
+
        # The compiler's flag must be a configure variable.
        define_configure_variable ($lang->flags)
          if (defined $lang->flags);
@@ -4791,16 +4847,6 @@ sub lang_c_finish
     }
 }
 
-sub lang_cxx_finish
-{
-    define_linker_variable ($languages{'cxx'});
-
-    if (! defined $configure_vars{'CXX'})
-    {
-       &am_error ("C++ source seen but `CXX' not defined in `$configure_ac'");
-    }
-}
-
 # This is a helper for both lex and yacc.
 sub yacc_lex_finish_helper
 {
@@ -4924,37 +4970,8 @@ sub lang_lex_finish
 }
 
 
-sub lang_f77_finish
-{
-    # FIXME: this function can be called more than once.  We should
-    # arrange for it to only do anything the first time through.
-
-    define_linker_variable ($languages{'f77'});
-
-    if (! defined $configure_vars{'F77'})
-    {
-       &am_error ("Fortran 77 source seen but `F77' not defined in 
`$configure_ac'");
-    }
-}
-
-# Preprocessed Fortran 77
-#
-# The current support for preprocessing Fortran 77 just involves passing
-# `$(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)' as additional flags
-# to the Fortran 77 compiler, since this is how GNU Make does it; see
-# the `GNU Make Manual, Edition 0.51 for `make' Version 3.76 Beta'
-# (specifically, from info file `(make)Catalogue of Rules').
-#
-# A better approach would be to write an Autoconf test
-# (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all
-# Fortran 77 compilers know how to do preprocessing.  The Autoconf macro
-# AC_PROG_FPP should test the Fortran 77 compiler first for
-# preprocessing capabilities, and then fall back on cpp (if cpp were
-# available).
 sub lang_ppf77_finish
 {
-    &lang_f77_finish;
-
     # We also handle the case of preprocessing `.F' files into `.f'
     # files.
     $output_rules .= (".F.f:\n"
@@ -4963,32 +4980,10 @@ sub lang_ppf77_finish
 
 sub lang_ratfor_finish
 {
-    &lang_f77_finish;
-
     # We also handle the case of preprocessing `.r' files into `.f'
     # files.
     $output_rules .= (".r.f:\n"
                      . "\t\$(RCOMPILE) -F \$<\n");
-}
-
-sub lang_objc_finish
-{
-    define_linker_variable ($languages{'objc'});
-
-    if (! defined $configure_vars{'OBJC'})
-    {
-       &am_error ("Objective C source seen but `OBJC' not defined in 
`$configure_ac'");
-    }
-}
-
-sub lang_java_finish
-{
-    define_linker_variable ($languages{'java'});
-
-    if (! defined $configure_vars{'GCJ'})
-    {
-       &am_error ("Java source seen but `GCJ' not defined in `$configure_ac'");
-    }
 }
 
 



reply via email to

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