[Top][All Lists]


Generating's for specific target platforms (os, cpu)

From: BRM
Subject: Generating's for specific target platforms (os, cpu)
Date: Wed, 14 Dec 2005 21:18:53 -0800 (PST)

Since no one else is chatting on the subject, I
thought I would go ahead and give my thoughts -
perhaps someone can see and correct them where they
are flawed, especially since I am new to the whole
autotool chainset.

I have a project that will need to be built for
different platforms (Windows, Unix, Linux, etc.) -
which is what autotools is aimed to accomplish (so far
as my understanding). I have autotools working, but
automake isn't cooperating with where I want to go. (I
am limited to the version numbers below because MSYS
won't compile & pass certain important tests for a
newer autoconf, so I can't build a newer automake. Any

In order to learn the Autotools I have been setting up
'hello world' test projects that demonstrate various
parts of the what I will need in my larger project. At
present, I need to be able to generate Makefiles
specific to the target system - by os and cpu. Thus I
have the following layout:

.\os\<os string>
.\arch\<arch string>

For my test project, I have <os string> = { mingw32,
linux } and <arch string> = { i386, i686, ppc }. If
all goes well, it should compile using mingw32 on
i686.  I can get aclocal and autoheaders to run, but
then the process dies on automake when it hits the
line in my file (for my third attempt at

AC_CONFIG_FILES([Makefile os/Makefile
os/${target_os}/Makefile arch/Makefile

(also if I replace AC_CONFIG_FILES with AC_OUTPUT). 
Automake simply doesn't like having ${target_os} or
${target_cpu} in the path, from what I can tell.
Autoconf doesn't seem to mind except that it will
complain that it can't find the at those
paths. So essentially, I get:

automake - complains and fails without generating the files at src/arch/${target_cpu} or

autoconf - complains that src/arch/i686/
doesn't exist or that src/os/mingw32/
doesn't exist. But otherwise seems okay. This should
be expected in automake didn't complete.

I have's in every directory, along with a
nearly identical (in my test project) source file that
needs to be compiled and linked in to the main
executable. I know I may not have everything quite
right in the to actually get it to build,
but I would think it should at least be making the's now.

Here's my

AC_COPYRIGHT([(c)2005 to see how it works])
AC_CONFIG_FILES([Makefile os/Makefile
os/${target_os}/Makefile arch/Makefile
# To overcome a shell script bug in the generated
# Makefile where '; fi' is missing.
if [ test -f Makefile ]; then
    if [ "$target_os" = "mingw32" ]; then
        patch -p1 Makefile Makefile.patch

The only difference I can tell between MSYS/MSYS DTK
and newer versions is that the MSYS DTK Automake won't
generate any warnings/errors, while Automake 1.9.5
(from Slackware 10.2) will generate the following
error: required file
`os/${target_os}/` not found required file
`os/${target_cpu}/` not found

Now that I think about it - even that error message is
weird since I'm running 'automake' not 'autoconf' so
it should be looking for not

Does automake understand the AC_CANONICAL_SYSTEM or
the macros that are with it? I get a bunch of
complaints about macros out of order if I put

Am I doing something wrong in my Is this
even possible with Automake? Are the directories
suppose to be 'optional'? I had thought of that, but I
must have at least one of the directories compile or
the build _will_ fail at the linker at the very least.

Any how...I am at a complete loss at how to solve this
issue. Any help is greatly appreciated.



reply via email to

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