Is there a macro to write an arbitrary file?

View: New views
3 Messages — Rating Filter:   Alert me  

Is there a macro to write an arbitrary file?

by Dr. David Kirkby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We have a makefile in a project, which works well. In the short term at
least, we do not want to use autoconf to create a makefile, but instead
use our own.

However, it would be nice to have a configure script at the top, which
at least supports --help and a few other things like that. But we do not
want it to create a makefile in the usual way.

Is it possible to create a configure.ac which sends it makefile to
/dev/null, and instead creates one we want.

Currently the first two lines of the makefile are:

all:
         cd spkg && ./install all 2>&1 | tee -a ../install.log


so would we create a configure script that has exactly that in it. A bit
like

echo "all:" > makefile
echo "cd spkg && ./install all 2>&1 | tee -a ../install.log" >> makefile
(I'm ignoring the fact some of this would need escaping)


Since a configure script is basically a shell script, I assume one could
just append one the end

rm rakefile
echo "all:" > makefile
echo "cd spkg && ./install all 2>&1 | tee -a ../install.log" >> makefile

etc

but if there is a neater way, using autoconf macros, that would be helpful.


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

Re: Is there a macro to write an arbitrary file?

by tip-bot for Mike Frysinger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 13 October 2009 21:13:29 Dr. David Kirkby wrote:
> We have a makefile in a project, which works well. In the short term at
> least, we do not want to use autoconf to create a makefile, but instead
> use our own.
>
> However, it would be nice to have a configure script at the top, which
> at least supports --help and a few other things like that. But we do not
> want it to create a makefile in the usual way.

autoconf isnt tied to any specific file (like "Makefile").  if you dont want
autoconf to create a file, dont list it as an output.

$ cat configure.ac
AC_INIT(foo)
$ autoconf
$ ./configure --help
        ....
-mike


_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf

signature.asc (853 bytes) Download Attachment

Re: Is there a macro to write an arbitrary file?

by Allan Clark-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Oct 14, 2009 at 02:13, Dr. David Kirkby <david.kirkby@...>wrote:

> We have a makefile in a project, which works well. In the short term at
> least, we do not want to use autoconf to create a makefile, but instead use
> our own.
>
> However, it would be nice to have a configure script at the top, which at
> least supports --help and a few other things like that. But we do not want
> it to create a makefile in the usual way.
>
> Is it possible to create a configure.ac which sends it makefile to
> /dev/null, and instead creates one we want.
>
> Currently the first two lines of the makefile are:
>
> all:
>        cd spkg && ./install all 2>&1 | tee -a ../install.log
>

Hi;

First, there's a split you're missing: autoconf makes the configure.ac part
and the xx.in --> xx (ie Makefile.in --> Makefile), automake makes the
Makefile.am -> Makefile.in part.

You could simply use autoconf as a you're thinking:

AC_INIT(myproject, 0.1)
AC_CANONICAL_HOST
AC_PROG_INSTALL
AC_PROG_MAKE_SET
...etc...
...etc...

AC_OUTPUT(Makefile)

... and hand-build your Makefile.in:

all:
       cd spkg && ./install all 2>&1 | tee -a ../install.log


... and simply add tokens as you find portability problems.  You may decide
a few years down-the-road to go with Automake for the portability it offers,
but not today.  Maybe next month you'll need to replace the "tee" command
with a AC_PROG([tee]) in configure.in and a TEE=@TEE@ in your Makefile.in.
 Who knows?

see also: two links of relatively unstructured replacement stuff:
http://www.gnu.org/software/hello/manual/autoconf/Setting-Output-Variables.html#Setting-Output-Variables
http://www.gnu.org/software/hello/manual/autoconf/Configuration-Files.html#Configuration-Files

Allan

--
allanc@...  "金鱼" http://linkedin.com/in/goldfish
please, no proprietary attachments (http://tinyurl.com/cbgq)
Sent from London, Eng, United Kingdom
_______________________________________________
Autoconf mailing list
Autoconf@...
http://lists.gnu.org/mailman/listinfo/autoconf