Hi! Ok for maint, or should the example be as simple as it can possible get even if portability is sacrificed?
Cheers, Peter >From 782f44dd4d3d42beb9d43ee0dd7cf46accc44731 Mon Sep 17 00:00:00 2001 From: Peter Rosin <p...@lysator.liu.se> Date: Thu, 5 Jan 2012 01:43:11 +0100 Subject: [PATCH] amhello: help compilers not supporting -c and -o together doc/amhello/configure.ac: Add AM_PROG_CC_C_O. doc/automake.texi (Hello World): Likewise. Also update the expected output from autoreconf and configure. Describe what AM_PROG_CC_C_O does in brief terms. doc/Makefile.am (amhello_configury): Add compile. --- doc/Makefile.am | 1 + doc/amhello/configure.ac | 1 + doc/automake.texi | 18 +++++++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index f4f76c6..0839d5f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -55,6 +55,7 @@ amhello_configury = \ aclocal.m4 \ autom4te.cache \ Makefile.in \ + compile \ config.h.in \ configure \ depcomp \ diff --git a/doc/amhello/configure.ac b/doc/amhello/configure.ac index cd378cb..5fef25f 100644 --- a/doc/amhello/configure.ac +++ b/doc/amhello/configure.ac @@ -5,6 +5,7 @@ AC_INIT([amhello], [1.0], [bug-autom...@gnu.org]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC +AM_PROG_CC_C_O AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ Makefile diff --git a/doc/automake.texi b/doc/automake.texi index 0c4dc01..3a08ee2 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -1470,6 +1470,7 @@ create the @command{configure} script. AC_INIT([amhello], [1.0], [@value{PACKAGE_BUGREPORT}]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC +AM_PROG_CC_C_O AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ Makefile @@ -1487,14 +1488,15 @@ command as follows: @example ~/amhello % @kbd{autoreconf --install} -configure.ac: installing `./install-sh' -configure.ac: installing `./missing' +configure.ac:4: installing `./compile' +configure.ac:2: installing `./install-sh' +configure.ac:2: installing `./missing' src/Makefile.am: installing `./depcomp' @end example At this point the build system is complete. -In addition to the three scripts mentioned in its output, you can see +In addition to the four scripts mentioned in its output, you can see that @command{autoreconf} created four other files: @file{configure}, @file{config.h.in}, @file{Makefile.in}, and @file{src/Makefile.in}. The latter three files are templates that will be adapted to the @@ -1509,16 +1511,17 @@ checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking for gcc... gcc -checking for C compiler default output file name... a.out checking whether the C compiler works... yes -checking whether we are cross compiling... no +checking for C compiler default output file name... a.out checking for suffix of executables... +checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 +checking whether gcc and cc understand -c and -o together... yes configure: creating ./config.status config.status: creating Makefile config.status: creating src/Makefile @@ -1577,6 +1580,7 @@ Let us begin with the contents of @file{configure.ac}. AC_INIT([amhello], [1.0], [@value{PACKAGE_BUGREPORT}]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC +AM_PROG_CC_C_O AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ Makefile @@ -1635,6 +1639,10 @@ creates @file{src/Makefile} from @file{src/Makefile.in}, it will define a @file{Makefile.in} that uses @code{CC} but @file{configure.ac} does not define it, it will suggest you add a call to @code{AC_PROG_CC}. +The @code{AM_PROG_CC_C_O} line triggers the help from the @command{compile} +script when the C compiler does not support the @option{-c} and +@option{-o} options together. + The @code{AC_CONFIG_HEADERS([config.h])} invocation causes the @command{configure} script to create a @file{config.h} file gathering @samp{#define}s defined by other macros in @file{configure.ac}. In our -- 1.7.5.1