Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/cats/~satr/GGAD/z69.html
Дата изменения: Wed Jul 12 23:54:36 2000
Дата индексирования: Mon Oct 1 23:59:24 2012
Кодировка:

Поисковые слова: planetary system
configure.in

configure.in

autoconf processes configure.in to produce a configure script. configure is a portable shell script which examines the build environment to determine which libraries are available, which features the platform has, where libraries and headers are located, and so on. Based on this information, it modifies compiler flags, generates makefiles, and/or outputs the file config.h with appropriate preprocessor symbols defined. Again, configure does not require autoconf to run; you generate it before distributing your software, so users do not have to have autoconf.

Your job is to write configure.in. The file is basically a series of m4 macros, which expand to snippets of shell script according to the parameters you pass them. You can also write shell code manually. Really understanding how to write a configure.in requires some knowledge of m4 (which is pretty simple) and some knowledge of the Bourne shell (which is a black art). Fortunately, you can cheat: start with an existing configure.in and modify it slightly to suit your application. There's also an extensive autoconf manual, which describes the many pre-written macros shipped with autoconf.

The GTK+ and Gnome developers have simplified things still further, by providing macros to locate GTK+ and Gnome on the user's system.

Here is a sample configure.in, from a Gnome version of "Hello, World":


AC_INIT(src/hello.c)

AM_CONFIG_HEADER(config.h)

AM_INIT_AUTOMAKE(GnomeHello, 0.1)

AM_MAINTAINER_MODE

AM_ACLOCAL_INCLUDE(macros)

GNOME_INIT

AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
AC_ARG_PROGRAM
AM_PROG_LIBTOOL

GNOME_COMPILE_WARNINGS

ALL_LINGUAS="da de es fr gl nl no pl ru sv fi uk"
AM_GNU_GETTEXT

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

AC_OUTPUT([
Makefile
macros/Makefile
src/Makefile
intl/Makefile
po/Makefile.in
pixmaps/Makefile
doc/Makefile
doc/C/Makefile
doc/es/Makefile
])




Before describing each macro, some general points should be made. First, those macros that begin with AC come with autoconf, and those that begin with AM usually come with automake. (This is useful when you're trying to find documentation for them.) The macros that begin with GNOME come in the Gnome macros directory. These macros are written in m4; the standard ones from autoconf/automake reside in /usr/share/aclocal, if you installed autoconf/automake under /usr. (An aside: the macros directory is not a good thing; each Gnome package should install its own m4 files to /usr/share/aclocal. Newer Gnome versions attempt to fix the problem.)

In the AC_OUTPUT stage, configure processes files containing variables marked with two @ symbols; for example, @PACKAGE@. It recognizes such variables only if AC_SUBST was used to "export" the variable (many of the pre-written macros discussed above use AC_SUBST to define variables). Most commonly, this features is used to convert a Makefile.in to a Makefile. Makefile.in is typically generated by automake from Makefile.am. (However, you can use autoconf without automake, and write Makefile.in yourself.)