[Gllug] automake/autoconf

Stig Brautaset stigbrau at start.no
Tue Jun 25 16:31:15 UTC 2002


* Stig Brautaset <stigbrau at start.no> spake thus:
> * Nix <nix at esperi.demon.co.uk> spake thus:
> > On Mon, 24 Jun 2002, Stig Brautaset mused:
> > > I have been trying to use automake/autoconf for my program. I don't want
> > > to put data files/ config files in hardcoded paths. I thought it would
> > > be natural to have a macro that defined the standard data directory for
> > > the install so I could use this.
> > 
> > Yes, and it's called, um, `datadir' ;}. It's ${prefix}/share by default,
> > but site-config files may change it: your configure.in should not, and
> > while it may consult it, it should (as with all these path variables)
> > put off expansion as long as possible, so that `make install
> > datadir=...' works.
> 
> ACK, I evidently failed to communicate my problem.

This is what I want:

http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html

However, it does not seem to work on my system (Debian Woody,
up-to-date, with autoconf and automake drawn in from Sid). 

The output I get from running my bootstrap script is:
+ aclocal
+ autoheader
autoheader2.50: missing template: DATADIR
+ exit 1

The bootstrap script looks thus:
#!/bin/sh
set -x
aclocal && autoheader || exit 1
automake --add-missing --foreign || exit 1
autoconf --warnings=all || exit 1

Other info:

stig at arwen:~/work/pac$ locate bin/autoconf
/usr/bin/autoconf
/usr/bin/autoconf2.13
/usr/bin/autoconf2.50
/usr/bin/autoconf-wrapper

stig at arwen:~/work/pac$ autoconf --version
autoconf (GNU Autoconf) 2.53
Written by David J. MacKenzie and Akim Demaille.
[snip]

stig at arwen:~/work/pac$ automake --version
automake (GNU automake) 1.6.2
Written by Tom Tromey <tromey at redhat.com>.
[snip]

In case it is interesting, to anyone, here's my configure.in (don't
laugh, I am still trying to learn this stuff... ;)


dnl Process this file with autoconf to produce a configure script.
AC_INIT(pac, 0.2.1, stig at brautaset.org)
AC_CONFIG_SRCDIR(src/pac.c)		dnl my sources are here
AC_CONFIG_AUX_DIR(config)		dnl install-sh etc stored here

AM_CONFIG_HEADER(config/config.h)	dnl the name of the header file
AM_INIT_AUTOMAKE			dnl needs to come after above cruft
AM_MAINTAINER_MODE			dnl I'm a power user ;)

# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S

# libraries
AC_SEARCH_LIBS(can_change_color, ncurses curses,,
	       [echo "Error: (n)curses is required!" && exit 1])

AC_DEFINE_DIR(DATADIR, $datadir)

# header files
AC_HEADER_STDC
AC_CHECK_HEADERS(stdlib.h string.h unistd.h ncurses.h curses.h)

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([atexit strchr usleep])

# Create makefile
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT


Puh, that should be all, I think..

Stig
-- 
brautaset.org


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list