1 dnl acinclude.m4 generated automatically by ac-archive's acinclude 0.5.63
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 dnl ______ /usr/share/aclocal/guidod/ax_cflags_gcc_option.m4 ______
14 dnl @synopsis AX_CFLAGS_GCC_OPTION (optionflag [,[shellvar][,[A][,[NA]]])
16 dnl AX_CFLAGS_GCC_OPTION(-fvomit-frame) would show a message as like
17 dnl "checking CFLAGS for gcc -fvomit-frame ... yes" and adds
18 dnl the optionflag to CFLAGS if it is understood. You can override
19 dnl the shellvar-default of CFLAGS of course. The order of arguments
20 dnl stems from the explicit macros like AX_CFLAGS_WARN_ALL.
22 dnl The cousin AX_CXXFLAGS_GCC_OPTION would check for an option to add
23 dnl to CXXFLAGS - and it uses the autoconf setup for C++ instead of C
24 dnl (since it is possible to use different compilers for C and C++).
26 dnl The macro is a lot simpler than any special AX_CFLAGS_* macro (or
27 dnl ac_cxx_rtti.m4 macro) but allows to check for arbitrary options.
28 dnl However, if you use this macro in a few places, it would be great
29 dnl if you would make up a new function-macro and submit it to the
32 dnl - $1 option-to-check-for : required ("-option" as non-value)
33 dnl - $2 shell-variable-to-add-to : CFLAGS (or CXXFLAGS in the other case)
34 dnl - $3 action-if-found : add value to shellvariable
35 dnl - $4 action-if-not-found : nothing
37 dnl note: in earlier versions, $1-$2 were swapped. We try to detect the
38 dnl situation and accept a $2=~/-/ as being the old option-to-check-for.
40 dnl also: there are other variants that emerged from the original macro
41 dnl variant which did just test an option to be possibly added. However,
42 dnl some compilers accept an option silently, or possibly for just
43 dnl another option that was not intended. Therefore, we have to do a
44 dnl generic test for a compiler family. For gcc we check "-pedantic"
45 dnl being accepted which is also understood by compilers who just want
46 dnl to be compatible with gcc even when not being made from gcc sources.
49 dnl AX_CFLAGS_SUN_OPTION AX_CFLAGS_HPUX_OPTION
50 dnl AX_CFLAGS_AIX_OPTION AX_CFLAGS_IRIX_OPTION
52 dnl @, tested, experimental
53 dnl @version %Id: ax_cflags_gcc_option.m4,v 1.2 2003/10/28 23:57:38 guidod Exp %
54 dnl @author Guido Draheim <guidod@gmx.de>
56 AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
57 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
58 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
59 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
60 VAR,[VAR="no, unknown"
63 ac_save_[]FLAGS="$[]FLAGS"
65 in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
67 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
68 AC_TRY_COMPILE([],[return 0;],
69 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
71 FLAGS="$ac_save_[]FLAGS"
75 .ok|.ok,*) m4_ifvaln($3,$3) ;;
76 .|.no|.no,*) m4_ifvaln($4,$4) ;;
78 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
79 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
80 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
81 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
84 AS_VAR_POPDEF([VAR])dnl
85 AS_VAR_POPDEF([FLAGS])dnl
89 dnl the only difference - the LANG selection... and the default FLAGS
91 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
92 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
93 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
94 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
95 VAR,[VAR="no, unknown"
98 ac_save_[]FLAGS="$[]FLAGS"
100 in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
102 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
103 AC_TRY_COMPILE([],[return 0;],
104 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
106 FLAGS="$ac_save_[]FLAGS"
110 .ok|.ok,*) m4_ifvaln($3,$3) ;;
111 .|.no|.no,*) m4_ifvaln($4,$4) ;;
113 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
114 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
115 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
116 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
119 AS_VAR_POPDEF([VAR])dnl
120 AS_VAR_POPDEF([FLAGS])dnl
123 dnl -------------------------------------------------------------------------
125 AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
126 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
127 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
128 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
129 VAR,[VAR="no, unknown"
132 ac_save_[]FLAGS="$[]FLAGS"
134 in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
136 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
137 AC_TRY_COMPILE([],[return 0;],
138 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
140 FLAGS="$ac_save_[]FLAGS"
144 .ok|.ok,*) m4_ifvaln($3,$3) ;;
145 .|.no|.no,*) m4_ifvaln($4,$4) ;;
147 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
148 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
149 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
150 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
153 AS_VAR_POPDEF([VAR])dnl
154 AS_VAR_POPDEF([FLAGS])dnl
158 dnl the only difference - the LANG selection... and the default FLAGS
160 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
161 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
162 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
163 AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
164 VAR,[VAR="no, unknown"
167 ac_save_[]FLAGS="$[]FLAGS"
169 in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
171 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
172 AC_TRY_COMPILE([],[return 0;],
173 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
175 FLAGS="$ac_save_[]FLAGS"
179 .ok|.ok,*) m4_ifvaln($3,$3) ;;
180 .|.no|.no,*) m4_ifvaln($4,$4) ;;
182 if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
183 then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
184 else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
185 m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
188 AS_VAR_POPDEF([VAR])dnl
189 AS_VAR_POPDEF([FLAGS])dnl
192 AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
193 [AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])
195 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
196 [AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])
200 dnl ______ /usr/share/aclocal/C_Support/acx_restrict.m4 ______
201 dnl @synopsis ACX_C_RESTRICT
203 dnl This macro determines whether the C compiler supports the "restrict"
204 dnl keyword introduced in ANSI C99, or an equivalent. Does nothing if
205 dnl the compiler accepts the keyword. Otherwise, if the compiler supports
206 dnl an equivalent (like gcc's __restrict__) defines "restrict" to be that.
207 dnl Otherwise, defines "restrict" to be empty.
209 dnl @version %Id: acx_restrict.m4,v 1.1.1.1 2001/07/26 00:46:18 guidod Exp %
210 dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
212 AC_DEFUN([ACX_C_RESTRICT],
213 [AC_CACHE_CHECK([for C restrict keyword], acx_cv_c_restrict,
214 [acx_cv_c_restrict=unsupported
217 # Try the official restrict keyword, then gcc's __restrict__, then
218 # SGI's __restrict. __restrict has slightly different semantics than
219 # restrict (it's a bit stronger, in that __restrict pointers can't
220 # overlap even with non __restrict pointers), but I think it should be
221 # okay under the circumstances where restrict is normally used.
222 for acx_kw in restrict __restrict__ __restrict; do
223 AC_TRY_COMPILE([], [float * $acx_kw x;], [acx_cv_c_restrict=$acx_kw; break])
227 if test "$acx_cv_c_restrict" != "restrict"; then
228 acx_kw="$acx_cv_c_restrict"
229 if test "$acx_kw" = unsupported; then acx_kw=""; fi
230 AC_DEFINE_UNQUOTED(restrict, $acx_kw, [Define to equivalent of C99 restrict keyword, or to nothing if this is not supported. Do not define if restrict is supported directly.])
234 dnl ______ /usr/share/aclocal/guidod/patch_libtool_sys_lib_search_path_spec.m4 ______
235 dnl @* PATCH_LIBTOOL_SYS_LIB_SEARCH_PATH_SPEC
237 dnl Cross-compiling to win32 from a unix system reveals a bug - the
238 dnl path-separator has been set to ";" depending on the target system.
239 dnl However, the crossgcc search_path_spec works in a unix-environment
240 dnl with unix-style directories and unix-stylish path_separator. The
241 dnl result: the search_path_spec is a single word still containing the
244 dnl This macro fixes the situation: when we see the libtool PATH_SEP
245 dnl to be ":" and search_path_spec to contain ":" characters, then
246 dnl these are replaced with spaces to let the resulting string work
247 dnl as a for-loop argument in libtool scripts that resolve -no-undefined
250 dnl Later libtool generations have fixed the situation with using
251 dnl $PATH_SEPARATOR in the first place as the original path delimiter
252 dnl that will be scanned for and replaced into spaces.
255 dnl @%Id: patch_libtool_sys_lib_search_path_spec.m4,v 1.3 2003/03/23 13:20:27 guidod Exp %
257 AC_DEFUN([PATCH_LIBTOOL_SYS_LIB_SEARCH_PATH_SPEC],
258 [# patch libtool to fix sys_lib_search_path (e.g. crosscompiling a win32 dll)
259 if test "_$PATH_SEPARATOR" = "_:" ; then
260 if grep "^sys_lib_search_path_spec.*:" libtool >/dev/null ; then
261 AC_MSG_RESULT(patching libtool to fix sys_lib_search_path_spec)
262 test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
263 sed -e "/^sys_lib_search_path_spec/s/:/ /g" libtool >libtool.new
264 (test -s libtool.new || rm libtool.new) 2>/dev/null
265 test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
266 test -f libtool || mv libtool.old libtool
270 dnl ______ /usr/share/aclocal/guidod/ax_warning_default_aclocaldir.m4 ______
271 dnl @* AX_WARNING_DEFAULT_ACLOCALDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])]
272 dnl @* AX_ENABLE_DEFAULT_ACLOCALDIR [(dirvariable [,defsetting])]
274 dnl print a warning message if the $(datadir)/aclocal directory
275 dnl is not in the dirlist searched by the aclocal tool. This macro
276 dnl is useful if some `make install` would target $(datadir)/aclocal
277 dnl to install an autoconf m4 file of your project to be picked up
278 dnl by other projects.
280 dnl default $1 dirvariable = aclocaldir
281 dnl default $2 defsetting = ${datadir}/aclocal
282 dnl default $3 action = nothing to do
283 dnl default $4 action = warn the user about mismatch
285 dnl In the _WARNING_ variant, the defsetting is not placed in
286 dnl dirvariable nor is it ac_subst'ed in any way. The default
287 dnl fail-action $4 is to send a warning message to the user,
288 dnl and the default accept-action $3 is nothing. It is expected that
289 dnl a Makefile is generated with aclocaldir=${datadir}/aclocal
291 dnl The _ENABLE_ variant however will set not only the $aclocaldir shell
292 dnl var of the script, but it is also AC-SUBST'ed on default - and
293 dnl furthermore a configure option "--enable-default-aclocaldir" is
294 dnl provided. Only if that option is set then $2 default is not set to
295 dnl the canonic default in the a $prefix subpath but instead $2 default
296 dnl is set to the primary path where `aclocal` looks for macros. The
297 dnl user may also override the default on the command line.
300 dnl @%Id: ax_warning_default_aclocaldir.m4,v 1.1 2003/10/18 02:57:12 guidod Exp %
302 AC_DEFUN([AX_WARNING_DEFAULT_ACLOCALDIR],[dnl
303 AC_REQUIRE([AX_EXPAND_PREFIX])dnl
304 AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_dir])dnl
305 AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
306 AS_VAR_PUSHDEF([LOC],[ax_warning_default_aclocal_loc])dnl
307 LOC='m4_if([$2],,[${datadir}/aclocal],[$2])'
308 m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
309 if test ".$ACLOCAL" = "." ; then
310 AC_PATH_PROG([ACLOCAL],[aclocal],[:])
313 test ".$BIN" = "." && BIN="aclocal"
314 DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
315 test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
316 test ".$DIR" = "." && DIR="/tmp"
317 DIR=`eval "echo $DIR"` # we need to expand
318 DIR=`eval "echo $DIR"`
319 LOC=`eval "echo $LOC"`
320 LOC=`eval "echo $LOC"`
321 LOC=`eval "echo $LOC"`
322 LOC=`eval "echo $LOC"`
323 AC_RUN_LOG([: test "$LOC" = "$DIR"])
324 if test "$LOC" != "$DIR" ; then
325 if test -f "$DIR/dirlist" ; then
326 for DIR in `cat $DIR/dirlist` $DIR ; do
327 AC_RUN_LOG([: test "$LOC" = "$DIR"])
328 test "$LOC" = "$DIR" && break
331 if test "$LOC" != "$DIR" ; then
332 m4_ifval([$4],[$4],[dnl
333 AC_MSG_NOTICE([warning: m4_if([$1],,[aclocaldir],[$1])=$LOC dnl
335 AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[aclocaldir],[$1])=$DIR])
336 cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
337 aclocaldir: the m4_if([$1],,[default aclocaldir],[$1 value]) of $LOC
338 aclocaldir: is not listed in the dirlist where aclocal will look
339 aclocaldir: for macros - you can override the install-path using
340 aclocaldir: make install aclocaldir=$DIR
341 aclocaldir: or append the directory to aclocal reconfigures later as
342 aclocaldir: aclocal -I $LOC
343 aclocaldir: when an autoconf macro is needed from that directory
345 m4_ifvaln([$5],[$5])])dnl
346 m4_ifvaln([$3],[else $3])dnl
349 AS_VAR_POPDEF([LOC])dnl
350 AS_VAR_POPDEF([BIN])dnl
351 AS_VAR_POPDEF([DIR])dnl
354 AC_DEFUN([AX_ENABLE_DEFAULT_ACLOCALDIR],[dnl
355 AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
356 AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_def])dnl
357 AS_VAR_PUSHDEF([DEF],[ax_warning_default_aclocal_def])dnl
358 AC_ARG_ENABLE([enable-default-aclocaldir],
359 [ --enable-default-aclocaldir(=PATH) override the datadir/aclocal default])
360 test ".$enable_default_aclocaldir" = "." && enable_default_aclocaldir="no"
361 case ".$enable_default_aclocaldir" in
362 .no) DIR='m4_if([$2],,[${datadir}/aclocal],[$2])' ;;
364 if test ".$ACLOCAL" = "." ; then
365 AC_PATH_PROG([ACLOCAL],[aclocal],[:])
368 test ".$BIN" = "." && BIN="aclocal"
369 DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
370 test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
371 test ".$DIR" = "." && DIR="/tmp" ;;
372 *) DIR="$enable_default_aclocaldir" ;;
374 AX_WARNING_DEFAULT_ACLOCALDIR([$1],[$DEF],[$3],[$4],[$5])
375 m4_if([$1],,[aclocaldir],[$1])="$ax_warning_default_aclocal_dir"
376 AC_SUBST(m4_if([$1],,[aclocaldir],[$1]))
377 AS_VAR_POPDEF([DEF])dnl
378 AS_VAR_POPDEF([DIR])dnl
379 AS_VAR_POPDEF([BIN])dnl
382 dnl ______ /usr/share/aclocal/guidod/ax_cflags_warn_all.m4 ______
383 dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
385 dnl Try to find a compiler option that enables most reasonable warnings.
386 dnl This macro is directly derived from VL_PROG_CC_WARNINGS which is
387 dnl split up into two AX_CFLAGS_WARN_ALL and AX_CFLAGS_WARN_ALL_ANSI
389 dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic)
390 dnl The result is added to the shellvar being CFLAGS by default.
392 dnl Currently this macro knows about GCC, Solaris C compiler,
393 dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler,
394 dnl IRIX C compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90
395 dnl (Unicos 10.0.0.8) C compiler.
397 dnl - $1 shell-variable-to-add-to : CFLAGS
398 dnl - $2 add-value-if-not-found : nothing
399 dnl - $3 action-if-found : add value to shellvariable
400 dnl - $4 action-if-not-found : nothing
402 dnl @version %Id: ax_cflags_warn_all.m4,v 1.2 2003/10/12 14:56:07 guidod Exp %
403 dnl @author Guido Draheim <guidod@gmx.de>
405 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
406 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
407 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
408 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
409 VAR,[VAR="no, unknown"
412 ac_save_[]FLAGS="$[]FLAGS"
414 in "-pedantic % -Wall" dnl GCC
415 "-xstrconst % -v" dnl Solaris C
416 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
417 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
418 "-ansi -ansiE % -fullwarn" dnl IRIX
419 "+ESlit % +w1" dnl HP-UX C
420 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
421 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
423 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
424 AC_TRY_COMPILE([],[return 0;],
425 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
427 FLAGS="$ac_save_[]FLAGS"
431 .ok|.ok,*) m4_ifvaln($3,$3) ;;
432 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
433 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
434 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
436 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
437 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
438 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
439 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
442 AS_VAR_POPDEF([VAR])dnl
443 AS_VAR_POPDEF([FLAGS])dnl
446 dnl the only difference - the LANG selection... and the default FLAGS
448 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
449 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
450 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
451 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
452 VAR,[VAR="no, unknown"
455 ac_save_[]FLAGS="$[]FLAGS"
457 in "-pedantic % -Wall" dnl GCC
458 "-xstrconst % -v" dnl Solaris C
459 "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
460 "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
461 "-ansi -ansiE % -fullwarn" dnl IRIX
462 "+ESlit % +w1" dnl HP-UX C
463 "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
464 "-h conform % -h msglevel 2" dnl Cray C (Unicos)
466 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
467 AC_TRY_COMPILE([],[return 0;],
468 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
470 FLAGS="$ac_save_[]FLAGS"
474 .ok|.ok,*) m4_ifvaln($3,$3) ;;
475 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
476 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
477 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
479 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
480 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
481 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
482 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
485 AS_VAR_POPDEF([VAR])dnl
486 AS_VAR_POPDEF([FLAGS])dnl
489 dnl implementation tactics:
490 dnl the for-argument contains a list of options. The first part of
491 dnl these does only exist to detect the compiler - usually it is
492 dnl a global option to enable -ansi or -extrawarnings. All other
493 dnl compilers will fail about it. That was needed since a lot of
494 dnl compilers will give false positives for some option-syntax
495 dnl like -Woption or -Xoption as they think of it is a pass-through
496 dnl to later compile stages or something. The "%" is used as a
497 dnl delimimiter. A non-option comment can be given after "%%" marks.
500 dnl ______ /usr/share/aclocal/guidod/ax_cflags_strict_prototypes.m4 ______
501 dnl @synopsis AX_CFLAGS_STRICT_PROTOTYPES [(shellvar [,default, [A/NA]]
503 dnl Try to find a compiler option that requires strict prototypes.
505 dnl The sanity check is done by looking at sys/signal.h which has a set
506 dnl of macro-definitions SIG_DFL and SIG_IGN that are cast to the local
507 dnl signal-handler type. If that signal-handler type is not fully
508 dnl qualified then the system headers are not seen as strictly prototype clean.
510 dnl For the GNU CC compiler it will be -fstrict-prototypes -Wstrict-prototypes
511 dnl The result is added to the shellvar being CFLAGS by default.
515 dnl - $1 shell-variable-to-add-to : CFLAGS
516 dnl - $2 add-value-if-not-found : nothing
517 dnl - $3 action-if-found : add value to shellvariable
518 dnl - $4 action-if-not-found : nothing
520 dnl @version %Id: ax_cflags_strict_prototypes.m4,v 1.7 2003/06/05 00:52:22 guidod Exp %
521 dnl @author Guido Draheim <guidod@gmx.de>
523 AC_DEFUN([AX_CFLAGS_STRICT_PROTOTYPES],[dnl
524 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
525 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_strict_prototypes])dnl
526 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for strict prototypes],
527 VAR,[VAR="no, unknown"
530 ac_save_[]FLAGS="$[]FLAGS"
532 in "-Wall % -fstrict-prototypes -Wstrict-prototypes" dnl GCC
533 "-Wall % -Wstrict-prototypes" dnl try to warn atleast
535 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
536 AC_TRY_COMPILE([],[return 0;],
537 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
541 *) # sanity check with signal() from sys/signal.h
542 cp config.log config.tmp
543 AC_TRY_COMPILE([#include <signal.h>],[
544 if (signal (SIGINT, SIG_IGN) == SIG_DFL) return 1;
545 if (signal (SIGINT, SIG_IGN) != SIG_DFL) return 2;],
546 dnl the original did use test -n `$CC testprogram.c`
547 [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
548 then if test `diff config.log config.tmp | grep -i warning | wc -l` != 1
549 then VAR="no, suppressed, signal.h," ; fi ; fi],
550 [VAR="no, suppressed, signal.h"])
554 FLAGS="$ac_save_[]FLAGS"
558 .ok|.ok,*) m4_ifvaln($3,$3) ;;
559 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
560 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
561 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
563 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
564 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
565 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
566 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
569 AS_VAR_POPDEF([VAR])dnl
570 AS_VAR_POPDEF([FLAGS])dnl
573 dnl the only difference - the LANG selection... and the default FLAGS
575 AC_DEFUN([AX_CXXFLAGS_STRICT_PROTOTYPES],[dnl
576 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
577 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_strict_prototypes])dnl
578 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for strict prototypes],
579 VAR,[VAR="no, unknown"
582 ac_save_[]FLAGS="$[]FLAGS"
584 in "-Wall % -fstrict-prototypes -Wstrict-prototypes" dnl GCC
585 "-Wall % -Wstrict-prototypes" dnl try to warn atleast
587 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
588 AC_TRY_COMPILE([],[return 0;],
589 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
593 *) # sanity check with signal() from sys/signal.h
594 cp config.log config.tmp
595 AC_TRY_COMPILE([#include <signal.h>],[
596 if (signal (SIGINT, SIG_IGN) == SIG_DFL) return 1;
597 if (signal (SIGINT, SIG_IGN) != SIG_DFL) return 2;],
598 dnl the original did use test -n `$CC testprogram.c`
599 [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
600 then if test `diff config.log config.tmp | grep -i warning | wc -l` != 1
601 then VAR="no, suppressed, signal.h," ; fi ; fi],
602 [VAR="no, suppressed, signal.h"])
606 FLAGS="$ac_save_[]FLAGS"
610 .ok|.ok,*) m4_ifvaln($3,$3) ;;
611 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
612 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
613 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
615 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
616 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
617 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
618 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
621 AS_VAR_POPDEF([VAR])dnl
622 AS_VAR_POPDEF([FLAGS])dnl
625 dnl ______ /usr/share/aclocal/guidod/ax_spec_package_version.m4 ______
626 dnl @* AX_SPEC_PACKAGE_AND_VERSION ([specfile])
627 dnl @* AX_SPEC_PACKAGE_NAME ([shellvar],[defaultvalue])
628 dnl @* AX_SPEC_PACKAGE_VERSION ([shellvar],[defaultvalue])
629 dnl @* AX_SPEC_PACKAGE_SUMMARY ([shellvar],[defaultvalue])
630 dnl @* AX_SPEC_PACKAGE_LICENSE ([shellvar],[defaultvalue])
631 dnl @* AX_SPEC_PACKAGE_CATEGORY ([shellvar],[defaultvalue])
632 dnl @* AX_SPEC_PACKAGE_ICON ([shellvar],[defaultvalue])
633 dnl @* AX_SPEC_DEFAULTS([specfile])
635 dnl set PACKAGE from the given specfile - default to basename of
636 dnl the rpmspecfile if no "name:" could be found in the spec file.
638 dnl set VERSION from the given specfile - default to a date-derived
639 dnl value if no "version:" could be found in the spec file.
641 dnl this macro builds on top of AX_SPEC_FILE / AX_SPEC_EXTRACT
643 dnl more specific: if not "name:" or "%define name" was found in
644 dnl the myproject.spec file then the PACKAGE var is set to the
645 dnl basename "myproject". When no spec file was present then it
646 dnl will usually default to "TODO".
648 dnl The version spec looks for "version:" or "%define version" in
649 dnl the spec file. When no such value was seen or no spec file
650 dnl had been present then the value is set to `date +0.%y.%W%w`.
652 dnl the version value itself is sanitized somewhat with making
653 dnl it to always carry atleast three digits (1.2.3) and clensing
654 dnl superflous "0" chars around from generating numbers elsewhere.
656 dnl additional macros are provided that extract a specific value
657 dnl from the spec file, among these:
659 dnl set PACKAGE_SUMMARY from the given specfile - default to package and
660 dnl try to detect a type suffix if "summary:" was not in the spec file
662 dnl set PACKAGE_LICENSE from the given specfile - if no "license:" tag was
663 dnl given in the spec file then various COPYING files are grepped to
664 dnl have a guess and the final fallback will be GNU GPL (or GNU LGPL).
666 dnl set PACKAGE_ICON from the given specfile - if no "icon:" tag was
667 dnl given in the spec file then we default to $PACKAGE-icon.png
669 dnl the final AX_SPEC_INIT(specfile) will initialize all variables to
670 dnl its defaults according to the spec file given.
672 dnl @version %Id: ax_spec_package_version.m4,v 1.1 2003/10/18 23:38:41 guidod Exp %
673 dnl @author Guido Draheim <guidod@gmx.de>
675 AC_DEFUN([AX_SPEC_PACKAGE_LICENSE],[AC_REQUIRE([AX_SPEC_FILE])dnl
676 AS_VAR_PUSHDEF([VAR],[PACKAGE_LICENSE])dnl
677 AC_MSG_CHECKING([for spec license type])
678 if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
681 AX_SPEC_EXTRACT(VAR,[license],m4_ifval($1,$1))
682 VAR=`echo $VAR | sed -e 's/ *License//g'`
684 test ".$VAR" = "." && k="(fallback)"
685 ifelse($2,,[dnl here the defaults for LICENSE / COPYRIGHT
686 if test ".$VAR" = "." ; then
687 for ac_file in "$srcdir/COPYING" "$srcdir/COPYING" "$srcdir/LICENSE" ; do
688 test -f "$ac_file" || continue
689 dnl http://www.ibiblio.org/osrt/omf/omf_elements "16. Rights"
690 if grep "GNU LESSER GENERAL PUBLIC LICENSE" "$ac_file" >/dev/null
691 then VAR="GNU LGPL" ; break
692 elif grep "GNU GENERAL PUBLIC LICENSE" "$ac_file" >/dev/null
693 then VAR="GNU GPL" ; break
694 elif grep "MOZILLA PUBLIC LICENSE" "$ac_file" >/dev/null
695 then VAR="MPL" ; break
696 elif grep "Mozilla Public License" "$ac_file" >/dev/null
697 then VAR="MPL" ; break
698 elif grep -i "artistic license" "$ac_file" >/dev/null
699 then VAR="Artistic" ; break
700 elif grep -i "artistic control" "$ac_file" >/dev/null
701 then VAR="Artistic" ; break
702 elif grep -i "semblance of artistic" "$ac_file" >/dev/null
703 then VAR="Artistic" ; break
704 elif grep -i "above copyright notice" "$ac_file" >/dev/null
705 then VAR="BSD" ; break
708 if test ".$VAR" = "." ; then
709 if test "$srcdir/COPYING.LIB" ; then VAR="GNU LGPL"
710 elif test ".$ltmain" != "." ; then VAR="GNU LGPL"
715 ],[test ".$VAR" = "." && VAR="$2"])
716 test "$VAR" = "GPL" && VAR="GNU GPL"
717 test "$VAR" = "LGPL" && VAR="GNU LGPL"
718 AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
719 AS_VAR_POPDEF([VAR])dnl
722 AC_DEFUN([AX_SPEC_PACKAGE_SUMMARY],[AC_REQUIRE([AX_SPEC_FILE])dnl
723 AS_VAR_PUSHDEF([VAR],[PACKAGE_SUMMARY])dnl
724 AC_MSG_CHECKING([for spec summary])
725 if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
728 AX_SPEC_EXTRACT(VAR,[summary],m4_ifval($1,$1))
730 test ".$VAR" = "." && k="(fallback)"
731 ifelse($2,,[dnl here the defaults for SUMMARY
732 if test ".$VAR" = "." ; then VAR="$PACKAGE"
733 test ".$VAR" = "." && VAR="foo"
734 test ".$ltmain" != "." && VAR="$VAR library"
736 ],[test ".$VAR" = "." && VAR="$2"])
737 AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
738 AS_VAR_POPDEF([VAR])dnl
741 AC_DEFUN([AX_SPEC_PACKAGE_ICON],[AC_REQUIRE([AX_SPEC_FILE])dnl
742 AS_VAR_PUSHDEF([VAR],[PACKAGE_ICON])dnl
743 AC_MSG_CHECKING([for spec icon])
744 if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
747 AX_SPEC_EXTRACT(VAR,[icon],m4_ifval($1,$1))
749 test ".$VAR" = "." && k="(fallback)"
750 ifelse($2,,[dnl here the defaults for ICON
751 if test ".$VAR" = "." ; then VAR="$PACKAGE-icon.png" ; fi
752 ],[test ".$VAR" = "." && VAR="$2"])
753 AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
754 AS_VAR_POPDEF([VAR])dnl
757 AC_DEFUN([AX_SPEC_PACKAGE_CATEGORY],[AC_REQUIRE([AX_SPEC_FILE])dnl
758 AS_VAR_PUSHDEF([VAR],[PACKAGE_CATEGORY])dnl
759 AC_MSG_CHECKING([for spec category])
760 if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
763 AX_SPEC_EXTRACT(VAR,[group],m4_ifval($1,$1))
764 VAR=`echo $VAR | sed -e 's/ /-/g'`
766 test ".$VAR" = "." && k="(fallback)"
767 ifelse($2,,[dnl here the defaults for CATEGORY
768 if test ".$VAR" = "." ; then if test ".$ltmain" != "."
769 then VAR="Development/Library"
770 else VAR="Development/Other"
772 ],[test ".$VAR" = "." && VAR="$2"])
773 AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
774 AS_VAR_POPDEF([VAR])dnl
777 AC_DEFUN([AX_SPEC_PACKAGE_NAME],[AC_REQUIRE([AX_SPEC_FILE])dnl
778 AS_VAR_PUSHDEF([VAR],[PACKAGE_NAME])dnl
779 AC_MSG_CHECKING([for spec package])
780 if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
783 AX_SPEC_EXTRACT(VAR,[name],m4_ifval($1,$1))
784 VAR=`echo $VAR | sed -e 's/ /-/g'`
786 test ".$VAR" = "." && k="(fallback)"
787 ifelse($2,,[dnl here the defaults for PACKAGE
788 test ".$VAR" = "." && VAR=`basename $ax_spec_file .spec`
789 test ".$VAR" = ".README" && VAR="TODO"
790 test ".$VAR" = ".TODO" && VAR="foo"
791 ],[test ".$VAR" = "." && VAR="$2"])
792 test "VAR" = "PACKAGE_NAME" && test ".$PACKAGE" = "." && PACKAGE="$VAR"
793 AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
794 AS_VAR_POPDEF([VAR])dnl
797 AC_DEFUN([AX_SPEC_PACKAGE_VERSION_],[AC_REQUIRE([AX_SPEC_FILE])dnl
798 AS_VAR_PUSHDEF([VAR],[PACKAGE_VERSION])dnl
799 AC_MSG_CHECKING([for spec version])
800 if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
803 AX_SPEC_EXTRACT(VAR,[version],m4_ifval($1,$1))
804 VAR=`echo $VAR | sed -e 's/ /-/g'`
806 test ".$VAR" = "." && k="(fallback)"
807 ifelse($2,,[dnl here the defaults for VERSION
808 test ".$VAR" = "." && VAR=`date +0.%y.%W%w`
809 ],[test ".$VAR" = "." && VAR="$2"])
810 test "VAR" = "PACKAGE_VERSION" && test ".$VERSION" = "." && VERSION="$VAR"
811 case "$VAR" in # note we set traditional VERSION before cleaning things up
812 *.*.) VAR="$VAR"`date +%W%w` ;;
814 *.) VAR="$VAR"`date +%y.%W%w` ;;
816 *) VAR=AS_TR_SH([$VAR]) ; VAR="$VAR.`date +%y.%W%w`" ;;
818 VAR=`echo $VAR | sed -e "s/[[.]][0]\\([0-9]\\)/.\\1/g"`
819 AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
820 AS_VAR_POPDEF([VAR])dnl
823 dnl for compatibility, we define ax_spec_package_version
824 dnl to do all of ax_spec_package_name as well.
825 AC_DEFUN([AX_SPEC_PACKAGE_VERSION],[AC_REQUIRE([AX_SPEC_FILE])dnl
827 AC_MSG_WARN([please use ax_spec_package_AND_version now!]),
828 AC_MSG_ERROR([please use ax_spec_package_AND_version now!]))
830 AX_SPEC_PACKAGE_VERSION_
834 AC_DEFUN([AX_SPEC_PACKAGE_AND_VERSION],[
835 m4_ifset([m4_ax_spec_file],,[AX_SPEC_FILE($1)])
837 AX_SPEC_PACKAGE_VERSION_
840 AC_DEFUN([AX_SPEC_DEFAULTS],[
841 m4_ifset([m4_ax_spec_file],,[AX_SPEC_FILE($1)])
843 AX_SPEC_PACKAGE_VERSION_
844 AX_SPEC_PACKAGE_LICENSE
845 AX_SPEC_PACKAGE_SUMMARY
846 AX_SPEC_PACKAGE_CATEGORY
850 dnl ______ /usr/share/aclocal/guidod/ax_set_version_info.m4 ______
851 dnl AX_SET_VERSION_INFO [(VERSION [,PREFIX])] -*- m4 -*-
852 dnl default $1 = $PACKAGE_VERSION
853 dnl default $2 = <none>
855 dnl This macro is the successor of AC_SET_RELEASEINFO_VERSIONINFO but
856 dnl it can be used in parallel because it uses all different variables.
858 dnl check the $VERSION number and cut the two last digit-sequences off
859 dnl which will form a -version-info in a @VERSION_INFO@ ac_subst while
860 dnl the rest is going to the -release name in a @RELEASE_INFO@ ac_subst.
862 dnl you should keep these two seperate - the release-name may contain
863 dnl alpha-characters and can be modified later with extra release-hints
864 dnl e.g. RELEASE_INFO="$RELEASE_INFO-debug" for a debug version
865 dnl of your lib. The $VERSION_INFO however should not be touched.
867 dnl example: a VERSION="2.4.18" will be transformed into
868 dnl RELEASE_INFO = -release 2
869 dnl VERSION_INFO = -versioninfo 4:18
870 dnl then use these two variables and push them to your libtool linker
871 dnl libtest_la_LIBADD = @RELEASE_INFO@ @VERSION_INFO@
872 dnl and for a linux-target this will tell libtool to install the lib as
873 dnl libmy.so libmy.la libmy.a libmy-2.so.4 libmy-2.so.4.0.18
874 dnl and executables will get link-resolve-infos for libmy-2.so.4 - therefore
875 dnl the patch-level is ignored during ldso linking, and ldso will use the
876 dnl one with the highest patchlevel. Using just "-release $(VERSION)"
877 dnl during libtool-linking would not do that - omitting the -version-info
878 dnl will libtool install libmy.so libmy.la libmy.a libmy-2.4.18.so and
879 dnl executables would get hardlinked with the 2.4.18 version of your lib.
881 dnl This background does also explain the default dll name for a win32
882 dnl target : libtool will choose to make up libmy-2-4.dll for this
885 dnl this macro does also set the usual three parts of a version spec
886 dnl $MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION but does not ac_subst
887 dnl for the plain AX_SET_VERSION_INFO macro. Use instead one of the numbered
888 dnl macros AX_SET_VERSION_INFO1 (use first number for release part) or
889 dnl that AX_SET_VERSION_INFO2 (use the first two numbers for release part).
891 dnl You may add sublevel parts like "1.4.2-ac5" where the sublevel is
892 dnl just killed from these version/release substvars. That allows to grab
893 dnl the version off a .spec file like with AX_SPEC_PACKAGE_VERSION where
894 dnl the $VERSION is used to name a tarball or distpack like mylib-2.2.9pre4
896 dnl Unlike earlier macros, you can use this one to break up different
897 dnl VERSIONs and put them into different variables, just hint with
898 dnl PREFIX-setting - i.e. _VERSION(2.4.5,TEST) will set variables named
899 dnl TEST_MAJOR_VERSION=2... and of course $TEST_RELEASE_INFO etc.
900 dnl (for the moment, it needs to be a literal prefix *sigh*)
902 dnl @version %Id: ax_set_version_info.m4,v 1.1 2003/07/02 23:41:42 guidod Exp %
903 dnl @author Guido Draheim <guidod@gmx.de>
905 AC_DEFUN([AX_SET_VERSION_INFO1],[dnl
906 AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
907 AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
908 AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
909 AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
910 AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
911 AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
912 test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
913 AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
914 ifelse($1,,$PACKAGE_VERSION,$1) )
915 MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
916 MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'`
917 MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'`
919 MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
920 MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
922 MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'`
923 PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'`
924 if test "_$MICRO" = "_" ; then MICRO="0" ; fi
925 if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
926 MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
927 LTREL="-release $MAJOR"
928 LTVER="-version-info $MINOR:$MICRO"
929 AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
936 AS_VAR_POPDEF([LTVER])dnl
937 AS_VAR_POPDEF([LTREL])dnl
938 AS_VAR_POPDEF([PATCH])dnl
939 AS_VAR_POPDEF([MICRO])dnl
940 AS_VAR_POPDEF([MINOR])dnl
941 AS_VAR_POPDEF([MAJOR])dnl
944 AC_DEFUN([AX_SET_VERSION_INFO2],[dnl
945 AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
946 AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
947 AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
948 AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
949 AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
950 AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
951 test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
952 AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
953 ifelse($1,,$PACKAGE_VERSION,$1) )
954 MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
955 MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'`
956 MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'`
958 MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
959 MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
961 MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'`
962 PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'`
963 test "_$MICRO" != "_" || MICRO="0"
964 if test "_$MINOR" != "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
965 MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
966 LTREL="-release $MAJOR.$MINOR"
967 LTVER="-version-info 0:$MICRO"
968 AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
975 AS_VAR_POPDEF([LTVER])dnl
976 AS_VAR_POPDEF([LTREL])dnl
977 AS_VAR_POPDEF([PATCH])dnl
978 AS_VAR_POPDEF([MICRO])dnl
979 AS_VAR_POPDEF([MINOR])dnl
980 AS_VAR_POPDEF([MAJOR])dnl
983 AC_DEFUN([AX_SET_VERSION_INFO],[dnl
984 AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
985 AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
986 AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
987 AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
988 AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
989 AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
990 test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
991 AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
992 ifelse($1,,$PACKAGE_VERSION,$1) )
993 MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
994 MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'`
995 MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'`
997 MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
998 MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
1000 MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'`
1001 PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/[[-.]]//'`
1002 if test "_$MICRO" = "_" ; then MICRO="0" ; fi
1003 if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
1004 MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
1005 LTREL="-release $MAJOR"
1006 LTVER="-version-info $MINOR:$MICRO"
1007 AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
1010 AS_VAR_POPDEF([LTVER])dnl
1011 AS_VAR_POPDEF([LTREL])dnl
1012 AS_VAR_POPDEF([PATCH])dnl
1013 AS_VAR_POPDEF([MICRO])dnl
1014 AS_VAR_POPDEF([MINOR])dnl
1015 AS_VAR_POPDEF([MAJOR])dnl
1018 dnl ______ /usr/share/aclocal/guidod/ax_enable_builddir.m4 ______
1019 dnl @synopsis AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])]
1021 dnl if the current configure was run within the srcdir then
1022 dnl we move all configure-files into a subdir and let the configure
1023 dnl steps continue there. We provide an option --disable-builddir
1024 dnl to suppress the move into a separate builddir.
1028 dnl $1 = $host (overridden with $HOST)
1029 dnl $2 = Makefile.mk
1032 dnl This macro must be called before AM_INIT_AUTOMAKE.
1034 dnl it creates a default toplevel srcdir Makefile from the information found
1035 dnl in the created toplevel builddir Makefile. It just copies the variables
1036 dnl and rule-targets, each extended with a default rule-execution that
1037 dnl recurses into the build directory of the current "HOST". You can override
1038 dnl the auto-dection through `config.guess` and build-time of course, as in
1040 dnl make HOST=i386-mingw-cross
1042 dnl which can of course set at configure time as well using
1044 dnl configure --host=i386-mingw-cross
1046 dnl After the default has been created, additional rules can be
1047 dnl appended that will not just recurse into the subdirectories and
1048 dnl only ever exist in the srcdir toplevel makefile - these parts
1049 dnl are read from the $2 = Makefile.mk file
1051 dnl The automatic rules are usually scanning the toplevel Makefile for
1052 dnl lines like '#### $host |$builddir' to recognize the place where to
1053 dnl recurse into. Usually, the last one is the only one used. However,
1054 dnl almost all targets have an additional "*-all" rule which makes the
1055 dnl script to recurse into _all_ variants of the current HOST (!!)
1056 dnl setting. The "-all" suffix can be overriden for the macro as well.
1058 dnl a special rule is only given for things like "dist" that will
1059 dnl copy the tarball from the builddir to the sourcedir (or $(PUB))
1060 dnl for reason of convenience.
1062 dnl @author Guido Draheim
1063 dnl @version %Id: ax_enable_builddir.m4,v 1.16 2005/01/16 17:29:48 guidod Exp %
1065 AC_DEFUN([AX_ENABLE_BUILDDIR],[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
1066 AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
1067 AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
1068 AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
1069 AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
1071 AC_ARG_ENABLE([builddir], AC_HELP_STRING(
1072 [--disable-builddir],[disable automatic build in subdir of sources])
1073 ,[SUB="$enableval"], [SUB="yes"])
1074 if test ".$ac_srcdir_defaulted" != ".no" ; then
1075 if test ".$srcdir" = ".." ; then
1076 if test -f config.status ; then
1077 AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build)
1079 test ".$SUB" = "." && SUB="."
1080 test ".$SUB" = ".no" && SUB="."
1081 test ".$TARGET" = "." && TARGET="$target"
1082 test ".$SUB" = ".yes" && SUB="m4_ifval([$1], [$1],[$TARGET])"
1083 if test ".$SUB" != ".." ; then # we know where to go and
1085 echo __.$SUB.__ > $SUB/conftest.tmp
1087 if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then
1089 AC_MSG_RESULT([continue configure in default builddir "./$SUB"])
1091 AC_MSG_ERROR([could not change to default builddir "./$SUB"])
1093 srcdir=`echo "$SUB" |
1094 sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'`
1095 # going to restart from subdirectory location
1096 test -f $srcdir/config.log && mv $srcdir/config.log .
1097 test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h .
1098 test -f $srcdir/conftest.log && mv $srcdir/conftest.log .
1099 test -f $srcdir/$cache_file && mv $srcdir/$cache_file .
1100 AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"})
1101 case "[$]0" in # restart
1102 [/\\]) exec $SHELL [$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"} ;;
1103 *) exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"} ;;
1108 dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec"
1109 AC_PATH_PROG(SED,gsed sed, sed)
1110 AUX="$ac_aux_dir" ; test ".$AUX" = "." && AUX="."
1112 echo "$AUX" : $SED -e "'s!$ac_top_srcdir!.!'"
1113 AUX=`echo "$AUX" | $SED -e "s|$ac_top_srcdir|.|"`
1114 test ".$AUX" = "." && AUX="."
1116 AS_VAR_POPDEF([SED])dnl
1117 AS_VAR_POPDEF([AUX])dnl
1118 AS_VAR_POPDEF([SUB])dnl
1119 AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status ..............
1120 AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
1121 AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl
1122 AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl
1123 AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
1124 AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
1125 pushdef([END],[Makefile.mk])dnl
1126 pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl
1127 SRC="$ax_enable_builddir_srcdir"
1128 if test ".$SUB" = "." ; then
1129 if test -f "$TOP/Makefile" ; then
1130 AC_MSG_NOTICE([skipping TOP/Makefile - left untouched])
1132 AC_MSG_NOTICE([skipping TOP/Makefile - not created])
1135 if test -f "$SRC/Makefile" ; then
1136 a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile`
1137 test "$a" != "$b" && rm "$SRC/Makefile"
1139 if test -f "$SRC/Makefile" ; then
1140 echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk
1141 echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk
1142 eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null"
1143 if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null
1144 then rm $SRC/Makefile ; fi
1145 cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING
1147 if test ! -f "$SRC/Makefile" ; then
1148 AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile])
1149 x='`' ; cat >$tmp/conftemp.sed <<_EOF
1166 s/^srcdir *=.*/srcdir = ./
1167 s/^top_srcdir *=.*/top_srcdir = ./
1172 /:\$/s/ \\([[a-z]][[a-z-]]*[[a-z]]\\) / \\1 \\1[]_ALL /g
1173 /:\$/s/^\\([[a-z]][[a-z-]]*[[a-z]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/
1175 /^all all[]_ALL[[ :]]/i\\
1176 all-configured : all[]_ALL
1177 dnl dist-all exists... and would make for dist-all-all
1180 @ HOST="\$(HOST)\" \\\\\\
1181 ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
1182 ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
1183 ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
1184 ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" = "0" ; then : \\\\\\
1185 ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\
1186 ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
1187 ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\
1188 ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1189 ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done
1190 dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree)
1192 @ HOST="\$(HOST)\" \\\\\\
1193 ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
1194 ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
1195 ; found=$x echo \$\$BUILD | wc -w $x \\\\\\
1196 ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\
1197 ; if test "\$\$found" = "0" ; then : \\\\\\
1198 ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\
1199 ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1200 ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\
1201 ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done
1202 dnl special rule add-on: "distclean" removes all local builddirs completely
1203 /distclean[]_ALL *:/a\\
1204 @ HOST="\$(HOST)\" \\\\\\
1205 ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
1206 ; BUILD=$x grep "^#### .*| *\\./" Makefile | sed -e 's/.*|//' $x \\\\\\
1207 ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
1208 ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\
1209 ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
1210 ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1211 ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\
1212 ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1213 ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile
1215 cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING
1216 $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile
1217 if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then
1218 AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])])
1219 cat $SRC/END >>$SRC/Makefile
1221 echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile
1223 if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then
1224 AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts])
1225 $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \
1227 (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null
1231 # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed
1232 echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed
1233 $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp
1234 cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING
1235 cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING
1236 if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then
1237 AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure])
1238 rm "$tmp/mkfile.tmp"
1240 AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure])
1241 mv "$tmp/mkfile.tmp" "$SRC/Makefile"
1244 AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)])
1246 echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile
1249 AS_VAR_POPDEF([SED])dnl
1250 AS_VAR_POPDEF([AUX])dnl
1251 AS_VAR_POPDEF([SRC])dnl
1252 AS_VAR_POPDEF([TOP])dnl
1253 AS_VAR_POPDEF([SUB])dnl
1255 ax_enable_builddir_srcdir="$srcdir" # $srcdir
1256 ax_enable_builddir_host="$HOST" # $HOST / $host
1257 ax_enable_builddir_version="$VERSION" # $VERSION
1258 ax_enable_builddir_package="$PACKAGE" # $PACKAGE
1259 ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX
1260 ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED
1261 ax_enable_builddir="$ax_enable_builddir" # $SUB
1265 dnl ______ /usr/share/aclocal/guidod/ax_warning_default_pkgconfig.m4 ______
1266 dnl @* AX_WARNING_DEFAULT_PKGCONFIGDIR [(dirvariable [,[defsetting][,[A][,[N/A]]]])]
1267 dnl @* AX_ENABLE_DEFAULT_PKGCONFIGDIR [(dirvariable [,defsetting])]
1269 dnl print a warning message if the $(datadir)/aclocal directory
1270 dnl is not in the dirlist searched by the aclocal tool. This macro
1271 dnl is useful if some `make install` would target $(datadir)/aclocal
1272 dnl to install an autoconf m4 file of your project to be picked up
1273 dnl by other projects.
1275 dnl default $1 dirvariable = pkgconfigdir
1276 dnl default $2 defsetting = ${libdir}/pkgconfig
1277 dnl default $3 action = nothing to do
1278 dnl default $4 action = warn the user about mismatch
1280 dnl In the _WARNING_ variant, the defsetting is not placed in
1281 dnl dirvariable nor is it ac_subst'ed in any way. The default
1282 dnl fail-action $4 is to send a warning message to the user,
1283 dnl and the default accept-action $3 is nothing. It is expected that
1284 dnl a Makefile is generated with pkgconfigdir=${libdir}/pkgconfig
1286 dnl The _ENABLE_ variant however will set not only the $pkgconfigdir shell
1287 dnl var of the script, but it is also AC-SUBST'ed on default - and
1288 dnl furthermore a configure option "--enable-default-pkgconfigdir" is
1289 dnl provided. Only if that option is set then $2 default is not set to
1290 dnl the canonic default in the a $prefix subpath but instead $2 default
1291 dnl is set to the primary path where `pkg-config` looks for .pc files. The
1292 dnl user may also override the default on the command line.
1294 dnl @: guidod@gmx.de
1295 dnl @%Id: ax_warning_default_pkgconfig.m4,v 1.1 2003/10/18 02:57:13 guidod Exp %
1297 AC_DEFUN([AX_WARNING_DEFAULT_PKGCONFIGDIR],[dnl
1298 AC_REQUIRE([AX_EXPAND_PREFIX])dnl
1299 AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_dir])dnl
1300 AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
1301 AS_VAR_PUSHDEF([LOC],[ax_warning_default_pkgconfig_loc])dnl
1302 LOC='m4_if([$2],,[${libdir}/pkgconfig],[$2])'
1303 m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
1304 if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
1305 AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
1307 if test "$PKG_CONFIG" = "no"
1308 then DIR="/" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
1309 else BIN=`AS_DIRNAME(["$DIR"])` ;
1310 if test -d "$BIN/lib/pkgconfig" ; then
1311 DIR="$BIN/lib/pkgconfig"
1312 else BIN=`AS_DIRNAME(["$DIR"])`
1313 if test -d "$BIN/lib/pkgconfig" ; then
1314 DIR="$BIN/lib/pkgconfig"
1316 if test -d "/usr/lib/pkgconfig" ; then
1317 DIR="/usr/lib/pkgconfig"
1322 AC_RUN_LOG([: last pkgconfig dir is assumed as "$DIR"])
1323 DIR=`eval "echo $DIR"`
1324 DIR=`eval "echo $DIR"`
1325 LOC=`eval "echo $LOC"`
1326 LOC=`eval "echo $LOC"`
1327 LOC=`eval "echo $LOC"`
1328 LOC=`eval "echo $LOC"`
1329 for DIR in `echo "$PKG_CONFIG_PATH:$DIR" | sed -e 's,:, ,g'` ; do
1330 AC_RUN_LOG([: test ".$LOC" = ".$DIR"])
1331 test ".$LOC" = ".$DIR" && break
1333 if test "$LOC" != "$DIR" ; then
1334 m4_ifval([$4],[$4],[dnl
1335 AC_MSG_NOTICE([warning: m4_if([$1],,[pkgconfigdir],[$1])=$LOC dnl
1337 AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR])
1338 cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
1339 pkgconfigdir: the m4_if([$1],,[default pkgconfigdir],[$1 value]) of $LOC
1340 pkgconfigdir: is not listed in the dirlist where pkg-config will look for
1341 pkgconfigdir: package-configs - you can override the install-path using
1342 pkgconfigdir: make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR
1343 pkgconfigdir: or set/append the directory to the environment variable
1344 pkgconfigdir: PKG_CONFIG_PATH="$LOC"
1346 m4_ifvaln([$5],[$5])])dnl
1347 m4_ifvaln([$3],[else $3])dnl
1349 AS_VAR_POPDEF([LOC])dnl
1350 AS_VAR_POPDEF([BIN])dnl
1351 AS_VAR_POPDEF([DIR])dnl
1354 AC_DEFUN([AX_ENABLE_DEFAULT_PKGCONFIGDIR],[dnl
1355 AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
1356 AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_def])dnl
1357 AS_VAR_PUSHDEF([DEF],[ax_warning_default_pkgconfig_def])dnl
1358 AC_ARG_ENABLE([enable-default-pkgconfigdir],
1359 [ --enable-default-pkgconfigdir(=PATH) override the libdir/pkgconfig default])
1360 test ".$enable_default_pkgconfigdir" = "." && enable_default_pkgconfigdir="no"
1361 case ".$enable_default_pkgconfigdir" in
1362 .no) DIR='m4_if([$2],,[${libdir}/pkgconfig],[$2])' ;;
1364 if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
1365 AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
1367 if test "$PKG_CONFIG" = "no"
1368 then DIR="/tmp" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
1369 else BIN=`AS_DIRNAME(["$DIR"])` ;
1370 if test -d "$BIN/lib/pkgconfig" ; then
1371 DIR="$BIN/lib/pkgconfig"
1372 else BIN=`AS_DIRNAME(["$DIR"])`
1373 if test -d "$BIN/lib/pkgconfig" ; then
1374 DIR="$BIN/lib/pkgconfig"
1376 if test -d "/usr/lib/pkgconfig" ; then
1377 DIR="/usr/lib/pkgconfig"
1382 *) DIR="$enable_default_pkgconfigdir" ;;
1384 AX_WARNING_DEFAULT_PKGCONFIGDIR([$1],[$DEF],[$3],[$4],[$5])
1385 m4_if([$1],,[pkgconfigdir],[$1])="$ax_warning_default_pkgconfig_dir"
1386 AC_SUBST(m4_if([$1],,[pkgconfigdir],[$1]))
1387 AS_VAR_POPDEF([DEF])dnl
1388 AS_VAR_POPDEF([DIR])dnl
1389 AS_VAR_POPDEF([BIN])dnl
1392 dnl ______ /usr/share/aclocal/Miscellaneous/ac_compile_check_sizeof.m4 ______
1393 dnl @synopsis AC_COMPILE_CHECK_SIZEOF(TYPE [, HEADERS [, EXTRA_SIZES...]])
1395 dnl This macro checks for the size of TYPE using compile checks, not
1396 dnl run checks. You can supply extra HEADERS to look into. the check
1397 dnl will cycle through 1 2 4 8 16 and any EXTRA_SIZES the user
1398 dnl supplies. If a match is found, it will #define SIZEOF_`TYPE' to
1399 dnl that value. Otherwise it will emit a configure time error
1400 dnl indicating the size of the type could not be determined.
1402 dnl The trick is that C will not allow duplicate case labels. While
1403 dnl this is valid C code:
1405 dnl switch (0) case 0: case 1:;
1407 dnl The following is not:
1409 dnl switch (0) case 0: case 0:;
1411 dnl Thus, the AC_TRY_COMPILE will fail if the currently tried size
1414 dnl Here is an example skeleton configure.in script, demonstrating the
1418 dnl AC_CHECK_HEADERS(stddef.h unistd.h)
1420 dnl AC_CHECK_TYPE(ssize_t, int)
1422 dnl headers='#ifdef HAVE_STDDEF_H
1423 dnl #include <stddef.h>
1425 dnl #ifdef HAVE_UNISTD_H
1426 dnl #include <unistd.h>
1430 dnl AC_COMPILE_CHECK_SIZEOF(char)
1431 dnl AC_COMPILE_CHECK_SIZEOF(short)
1432 dnl AC_COMPILE_CHECK_SIZEOF(int)
1433 dnl AC_COMPILE_CHECK_SIZEOF(long)
1434 dnl AC_COMPILE_CHECK_SIZEOF(unsigned char *)
1435 dnl AC_COMPILE_CHECK_SIZEOF(void *)
1436 dnl AC_COMPILE_CHECK_SIZEOF(size_t, $headers)
1437 dnl AC_COMPILE_CHECK_SIZEOF(ssize_t, $headers)
1438 dnl AC_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers)
1439 dnl AC_COMPILE_CHECK_SIZEOF(off_t, $headers)
1441 dnl @author Kaveh Ghazi <ghazi@caip.rutgers.edu>
1442 dnl @version %Id: ac_compile_check_sizeof.m4,v 1.1.1.1 2001/07/26 00:46:24 guidod Exp %
1444 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
1445 [changequote(<<, >>)dnl
1446 dnl The name to #define.
1447 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
1448 dnl The cache variable name.
1449 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
1450 changequote([, ])dnl
1451 AC_MSG_CHECKING(size of $1)
1452 AC_CACHE_VAL(AC_CV_NAME,
1453 [for ac_size in 4 8 1 2 16 $2 ; do # List sizes in rough order of prevalence.
1454 AC_TRY_COMPILE([#include "confdefs.h"
1455 #include <sys/types.h>
1457 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
1458 if test x$AC_CV_NAME != x ; then break; fi
1461 if test x$AC_CV_NAME = x ; then
1462 AC_MSG_ERROR([cannot determine a size for $1])
1464 AC_MSG_RESULT($AC_CV_NAME)
1465 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
1466 undefine([AC_TYPE_NAME])dnl
1467 undefine([AC_CV_NAME])dnl
1470 dnl ______ /usr/share/aclocal/guidod/patch_libtool_to_add_host_cc.m4 ______
1471 dnl @* PATCH_LIBTOOL_TO_ADD_HOST_CC
1473 dnl The libtool 1.4.x processing (and patched 1.3.5) uses a little
1474 dnl "impgen" tool to turn a "*.dll" into an import "*.lib" as it is
1475 dnl needed for win32 targets. However, this little tool is not shipped
1476 dnl by binutils, it is not even a command option of dlltool or dllwrap.
1477 dnl It happens to be a C source snippet implanted into the libtool
1478 dnl sources - it gets written to ".libs", compiled into a binary
1479 dnl on-the-fly, and executed right away on the "dll" file to create
1480 dnl the import-lib (dll.a files in gcc-speak).
1482 dnl This mode works fine for a native build within mingw or cygwin,
1483 dnl but it does not work in cross-compile mode since CC is a
1484 dnl crosscompiler - it will create an .exe file on a non-win32
1485 dnl system, and as a result an impgen.exe is created on-the-fly
1486 dnl that can not be executed on-the-fly. Luckily, the actual
1487 dnl libtool snippet uses HOST_CC to compile the sources which
1488 dnl has a fallback to CC when the HOST_CC variable was not set.
1490 dnl this ac-macro is trying to detect a valid HOST_CC which is not
1491 dnl a cross-compiler. This is done by looking into the $PATH for
1492 dnl a "cc" and the result is patched into libtool a HOST_CC, iow
1493 dnl it adds another configured variable at the top of the libtool
1496 dnl In discussions on the libtool mailinglist it occurred that
1497 dnl later gcc/binutils generations are able to link with dlls
1498 dnl directly, i.e. there is no import-lib needed anymore. The
1499 dnl import-table is created within the linker itself (in-memory)
1500 dnl and bound to the .exe/.dll currently in the making. The
1501 dnl whole stuff of impgen exe and compiling it on-the-fly, well,
1502 dnl it is superflouos then.
1504 dnl Since mingw crosscompilers tend to be quite a fresh development
1505 dnl it was agreed to remove the impgen stuff completly from
1506 dnl libtool sources. Still however, this macro does not hurt
1507 dnl since it does not patch impgen cmds but it just adds HOST_CC
1508 dnl which might be useful in other cross-compiling cases as well.
1509 dnl Therefore, you can leave it in for maximum compatibility and
1512 dnl @= guidod@gmx.de
1513 dnl @%Id: patch_libtool_to_add_host_cc.m4,v 1.3 2003/03/23 13:20:27 guidod Exp %
1515 AC_DEFUN([PATCH_LIBTOOL_TO_ADD_HOST_CC],
1516 [# patch libtool to add HOST_CC sometimes needed in crosscompiling a win32 dll
1517 if grep "HOST_CC" libtool >/dev/null; then
1518 if test "$build" != "$host" ; then
1519 if test "_$HOST_CC" = "_" ; then
1521 for i in `echo $PATH | sed 's,:, ,g'` ; do
1522 test -x $i/cc && HOST_CC=$i/cc
1525 AC_MSG_RESULT(patching libtool to add HOST_CC=$HOST_CC)
1526 test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
1527 sed -e "/BEGIN.*LIBTOOL.*CONFIG/a\\
1528 HOST_CC=$HOST_CC" libtool >libtool.new
1529 (test -s libtool.new || rm libtool.new) 2>/dev/null
1530 test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
1531 test -f libtool || mv libtool.old libtool
1535 dnl ______ /usr/share/aclocal/guidod/patch_libtool_on_darwin_zsh_overquoting.m4 ______
1536 dnl @* PATCH_LIBTOOL_ON_DARWIN_ZSH_OVERQUOTING
1538 dnl libtool 1.4.x has a bug on darwin where the "zsh" is installed
1539 dnl as the bourne shell replacement. Of course, the zsh is called in
1540 dnl a compatibility mode but there is a common problem with it,
1541 dnl probably a bug of zsh. Newer darwin systems have a "bash"
1542 dnl installed now, but the configure-default will be "zsh" in most
1545 dnl The bug revelas itself as an overquoted statement in the
1546 dnl libtool cmds-spec for sharedlib creation on testing for
1547 dnl "module" builds. Later libtool has gone rid of it by simply
1548 dnl removing the quotes at that point . Here we maintain the
1549 dnl original style and simply remove the extra escape character,
1550 dnl i.e. we look for "archive_cmds" and replace a sequence of
1551 dnl triple-backslash-and-doublequote with single-backslash-and-doublequote.
1553 dnl @= guidod@gmx.de
1554 dnl %Id: patch_libtool_on_darwin_zsh_overquoting.m4,v 1.4 2003/03/24 16:58:21 guidod Exp %
1556 AC_DEFUN([PATCH_LIBTOOL_ON_DARWIN_ZSH_OVERQUOTING],
1557 [# libtool-1.4 specific, on zsh target the final requoting does one too much
1560 if grep "1.92" libtool >/dev/null ; then
1561 AC_MSG_RESULT(patching libtool on .so-sharedlib creation (zsh overquoting))
1562 test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
1563 sed -e '/archive_cmds=/s:[[\\]][[\\]][[\\]]*":\\":g' libtool >libtool.new
1564 (test -s libtool.new || rm libtool.new) 2>/dev/null
1565 test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
1566 test -f libtool || mv libtool.old libtool
1571 dnl ______ /usr/share/aclocal/guidod/ac_sys_largefile_sensitive.m4 ______
1572 dnl @synopsis AC_SYS_LARGEFILE_SENSITIVE
1574 dnl checker whether the current system is sensitive to -Ddefines
1575 dnl making off_t having different types/sizes. Automatically define
1576 dnl a config.h symbol LARGEFILE_SENSITIVE if that is the case,
1577 dnl otherwise leave everything as is.
1579 dnl This macro builds on top of AC_SYS_LARGEFILE to detect whether
1580 dnl special options are neede to make the code use 64bit off_t - in
1581 dnl many setups this will also make the code use 64bit off_t immediatly.
1583 dnl The common use of a LARGEFILE_SENSITIVE config.h-define is to rename
1584 dnl exported functions, usually adding a 64 to the original function name.
1585 dnl Such renamings are only needed on systems being both (a) 32bit off_t
1586 dnl by default and (b) implementing large.file extensions (as for unix98).
1588 dnl a renaming section could look like this:
1589 dnl #if defined LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 == 64
1590 dnl #define zzip_open zzip_open64
1591 dnl #define zzip_seek zzip_seek64
1594 dnl for libraries, it is best to take advantage of the prefix-config.h
1595 dnl macro, otherwise you want to export a renamed LARGEFILE_SENSITIVE
1596 dnl in an installed header file. -> see AX_PREFIX_CONFIG_H
1598 dnl @, System Headers
1599 dnl @Author Guido Draheim <guidod@gmx.de>
1600 dnl @Version %Id: ac_sys_largefile_sensitive.m4,v 1.2 2003/05/13 18:46:22 guidod Exp %
1602 AC_DEFUN([AC_SYS_LARGEFILE_SENSITIVE],[dnl
1603 AC_REQUIRE([AC_SYS_LARGEFILE])dnl
1604 # we know about some internals of ac_sys_largefile here...
1605 AC_MSG_CHECKING(whether system differentiates 64bit off_t by defines)
1606 ac_cv_sys_largefile_sensitive="no"
1607 if test ".$ac_cv_sys_file_offset_bits$ac_cv_sys_large_files" != ".nono"
1608 then ac_cv_sys_largefile_sensitive="yes"
1609 AC_DEFINE(LARGEFILE_SENSITIVE, 1,
1610 [whether the system defaults to 32bit off_t but can do 64bit when requested])
1612 AC_MSG_RESULT([$ac_cv_sys_largefile_sensitive])
1615 dnl ______ /usr/share/aclocal/guidod/ax_maintainer_mode_auto_silent.m4 ______
1616 dnl @* AX_MAINTAINER_MODE_AUTO_SILENT
1618 dnl Set autotools to error/sleep settings so that they are not run when
1619 dnl being errornously triggered. Likewise make libtool-silent when
1620 dnl libtool has been used.
1622 dnl I am using the macro quite a lot since some automake versions had the
1623 dnl tendency to try to rerun some autotools on a mere make even when not
1624 dnl quite in --maintainer-mode. That is very annoying. Likewise, a user
1625 dnl who installs from source does not want to see doubled compiler messages.
1627 dnl I did not put an AC-REQUIRE(MAINTAINER_MODE) in here - should I?
1629 dnl @: guidod@gmx.de
1630 dnl @%Id: ax_maintainer_mode_auto_silent.m4,v 1.1 2003/10/19 00:12:45 guidod Exp %
1632 AC_DEFUN([AX_MAINTAINER_MODE_AUTO_SILENT],[dnl
1633 dnl ac_REQUIRE([am_MAINTAINER_MODE])dn
1634 AC_MSG_CHECKING(auto silent in maintainer mode)
1635 if test "$USE_MAINTAINER_MODE" = "no" ; then
1636 test ".$TIMEOUT" = "." && TIMEOUT="9"
1637 AUTOHEADER="sleep $TIMEOUT ; true || autoheader || skipped"
1638 AUTOMAKE="sleep $TIMEOUT ; true || automake || skipped"
1639 AUTOCONF="sleep $TIMEOUT ; true || autoconf || skipped"
1640 if test ".$LIBTOOL" != "." ; then
1641 LIBTOOL="$LIBTOOL --silent"
1642 AC_MSG_RESULT([libtool-silent, auto-sleep-9])
1644 AC_MSG_RESULT([auto-sleep-9])
1651 dnl ______ /usr/share/aclocal/guidod/ax_expand_prefix.m4 ______
1652 dnl @* AX_EXPAND_PREFIX
1654 dnl when $prefix and $exec_prefix are still set to NONE then set them
1655 dnl to the usual default values - being based on $ac_default_prefix.
1656 dnl - this macro can be AC_REQUIREd by other macros that need to
1657 dnl compute values for installation directories. It has been observed
1658 dnl that it was done wrong over and over again, so this is a bit
1659 dnl more safe to do.
1661 dnl remember - setting exec_prefix='${prefix}' needs you interpolate
1662 dnl directories multiple times, it is not sufficient to just say
1663 dnl MYVAR="${datadir}/putter" but you do have to run `eval` a few
1664 dnl times, sth. like MYVAR=`eval "echo \"$MYVAR\""` done atleast
1667 dnl The implementation of this macro simply picks up the lines that
1668 dnl would be run at the start of AC_OUTPUT anyway to set the
1669 dnl prefix/exec_prefix defaults. Between AC_INIT and the first
1670 dnl command to AC_REQUIRE this macro you can set the two variables
1671 dnl to something explicit instead. Probably, any command to compute
1672 dnl installation directories should be run _after_ AM_INIT_AUTOMAKE
1674 dnl @: guidod@gmx.de
1675 dnl @%Id: ax_expand_prefix.m4,v 1.1 2003/10/19 00:05:18 guidod Exp %
1677 AC_DEFUN([AX_EXPAND_PREFIX],[dnl
1678 # The prefix default can be set in configure.ac (otherwise it is /usr/local)
1679 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1680 # Let make expand exec_prefix. Allows to override the makevar 'prefix' later
1681 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1684 dnl ______ /usr/share/aclocal/guidod/ax_create_pkgconfig_info.m4 ______
1685 dnl @* AX_CREATE_PKGCONFIG_INFO [(outputfile, [requires [,libs [,summary]]])]
1687 dnl $1 = $PACKAGE_NAME.pc
1689 dnl $3 = $PACKAGE_LIBS $LIBS (as set at that point in configure.ac)
1690 dnl $4 = $PACKAGE_SUMMARY (or $1 Library)
1691 dnl $5 = $CPPFLAGS $PACKAGE_CFLAGS (as set at the point in configure.ac)
1693 dnl PACKAGE_NAME defaults to $PACKAGE if not set.
1694 dnl PACKAGE_LIBS defaults to -l$PACKAGE_NAME if not set.
1696 dnl the resulting file is called $PACKAGE.pc.in / $PACKAGE.pc
1698 dnl You will find this macro most useful in conjunction with ax_spec_defaults
1699 dnl that can read good initializers from the .spec file. In consequencd, most
1700 dnl of the generatable installable stuff can be made from information being
1701 dnl updated in a single place for the whole project.
1703 dnl @%Id: ax_create_pkgconfig_info.m4,v 1.2 2005/01/06 19:56:30 guidod Exp %
1705 AC_DEFUN([AX_CREATE_PKGCONFIG_INFO],[dnl
1706 AS_VAR_PUSHDEF([PKGCONFIG_suffix],[ax_create_pkgconfig_suffix])dnl
1707 AS_VAR_PUSHDEF([PKGCONFIG_libdir],[ax_create_pkgconfig_libdir])dnl
1708 AS_VAR_PUSHDEF([PKGCONFIG_libfile],[ax_create_pkgconfig_libfile])dnl
1709 AS_VAR_PUSHDEF([PKGCONFIG_libname],[ax_create_pkgconfig_libname])dnl
1710 AS_VAR_PUSHDEF([PKGCONFIG_version],[ax_create_pkgconfig_version])dnl
1711 AS_VAR_PUSHDEF([PKGCONFIG_description],[ax_create_pkgconfig_description])dnl
1712 AS_VAR_PUSHDEF([PKGCONFIG_requires],[ax_create_pkgconfig_requires])dnl
1713 AS_VAR_PUSHDEF([PKGCONFIG_pkglibs],[ax_create_pkgconfig_pkglibs])dnl
1714 AS_VAR_PUSHDEF([PKGCONFIG_libs],[ax_create_pkgconfig_libs])dnl
1715 AS_VAR_PUSHDEF([PKGCONFIG_cppflags],[ax_create_pkgconfig_cppflags])dnl
1716 AS_VAR_PUSHDEF([PKGCONFIG_generate],[ax_create_pkgconfig_generate])dnl
1717 AS_VAR_PUSHDEF([PKGCONFIG_src_libdir],[ax_create_pkgconfig_src_libdir])dnl
1718 AS_VAR_PUSHDEF([PKGCONFIG_src_headers],[ax_create_pkgconfig_src_headers])dnl
1720 # we need the expanded forms...
1721 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1722 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1724 AC_MSG_CHECKING(our pkgconfig libname)
1725 test ".$PKGCONFIG_libname" != "." || \
1726 PKGCONFIG_libname="ifelse($1,,${PACKAGE_NAME},`basename $1 .pc`)"
1727 test ".$PKGCONFIG_libname" != "." || \
1728 PKGCONFIG_libname="$PACKAGE"
1729 PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"`
1730 PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"`
1731 AC_MSG_RESULT($PKGCONFIG_libname)
1733 AC_MSG_CHECKING(our pkgconfig version)
1734 test ".$PKGCONFIG_version" != "." || \
1735 PKGCONFIG_version="${PACKAGE_VERSION}"
1736 test ".$PKGCONFIG_version" != "." || \
1737 PKGCONFIG_version="$VERSION"
1738 PKGCONFIG_version=`eval echo "$PKGCONFIG_version"`
1739 PKGCONFIG_version=`eval echo "$PKGCONFIG_version"`
1740 AC_MSG_RESULT($PKGCONFIG_version)
1742 AC_MSG_CHECKING(our pkgconfig_libdir)
1743 test ".$pkgconfig_libdir" = "." && \
1744 pkgconfig_libdir='${libdir}/pkgconfig'
1745 PKGCONFIG_libdir=`eval echo "$pkgconfig_libdir"`
1746 PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"`
1747 PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"`
1748 AC_MSG_RESULT($pkgconfig_libdir)
1749 test "$pkgconfig_libdir" != "$PKGCONFIG_libdir" && (
1750 AC_MSG_RESULT(expanded our pkgconfig_libdir... $PKGCONFIG_libdir))
1751 AC_SUBST([pkgconfig_libdir])
1753 AC_MSG_CHECKING(our pkgconfig_libfile)
1754 test ".$pkgconfig_libfile" != "." || \
1755 pkgconfig_libfile="ifelse($1,,$PKGCONFIG_libname.pc,`basename $1`)"
1756 PKGCONFIG_libfile=`eval echo "$pkgconfig_libfile"`
1757 PKGCONFIG_libfile=`eval echo "$PKGCONFIG_libfile"`
1758 AC_MSG_RESULT($pkgconfig_libfile)
1759 test "$pkgconfig_libfile" != "$PKGCONFIG_libfile" && (
1760 AC_MSG_RESULT(expanded our pkgconfig_libfile... $PKGCONFIG_libfile))
1761 AC_SUBST([pkgconfig_libfile])
1763 AC_MSG_CHECKING(our package / suffix)
1764 PKGCONFIG_suffix="$program_suffix"
1765 test ".$PKGCONFIG_suffix" != .NONE || PKGCONFIG_suffix=""
1766 AC_MSG_RESULT(${PACKAGE_NAME} / ${PKGCONFIG_suffix})
1768 AC_MSG_CHECKING(our pkgconfig description)
1769 PKGCONFIG_description="ifelse($4,,$PACKAGE_SUMMARY,$4)"
1770 test ".$PKGCONFIG_description" != "." || \
1771 PKGCONFIG_description="$PKGCONFIG_libname Library"
1772 PKGCONFIG_description=`eval echo "$PKGCONFIG_description"`
1773 PKGCONFIG_description=`eval echo "$PKGCONFIG_description"`
1774 AC_MSG_RESULT($PKGCONFIG_description)
1776 AC_MSG_CHECKING(our pkgconfig requires)
1777 PKGCONFIG_requires="ifelse($2,,$PACKAGE_REQUIRES,$2)"
1778 PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"`
1779 PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"`
1780 AC_MSG_RESULT($PKGCONFIG_requires)
1782 AC_MSG_CHECKING(our pkgconfig ext libs)
1783 PKGCONFIG_pkglibs="$PACKAGE_LIBS"
1784 test ".$PKGCONFIG_pkglibs" != "." || PKGCONFIG_pkglibs="-l$PKGCONFIG_libname"
1785 PKGCONFIG_libs="ifelse($3,,$PKGCONFIG_pkglibs $LIBS,$3)"
1786 PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"`
1787 PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"`
1788 AC_MSG_RESULT($PKGCONFIG_libs)
1790 AC_MSG_CHECKING(our pkgconfig cppflags)
1791 PKGCONFIG_cppflags="ifelse($5,,$CPPFLAGS $PACKAGE_CFLAGS,$5)"
1792 PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"`
1793 PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"`
1794 AC_MSG_RESULT($PKGCONFIG_cppflags)
1796 test ".$PKGCONFIG_generate" != "." || \
1797 PKGCONFIG_generate="ifelse($1,,$PKGCONFIG_libname.pc,$1)"
1798 PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"`
1799 PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"`
1800 test "$pkgconfig_libfile" != "$PKGCONFIG_generate" && (
1801 AC_MSG_RESULT(generate the pkgconfig later... $PKGCONFIG_generate))
1803 if test ".$PKGCONFIG_src_libdir" = "." ; then
1804 PKGCONFIG_src_libdir=`pwd`
1805 PKGCONFIG_src_libdir=`AS_DIRNAME("$PKGCONFIG_src_libdir/$PKGCONFIG_generate")`
1806 test ! -d $PKGCONFIG_src_libdir/src || \
1807 PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/src"
1809 *libs) PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/$objdir" ;; esac
1810 AC_MSG_RESULT(noninstalled pkgconfig -L $PKGCONFIG_src_libdir)
1813 if test ".$PKGCONFIG_src_headers" = "." ; then
1814 PKGCONFIG_src_headers=`pwd`
1815 v="$ac_top_srcdir" ;
1816 test ".$v" != "." || v="$ax_spec_dir"
1817 test ".$v" != "." || v="$srcdir"
1818 case "$v" in /*) PKG_CONFIG_src_headers="" ;; esac
1819 PKGCONFIG_src_headers=`AS_DIRNAME("$PKGCONFIG_src_headers/$v/x")`
1820 test ! -d $PKGCONFIG_src_headers/incl[]ude || \
1821 PKGCONFIG_src_headers="$PKGCONFIG_src_headers/incl[]ude"
1822 AC_MSG_RESULT(noninstalled pkgconfig -I $PKGCONFIG_src_headers)
1826 dnl AC_CONFIG_COMMANDS crap disallows to use $PKGCONFIG_libfile here...
1827 AC_CONFIG_COMMANDS([$ax_create_pkgconfig_generate],[
1828 pkgconfig_generate="$ax_create_pkgconfig_generate"
1829 if test ! -f "$pkgconfig_generate.in"
1830 then generate="true"
1831 elif grep ' generated by configure ' $pkgconfig_generate.in >/dev/null
1832 then generate="true"
1833 else generate="false";
1836 AC_MSG_NOTICE(creating $pkgconfig_generate.in)
1837 cat > $pkgconfig_generate.in <<AXEOF
1838 # generated by configure / remove this line to disable regeneration
1840 exec_prefix=@exec_prefix@
1844 sysconfdir=@sysconfdir@
1845 includedir=@includedir@
1849 Name: @PACKAGE_NAME@
1850 Description: @PACKAGE_DESCRIPTION@
1851 Version: @PACKAGE_VERSION@
1852 Requires: @PACKAGE_REQUIRES@
1853 Libs: -L\${libdir} @LIBS@
1854 Cflags: -I\${includedir} @CPPFLAGS@
1856 fi # DONE generate $pkgconfig_generate.in
1857 AC_MSG_NOTICE(creating $pkgconfig_generate)
1858 cat >conftest.sed <<AXEOF
1859 s|@prefix@|${pkgconfig_prefix}|
1860 s|@exec_prefix@|${pkgconfig_execprefix}|
1861 s|@bindir@|${pkgconfig_bindir}|
1862 s|@libdir@|${pkgconfig_libdir}|
1863 s|@datadir@|${pkgconfig_datadir}|
1864 s|@sysconfdir@|${pkgconfig_sysconfdir}|
1865 s|@includedir@|${pkgconfig_includedir}|
1866 s|@suffix@|${pkgconfig_suffix}|
1867 s|@PACKAGE@|${pkgconfig_package}|
1868 s|@PACKAGE_NAME@|${pkgconfig_libname}|
1869 s|@PACKAGE_DESCRIPTION@|${pkgconfig_description}|
1870 s|@PACKAGE_VERSION@|${pkgconfig_version}|
1871 s|@PACKAGE_REQUIRES@|${pkgconfig_requires}|
1872 s|@LIBS@|${pkgconfig_libs}|
1873 s|@CPPFLAGS@|${pkgconfig_cppflags}|
1875 sed -f conftest.sed $pkgconfig_generate.in > $pkgconfig_generate
1876 if test ! -s $pkgconfig_generate ; then
1877 AC_MSG_ERROR([$pkgconfig_generate is empty])
1878 fi ; rm conftest.sed # DONE generate $pkgconfig_generate
1879 pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.pc/'`
1880 AC_MSG_NOTICE(creating $pkgconfig_uninstalled)
1881 cat >conftest.sed <<AXEOF
1882 s|@prefix@|${pkgconfig_prefix}|
1883 s|@exec_prefix@|${pkgconfig_execprefix}|
1884 s|@bindir@|${pkgconfig_bindir}|
1885 s|@libdir@|${pkgconfig_src_libdir}|
1886 s|@datadir@|${pkgconfig_datadir}|
1887 s|@sysconfdir@|${pkgconfig_sysconfdir}|
1888 s|@includedir@|${pkgconfig_src_headers}|
1889 s|@suffix@|${pkgconfig_suffix}|
1890 s|@PACKAGE@|${pkgconfig_package}|
1891 s|@PACKAGE_NAME@|${pkgconfig_libname}|
1892 s|@PACKAGE_DESCRIPTION@|${pkgconfig_description}|
1893 s|@PACKAGE_VERSION@|${pkgconfig_version}|
1894 s|@PACKAGE_REQUIRES@|${pkgconfig_requires}|
1895 s|@LIBS@|${pkgconfig_libs}|
1896 s|@CPPFLAGS@|${pkgconfig_cppflags}|
1898 sed -f conftest.sed $pkgconfig_generate.in > $pkgconfig_uninstalled
1899 if test ! -s $pkgconfig_uninstalled ; then
1900 AC_MSG_ERROR([$pkgconfig_uninstalled is empty])
1901 fi ; rm conftest.sed # DONE generate $pkgconfig_uninstalled
1902 pkgconfig_requires_add=`echo ${pkgconfig_requires}`
1903 if test ".$pkgconfig_requires_add" != "." ; then
1904 pkgconfig_requires_add="pkg-config $pkgconfig_requires_add"
1905 else pkgconfig_requires_add=":" ; fi
1906 pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.sh/'`
1907 AC_MSG_NOTICE(creating $pkgconfig_uninstalled)
1908 cat >conftest.sed <<AXEOF
1909 s|@prefix@|\"${pkgconfig_prefix}\"|
1910 s|@exec_prefix@|\"${pkgconfig_execprefix}\"|
1911 s|@bindir@|\"${pkgconfig_bindir}\"|
1912 s|@libdir@|\"${pkgconfig_src_libdir}\"|
1913 s|@datadir@|\"${pkgconfig_datadir}\"|
1914 s|@sysconfdir@|\"${pkgconfig_sysconfdir}\"|
1915 s|@includedir@|\"${pkgconfig_src_headers}\"|
1916 s|@suffix@|\"${pkgconfig_suffix}\"|
1917 s|@PACKAGE@|\"${pkgconfig_package}\"|
1918 s|@PACKAGE_NAME@|\"${pkgconfig_libname}\"|
1919 s|@PACKAGE_DESCRIPTION@|\"${pkgconfig_description}\"|
1920 s|@PACKAGE_VERSION@|\"${pkgconfig_version}\"|
1921 s|@PACKAGE_REQUIRES@|\"${pkgconfig_requires}\"|
1922 s|@LIBS@|\"${pkgconfig_libs}\"|
1923 s|@CPPFLAGS@|\"${pkgconfig_cppflags}\"|
1924 s>Name:>for option\\; do case \"\$option\" in --list-all|--name) echo >
1925 s>Description: *>\\;\\; --help) pkg-config --help \\; echo Buildscript Of >
1926 s>Version: *>\\;\\; --modversion|--version) echo >
1927 s>Requires:>\\;\\; --requires) echo $pkgconfig_requires_add>
1928 s>Libs: *>\\;\\; --libs) echo >
1929 s>Cflags: *>\\;\\; --cflags) echo >
1931 $pkgconfig_requires_add
1933 $pkgconfig_requires_add\\
1934 ;; --variable=*) eval echo '\$'\`echo \$option | sed -e 's/.*=//'\`\\
1935 ;; --uninstalled) exit 0 \\
1938 sed -f conftest.sed $pkgconfig_generate.in > $pkgconfig_uninstalled
1939 if test ! -s $pkgconfig_uninstalled ; then
1940 AC_MSG_ERROR([$pkgconfig_uninstalled is empty])
1941 fi ; rm conftest.sed # DONE generate $pkgconfig_uninstalled
1943 dnl AC_CONFIG_COMMANDS crap, the AS_PUSHVAR defines are invalid here...
1944 ax_create_pkgconfig_generate="$ax_create_pkgconfig_generate"
1945 pkgconfig_prefix='$prefix'
1946 pkgconfig_execprefix='$exec_prefix'
1947 pkgconfig_bindir='$bindir'
1948 pkgconfig_libdir='$libdir'
1949 pkgconfig_includedir='$includedir'
1950 pkgconfig_datadir='$datadir'
1951 pkgconfig_sysconfdir='$sysconfdir'
1952 pkgconfig_suffix='$ax_create_pkgconfig_suffix'
1953 pkgconfig_package='$PACKAGE_NAME'
1954 pkgconfig_libname='$ax_create_pkgconfig_libname'
1955 pkgconfig_description='$ax_create_pkgconfig_description'
1956 pkgconfig_version='$ax_create_pkgconfig_version'
1957 pkgconfig_requires='$ax_create_pkgconfig_requires'
1958 pkgconfig_libs='$ax_create_pkgconfig_libs'
1959 pkgconfig_cppflags='$ax_create_pkgconfig_cppflags'
1960 pkgconfig_src_libdir='$ax_create_pkgconfig_src_libdir'
1961 pkgconfig_src_headers='$ax_create_pkgconfig_src_headers'
1963 AS_VAR_POPDEF([PKGCONFIG_suffix])dnl
1964 AS_VAR_POPDEF([PKGCONFIG_libdir])dnl
1965 AS_VAR_POPDEF([PKGCONFIG_libfile])dnl
1966 AS_VAR_POPDEF([PKGCONFIG_libname])dnl
1967 AS_VAR_POPDEF([PKGCONFIG_version])dnl
1968 AS_VAR_POPDEF([PKGCONFIG_description])dnl
1969 AS_VAR_POPDEF([PKGCONFIG_requires])dnl
1970 AS_VAR_POPDEF([PKGCONFIG_pkglibs])dnl
1971 AS_VAR_POPDEF([PKGCONFIG_libs])dnl
1972 AS_VAR_POPDEF([PKGCONFIG_cppflags])dnl
1973 AS_VAR_POPDEF([PKGCONFIG_generate])dnl
1974 AS_VAR_POPDEF([PKGCONFIG_src_libdir])dnl
1975 AS_VAR_POPDEF([PKGCONFIG_src_headers])dnl
1978 dnl ______ /usr/share/aclocal/guidod/ax_prefix_config_h.m4 ______
1979 dnl @synopsis AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
1981 dnl This is a new variant from ac_prefix_config_ this one will use a
1982 dnl lowercase-prefix if the config-define was starting with a
1983 dnl lowercase-char, e.g. "#define const", "#define restrict", or
1984 dnl "#define off_t", (and this one can live in another directory, e.g.
1985 dnl testpkg/config.h therefore I decided to move the output-header to
1986 dnl be the first arg)
1988 dnl takes the usual config.h generated header file; looks for each of
1989 dnl the generated "#define SOMEDEF" lines, and prefixes the defined name
1990 dnl (ie. makes it "#define PREFIX_SOMEDEF". The result is written to
1991 dnl the output config.header file. The PREFIX is converted to uppercase
1992 dnl for the conversions.
1996 dnl OUTPUT-HEADER = $PACKAGE-config.h
1997 dnl PREFIX = $PACKAGE
1998 dnl ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
2000 dnl Your configure.ac script should contain both macros in this order,
2001 dnl and unlike the earlier variations of this prefix-macro it is okay to
2002 dnl place the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation.
2006 dnl AC_INIT(config.h.in) # config.h.in as created by "autoheader"
2007 dnl AM_INIT_AUTOMAKE(testpkg, 0.1.1) # makes #undef VERSION and PACKAGE
2008 dnl AM_CONFIG_HEADER(config.h) # prep config.h from config.h.in
2009 dnl AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
2010 dnl AC_MEMORY_H # makes "#undef NEED_MEMORY_H"
2011 dnl AC_C_CONST_H # makes "#undef const"
2012 dnl AC_OUTPUT(Makefile) # creates the "config.h" now
2013 dnl # and also mylib/_config.h
2015 dnl if the argument to AX_PREFIX_CONFIG_H would have been omitted then the
2016 dnl default outputfile would have been called simply "testpkg-config.h", but
2017 dnl even under the name "mylib/_config.h" it contains prefix-defines like
2019 dnl #ifndef TESTPKG_VERSION
2020 dnl #define TESTPKG_VERSION "0.1.1"
2022 dnl #ifndef TESTPKG_NEED_MEMORY_H
2023 dnl #define TESTPKG_NEED_MEMORY_H 1
2025 dnl #ifndef _testpkg_const
2026 dnl #define _testpkg_const _const
2029 dnl and this "mylib/_config.h" can be installed along with other
2030 dnl header-files, which is most convenient when creating a shared
2031 dnl library (that has some headers) where some functionality is
2032 dnl dependent on the OS-features detected at compile-time. No
2033 dnl need to invent some "mylib-confdefs.h.in" manually. :-)
2035 dnl Note that some AC_DEFINEs that end up in the config.h file are
2036 dnl actually self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the
2037 dnl AC_TYPE_OFF_T say that they "will define inline|const|off_t if the
2038 dnl system does not do it by itself". You might want to clean up about
2039 dnl these - consider an extra mylib/conf.h that reads something like:
2041 dnl #include <mylib/_config.h>
2042 dnl #ifndef _testpkg_const
2043 dnl #define _testpkg_const const
2046 dnl and then start using _testpkg_const in the header files. That is
2047 dnl also a good thing to differentiate whether some library-user has
2048 dnl starting to take up with a different compiler, so perhaps it could
2049 dnl read something like this:
2052 dnl #include <mylib/_msvc.h>
2054 dnl #include <mylib/_config.h>
2056 dnl #ifndef _testpkg_const
2057 dnl #define _testpkg_const const
2060 dnl @version %Id: ax_prefix_config_h.m4,v 1.5 2003/07/02 23:29:23 guidod Exp %
2061 dnl @author Guiodo Draheim <guidod@gmx.de>
2063 AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER])
2064 AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
2065 AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
2066 AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
2067 AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
2068 AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
2069 AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
2070 AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
2071 m4_pushdef([_script],[conftest.prefix])dnl
2072 m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
2073 _OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
2074 _DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
2075 _PKG=`echo ifelse($2, , $PACKAGE, $2)`
2076 _LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
2077 _UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:" -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
2078 _INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
2079 if test ".$_INP" = "."; then
2080 for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
2082 *.h) _INP=$ac_file ;;
2085 test ".$_INP" != "." && break
2088 if test ".$_INP" = "."; then
2090 */*) _INP=`basename "$_OUT"`
2092 *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
2098 if test -z "$_PKG" ; then
2099 AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
2101 if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
2102 _INP="$srcdir/$_INP"
2104 AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
2105 if test -f $_INP ; then
2106 echo "s/@%:@undef *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script
2107 echo "s/@%:@undef *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script
2108 echo "s/@%:@def[]ine *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script
2109 echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script
2110 echo "@%:@endif/" >>_script
2111 echo "s/@%:@def[]ine *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script
2112 echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script
2113 echo "@%:@endif/" >> _script
2114 # now executing _script on _DEF input to create _OUT output file
2115 echo "@%:@ifndef $_DEF" >$tmp/pconfig.h
2116 echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
2117 echo ' ' >>$tmp/pconfig.h
2118 echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
2120 sed -f _script $_INP >>$tmp/pconfig.h
2121 echo ' ' >>$tmp/pconfig.h
2122 echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
2123 echo "@%:@endif" >>$tmp/pconfig.h
2124 if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
2125 AC_MSG_NOTICE([$_OUT is unchanged])
2127 ac_dir=`AS_DIRNAME(["$_OUT"])`
2128 AS_MKDIR_P(["$ac_dir"])
2130 mv $tmp/pconfig.h "$_OUT"
2132 cp _script _configs.sed
2134 AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
2138 m4_popdef([_symbol])dnl
2139 m4_popdef([_script])dnl
2140 AS_VAR_POPDEF([_INP])dnl
2141 AS_VAR_POPDEF([_UPP])dnl
2142 AS_VAR_POPDEF([_LOW])dnl
2143 AS_VAR_POPDEF([_PKG])dnl
2144 AS_VAR_POPDEF([_DEF])dnl
2145 AS_VAR_POPDEF([_OUT])dnl
2146 ],[PACKAGE="$PACKAGE"])])
2148 dnl ______ /usr/share/aclocal/guidod/ax_not_enable_frame_pointer.m4 ______
2149 dnl @* AX_NOT_ENABLE_FRAME_POINTER ([shellvar])
2151 dnl add --enable-frame-pointer option, the default will add the gcc
2152 dnl --fomit-frame-pointer option to the shellvar (per default CFLAGS)
2153 dnl and remove the " -g " debuginfo option from it. In other words,
2154 dnl the default is "--disable-frame-pointer"
2156 dnl @: guidod@gmx.de
2159 AC_DEFUN([AX_NOT_ENABLE_FRAME_POINTER],[dnl
2160 AS_VAR_PUSHDEF([VAR],[enable_frame_pointer])dnl
2161 AC_MSG_CHECKING([m4_ifval($1,$1,CFLAGS) frame-pointer])
2162 AC_ARG_ENABLE([frame-pointer], AC_HELP_STRING(
2163 [--enable-frame-pointer],[enable callframe generation for debugging]))
2165 .|.no|.no,*) test ".$VAR" = "." && VAR="no"
2166 m4_ifval($1,$1,CFLAGS)=`echo dnl
2167 " $m4_ifval($1,$1,CFLAGS) " | sed -e 's/ -g / /'`
2168 if test ".$GCC" = ".yes" ; then
2169 m4_ifval($1,$1,CFLAGS)="$m4_ifval($1,$1,CFLAGS) -fomit-frame-pointer"
2170 AC_MSG_RESULT([$VAR, -fomit-frame-pointer added])
2172 AC_MSG_RESULT([$VAR, -g removed])
2174 *) AC_MSG_RESULT([$VAR, kept]) ;;
2176 AS_VAR_POPDEF([VAR])dnl
2179 dnl ______ /usr/share/aclocal/guidod/ac_set_default_paths_system.m4 ______
2180 dnl @synopsis AC_SET_DEFAULT_PATHS_SYSTEM
2182 dnl the most interesting changes go about windows-targets - where the
2183 dnl default_prefix is set to /programs, and quite some directories
2184 dnl are aliased: sbindir := libdir := bindir and the docprefix-defaults
2185 dnl are also a bit different, even on FHS2-compliant systems where the
2186 dnl mandir is going to $prefix/man only if prefix=/usr, otherwise they
2187 dnl shall go to $datadir/man. We use an extra docprefix to express it
2188 dnl which is either defined as being prefix or datadir. not SUBSTed here.
2190 dnl @, (very useful)
2191 dnl @version %Id: ac_set_default_paths_system.m4,v 1.5 2003/02/02 19:32:30 guidod Exp %
2192 dnl @author Guido Draheim <guidod@gmx.de>
2193 AC_DEFUN([AC_SET_DEFAULT_PATHS_SYSTEM],
2194 [AC_REQUIRE([AC_CANONICAL_HOST]) # --------------------------------------------
2195 case "$prefix:$ac_default_prefix" in
2198 AC_MSG_CHECKING(default prefix path)
2199 case "${target_os}" in
2200 *cygwin* | *mingw* | *uwin* | *djgpp | *emx* )
2201 if test "${host_os}" = "${target_os}" ; then
2202 ac_default_prefix="/programs"
2203 result="(win/dos target)"
2206 *:/usr/local/cross-tools/$target_alias/bin:*)
2207 ac_default_prefix="/usr/local/cross-tools/$target_alias" ;;
2208 *:/usr/local/$target_alias/bin:*)
2209 ac_default_prefix="/usr/local/$target_alias" ;;
2210 *:/usr/local/$target_cpu-$target_os/bin:*)
2211 ac_default_prefix="/usr/local/$target_cpu-$target_os" ;;
2213 ac_default_prefix="/programs" ;;
2215 result="(win/dos cross-compiler)"
2219 AC_MSG_RESULT($ac_default_prefix $result)
2222 AC_MSG_CHECKING(default prefix system)
2223 result="$prefix" ; test "$result" = "NONE" && result="$ac_default_prefix"
2225 /programs | /programs/*) result="is win-/programs"
2226 # on win/dos, .exe .dll and .cfg live in the same directory
2227 libdir=`echo $libdir |sed -e 's:^..exec_prefix./lib$:${bindir}:'`
2228 sbindir=`echo $sbindir |sed -e 's:^..exec_prefix./sbin$:${libdir}:'`
2229 sysconfdir=`echo $sysconfdir |sed -e 's:^..prefix./etc$:${sbindir}:'`
2230 libexecdir=`echo $libexecdir |sed -e 's:/libexec$:/system:'`
2231 # help-files shall be set with --infodir, docprefix is datadir
2232 docprefix="${datadir}"
2233 mandir=`echo $mandir \
2234 |sed -e 's:^..prefix./man$:${datadir}/info:'`
2235 includedir=`echo $includedir \
2236 |sed -e 's:^..prefix./include$:${datadir}/include:'`
2237 # other state files (but /etc) are moved to datadir
2238 sharedstatedir=`echo $sharedstatedir \
2239 |sed -e 's:^..prefix./com$:${datadir}/default:'`
2240 localstatedir=`echo $localstatedir \
2241 |sed -e 's:^..prefix./var$:${datadir}/current:'`
2243 /usr) result="is /usr-shipped"
2244 # doc files are left at prefix
2245 docprefix="${prefix}"
2246 # state files go under /top
2247 sysconfdir=`echo $sysconfdir |sed -e 's:^..prefix./etc$:/etc:'`
2248 sharedstatedir=`echo $sharedstatedir \
2249 |sed -e 's:^..prefix./com$:/etc/default:'`
2250 # $prefix/var is going to end up in /var/lib
2251 localstatedir=`echo $localstatedir \
2252 |sed -e 's:^..prefix./var$:/var/lib:'`
2254 /opt | /opt/*) result="is /opt-package"
2255 # state files go under /top/prefix
2256 sysconfdir=`echo $sysconfdir \
2257 |sed -e 's:^..prefix./etc$:/etc${prefix}:'`
2258 sharedstatedir=`echo $sharedstatedir \
2259 |sed -e 's:^..prefix./com$:/etc/default${prefix}:'`
2260 # $prefix/var is going to to be /var$prefix... once again
2261 localstatedir=`echo $localstatedir \
2262 |sed -e 's:^..prefix./var$:/var${prefix}:'`
2263 # doc files are left at prefix
2264 docprefix="${prefix}"
2266 *) result="is /local-package"
2267 # doc files are moved from prefix down to datadir
2268 docprefix="${datadir}"
2269 mandir=`echo $mandir \
2270 |sed -e 's:^..prefix./man$:${datadir}/man:'`
2271 infodir=`echo $infodir \
2272 |sed -e 's:^..prefix./infodir$:${datadir}/info:'`
2273 # never use $prefix/com - that is no good idea
2274 sharedstatedir=`echo $sharedstatedir \
2275 |sed -e 's:^..prefix./com$:${sysconfdir}/default:'`
2278 AC_MSG_RESULT($result)
2279 # --------------------------------------------------------
2282 dnl ______ /usr/share/aclocal/guidod/ax_cflags_no_writable_strings.m4 ______
2283 dnl @synopsis AX_CFLAGS_NO_WRITABLE_STRINGS [(shellvar [,default, [A/NA]])]
2285 dnl Try to find a compiler option that makes all stringliteral readonly.
2287 dnl The sanity check is done by looking at string.h which has a set
2288 dnl of strcpy definitions that should be defined with const-modifiers
2289 dnl to not emit a warning in all so many places.
2291 dnl For the GNU CC compiler it will be -fno-writable-strings -Wwrite-strings
2292 dnl The result is added to the shellvar being CFLAGS by default.
2296 dnl - $1 shell-variable-to-add-to : CFLAGS
2297 dnl - $2 add-value-if-not-found : nothing
2298 dnl - $3 action-if-found : add value to shellvariable
2299 dnl - $4 action-if-not-found : nothing
2301 dnl @version %Id: ax_cflags_no_writable_strings.m4,v 1.6 2003/06/05 00:52:15 guidod Exp %
2302 dnl @author Guido Draheim <guidod@gmx.de>
2304 AC_DEFUN([AX_CFLAGS_NO_WRITABLE_STRINGS],[dnl
2305 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
2306 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_no_writable_strings])dnl
2307 AC_CACHE_CHECK([m4_ifval([$1],[$1],FLAGS) making strings readonly],
2308 VAR,[VAR="no, unknown"
2311 ac_save_[]FLAGS="$[]FLAGS"
2313 # -use_readonly_const is the default for IRIX C,
2314 # puts them into .rodata, but they are copied later.
2315 # need to be "-G0 -rdatashared" for strictmode but
2316 # I am not sure what effect that has really. - guidod
2318 in "-Wall % -fno-writable-strings -Wwrite-strings" dnl GCC
2319 "-v -Xc % -xstrconst" dnl Solaris C - strings go into readonly segment
2320 "+w1 -Aa % +ESlit" dnl HP-UX C - strings go into readonly segment
2321 "-w0 -std1 % -readonly_strings" dnl Digital Unix - again readonly segment
2322 "-fullwarn -use_readonly_const %% ok, its the default" dnl IRIX C
2324 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
2325 AC_TRY_COMPILE([],[return 0;],
2326 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
2330 *) # sanity check - testing strcpy() from string.h
2331 cp config.log config.tmp
2332 AC_TRY_COMPILE([#include <string.h>],[
2334 if (strcpy (test, "test")) return 1;],
2335 dnl the original did use test -n `$CC testprogram.c`
2336 [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
2337 then VAR="no, suppressed, string.h," ; fi],
2338 [VAR="no, suppressed, string.h"])
2342 FLAGS="$ac_save_[]FLAGS"
2346 .ok|.ok,*) m4_ifvaln($3,$3) ;;
2347 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
2348 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
2349 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
2350 *) m4_ifvaln($3,$3,[
2351 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
2352 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
2353 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
2354 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
2357 AS_VAR_POPDEF([VAR])dnl
2358 AS_VAR_POPDEF([FLAGS])dnl
2361 dnl the only difference - the LANG selection... and the default FLAGS
2363 AC_DEFUN([AX_CXXFLAGS_NO_WRITABLE_STRINGS],[dnl
2364 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
2365 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_no_writable_strings])dnl
2366 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) making strings readonly],
2367 VAR,[VAR="no, unknown"
2370 ac_save_[]FLAGS="$[]FLAGS"
2372 # -use_readonly_const is the default for IRIX C,
2373 # puts them into .rodata, but they are copied later.
2374 # need to be "-G0 -rdatashared" for strictmode but
2375 # I am not sure what effect that has really. - guidod
2377 in "-Wall % -fno-writable-strings -Wwrite-strings" dnl GCC
2378 "-v -Xc % -xstrconst" dnl Solaris C - strings go into readonly segment
2379 "+w1 -Aa % +ESlit" dnl HP-UX C - strings go into readonly segment
2380 "-w0 -std1 % -readonly_strings" dnl Digital Unix - again readonly segment
2381 "-fullwarn -use_readonly_const %% ok, its the default" dnl IRIX C
2383 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
2384 AC_TRY_COMPILE([],[return 0;],
2385 [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
2389 *) # sanity check - testing strcpy() from string.h
2390 cp config.log config.tmp
2391 AC_TRY_COMPILE([#include <string.h>],[[
2393 if (strcpy (test, "test")) return 1;]],
2394 dnl the original did use test -n `$CC testprogram.c`
2395 [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
2396 then VAR="no, suppressed, string.h," ; fi],
2397 [VAR="no, suppressed, string.h"])
2401 FLAGS="$ac_save_[]FLAGS"
2405 .ok|.ok,*) m4_ifvaln($3,$3) ;;
2406 .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
2407 AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
2408 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
2409 *) m4_ifvaln($3,$3,[
2410 if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
2411 then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
2412 else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
2413 m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
2416 AS_VAR_POPDEF([VAR])dnl
2417 AS_VAR_POPDEF([FLAGS])dnl
2420 dnl ______ /usr/share/aclocal/guidod/ax_spec_file.m4 ______
2421 dnl @* AX_SPEC_FILE [(rpmspecfile [,subdirpath])]
2423 dnl set the specfile - if no argument has been given then check whether
2424 dnl the ac_unique_file looks like a .spec file and use it. This macro
2425 dnl is ac_REQUIRED by many AX_SPEC_ routines.
2427 dnl the AX_SPEC_EXTRACT macro is a helper used by many AX_SPEC_
2428 dnl routines and therefore placed here to be automatically included
2429 dnl in the macro set of (older) aclocal/acinclude.
2431 dnl AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]])
2433 dnl @version %Id: ax_spec_file.m4,v 1.1 2003/10/18 23:38:41 guidod Exp %
2434 dnl @author Guido Draheim <guidod@gmx.de>
2436 AC_DEFUN([AX_SPEC_FILE],
2437 [ AC_MSG_CHECKING([rpm spec file])
2438 if test ".$1" != "." ; then
2440 ax_spec_file=`basename $1`
2442 case ".$ac_unique_file" in
2443 *.spec) ax_spec_file="$ac_unique_file"
2444 ax_spec_file_="$ac_unique_file" ;;
2445 *) ax_spec_file="TODO"
2446 if test ".$PACKAGE" != "."
2447 then ax_spec_file_="$PACKAGE.spec"
2448 else ax_spec_file_="README"
2450 cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
2451 no ax_spec_file argument has been given, using defaults of
2459 for i in ifelse($2,,,$2) . $srcdir $srcdir/.. .. ; do
2460 if test -f "$i/$ax_spec_file_" ; then
2462 ax_spec_file="$ax_spec_dir/$ax_spec_file_"
2465 if test -f "$i/$ax_spec_file" ; then
2467 ax_spec_file="$ax_spec_dir/$ax_spec_file"
2471 case "$ax_spec_file" in
2472 ./*) if test "$ax_spec_file" = "./$ax_spec_file_" ; then
2473 ax_spec_file="$ax_spec_file_"
2475 AC_MSG_RESULT([$ax_spec_file]) ;;
2476 */*) AC_MSG_RESULT([$ax_spec_file]) ;;
2477 *) AC_MSG_ERROR([no rpm spec file found]) ;;
2479 m4_define([m4_ax_spec_file],[ax_spec_file])
2482 dnl AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]])
2484 AC_DEFUN([AX_SPEC_EXTRACT],
2486 if test ".$[]$1" = "." ; then
2487 $1=`grep -i '^[[ ]]*m4_ifval([$2],[$2],[$1])[[ ]]*:' dnl
2488 "$ax_spec_file" | sed -e 's/.*:[[ ]]*//' dnl
2489 -e 's/[[ ]][[ ]]*/ /g' -e 's/^ //' -e 's/ $[]//' -e 'q'`
2490 if test ".$[]$1" = "." ; then
2491 for $1 in $2 $1 m4_tolower([$1]) ; do
2492 $1=`echo "$[]$1" | sed -e 's/^%//g'`
2494 -e "/^%[[ ]]*def[]ine[[ ]][[ ]]*$[]$1[[ ]]/!d" dnl
2495 -e "s/^%[[ ]]*def[]ine[[ ]][[ ]]*$[]$1[[ ]]*//" dnl
2496 -e 's/[[ ]][[ ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file`
2497 test ".$1" != "." && break
2502 $1=`echo "$[]$1" | sed -e 's/%{//' -e 's/}$[]//'`
2504 -e "/^%[[ ]]*def[]ine[[ ]][[ ]]*$[]$1[[ ]]/!d" dnl
2505 -e "s/^%[[ ]]*def[]ine[[ ]][[ ]]*$[]$1[[ ]]*//" dnl
2506 -e 's/[[ ]][[ ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file` ;;
2508 $1=`echo "$[]$1" | sed -e 's/%//'`
2510 -e "/^%[[ ]]*def[]ine[[ ]][[ ]]*$[]$1[[ ]]/!d" dnl
2511 -e "s/^%[[ ]]*def[]ine[[ ]][[ ]]*$[]$1[[ ]]*//" dnl
2512 -e 's/[[ ]][[ ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file` ;;
2514 m4_ifval([$3],[test ".$[]$1" = "." && $1="$3"])
2515 fi # test ".$[]$1" = "."