Debian Codegraph @

storage/maria/libmarias3/m4/ax_create_generic_config.m4

raw
1 # ============================================================================
2 # http://www.gnu.org/software/autoconf-archive/ax_create_generic_config.html
3 # ============================================================================
4 #
5 # SYNOPSIS
6 #
7 # AX_CREATE_GENERIC_CONFIG [(PACKAGEnlibs [, VERSION])]
8 #
9 # DESCRIPTION
10 #
11 # Creates a generic PACKAGE-config file that has all the things that you
12 # want, hmm, well, atleast it has --cflags, --version, --libs. Ahhm, did
13 # you see ax_path_generic in the autoconf-archive? ;-)
14 #
15 # this macros saves you all the typing for a pkg-config.in script, you
16 # don't even need to distribute one along. Place this macro in your
17 # configure.ac, et voila, you got one that you want to install.
18 #
19 # oh, btw, if the first arg looks like "mylib -lwhat' then it will go to
20 # be added to the --libs, and mylib is extracted.
21 #
22 # the defaults: $1 = $PACKAGE $LIBS $2 = $VERSION there is also an
23 # AC_SUBST(GENERIC_CONFIG) that will be set to the name of the file that
24 # we did output in this macro. Use as:
25 #
26 # install-exec-local: install-generic-config
27 #
28 # install-generic-config:
29 # $(mkinstalldirs) $(DESTDIR)$(bindir)
30 # $(INSTALL_SCRIPT) @GENERIC_CONFIG@ $(DESTDIR)$(bindir)
31 #
32 # LICENSE
33 #
34 # Copyright (c) 2008 Guido U. Draheim <[email protected]>
35 #
36 # This program is free software; you can redistribute it and/or modify it
37 # under the terms of the GNU General Public License as published by the
38 # Free Software Foundation; either version 3 of the License, or (at your
39 # option) any later version.
40 #
41 # This program is distributed in the hope that it will be useful, but
42 # WITHOUT ANY WARRANTY; without even the implied warranty of
43 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
44 # Public License for more details.
45 #
46 # You should have received a copy of the GNU General Public License along
47 # with this program. If not, see <http://www.gnu.org/licenses/>.
48 #
49 # As a special exception, the respective Autoconf Macro's copyright owner
50 # gives unlimited permission to copy, distribute and modify the configure
51 # scripts that are the output of Autoconf when processing the Macro. You
52 # need not follow the terms of the GNU General Public License when using
53 # or distributing such scripts, even though portions of the text of the
54 # Macro appear in them. The GNU General Public License (GPL) does govern
55 # all other use of the material that constitutes the Autoconf Macro.
56 #
57 # This special exception to the GPL applies to versions of the Autoconf
58 # Macro released by the Autoconf Archive. When you make and distribute a
59 # modified version of the Autoconf Macro, you may extend this special
60 # exception to the GPL to apply to your modified version as well.
61
62 #serial 6
63
64 AU_ALIAS([AC_CREATE_GENERIC_CONFIG], [AX_CREATE_GENERIC_CONFIG])
65 AC_DEFUN([AX_CREATE_GENERIC_CONFIG],[# create a generic PACKAGE-config file
66 L=`echo ifelse($1, , $PACKAGE $LIBS, $1)`
67 P=`echo $L | sed -e 's/ -.*//'`
68 P=`echo $P`
69 V=`echo ifelse($2, , $VERSION, $2)`
70 F=`echo $P-config`
71 L=`echo -l$L | sed -e 's/^-llib/-l/'`
72 AC_MSG_RESULT(creating $F - generic $V for $L)
73 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
74 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
75 echo '#! /bin/sh' >$F
76 echo ' ' >>$F
77 echo 'package="'$P'"' >>$F
78 echo 'version="'$V'"' >>$F
79 echo 'libs="'$L'"' >>$F
80 echo ' ' >>$F
81 # in the order of occurence a standard automake Makefile
82 echo 'prefix="'$prefix'"' >>$F
83 echo 'exec_prefix="'$exec_prefix'"' >>$F
84 echo 'bindir="'$bindir'"' >>$F
85 echo 'sbindir="'$sbindir'"' >>$F
86 echo 'libexecdir="'$libexecdir'"' >>$F
87 echo 'datadir="'$datadir'"' >>$F
88 echo 'sysconfdir="'$sysconfdir'"' >>$F
89 echo 'sharedstatedir="'$sharedstatedir'"' >>$F
90 echo 'localstatedir="'$localstatedir'"' >>$F
91 echo 'libdir="'$libdir'"' >>$F
92 echo 'infodir="'$infodir'"' >>$F
93 echo 'mandir="'$mandir'"' >>$F
94 echo 'includedir="'$includedir'"' >>$F
95 echo 'target="'$target'"' >>$F
96 echo 'host="'$host'"' >>$F
97 echo 'build="'$build'"' >>$F
98 echo ' ' >>$F
99 echo 'if test "'"\$""#"'" -eq 0; then' >>$F
100 echo ' cat <<EOF' >>$F
101 echo 'Usage: $package-config [OPTIONS]' >>$F
102 echo 'Options:' >>$F
103 echo ' --prefix[=DIR]) : \$prefix' >>$F
104 echo ' --package) : \$package' >>$F
105 echo ' --version) : \$version' >>$F
106 echo ' --cflags) : -I\$includedir' >>$F
107 echo ' --libs) : -L\$libdir -l\$package' >>$F
108 echo ' --help) print all the options (not just these)' >>$F
109 echo 'EOF' >>$F
110 echo 'fi' >>$F
111 echo ' ' >>$F
112 echo 'o=""' >>$F
113 echo 'h=""' >>$F
114 echo 'for i in "[$]@"; do' >>$F
115 echo ' case $i in' >>$F
116 echo ' --prefix=*) prefix=`echo $i | sed -e "s/--prefix=//"` ;;' >>$F
117 echo ' --prefix) o="$o $prefix" ;;' >>$F
118 echo ' --package) o="$o $package" ;;' >>$F
119 echo ' --version) o="$o $version" ;;' >>$F
120 echo ' --cflags) if test "_$includedir" != "_/usr/include"' >>$F
121 echo ' then o="$o -I$includedir" ; fi' >>$F
122 echo ' ;;' >>$F
123 echo ' --libs) o="$o -L$libdir $libs" ;;' >>$F
124 echo ' --exec_prefix|--eprefix) o="$o $exec_prefix" ;;' >>$F
125 echo ' --bindir) o="$o $bindir" ;;' >>$F
126 echo ' --sbindir) o="$o $sbindir" ;;' >>$F
127 echo ' --libexecdir) o="$o $libexecdir" ;;' >>$F
128 echo ' --datadir) o="$o $datadir" ;;' >>$F
129 echo ' --datainc) o="$o -I$datadir" ;;' >>$F
130 echo ' --datalib) o="$o -L$datadir" ;;' >>$F
131 echo ' --sysconfdir) o="$o $sysconfdir" ;;' >>$F
132 echo ' --sharedstatedir) o="$o $sharedstatedir" ;;' >>$F
133 echo ' --localstatedir) o="$o $localstatedir" ;;' >>$F
134 echo ' --libdir) o="$o $libdir" ;;' >>$F
135 echo ' --libadd) o="$o -L$libdir" ;;' >>$F
136 echo ' --infodir) o="$o $infodir" ;;' >>$F
137 echo ' --mandir) o="$o $mandir" ;;' >>$F
138 echo ' --target) o="$o $target" ;;' >>$F
139 echo ' --host) o="$o $host" ;;' >>$F
140 echo ' --build) o="$o $build" ;;' >>$F
141 echo ' --data) o="$o -I$datadir/$package" ;;' >>$F
142 echo ' --pkgdatadir) o="$o $datadir/$package" ;;' >>$F
143 echo ' --pkgdatainc) o="$o -I$datadir/$package" ;;' >>$F
144 echo ' --pkgdatalib) o="$o -L$datadir/$package" ;;' >>$F
145 echo ' --pkglibdir) o="$o $libdir/$package" ;;' >>$F
146 echo ' --pkglibinc) o="$o -I$libinc/$package" ;;' >>$F
147 echo ' --pkglibadd) o="$o -L$libadd/$package" ;;' >>$F
148 echo ' --pkgincludedir) o="$o $includedir/$package" ;;' >>$F
149 echo ' --help) h="1" ;;' >>$F
150 echo ' -?//*|-?/*//*|-?./*//*|//*|/*//*|./*//*) ' >>$F
151 echo ' v=`echo $i | sed -e s://:\$:g`' >>$F
152 echo ' v=`eval "echo $v"` ' >>$F
153 echo ' o="$o $v" ;; ' >>$F
154 echo ' esac' >>$F
155 echo 'done' >>$F
156 echo ' ' >>$F
157 echo 'o=`eval "echo $o"`' >>$F
158 echo 'o=`eval "echo $o"`' >>$F
159 echo 'eval "echo $o"' >>$F
160 echo ' ' >>$F
161 echo 'if test ! -z "$h" ; then ' >>$F
162 echo 'cat <<EOF' >>$F
163 echo ' --prefix=xxx) (what is that for anyway?)' >>$F
164 echo ' --prefix) \$prefix $prefix' >>$F
165 echo ' --package) \$package $package' >>$F
166 echo ' --version) \$version $version' >>$F
167 echo ' --cflags) -I\$includedir unless it is /usr/include' >>$F
168 echo ' --libs) -L\$libdir -l\$PACKAGE \$LIBS' >>$F
169 echo ' --exec_prefix) or... ' >>$F
170 echo ' --eprefix) \$exec_prefix $exec_prefix' >>$F
171 echo ' --bindir) \$bindir $bindir' >>$F
172 echo ' --sbindir) \$sbindir $sbindir' >>$F
173 echo ' --libexecdir) \$libexecdir $libexecdir' >>$F
174 echo ' --datadir) \$datadir $datadir' >>$F
175 echo ' --sysconfdir) \$sysconfdir $sysconfdir' >>$F
176 echo ' --sharedstatedir) \$sharedstatedir$sharedstatedir' >>$F
177 echo ' --localstatedir) \$localstatedir $localstatedir' >>$F
178 echo ' --libdir) \$libdir $libdir' >>$F
179 echo ' --infodir) \$infodir $infodir' >>$F
180 echo ' --mandir) \$mandir $mandir' >>$F
181 echo ' --target) \$target $target' >>$F
182 echo ' --host) \$host $host' >>$F
183 echo ' --build) \$build $build' >>$F
184 echo ' --data) -I\$datadir/\$package' >>$F
185 echo ' --pkgdatadir) \$datadir/\$package' >>$F
186 echo ' --pkglibdir) \$libdir/\$package' >>$F
187 echo ' --pkgincludedir) \$includedir/\$package' >>$F
188 echo ' --help) generated by ax_create_generic_config.m4' >>$F
189 echo ' -I//varname and other inc-targets like --pkgdatainc supported' >>$F
190 echo ' -L//varname and other lib-targets, e.g. --pkgdatalib or --libadd' >>$F
191 echo 'EOF' >>$F
192 echo 'fi' >>$F
193 GENERIC_CONFIG="$F"
194 AC_SUBST(GENERIC_CONFIG)
195 ])