1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: ac_config_pkgconfig_in
</title>
<link rel="stylesheet" type="text/css" href="ac-archive.css">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:50%;" align="center">
<a href=
"http://autoconf-archive.cryp.to/ac_config_pkgconfig_in.m4">Download M4
Source</a>
</td>
<td style="width:50%;" align="center">
<a href="macros-by-category.html">Macro Index Page</a>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
ac_config_pkgconfig_in
</h1>
<h2>
Obsolete Macro
</h2>
<p class="indent">
Deprecated with the advent of pkg-config.
</p>
<h2>
Synopsis
</h2>
<p class="indent" style="white-space:nowrap;">
<code>AC_CONFIG_PKGCONFIG_IN [(LIBRARY [, DESCRIPTION [,
DESTINATION]])]</code>
</p>
<h2>
Description
</h2>
<div class="indent">
<p>
Creates a custom pkg-config script. The script supports --cflags, --libs
and --version options.
</p>
<p>
This macro saves you all the typing for a pkg-config.in script; you don't
even need to distribute one along. Place this macro in your configure.ac,
et voila, you got one that you want to install.
</p>
<p>
The options:
</p>
<pre>
$1 = LIBRARY e.g. gtk, ncurses
$2 = DESCRIPTION one line description of library
$3 = DESTINATION directory path, e.g. src/scripts
</pre>
<p>
It is suggested that the following CFLAGS and LIBS variables are used in
your configure.ac. library_libs is *essential*. library_cflags is
important, but not always needed. If they do not exist, defaults will be
taken from LIBRARY_CFLAGS, LIBRARY_LIBS (should be -llibrary *only*) and
LIBRARY_LIBDEPS (-l options for libraries your library depends upon.
LIBLIBRARY_LIBS is simply $LIBRARY_LIBS $LIBRARY_LIBDEPS. NB. LIBRARY and
library are the name of your library, in upper and lower case repectively
e.g. GTK, gtk.
</p>
<pre>
LIBRARY_CFLAGS: cflags for compiling libraries and example progs
LIBRARY_LIBS: libraries for linking programs
LIBRARY_LIBDEPS*: libraries for linking libraries against (needed
to link -static
LIBRARY_REQUIRES: packages required by your library
LIBRARY_CONFLICTS: packages to conflict with your library
library_cflags*: cflags to store in library-config
library_libs*: libs to store in library-config
LIBLIBRARY_LIBS: libs to link programs IN THIS PACKAGE ONLY against
LIBRARY_VERSION*: the version of your library (x.y.z recommended)
*=required if you want sensible output, otherwise they will be
*guessed* (DWIM, but usually correct)
</pre>
<p>
There is also an AC_SUBST(LIBRARY_PKGCONFIG) that will be set to the name
of the file that we output in this macro. Use as:
</p>
<pre>
install-data-local: install-pkgconfig
install-pkgconfig:
$(mkinstalldirs) $(DESTDIR)$(bindir)
$(INSTALL_DATA) @LIBRARY_PKGCONFIG@ $(DESTDIR)$(prefix)/lib/pkgconfig
</pre>
<p>
Or, if using automake:
</p>
<pre>
pkgconfigdatadir = $(prefix)/lib/pkgconfig
pkgconfigdata_DATA = gimpprint.pc = @LIBRARY_PKGCONFIG@
</pre>
<p>
Example usage:
</p>
<pre>
GIMPPPRINT_LIBS="-lgimpprint"
AC_CHECK_LIB(m,pow,
GIMPPRINT_DEPLIBS="${GIMPPRINT_DEPLIBS} -lm")
AC_CONFIG_PKGCONFIG_IN([gimpprint], [GIMP Print Top Quality Printer Drivers], [src/main])
</pre>
</div>
<h2>
Author
</h2>
<p class="indent">
Roger Leigh <roger@whinlatter.uklinux.net>
</p>
<h2>
Last Modified
</h2>
<p class="indent">
2005-01-23
</p>
<h2>
M4 Source Code
</h2>
<div class="indent">
<pre class="m4source">
## AC_CONFIG_PKGCONFIG_IN(LIBRARY, DESCRIPTION, DESTINATION)
## ---------------------------------------------------------
## Create a custom pkg-config script for LIBRARY. Include a one-line
## DESCRIPTION. The script will be created in a DESTINATION
## directory.
AC_DEFUN([AC_CONFIG_PKGCONFIG_IN],
[# create a custom pkg-config file ($1.pc.in)
m4_pushdef([PKGCONFIG_DIR], [m4_if([$3], , , [$3/])])
PKGCONFIG_FILE="PKGCONFIG_DIR[]$1.pc.in"
AC_SUBST(target)dnl
AC_SUBST(host)dnl
AC_SUBST(build)dnl
dnl create directory if it does not preexist
m4_if([$3], , , [AS_MKDIR_P([$3])])
AC_MSG_NOTICE([creating $PKGCONFIG_FILE])
dnl we're going to need uppercase, lowercase and user-friendly versions of the
dnl string `MODULE'
m4_pushdef([MODULE_UP], m4_translit([$1], [a-z], [A-Z]))dnl
m4_pushdef([MODULE_DOWN], m4_translit([$1], [A-Z], [a-z]))dnl
if test -z "$MODULE_DOWN[]_cflags" ; then
if test -n "$MODULE_UP[]_CFLAGS" ; then
MODULE_DOWN[]_cflags="$MODULE_UP[]_CFLAGS"
else
dnl AC_MSG_WARN([variable `MODULE_DOWN[]_cflags' undefined])
MODULE_DOWN[]_cflags=''
fi
fi
AC_SUBST(MODULE_DOWN[]_cflags)dnl
if test -z "$MODULE_DOWN[]_libs" ; then
if test -n "$MODULE_UP[]_LIBS" ; then
MODULE_DOWN[]_libs="$MODULE_UP[]_LIBS"
else
AC_MSG_WARN([variable `MODULE_DOWN[]_libs' and `MODULE_UP[]_LIBS' undefined])
MODULE_DOWN[]_libs='-l$1'
fi
if test -n "$MODULE_UP[]_LIBDEPS" ; then
MODULE_DOWN[]_libs="$MODULE_DOWN[]_libs $MODULE_UP[]_LIBDEPS"
fi
fi
AC_SUBST(MODULE_DOWN[]_libs)dnl
AC_SUBST(MODULE_UP[]_REQUIRES)
AC_SUBST(MODULE_UP[]_CONFLICTS)
if test -z "$MODULE_UP[]_VERSION" ; then
AC_MSG_WARN([variable `MODULE_UP[]_VERSION' undefined])
MODULE_UP[]_VERSION="$VERSION"
fi
AC_SUBST(MODULE_UP[]_VERSION)dnl
echo 'prefix=@prefix@' >$PKGCONFIG_FILE
echo 'exec_prefix=@exec_prefix@' >>$PKGCONFIG_FILE
echo 'libdir=@libdir@' >>$PKGCONFIG_FILE
echo 'includedir=@includedir@' >>$PKGCONFIG_FILE
echo '' >>$PKGCONFIG_FILE
echo 'Name: @PACKAGE@' >>$PKGCONFIG_FILE
echo 'Description: $2' >>$PKGCONFIG_FILE
if test -n "$MODULE_UP[]_REQUIRES" ; then
echo 'Requires: @MODULE_UP[]_REQUIRES@' >>$PKGCONFIG_FILE
fi
if test -n "$MODULE_UP[]_CONFLICTS" ; then
echo 'Conflicts: @MODULE_UP[]_CONFLICTS@' >>$PKGCONFIG_FILE
fi
echo 'Version: @VERSION@' >>$PKGCONFIG_FILE
echo 'Libs: -L${libdir} @MODULE_DOWN[]_libs@' >>$PKGCONFIG_FILE
echo 'Cflags: -I${includedir} @MODULE_DOWN[]_cflags@' >>$PKGCONFIG_FILE
m4_pushdef([PKGCONFIG_UP], [m4_translit([$1], [a-z], [A-Z])])dnl
PKGCONFIG_UP[]_PKGCONFIG="PKGCONFIG_DIR[]$1-config"
AC_SUBST(PKGCONFIG_UP[]_PKGCONFIG)
dnl AC_CONFIG_FILES(PKGCONFIG_DIR[]$1[-config], [chmod +x ]PKGCONFIG_DIR[]$1[-config])
m4_popdef([PKGCONFIG_UP])
m4_popdef([MODULE_DOWN])dnl
m4_popdef([MODULE_UP])dnl
m4_popdef([PKGCONFIG_DIR])dnl
])
</pre>
</div>
</body>
</html>
|