Re: A GNU autotools question
From: Roger Leigh (${roger}_at_invalid.whinlatter.uklinux.net.invalid)
Date: 11/26/04
- Next message: Måns Rullgård: "Re: A GNU autotools question"
- Previous message: Heiko: "Re: A GNU autotools question"
- In reply to: Daniel Haude: "A GNU autotools question"
- Next in thread: Måns Rullgård: "Re: A GNU autotools question"
- Reply: Måns Rullgård: "Re: A GNU autotools question"
- Reply: Daniel Haude: "Re: A GNU autotools question"
- Reply: Daniel Haude: "Re: A GNU autotools question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 26 Nov 2004 16:15:40 +0000
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Daniel Haude <haude@kir.physnet.uni-hamburg.de> writes:
> Slooowly, sloowly I'm beginning to succeed in wrapping my head around GNU
> autotools. But there remain many very basic points I don't understand.
>
> I have a very small project called 'uc', consiting of a single-source ISO
> C program (uc.c), a data file (uc.dat), and a man page (uc.1). So after
> grappling with the autotools book for quite some time, this is what I came
> up with for configure.in (Makefile.am at the bottom if needed):
You are using an older version of autoconf/make. I've written the
updated syntax below. Also note the m4 quoting (`[' and `]')! You
should really upgrade to the latest versions if at all possible.
> ------------------------
> dnl Process this file with autoconf to produce a configure script.
> AC_INIT(uc.c)
AC_INIT([uc], [0.1.0], [uc-devel@some.where])
AC_PREREQ([2.59])
AC_CONFIG_SRCDIR([uc.c])
> AM_CONFIG_HEADER(config.h)
> AM_INIT_AUTOMAKE(uc, 1.0)
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
> AC_PROG_CC
> AC_OUTPUT(Makefile)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
> -----------------------
>
> Now my problem is the following: Obviously I need my program to know where
> the "make install" at the end-user's machine puts the data file, uc.dat
> (I've tried it; it ends up in /usr/local/share/uc/uc.dat which is fine). I
> guess this information should be put into config.h by configure, but it
> doesn't. All that gets #defined in config.h is the package name and the
> version.
dnl Set PACKAGE_DATA_DIR in config.h.
AH_TEMPLATE(PACKAGE_DATA_DIR,, [Package data directory])
if test "x${datadir}" = 'x${prefix}/share'; then
if test "x${prefix}" = "xNONE"; then
PACKAGE_DATA_DIR="${ac_default_prefix}/share/${PACKAGE}"
else
PACKAGE_DATA_DIR="${prefix}/share/${PACKAGE}"
fi
else
PACKAGE_DATA_DIR="${datadir}/${PACKAGE}"
fi
AC_DEFINE_UNQUOTED(PACKAGE_DATA_DIR, "${PACKAGE_DATA_DIR}")
[What MÃ¥ns suggested with AC_DEFINE is correct, but $pkgdatadir and
$datadir are only partially defined during the configure run, and the
above ensures that it is expanded as it would be if you were to take
it from config.status or after subsitution and expansion in a
Makefile.]
> (below: Makefile.am)
> ----------------------------------------------------
>
> ## Process this file with automake to produce Makefile.in
>
> AM_CFLAGS = -Wall -W -ansi -pedantic -g
These are compiler-specific; you might want to check GCC is in use
before substituting them in. The rest looks just fine, though.
Regards,
Roger
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iD8DBQFBp1arVcFcaSW/uEgRAroZAKDY5LS6qFJ5TWbHegmYEI5ycSls4ACgyuj7
sYdh4TUxwAJgQcGiZbgcRsE=
=ZFTM
-----END PGP SIGNATURE-----
- Next message: Måns Rullgård: "Re: A GNU autotools question"
- Previous message: Heiko: "Re: A GNU autotools question"
- In reply to: Daniel Haude: "A GNU autotools question"
- Next in thread: Måns Rullgård: "Re: A GNU autotools question"
- Reply: Måns Rullgård: "Re: A GNU autotools question"
- Reply: Daniel Haude: "Re: A GNU autotools question"
- Reply: Daniel Haude: "Re: A GNU autotools question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]