automake
[Top][All Lists]
Advanced

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

Re: preferred directory layout


From: Tim Van Holder
Subject: Re: preferred directory layout
Date: Tue, 6 Mar 2001 22:03:55 +0100

I'm sure other people on this list will tell how this can or cannot
be achieved in an autotools-specific way, but you could
get what you want the same way you get your 'generic' sources to
behave.  In your 'foo.c' example, you could have a foo.c in your
'common' directory, which simply forwards to the correct file for
that build:

%% file starts here %%
/* foo.c - Forward to correct source for this platform */

#if defined (__system1__)
# include "system1/foo.c"
#elif defined (__system2__)
# include "system1/foo.c"
#else
# error I have no compatible version of foo.c for this platform.
#endif
%% file ends here %%

In this case, a layout of

./
  common.h
  common.c
  foo.h
  foo.c
./unix
  foo.c
./win32
  foo.c
./dos
  foo.c
./mac
  foo.c

may be more appropriate.

Alternatively, you could have configure copy <arch>/foo.c to
./foo.c based on the configured host platform.

%% file starts here %%
AC_INIT([myapp], [1.0], address@hidden)
AC_CONFIG_SRCDIR(common.c)

AC_CANONICAL_HOST

dnl blah

dnl <check if $host is a supported platform here>

dnl blah

AC_CONFIG_COMMANDS(foo.c, [
case "$host" in
  *-*-system1)
    cp $srcdir/system1/foo.c foo.c ;;
  *-*-system2)
    cp $srcdir/system2/foo.c foo.c ;;
esac],
[host="$host"])  #not sure if this last assignment is needed
%% file ends here %%




reply via email to

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