automake-patches
[Top][All Lists]
Advanced

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

FYI: more doc about conditionals programs


From: Alexandre Duret-Lutz
Subject: FYI: more doc about conditionals programs
Date: Sun, 19 Jan 2003 16:18:45 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu)

I'm installing this on HEAD and branch-1-7.

2003-01-19  Alexandre Duret-Lutz  <address@hidden>

        * automake.texi (Conditional Programs): Show a sample Makefile.am.
        Remind $(EXEEXT) must be appended to configure substitutions.
        Show how Automake conditionals can be used instead.
        * tests/exeext.test (check_PROGRAMS): Make sure EXEEXT is also
        appended to conditionally defined programs.

Index: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.317
diff -u -r1.317 automake.texi
--- automake.texi       14 Jan 2003 07:26:21 -0000      1.317
+++ automake.texi       19 Jan 2003 15:15:51 -0000
@@ -2252,12 +2252,16 @@
 
 @node Conditional Programs,  , Conditional Sources, A Program
 @subsection Conditional compilation of programs
address@hidden Conditional programs
address@hidden Programs, conditional
 
-Sometimes it is useful to determine the programs that are to be built at
-configure time.  For instance, GNU @code{cpio} only builds @code{mt} and
address@hidden under special circumstances.
+Sometimes it is useful to determine the programs that are to be built
+at configure time.  For instance, GNU @code{cpio} only builds
address@hidden and @code{rmt} under special circumstances.  The means to
+achieve conditional compilation of programs are the same you can use
+to compile source files conditionally: substitutions or conditionals.
 
address@hidden EXTRA_PROGRAMS, defined
address@hidden Conditional programs using @code{configure} substitutions
 
 In this case, you must notify Automake of all the programs that can
 possibly be built, but at the same time cause the generated
@@ -2266,9 +2270,37 @@
 @samp{_PROGRAMS} definition, while listing all optionally built programs
 in @code{EXTRA_PROGRAMS}.
 @vindex EXTRA_PROGRAMS
address@hidden EXTRA_PROGRAMS, defined
+
address@hidden
+bin_PROGRAMS = cpio pax $(MT)
+libexec_PROGRAMS = $(RMT)
+EXTRA_PROGRAMS = mt rmt
address@hidden example
+
+As explained in @ref{EXEEXT}, Automake will rewrite
address@hidden, @code{libexec_PROGRAMS}, and
address@hidden, appending @code{$(EXEEXT)} to each binary.
+Obviously it cannot rewrite values obtained at run-time through
address@hidden substitutions, therefore you should take care of
+appending @code{$(EXEEXT)} yourself, as in @code{AC_SUBST([MT],
+['address@hidden@}'])}.
+
address@hidden Conditional programs using Automake conditionals
+
+You can also use Automake conditionals (@pxref{Conditionals}) to
+select programs to be built.  In this case you don't have to worry
+about @code{$(EXEEXT)} or @code{EXTRA_PROGRAMS}.
 
-Of course you can use Automake conditionals to determine the programs to
-be built.
address@hidden
+bin_PROGRAMS = cpio pax
+if WANT_MT
+  bin_PROGRAMS += mt
+endif
+if WANT_RMT
+  libexec_PROGRAMS = rmt
+endif
address@hidden example
 
 
 @node A Library, A Shared Library, A Program, Programs
Index: tests/exeext.test
===================================================================
RCS file: /cvs/automake/automake/tests/exeext.test,v
retrieving revision 1.2
diff -u -r1.2 exeext.test
--- tests/exeext.test   8 Sep 2002 13:07:55 -0000       1.2
+++ tests/exeext.test   19 Jan 2003 15:15:52 -0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -20,21 +20,30 @@
 
 # Test to make sure `.' in an exe name doesn't fool us.
 # Report from Robert Collins.
+# Also make sure we rewrite conditionals variables.
 
 . ./defs || exit 1
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_EXEEXT
+AM_CONDITIONAL([WANT_MT], [:])
+AM_CONDITIONAL([WANT_RMT], [:])
 END
 
 cat > Makefile.am << 'END'
 ## Use a different dir for each to make grep easy.
-bin_PROGRAMS = maude 
+bin_PROGRAMS = maude
 sbin_PROGRAMS = maude.static
 ## We don't define this one for now.  Probably it is an error.
 ## noinst_PROGRAMS = maude2.exe
 check_PROGRAMS = maude3$(EXEEXT)
+
+if WANT_MT
+  bin_PROGRAMS += mt
+endif
+if WANT_RMT
+  libexec_PROGRAMS = rmt
+endif
 END
 
 set -e
@@ -50,3 +59,9 @@
 
 grep '^maude3$(EXEEXT):' Makefile.in
 grep 'check_PROGRAMS =.*maude3$(EXEEXT)' Makefile.in
+
+grep '^mt$(EXEEXT):' Makefile.in
+grep '@address@hidden =.* mt$(EXEEXT)' Makefile.in
+
+grep '^rmt$(EXEEXT):' Makefile.in
+grep '@address@hidden =.*rmt$(EXEEXT)' Makefile.in

-- 
Alexandre Duret-Lutz





reply via email to

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