automake
[Top][All Lists]
Advanced

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

[PATCH v2 1/3] AX_ADD_AM_MACRO_STATIC: Added a new macro and helpers.


From: Allan Caffee
Subject: [PATCH v2 1/3] AX_ADD_AM_MACRO_STATIC: Added a new macro and helpers.
Date: Wed, 4 Mar 2009 21:40:32 -0500
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

This new macro adds some text to the file aminclude_static.am when *Autoconf*
is run.  The current macro AX_ADD_AM_MACRO writes text to the file
`aminclude.am' when _configure_ is run.  Unfortunately this means that a) the
existing macro append Make code rather than Automake code as the name would
imply and b) only works for implementations of Make which allow includes, BSD
Make and GNU Make are the only ones that come to mind.

Hopefully this new macro will eventually replace the existing one altogether
because it allows Automake to do the actual work thereby offering more portable
Makefiles and pushing logic out of configure conditionals and into
AM_CONDITIONALs.  However, in an attempt to avoid breaking existing Autoconf
scripts those macros have been left unchanged for the time being.
---
 ax_ac_append_to_file.m4             |   33 +++++++++++++++++++++++
 ax_ac_print_to_file.m4              |   33 +++++++++++++++++++++++
 ax_add_am_macro.m4                  |    6 +++-
 ax_add_am_macro_static.m4           |   29 ++++++++++++++++++++
 ax_add_recursive_am_macro.m4        |    5 ++-
 ax_add_recursive_am_macro_static.m4 |   50 +++++++++++++++++++++++++++++++++++
 ax_am_macros.m4                     |    6 ++--
 ax_am_macros_static.m4              |   41 ++++++++++++++++++++++++++++
 8 files changed, 196 insertions(+), 7 deletions(-)
 create mode 100644 ax_ac_append_to_file.m4
 create mode 100644 ax_ac_print_to_file.m4
 create mode 100644 ax_add_am_macro_static.m4
 create mode 100644 ax_add_recursive_am_macro_static.m4
 create mode 100644 ax_am_macros_static.m4

diff --git a/ax_ac_append_to_file.m4 b/ax_ac_append_to_file.m4
new file mode 100644
index 0000000..cdde6e0
--- /dev/null
+++ b/ax_ac_append_to_file.m4
@@ -0,0 +1,33 @@
+# ===========================================================================
+#           http://autoconf-archive.cryp.to/ax_ac_append_to_file.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_AC_APPEND_TO_FILE([FILE],[DATA])
+#
+# DESCRIPTION
+#
+#   Appends the specified data to the specified Autoconf is run.  If you want
+#   to append to a file when configure is run use AX_APPEND_TO_FILE instead.
+#
+# LAST MODIFICATION
+#
+#   2009-02-03
+#
+# COPYLEFT
+#
+#   Copyright (c) 2009 Allan Caffee <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_AC_APPEND_TO_FILE],[
+AC_REQUIRE([AX_FILE_ESCAPES])
+m4_esyscmd(
+AX_FILE_ESCAPES
+[
+printf "$2" >> "$1"
+])
+])
diff --git a/ax_ac_print_to_file.m4 b/ax_ac_print_to_file.m4
new file mode 100644
index 0000000..ff96935
--- /dev/null
+++ b/ax_ac_print_to_file.m4
@@ -0,0 +1,33 @@
+# ===========================================================================
+#            http://autoconf-archive.cryp.to/ax_ac_print_to_file.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_AC_PRINT_TO_FILE([FILE],[DATA])
+#
+# DESCRIPTION
+#
+#   Writes the specified data to the specified file when Autoconf is is run.
+#   If you want to print to a file when configure is run use AX_PRINT_TO_FILE
+#   instead.
+#
+# LAST MODIFICATION
+#
+#   2009-02-06
+#
+# COPYLEFT
+#
+#   Copyright (c) 2009 Allan Caffee <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_AC_PRINT_TO_FILE],[
+m4_esyscmd(
+AC_REQUIRE([AX_FILE_ESCAPES])
+[
+printf "$2" > "$1"
+])
+])
diff --git a/ax_add_am_macro.m4 b/ax_add_am_macro.m4
index 6f8b5c8..f579143 100644
--- a/ax_add_am_macro.m4
+++ b/ax_add_am_macro.m4
@@ -8,11 +8,13 @@
 #
 # DESCRIPTION
 #
-#   Adds the specified rule to $AMINCLUDE
+#   Adds the specified rule to $AMINCLUDE.  This macro will only work properly
+#   with implementations of Make which allow include statements.  See also
+#   AX_ADD_AM_MACRO_STATIC.
 #
 # LAST MODIFICATION
 #
-#   2008-04-12
+#   2009-02-09
 #
 # COPYLEFT
 #
diff --git a/ax_add_am_macro_static.m4 b/ax_add_am_macro_static.m4
new file mode 100644
index 0000000..719b2ab
--- /dev/null
+++ b/ax_add_am_macro_static.m4
@@ -0,0 +1,29 @@
+# ===========================================================================
+#            http://autoconf-archive.cryp.to/ax_add_am_macro_static.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_ADD_AM_MACRO_STATIC([RULE])
+#
+# DESCRIPTION
+#
+#   Adds the specified rule to $AMINCLUDE
+#
+# LAST MODIFICATION
+#
+#   2009-02-08
+#
+# COPYLEFT
+#
+#   Copyright (c) 2008 Tom Howard <address@hidden>
+#   Copyright (c) 2009 Allan Caffee <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_ADD_AM_MACRO_STATIC],[
+  AC_REQUIRE([AX_AM_MACROS_STATIC])
+  AX_AC_APPEND_TO_FILE(AMINCLUDE_STATIC,[$1])
+])
diff --git a/ax_add_recursive_am_macro.m4 b/ax_add_recursive_am_macro.m4
index dabf155..705877f 100644
--- a/ax_add_recursive_am_macro.m4
+++ b/ax_add_recursive_am_macro.m4
@@ -10,11 +10,12 @@
 #
 #   Adds the specified rule to $AMINCLUDE along with a TARGET-recursive rule
 #   that will call TARGET for the current directory and TARGET-am
-#   recursively for each subdirectory
+#   recursively for each subdirectory.  See also
+#   AX_ADD_RECURSIVE_AM_MACRO_STATIC.
 #
 # LAST MODIFICATION
 #
-#   2008-04-12
+#   2009-02-09
 #
 # COPYLEFT
 #
diff --git a/ax_add_recursive_am_macro_static.m4 
b/ax_add_recursive_am_macro_static.m4
new file mode 100644
index 0000000..2054fc2
--- /dev/null
+++ b/ax_add_recursive_am_macro_static.m4
@@ -0,0 +1,50 @@
+# ===========================================================================
+#       http://autoconf-archive.cryp.to/ax_add_recursive_am_macro_static.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_ADD_RECURSIVE_AM_MACRO_STATIC([TARGET],[RULE])
+#
+# DESCRIPTION
+#
+#   Adds the specified rule to AMINCLUDE_STATIC along with a
+#   TARGET-recursive rule that will call TARGET for the current
+#   directory and TARGET-am recursively for each subdirectory.
+#
+# LAST MODIFICATION
+#
+#   2009-02-08
+#
+# COPYLEFT
+#
+#   Copyright (c) 2008 Tom Howard <address@hidden>
+#   Copyright (c) 2009 Allan Caffee <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_ADD_RECURSIVE_AM_MACRO_STATIC],[
+  AX_ADD_AM_MACRO_STATIC([
+$1-recursive:
+       @set fnord ${AX_DOLLAR}${AX_DOLLAR}MAKEFLAGS; 
amf=${AX_DOLLAR}${AX_DOLLAR}2; \\
+       dot_seen=no; \\
+       list='${AX_DOLLAR}(SUBDIRS)'; for subdir in 
${AX_DOLLAR}${AX_DOLLAR}list; do \\
+         echo \"Making $1 in ${AX_DOLLAR}${AX_DOLLAR}subdir\"; \\
+         if test \"${AX_DOLLAR}${AX_DOLLAR}subdir\" = \".\"; then \\
+           dot_seen=yes; \\
+           local_target=\"$1-am\"; \\
+         else \\
+           local_target=\"$1\"; \\
+         fi; \\
+         (cd ${AX_DOLLAR}${AX_DOLLAR}subdir && ${AX_DOLLAR}(MAKE) 
${AX_DOLLAR}(AM_MAKEFLAGS) ${AX_DOLLAR}${AX_DOLLAR}local_target) \\
+          || case \"${AX_DOLLAR}${AX_DOLLAR}amf\" in *=*) exit 1;; *k*) 
fail=yes;; *) exit 1;; esac; \\
+       done; \\
+       if test \"${AX_DOLLAR}${AX_DOLLAR}dot_seen\" = \"no\"; then \\
+         ${AX_DOLLAR}(MAKE) ${AX_DOLLAR}(AM_MAKEFLAGS) \"$1-am\" || exit 1; \\
+       fi; test -z \"${AX_DOLLAR}${AX_DOLLAR}fail\"
+
+$2
+])
+])
diff --git a/ax_am_macros.m4 b/ax_am_macros.m4
index 59468bf..e665a98 100644
--- a/ax_am_macros.m4
+++ b/ax_am_macros.m4
@@ -8,16 +8,16 @@
 #
 # DESCRIPTION
 #
-#   Adds support for macros that create automake rules. You must manually
+#   Adds support for macros that create Make rules. You must manually
 #   add the following line
 #
 #     @INC_AMINCLUDE@
 #
-#   to your Makefile.am files.
+#   to your Makefile.in (or Makefile.am if you use Automake) files.
 #
 # LAST MODIFICATION
 #
-#   2008-04-12
+#   2009-02-09
 #
 # COPYLEFT
 #
diff --git a/ax_am_macros_static.m4 b/ax_am_macros_static.m4
new file mode 100644
index 0000000..d3f8e37
--- /dev/null
+++ b/ax_am_macros_static.m4
@@ -0,0 +1,41 @@
+# ===========================================================================
+#              http://autoconf-archive.cryp.to/ax_am_macros_static.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_AM_MACROS_STATIC
+#
+# DESCRIPTION
+#
+#   Adds support for macros that create Automake rules. You must manually
+#   add the following line
+#
+#     include $(top_srcdir)/aminclude_static.am
+#
+#   to your Makefile.am files.
+#
+# LAST MODIFICATION
+#
+#   2009-02-08
+#
+# COPYLEFT
+#
+#   Copyright (c) 2008 Tom Howard <address@hidden>
+#   Copyright (c) 2009 Allan Caffee <address@hidden>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AMINCLUDE_STATIC],[aminclude_static.am])
+
+AC_DEFUN([AX_AM_MACROS_STATIC],
+[
+AMINCLUDE_TIME=`date`
+AX_AC_PRINT_TO_FILE(AMINCLUDE_STATIC,[
+# generated automatically by Autoconf from AX_AUTOMAKE_MACROS_STATIC
+# on $AMINCLUDE_TIME
+
+])
+])
-- 
1.5.4.3





reply via email to

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