]> granicus.if.org Git - zziplib/blob - acinclude.m4
This commit was generated by cvs2svn to compensate for changes in r122,
[zziplib] / acinclude.m4
1 dnl acinclude.m4 generated automatically by ac-archive's acinclude 0.5.53
2
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.
7
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.
12
13 dnl ______ /usr/share/aclocal/guidod/ax_cflags_gcc_option.m4 ______
14 dnl @synopsis AX_CFLAGS_GCC_OPTION ([shellvar], optionflag [,A/NA])
15 dnl
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.
21 dnl
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++).
25 dnl
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
30 dnl ac-archive.
31 dnl
32 dnl   - $1 shell-variable-to-add-to : CFLAGS
33 dnl   - $2 option-to-check-for : required ("-option" as non-value)
34 dnl   - $3 action-if-found : add value to shellvariable
35 dnl   - $4 action-if-not-found : nothing
36 dnl
37 dnl @, untested, experimental
38 dnl @version %Id: ax_cflags_gcc_option.m4,v 1.2 2003/06/04 23:54:23 guidod Exp %
39 dnl @author Guido Draheim <guidod@gmx.de>
40 dnl
41 AC_DEFUN([AX_CFLAGS_GCC_OPTION], [dnl
42 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
43 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
44 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
45 VAR,[VAR="no, unknown"
46  AC_LANG_SAVE
47  AC_LANG_C
48  ac_save_[]FLAGS="$[]FLAGS"
49 for ac_arg dnl
50 in "-pedantic  % m4_ifval($2,$2,-option)"  dnl   GCC
51    #
52 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
53    AC_TRY_COMPILE([],[return 0;],
54    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
55 done
56  FLAGS="$ac_save_[]FLAGS"
57  AC_LANG_RESTORE
58 ])
59 case ".$VAR" in
60      .ok|.ok,*) m4_ifvaln($3,$3) ;;
61    .|.no|.no,*) m4_ifvaln($4,$4) ;;
62    *) m4_ifvaln($3,$3,[
63    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
64    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
65    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
66                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
67    fi ]) ;;
68 esac
69 AS_VAR_POPDEF([VAR])dnl
70 AS_VAR_POPDEF([FLAGS])dnl
71 ])
72
73
74 dnl the only difference - the LANG selection... and the default FLAGS
75
76 AC_DEFUN([AX_CXXFLAGS_GCC_OPTION], [dnl
77 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
78 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
79 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
80 VAR,[VAR="no, unknown"
81  AC_LANG_SAVE
82  AC_LANG_CXX
83  ac_save_[]FLAGS="$[]FLAGS"
84 for ac_arg dnl
85 in "-pedantic  % m4_ifval($2,$2,-option)"  dnl   GCC
86    #
87 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
88    AC_TRY_COMPILE([],[return 0;],
89    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
90 done
91  FLAGS="$ac_save_[]FLAGS"
92  AC_LANG_RESTORE
93 ])
94 case ".$VAR" in
95      .ok|.ok,*) m4_ifvaln($3,$3) ;;
96    .|.no|.no,*) m4_ifvaln($4,$4) ;;
97    *) m4_ifvaln($3,$3,[
98    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
99    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
100    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
101                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
102    fi ]) ;;
103 esac
104 AS_VAR_POPDEF([VAR])dnl
105 AS_VAR_POPDEF([FLAGS])dnl
106 ])
107
108 dnl ______  ______
109
110 dnl ______ /usr/share/aclocal/guidod/patch_libtool_sys_lib_search_path_spec.m4 ______
111 dnl @* PATCH_LIBTOOL_SYS_LIB_SEARCH_PATH_SPEC
112 dnl
113 dnl Cross-compiling to win32 from a unix system reveals a bug - the
114 dnl path-separator has been set to ";" depending on the target system.
115 dnl However, the crossgcc search_path_spec works in a unix-environment
116 dnl with unix-style directories and unix-stylish path_separator. The
117 dnl result: the search_path_spec is a single word still containing the
118 dnl ":" separators.
119 dnl
120 dnl This macro fixes the situation: when we see the libtool PATH_SEP
121 dnl to be ":" and search_path_spec to contain ":" characters, then
122 dnl these are replaced with spaces to let the resulting string work
123 dnl as a for-loop argument in libtool scripts that resolve -no-undefined
124 dnl libraries.
125 dnl
126 dnl Later libtool generations have fixed the situation with using
127 dnl $PATH_SEPARATOR in the first place as the original path delimiter
128 dnl that will be scanned for and replaced into spaces.
129 dnl
130 dnl @= guidod@gmx.de
131 dnl @%Id: patch_libtool_sys_lib_search_path_spec.m4,v 1.3 2003/03/23 13:20:27 guidod Exp %
132
133 AC_DEFUN([PATCH_LIBTOOL_SYS_LIB_SEARCH_PATH_SPEC],
134 [# patch libtool to fix sys_lib_search_path (e.g. crosscompiling a win32 dll)
135 if test "_$PATH_SEPARATOR" = "_:" ; then
136   if grep "^sys_lib_search_path_spec.*:" libtool >/dev/null ; then
137 AC_MSG_RESULT(patching libtool to fix sys_lib_search_path_spec)
138     test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
139     sed -e "/^sys_lib_search_path_spec/s/:/ /g" libtool >libtool.new
140     (test -s libtool.new || rm libtool.new) 2>/dev/null
141     test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
142     test -f libtool     || mv libtool.old libtool
143   fi
144 fi
145 ])
146 dnl ______ /usr/share/aclocal/guidod/ax_warning_default_aclocaldir.m4 ______
147 dnl @* AX_WARNING_DEFAULT_ACLOCALDIR [(dirvariable [,defsetting])]
148 dnl
149 dnl print a warning message if the $(datadir)/aclocal directory
150 dnl is not in the dirlist searched by the aclocal tool. This macro
151 dnl is useful if some `make install` would target $(datadir)/aclocal
152 dnl to install an autoconf m4 file of your project to be picked up
153 dnl by other projects.
154 dnl
155 dnl  default $1 dirvariable = aclocaldir
156 dnl  default $2 defsetting  = ${datadir}/aclocal
157 dnl  (the defsetting is not placed in dirvariable nor is it ac_subst'ed)
158 dnl
159 dnl @: guidod@gmx.de
160 dnl @%Id: %
161
162 AC_DEFUN([AX_WARNING_DEFAULT_ACLOCALDIR],[dnl
163 AC_REQUIRE([AX_EXPAND_PREFIX])dnl
164 AS_VAR_PUSHDEF([DIR],[ax_warning_default_aclocal_dir])dnl
165 AS_VAR_PUSHDEF([BIN],[ax_warning_default_aclocal_bin])dnl
166 AS_VAR_PUSHDEF([LOC],[ax_warning_default_aclocal_loc])dnl
167 if test ".$ACLOCAL" = "." ; then
168    AC_PATH_PROG([ACLOCAL],[aclocal],[:])
169 fi
170 LOC='m4_if([$2],,[${datadir}/aclocal],[$2])'
171 m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
172 BIN="$ACLOCAL"
173 test ".$BIN" = "." && BIN="aclocal" 
174 DIR=`test ".$SHELL" = "." && SHELL="'sh'" ; eval "$BIN --print-ac-dir"`
175 test ".$DIR" = "." && test -d "/usr/share/aclocal" && DIR="/usr/share/aclocal"
176 test ".$DIR" = "." && DIR="/"
177 DIR=`eval "echo $DIR"`  # we need to expand 
178 DIR=`eval "echo $DIR"`
179 LOC=`eval "echo $LOC"`
180 LOC=`eval "echo $LOC"`
181 AC_RUN_LOG([: test "$LOC" = "$DIR"])
182 if test "$LOC" != "$DIR" ; then
183    if test -f "$DIR/dirlist" ; then
184       for DIR in `cat $DIR/dirlist` $DIR ; do
185           AC_RUN_LOG([: test "$LOC" = "$DIR"])
186           test "$LOC" = "$DIR" && break
187       done
188    fi
189    if test "$LOC" != "$DIR" ; then
190       AC_MSG_NOTICE([warning: m4_if([$1],,[aclocaldir],[$1])=$LOC dnl
191 (see config.log)])
192    AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[aclocaldir],[$1])=$DIR])
193    cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
194   aclocaldir:   the m4_if([$1],,[default aclocaldir],[$1 value]) of $LOC
195   aclocaldir:   is not listed in the dirlist where aclocal will look
196   aclocaldir:   for macros - you can override the install-path using
197   aclocaldir:   make install aclocaldir=$DIR
198   aclocaldir:   or append the directory to aclocal reconfigures later as
199   aclocaldir:   aclocal -I $LOC
200   aclocaldir:   when an autoconf macro is needed from that directory
201 EOF
202    fi
203 fi
204 AS_VAR_POPDEF([LOC])dnl
205 AS_VAR_POPDEF([BIN])dnl
206 AS_VAR_POPDEF([DIR])dnl
207 ])
208
209 dnl ______ /usr/share/aclocal/guidod/ax_cflags_warn_all.m4 ______
210 dnl @synopsis AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
211 dnl
212 dnl Try to find a compiler option that enables most reasonable warnings.
213 dnl This macro is directly derived from VL_PROG_CC_WARNINGS which is
214 dnl split up into two AX_CFLAGS_WARN_ALL and AX_CFLAGS_WARN_ALL_ANSI
215 dnl
216 dnl For the GNU CC compiler it will be -Wall (and -ansi -pedantic)
217 dnl The result is added to the shellvar being CFLAGS by default.
218 dnl
219 dnl Currently this macro knows about GCC, Solaris C compiler,
220 dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler,
221 dnl IRIX C compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90
222 dnl (Unicos 10.0.0.8) C compiler.
223 dnl
224 dnl - $1 shell-variable-to-add-to : CFLAGS
225 dnl - $2 add-value-if-not-found : nothing 
226 dnl - $3 action-if-found : add value to shellvariable
227 dnl - $4 action-if-not-found : nothing 
228 dnl
229 dnl @version %Id: ax_cflags_warn_all.m4,v 1.1 2003/01/06 00:51:33 guidod Exp %
230 dnl @author Guido Draheim <guidod@gmx.de>
231 dnl
232 AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
233 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
234 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
235 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
236 VAR,[VAR="no, unknown"
237  AC_LANG_SAVE
238  AC_LANG_C
239  ac_save_[]FLAGS="$[]FLAGS"
240 for ac_arg dnl
241 in "-pedantic  % -Wall"       dnl   GCC
242    "-xstrconst % -v"          dnl Solaris C 
243    "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix 
244    "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
245    "-ansi -ansiE % -fullwarn" dnl IRIX
246    "+ESlit     % +w1"         dnl HP-UX C 
247    "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
248    "-h conform % -h msglevel 2" dnl Cray C (Unicos)
249    # 
250 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
251    AC_TRY_COMPILE([],[return 0;],
252    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
253 done
254  FLAGS="$ac_save_[]FLAGS"
255  AC_LANG_RESTORE
256 ])
257 case ".$VAR" in
258      .ok|.ok,*) m4_ifvaln($3,$3) ;;
259    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
260         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
261                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
262    *) m4_ifvaln($3,$3,[
263    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
264    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
265    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
266                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
267    fi ]) ;;
268 esac
269 AS_VAR_POPDEF([VAR])dnl
270 AS_VAR_POPDEF([FLAGS])dnl
271 ])
272
273 dnl the only difference - the LANG selection... and the default FLAGS
274
275 AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
276 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
277 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
278 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
279 VAR,[VAR="no, unknown"
280  AC_LANG_SAVE
281  AC_LANG_CXX
282  ac_save_[]FLAGS="$[]FLAGS"
283 for ac_arg dnl
284 in "-pedantic  % -Wall"       dnl   GCC
285    "-xstrconst % -v"          dnl Solaris C 
286    "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix 
287    "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
288    "-ansi -ansiE % -fullwarn" dnl IRIX
289    "+ESlit     % +w1"         dnl HP-UX C 
290    "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
291    "-h conform % -h msglevel 2" dnl Cray C (Unicos)
292    # 
293 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
294    AC_TRY_COMPILE([],[return 0;],
295    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
296 done
297  FLAGS="$ac_save_[]FLAGS"
298  AC_LANG_RESTORE
299 ])
300 case ".$VAR" in
301      .ok|.ok,*) m4_ifvaln($3,$3) ;;
302    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
303         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
304                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
305    *) m4_ifvaln($3,$3,[
306    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
307    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
308    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
309                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
310    fi ]) ;;
311 esac
312 AS_VAR_POPDEF([VAR])dnl
313 AS_VAR_POPDEF([FLAGS])dnl
314 ])
315
316 dnl  implementation tactics:
317 dnl   the for-argument contains a list of options. The first part of
318 dnl   these does only exist to detect the compiler - usually it is
319 dnl   a global option to enable -ansi or -extrawarnings. All other
320 dnl   compilers will fail about it. That was needed since a lot of
321 dnl   compilers will give false positives for some option-syntax
322 dnl   like -Woption or -Xoption as they think of it is a pass-through
323 dnl   to later compile stages or something. The "%" is used as a
324 dnl   delimimiter. A non-option comment can be given after "%%" marks.
325
326
327 dnl ______ /usr/share/aclocal/guidod/ax_cflags_strict_prototypes.m4 ______
328 dnl @synopsis AX_CFLAGS_STRICT_PROTOTYPES [(shellvar [,default, [A/NA]]
329 dnl
330 dnl Try to find a compiler option that requires strict prototypes.
331 dnl
332 dnl The sanity check is done by looking at sys/signal.h which has a set
333 dnl of macro-definitions SIG_DFL and SIG_IGN that are cast to the local
334 dnl signal-handler type. If that signal-handler type is not fully
335 dnl qualified then the system headers are not seen as strictly prototype clean.
336 dnl
337 dnl For the GNU CC compiler it will be -fstrict-prototypes -Wstrict-prototypes
338 dnl The result is added to the shellvar being CFLAGS by default.
339 dnl
340 dnl DEFAULTS:
341 dnl
342 dnl  - $1 shell-variable-to-add-to : CFLAGS
343 dnl  - $2 add-value-if-not-found : nothing
344 dnl  - $3 action-if-found : add value to shellvariable
345 dnl  - $4 action-if-not-found : nothing
346 dnl
347 dnl @version %Id: ax_cflags_strict_prototypes.m4,v 1.7 2003/06/05 00:52:22 guidod Exp %
348 dnl @author Guido Draheim <guidod@gmx.de>
349 dnl
350 AC_DEFUN([AX_CFLAGS_STRICT_PROTOTYPES],[dnl
351 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
352 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_strict_prototypes])dnl
353 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for strict prototypes],
354 VAR,[VAR="no, unknown"
355  AC_LANG_SAVE
356  AC_LANG_C
357  ac_save_[]FLAGS="$[]FLAGS"
358 for ac_arg dnl
359 in "-Wall     % -fstrict-prototypes -Wstrict-prototypes" dnl   GCC
360    "-Wall     % -Wstrict-prototypes" dnl try to warn atleast
361    #
362 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
363    AC_TRY_COMPILE([],[return 0;],
364    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
365 done
366 case ".$VAR" in
367    .|.no|.no,*) ;;
368    *) # sanity check with signal() from sys/signal.h
369     cp config.log config.tmp
370     AC_TRY_COMPILE([#include <signal.h>],[
371     if (signal (SIGINT, SIG_IGN) == SIG_DFL) return 1;
372     if (signal (SIGINT, SIG_IGN) != SIG_DFL) return 2;],
373     dnl the original did use test -n `$CC testprogram.c`
374     [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
375 then if test `diff config.log config.tmp | grep -i warning | wc -l` != 1
376 then VAR="no, suppressed, signal.h," ; fi ; fi],
377     [VAR="no, suppressed, signal.h"])
378     rm config.tmp
379   ;;
380 esac
381  FLAGS="$ac_save_[]FLAGS"
382  AC_LANG_RESTORE
383 ])
384 case ".$VAR" in
385      .ok|.ok,*) m4_ifvaln($3,$3) ;;
386    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
387         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
388                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
389    *) m4_ifvaln($3,$3,[
390    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
391    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
392    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
393                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
394    fi ]) ;;
395 esac
396 AS_VAR_POPDEF([VAR])dnl
397 AS_VAR_POPDEF([FLAGS])dnl
398 ])
399
400 dnl the only difference - the LANG selection... and the default FLAGS
401
402 AC_DEFUN([AX_CXXFLAGS_STRICT_PROTOTYPES],[dnl
403 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
404 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_strict_prototypes])dnl
405 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for strict prototypes],
406 VAR,[VAR="no, unknown"
407  AC_LANG_SAVE
408  AC_LANG_CXX
409  ac_save_[]FLAGS="$[]FLAGS"
410 for ac_arg dnl
411 in "-Wall     % -fstrict-prototypes -Wstrict-prototypes" dnl   GCC
412    "-Wall     % -Wstrict-prototypes" dnl try to warn atleast
413    #
414 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
415    AC_TRY_COMPILE([],[return 0;],
416    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
417 done
418 case ".$VAR" in
419    .|.no|.no,*) ;;
420    *) # sanity check with signal() from sys/signal.h
421     cp config.log config.tmp
422     AC_TRY_COMPILE([#include <signal.h>],[
423     if (signal (SIGINT, SIG_IGN) == SIG_DFL) return 1;
424     if (signal (SIGINT, SIG_IGN) != SIG_DFL) return 2;],
425     dnl the original did use test -n `$CC testprogram.c`
426     [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
427 then if test `diff config.log config.tmp | grep -i warning | wc -l` != 1
428 then VAR="no, suppressed, signal.h," ; fi ; fi],
429     [VAR="no, suppressed, signal.h"])
430     rm config.tmp
431   ;;
432 esac
433  FLAGS="$ac_save_[]FLAGS"
434  AC_LANG_RESTORE
435 ])
436 case ".$VAR" in
437      .ok|.ok,*) m4_ifvaln($3,$3) ;;
438    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
439         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
440                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
441    *) m4_ifvaln($3,$3,[
442    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
443    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
444    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
445                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
446    fi ]) ;;
447 esac
448 AS_VAR_POPDEF([VAR])dnl
449 AS_VAR_POPDEF([FLAGS])dnl
450 ])
451
452 dnl ______ /usr/share/aclocal/guidod/ax_spec_package_version.m4 ______
453 dnl @* AX_SPEC_PACKAGE_AND_VERSION ([specfile])
454 dnl @* AX_SPEC_PACKAGE_NAME ([shellvar],[defaultvalue])
455 dnl @* AX_SPEC_PACKAGE_VERSION ([shellvar],[defaultvalue])
456 dnl @* AX_SPEC_PACKAGE_SUMMARY ([shellvar],[defaultvalue])
457 dnl @* AX_SPEC_PACKAGE_LICENSE ([shellvar],[defaultvalue])
458 dnl @* AX_SPEC_PACKAGE_CATEGORY ([shellvar],[defaultvalue])
459 dnl @* AX_SPEC_PACKAGE_ICON ([shellvar],[defaultvalue])
460 dnl @* AX_SPEC_DEFAULTS([specfile])
461 dnl
462 dnl set PACKAGE from the given specfile - default to basename of
463 dnl the rpmspecfile if no "name:" could be found in the spec file.
464 dnl
465 dnl set VERSION from the given specfile - default to a date-derived
466 dnl value if no "version:" could be found in the spec file.
467 dnl
468 dnl this macro builds on top of AX_SPEC_FILE / AX_SPEC_EXTRACT
469 dnl
470 dnl more specific: if not "name:" or "%define name" was found in
471 dnl the myproject.spec file then the PACKAGE var is set to the
472 dnl basename "myproject". When no spec file was present then it
473 dnl will usually default to "TODO".
474 dnl
475 dnl The version spec looks for "version:" or "%define version" in
476 dnl the spec file. When no such value was seen or no spec file
477 dnl had been present then the value is set to `date +0.%y.%W%w`.
478 dnl
479 dnl the version value itself is sanitized somewhat with making
480 dnl it to always carry atleast three digits (1.2.3) and clensing
481 dnl superflous "0" chars around from generating numbers elsewhere.
482 dnl
483 dnl additional macros are provided that extract a specific value
484 dnl from the spec file, among these:
485 dnl
486 dnl set PACKAGE_SUMMARY from the given specfile - default to package and
487 dnl try to detect a type suffix if "summary:" was not in the spec file
488 dnl
489 dnl set PACKAGE_LICENSE from the given specfile - if no "license:" tag was
490 dnl given in the spec file then various COPYING files are grepped to
491 dnl have a guess and the final fallback will be GNU GPL (or GNU LGPL).
492 dnl
493 dnl set PACKAGE_ICON from the given specfile - if no "icon:" tag was
494 dnl given in the spec file then we default to $PACKAGE-icon.png
495 dnl
496 dnl the final AX_SPEC_INIT(specfile) will initialize all variables to
497 dnl its defaults according to the spec file given.
498 dnl
499 dnl @version %Id: %
500 dnl @author Guido Draheim <guidod@gmx.de>
501
502 AC_DEFUN([AX_SPEC_PACKAGE_LICENSE],[AC_REQUIRE([AX_SPEC_FILE])dnl
503   AS_VAR_PUSHDEF([VAR],[PACKAGE_LICENSE])dnl
504   AC_MSG_CHECKING([for spec license type])
505   if test ".$VAR" = "." ; then if test ! -f $ax_spec_file 
506   then k="(w/o spec)"
507   else k=""
508     AX_SPEC_EXTRACT(VAR,[license],m4_ifval($1,$1))
509     VAR=`echo $VAR | sed -e 's/ *License//g'`
510   fi fi
511   test ".$VAR" = "." && k="(fallback)"
512   ifelse($2,,[dnl here the defaults for LICENSE / COPYRIGHT
513   if test ".$VAR"   = "."  ; then
514     for ac_file in "$srcdir/COPYING" "$srcdir/COPYING" "$srcdir/LICENSE" ; do
515       test -f "$ac_file" || continue
516 dnl  http://www.ibiblio.org/osrt/omf/omf_elements "16. Rights"
517       if grep "GNU LESSER GENERAL PUBLIC LICENSE" "$ac_file" >/dev/null
518       then VAR="GNU LGPL" ; break
519       elif grep "GNU GENERAL PUBLIC LICENSE" "$ac_file" >/dev/null
520       then VAR="GNU GPL" ; break
521       elif grep "MOZILLA PUBLIC LICENSE" "$ac_file" >/dev/null
522       then VAR="MPL" ; break
523       elif grep "Mozilla Public License" "$ac_file" >/dev/null
524       then VAR="MPL" ; break
525       elif grep -i "artistic license" "$ac_file" >/dev/null
526       then VAR="Artistic" ; break
527       elif grep -i "artistic control" "$ac_file" >/dev/null
528       then VAR="Artistic" ; break
529       elif grep -i "semblance of artistic" "$ac_file" >/dev/null
530       then VAR="Artistic" ; break
531       elif grep -i "above copyright notice" "$ac_file" >/dev/null
532       then VAR="BSD" ; break
533       fi
534     done
535     if test ".$VAR" = "." ; then
536       if test "$srcdir/COPYING.LIB" ; then VAR="GNU LGPL"
537       elif test ".$ltmain" != "."   ; then VAR="GNU LGPL" 
538        else VAR="GNU GPL"
539       fi
540     fi
541   fi
542   ],[test ".$VAR" = "." && VAR="$2"])
543   test "$VAR" = "GPL" && VAR="GNU GPL"
544   test "$VAR" = "LGPL" && VAR="GNU LGPL"
545   AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
546   AS_VAR_POPDEF([VAR])dnl
547 ])
548
549 AC_DEFUN([AX_SPEC_PACKAGE_SUMMARY],[AC_REQUIRE([AX_SPEC_FILE])dnl
550   AS_VAR_PUSHDEF([VAR],[PACKAGE_SUMMARY])dnl
551   AC_MSG_CHECKING([for spec summary])
552   if test ".$VAR" = "." ; then if test ! -f $ax_spec_file 
553   then k="(w/o spec)"
554   else k=""
555     AX_SPEC_EXTRACT(VAR,[summary],m4_ifval($1,$1))
556   fi fi
557   test ".$VAR" = "." && k="(fallback)"
558   ifelse($2,,[dnl here the defaults for SUMMARY
559   if test ".$VAR"   = "."  ; then VAR="$PACKAGE"
560      test ".$VAR" = "." && VAR="foo"
561      test ".$ltmain" != "." && VAR="$VAR library"
562   fi
563   ],[test ".$VAR" = "." && VAR="$2"])
564   AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
565   AS_VAR_POPDEF([VAR])dnl
566 ])
567
568 AC_DEFUN([AX_SPEC_PACKAGE_ICON],[AC_REQUIRE([AX_SPEC_FILE])dnl
569   AS_VAR_PUSHDEF([VAR],[PACKAGE_ICON])dnl
570   AC_MSG_CHECKING([for spec icon])
571   if test ".$VAR" = "." ; then if test ! -f $ax_spec_file 
572   then k="(w/o spec)"
573   else k=""
574     AX_SPEC_EXTRACT(VAR,[icon],m4_ifval($1,$1))
575   fi fi
576   test ".$VAR" = "." && k="(fallback)"
577   ifelse($2,,[dnl here the defaults for ICON
578   if test ".$VAR"   = "."  ; then VAR="$PACKAGE-icon.png" ; fi
579   ],[test ".$VAR" = "." && VAR="$2"])
580   AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
581   AS_VAR_POPDEF([VAR])dnl
582 ])
583
584 AC_DEFUN([AX_SPEC_PACKAGE_CATEGORY],[AC_REQUIRE([AX_SPEC_FILE])dnl
585   AS_VAR_PUSHDEF([VAR],[PACKAGE_CATEGORY])dnl
586   AC_MSG_CHECKING([for spec category])
587   if test ".$VAR" = "." ; then if test ! -f $ax_spec_file 
588   then k="(w/o spec)"
589   else k=""
590     AX_SPEC_EXTRACT(VAR,[group],m4_ifval($1,$1))
591     VAR=`echo $VAR | sed -e 's/ /-/g'`
592   fi fi
593   test ".$VAR" = "." && k="(fallback)"
594   ifelse($2,,[dnl here the defaults for CATEGORY
595   if test ".$VAR" = "."  ; then if test ".$ltmain" != "."
596      then VAR="Development/Library"
597      else VAR="Development/Other"
598   fi fi
599   ],[test ".$VAR" = "." && VAR="$2"])
600   AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
601   AS_VAR_POPDEF([VAR])dnl
602 ])
603
604 AC_DEFUN([AX_SPEC_PACKAGE_NAME],[AC_REQUIRE([AX_SPEC_FILE])dnl
605   AS_VAR_PUSHDEF([VAR],[PACKAGE_NAME])dnl
606   AC_MSG_CHECKING([for spec package])
607   if test ".$VAR" = "." ; then if test ! -f $ax_spec_file 
608   then k="(w/o spec)"
609   else k=""
610     AX_SPEC_EXTRACT(VAR,[name],m4_ifval($1,$1))
611     VAR=`echo $VAR | sed -e 's/ /-/g'`
612   fi fi
613   test ".$VAR" = "." && k="(fallback)"
614   ifelse($2,,[dnl here the defaults for PACKAGE
615   test ".$VAR"   = "."  && VAR=`basename $ax_spec_file .spec`
616   test ".$VAR"   = ".README" && VAR="TODO"
617   test ".$VAR"   = ".TODO" && VAR="foo"
618   ],[test ".$VAR" = "." && VAR="$2"])
619   test "VAR" = "PACKAGE_NAME" && test ".$PACKAGE" = "." && PACKAGE="$VAR" 
620   AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
621   AS_VAR_POPDEF([VAR])dnl
622 ])
623
624 AC_DEFUN([AX_SPEC_PACKAGE_VERSION_],[AC_REQUIRE([AX_SPEC_FILE])dnl
625   AS_VAR_PUSHDEF([VAR],[PACKAGE_VERSION])dnl
626   AC_MSG_CHECKING([for spec version])
627   if test ".$VAR" = "." ; then if test ! -f $ax_spec_file
628   then k="(w/o spec)"
629   else k=""
630     AX_SPEC_EXTRACT(VAR,[version],m4_ifval($1,$1))
631     VAR=`echo $VAR | sed -e 's/ /-/g'`
632   fi fi
633   test ".$VAR" = "." && k="(fallback)"
634   ifelse($2,,[dnl here the defaults for VERSION
635   test ".$VAR"   = "."  && VAR=`date +0.%y.%W%w`
636   ],[test ".$VAR" = "." && VAR="$2"])
637   test "VAR" = "PACKAGE_VERSION" && test ".$VERSION" = "." && VERSION="$VAR"
638   case "$VAR" in  # note we set traditional VERSION before cleaning things up
639   *.*.) VAR="$VAR"`date +%W%w` ;;
640   *.*.*) ;;
641   *.)  VAR="$VAR"`date +%y.%W%w` ;;
642   *.*) VAR="$VAR.0" ;;
643   *) VAR=AS_TR_SH([$VAR]) ; VAR="$VAR.`date +%y.%W%w`" ;;
644   esac
645   VAR=`echo $VAR | sed -e "s/[[.]][0]\\([0-9]\\)/.\\1/g"`
646   AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k])
647   AS_VAR_POPDEF([VAR])dnl
648 ])
649
650 dnl for compatibility, we define ax_spec_package_version
651 dnl to do all of ax_spec_package_name as well.
652 AC_DEFUN([AX_SPEC_PACKAGE_VERSION],[AC_REQUIRE([AX_SPEC_FILE])dnl
653   ifelse($1,,
654     AC_MSG_WARN([please use ax_spec_package_AND_version now!]),
655     AC_MSG_ERROR([please use ax_spec_package_AND_version now!]))
656   AX_SPEC_PACKAGE_NAME
657   AX_SPEC_PACKAGE_VERSION_
658   
659 ])
660
661 AC_DEFUN([AX_SPEC_PACKAGE_AND_VERSION],[
662   m4_ifset([m4_ax_spec_file],,[AX_SPEC_FILE($1)])
663   AX_SPEC_PACKAGE_NAME
664   AX_SPEC_PACKAGE_VERSION_
665 ])
666
667 AC_DEFUN([AX_SPEC_DEFAULTS],[
668   m4_ifset([m4_ax_spec_file],,[AX_SPEC_FILE($1)])
669   AX_SPEC_PACKAGE_NAME
670   AX_SPEC_PACKAGE_VERSION_
671   AX_SPEC_PACKAGE_LICENSE
672   AX_SPEC_PACKAGE_SUMMARY
673   AX_SPEC_PACKAGE_CATEGORY
674   AX_SPEC_PACKAGE_ICON
675 ])
676
677 dnl ______ /usr/share/aclocal/guidod/ax_set_version_info.m4 ______
678 dnl AX_SET_VERSION_INFO [(VERSION  [,PREFIX])]      -*- m4 -*-
679 dnl   default $1 = $PACKAGE_VERSION
680 dnl   default $2 = <none>
681 dnl 
682 dnl This macro is the successor of AC_SET_RELEASEINFO_VERSIONINFO but
683 dnl it can be used in parallel because it uses all different variables.
684 dnl
685 dnl check the $VERSION number and cut the two last digit-sequences off
686 dnl which will form a -version-info in a @VERSION_INFO@ ac_subst while
687 dnl the rest is going to the -release name in a @RELEASE_INFO@ ac_subst.
688 dnl
689 dnl you should keep these two seperate - the release-name may contain
690 dnl alpha-characters and can be modified later with extra release-hints
691 dnl e.g. RELEASE_INFO="$RELEASE_INFO-debug" for a debug version 
692 dnl of your lib. The $VERSION_INFO however should not be touched.
693 dnl
694 dnl example: a VERSION="2.4.18" will be transformed into
695 dnl    RELEASE_INFO = -release 2
696 dnl    VERSION_INFO = -versioninfo 4:18
697 dnl then use these two variables and push them to your libtool linker
698 dnl    libtest_la_LIBADD = @RELEASE_INFO@ @VERSION_INFO@
699 dnl and for a linux-target this will tell libtool to install the lib as
700 dnl           libmy.so libmy.la libmy.a libmy-2.so.4 libmy-2.so.4.0.18
701 dnl and executables will get link-resolve-infos for libmy-2.so.4 - therefore
702 dnl the patch-level is ignored during ldso linking, and ldso will use the
703 dnl one with the highest patchlevel. Using just "-release $(VERSION)"
704 dnl during libtool-linking would not do that - omitting the -version-info
705 dnl will libtool install libmy.so libmy.la libmy.a libmy-2.4.18.so and
706 dnl executables would get hardlinked with the 2.4.18 version of your lib.
707 dnl
708 dnl This background does also explain the default dll name for a win32
709 dnl target : libtool will choose to make up libmy-2-4.dll for this 
710 dnl version spec.
711 dnl
712 dnl this macro does also set the usual three parts of a version spec
713 dnl $MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION but does not ac_subst 
714 dnl for the plain AX_SET_VERSION_INFO macro. Use instead one of the numbered
715 dnl macros AX_SET_VERSION_INFO1 (use first number for release part) or
716 dnl that AX_SET_VERSION_INFO2 (use the first two numbers for release part).
717 dnl 
718 dnl You may add sublevel parts like "1.4.2-ac5" where the sublevel is 
719 dnl just killed from these version/release substvars. That allows to grab
720 dnl the version off a .spec file like with AX_SPEC_PACKAGE_VERSION where 
721 dnl the $VERSION is used to name a tarball or distpack like mylib-2.2.9pre4
722 dnl
723 dnl Unlike earlier macros, you can use this one to break up different
724 dnl VERSIONs and put them into different variables, just hint with
725 dnl PREFIX-setting - i.e. _VERSION(2.4.5,TEST) will set variables named
726 dnl TEST_MAJOR_VERSION=2... and of course $TEST_RELEASE_INFO etc.
727 dnl (for the moment, it needs to be a literal prefix *sigh*)
728 dnl
729 dnl @version %Id: ax_set_version_info.m4,v 1.1 2003/07/02 23:41:42 guidod Exp %
730 dnl @author Guido Draheim <guidod@gmx.de>
731
732 AC_DEFUN([AX_SET_VERSION_INFO1],[dnl
733 AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
734 AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
735 AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
736 AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
737 AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
738 AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
739 test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
740 AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
741 ifelse($1,,$PACKAGE_VERSION,$1) )
742   MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
743   MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'` 
744   MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'` 
745   MICRO="$MINOR"
746   MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
747   MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
748   PATCH="$MICRO"
749   MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'` 
750   PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'`
751   if test "_$MICRO" = "_" ; then MICRO="0" ; fi
752   if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
753   MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
754   LTREL="-release $MAJOR"
755   LTVER="-version-info $MINOR:$MICRO"
756 AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
757 AC_SUBST(MAJOR)
758 AC_SUBST(MINOR)
759 AC_SUBST(MICRO)
760 AC_SUBST(PATCH)
761 AC_SUBST(LTREL)
762 AC_SUBST(LTVER)
763 AS_VAR_POPDEF([LTVER])dnl
764 AS_VAR_POPDEF([LTREL])dnl
765 AS_VAR_POPDEF([PATCH])dnl
766 AS_VAR_POPDEF([MICRO])dnl
767 AS_VAR_POPDEF([MINOR])dnl
768 AS_VAR_POPDEF([MAJOR])dnl
769 ])
770
771 AC_DEFUN([AX_SET_VERSION_INFO2],[dnl
772 AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
773 AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
774 AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
775 AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
776 AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
777 AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
778 test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
779 AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
780 ifelse($1,,$PACKAGE_VERSION,$1) )
781   MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
782   MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'` 
783   MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'` 
784   MICRO="$MINOR"
785   MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
786   MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
787   PATCH="$MICRO"
788   MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'` 
789   PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'`
790   test "_$MICRO" != "_" || MICRO="0"
791   if test "_$MINOR" != "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
792   MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
793   LTREL="-release $MAJOR.$MINOR"
794   LTVER="-version-info 0:$MICRO"
795 AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
796 AC_SUBST(MAJOR)
797 AC_SUBST(MINOR)
798 AC_SUBST(MICRO)
799 AC_SUBST(PATCH)
800 AC_SUBST(LTREL)
801 AC_SUBST(LTVER)
802 AS_VAR_POPDEF([LTVER])dnl
803 AS_VAR_POPDEF([LTREL])dnl
804 AS_VAR_POPDEF([PATCH])dnl
805 AS_VAR_POPDEF([MICRO])dnl
806 AS_VAR_POPDEF([MINOR])dnl
807 AS_VAR_POPDEF([MAJOR])dnl
808 ])
809
810 AC_DEFUN([AX_SET_VERSION_INFO],[dnl
811 AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
812 AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
813 AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
814 AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
815 AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
816 AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
817 test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
818 AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
819 ifelse($1,,$PACKAGE_VERSION,$1) )
820   MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
821   MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'` 
822   MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'` 
823   MICRO="$MINOR"
824   MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
825   MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
826   PATCH="$MICRO"
827   MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'` 
828   PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/[[-.]]//'`
829   if test "_$MICRO" = "_" ; then MICRO="0" ; fi
830   if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
831   MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
832   LTREL="-release $MAJOR"
833   LTVER="-version-info $MINOR:$MICRO"
834 AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
835 AC_SUBST(LTREL)
836 AC_SUBST(LTVER)
837 AS_VAR_POPDEF([LTVER])dnl
838 AS_VAR_POPDEF([LTREL])dnl
839 AS_VAR_POPDEF([PATCH])dnl
840 AS_VAR_POPDEF([MICRO])dnl
841 AS_VAR_POPDEF([MINOR])dnl
842 AS_VAR_POPDEF([MAJOR])dnl
843 ])
844
845 dnl ______ /usr/share/aclocal/guidod/ax_enable_builddir.m4 ______
846 dnl @synopsis AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])]
847 dnl
848 dnl if the current configure was run within the srcdir then
849 dnl we move all configure-files into a subdir and let the configure
850 dnl steps continue there. We provide an option --disable-builddir
851 dnl to suppress the move into a separate builddir.
852 dnl
853 dnl Defaults:
854 dnl
855 dnl   $1 = $host (overridden with $HOST)
856 dnl   $2 = Makefile.mk
857 dnl   $3 = -all
858 dnl
859 dnl This macro must be called before AM_INIT_AUTOMAKE.
860 dnl
861 dnl it creates a default toplevel srcdir Makefile from the information found
862 dnl in the created toplevel builddir Makefile. It just copies the variables
863 dnl and rule-targets, each extended with a default rule-execution that
864 dnl recurses into the build directory of the current "HOST". You can override
865 dnl the auto-dection through `config.guess` and build-time of course, as in
866 dnl
867 dnl   make HOST=i386-mingw-cross
868 dnl
869 dnl which can of course set at configure time as well using
870 dnl
871 dnl   configure --host=i386-mingw-cross
872 dnl
873 dnl After the default has been created, additional rules can be
874 dnl appended that will not just recurse into the subdirectories and
875 dnl only ever exist in the srcdir toplevel makefile - these parts
876 dnl are read from the $2 = Makefile.mk file
877 dnl
878 dnl The automatic rules are usually scanning the toplevel Makefile for
879 dnl lines like '#### $host |$builddir' to recognize the place where to
880 dnl recurse into. Usually, the last one is the only one used. However,
881 dnl almost all targets have an additional "*-all" rule which makes the
882 dnl script to recurse into _all_ variants of the current HOST (!!)
883 dnl setting. The "-all" suffix can be overriden for the macro as well.
884 dnl
885 dnl a special rule is only given for things like "dist" that will
886 dnl copy the tarball from the builddir to the sourcedir (or $(PUB))
887 dnl for reason of convenience.
888 dnl
889 dnl @author Guido Draheim
890 dnl @version %Id: ax_enable_builddir.m4,v 1.12 2003/06/05 00:52:29 guidod Exp %
891 dnl
892 AC_DEFUN([AX_ENABLE_BUILDDIR],[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl
893 AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
894 AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
895 AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
896 AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
897 SUB="."
898 if test ".$ac_srcdir_defaulted" != ".no" ; then
899   if test ".$srcdir" = ".." ; then
900     AC_PATH_PROG(SED,gsed sed, sed)
901     AC_ARG_ENABLE([builddir], AC_HELP_STRING(
902    [--disable-builddir],[disable automatic build in subdir of sources])
903     ,[SUB="$withval"], [SUB="."])
904     test ".$SUB" = ".." && SUB=`$SED -V 2>&1 |$SED -e '/GNU/!d' -e 's/.*/yes/'`
905     test ".$SUB" = "."  && SUB="."
906     test ".$SUB" = ".no"  && SUB="."
907     if test ".$SUB" != ".." ; then    # we know where to go and
908     if test ! -f config.status ; then # srcdir not yet configured
909       test ".$HOST" = "." && HOST="$host"
910       test ".$SUB" = ".yes" && SUB="m4_ifval([$1], [$1],[$HOST])"
911       AS_MKDIR_P([$SUB])
912       echo __.$SUB.__ > $SUB/conftest.tmp
913       cd $SUB
914       if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then
915         rm conftest.tmp
916         AC_MSG_RESULT([continue configure in default builddir ./$SUB])
917       else
918         AC_MSG_ERROR([could not change to default builddir ./$SUB])
919       fi
920       srcdir=`echo "$SUB" |
921               $SED -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'`
922       AUX="$ac_aux_dir"
923       test ".$ac_aux_dir" != "."      &&    ac_aux_dir="$srcdir/$ac_aux_dir"
924       test ".$ac_install_sh" != "."   && ac_install_sh="$srcdir/$ac_install_sh"
925       ac_config_guess="$SHELL $ac_aux_dir/config.guess"
926       ac_config_sub="$SHELL $ac_aux_dir/config.sub"
927       ac_configure="$SHELL $ac_aux_dir/configure" # Cygnus configure
928
929       test -f $srcdir/config.log   && mv $srcdir/config.log   .
930       test -f $srcdir/confdefs.h   && mv $srcdir/confdefs.h   .
931       test -f $srcdir/conftest.log && mv $srcdir/conftest.log .
932       test -f $srcdir/$cache_file  && mv $srcdir/$cache_file  .
933     fi fi
934   fi
935 fi
936 AS_VAR_POPDEF([SED])dnl
937 AS_VAR_POPDEF([AUX])dnl
938 AS_VAR_POPDEF([SUB])dnl
939 AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status ..............
940 AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl
941 AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl
942 AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl
943 AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl
944 AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl
945 pushdef([END],[Makefile.mk])dnl
946 pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl
947   SUB=`grep "continue configure in default builddir " config.log |
948     $SED -e "s/.*continue configure in default builddir //"`
949   SRC="$ax_enable_builddir_srcdir"
950   if test ".$SUB" = "." ; then
951     if test -f "$TOP/Makefile" ; then
952       AC_MSG_NOTICE([skipping TOP/Makefile - left untouched])
953     else
954       AC_MSG_NOTICE([skipping TOP/Makefile - not created])
955     fi
956   else
957     if test -f "$SRC/Makefile" ; then
958       a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile`
959       test "$a" != "$b" && rm "$SRC/Makefile"
960     fi
961     if test -f "$SRC/Makefile" ; then
962         echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk
963         echo "  []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk
964       eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null"
965       if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null 
966       then rm $SRC/Makefile ; fi
967       cp $tmp/conftemp.mk $SRC/makefiles.mk~      ## DEBUGGING
968     fi
969     if test ! -f "$SRC/Makefile" ; then
970       AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile])
971       x='`' ; cat >$tmp/conftemp.sed <<_EOF
972 /^\$/n
973 x
974 /^\$/bS
975 x
976 /\\\\\$/{H;d;}
977 {H;s/.*//;x;}
978 bM
979 :S
980 x
981 /\\\\\$/{h;d;}
982 {h;s/.*//;x;}
983 :M
984 s/\\(\\n\\)     /\\1 /g
985 /^      /d
986 /^[[    ]]*[[\\#]]/d
987 /^VPATH *=/d
988 s/^srcdir *=.*/srcdir = ./
989 s/^top_srcdir *=.*/top_srcdir = ./
990 /[[:=]]/!d
991 /^\\./d
992 s/:.*/:/
993 /:\$/s/ /  /g
994 /:\$/s/ \\([[a-z]][[a-z-]]*[[a-z]]\\) / \\1 \\1[]_ALL /g
995 /:\$/s/^\\([[a-z]][[a-z-]]*[[a-z]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/
996 /:\$/s/  / /g
997 /^all all[]_ALL[[ :]]/i\\
998 all-configured : all[]_ALL
999 dnl dist-all exists... and would make for dist-all-all
1000 /[]_ALL[]_ALL/d
1001 /^.*[[=]]/!a\\
1002         @ HOST="\$(HOST)\" \\\\\\
1003         ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
1004         ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
1005         ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
1006         ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" = "0" ; then : \\\\\\
1007         ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\
1008         ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
1009         ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\
1010         ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1011         ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) ; done
1012 dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree)
1013 /dist[]_ALL *:/a\\
1014         @ HOST="\$(HOST)\" \\\\\\
1015         ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
1016         ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
1017         ; found=$x echo \$\$BUILD | wc -w $x \\\\\\
1018         ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\
1019         ; if test "\$\$found" = "0" ; then : \\\\\\
1020         ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\
1021         ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1022         ; test -f "\$\$i/\$(PACKAGE)-\$(VERSION).tar.gz" \\\\\\
1023         && mv "\$\$i/\$(PACKAGE)-\$(VERSION).tar.gz" \$(PUB). ; break ; done
1024 dnl special rule add-on: "distclean" removes all local builddirs completely
1025 /distclean[]_ALL *:/a\\
1026         @ HOST="\$(HOST)\" \\\\\\
1027         ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\
1028         ; BUILD=$x grep "^#### .*| *\\./" Makefile | sed -e 's/.*|//' $x \\\\\\
1029         ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
1030         ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\
1031         ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
1032         ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1033         ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\
1034         ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
1035         ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile
1036 _EOF
1037       cp "$tmp/conftemp.sed" "$SRC/makefile.sed~"            ## DEBUGGING
1038       $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile
1039       if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then
1040         AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])])
1041         cat $SRC/END >>$SRC/Makefile
1042       fi ; xxxx="####"
1043       echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile
1044       # sanity check
1045       if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then
1046         AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts])
1047         $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/        /' $SRC/Makefile \
1048           >$SRC/Makefile~
1049         (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null
1050       fi
1051     else
1052       xxxx="\\#\\#\\#\\#"
1053       # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed
1054       echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed
1055       $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp
1056         cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~"         ## DEBUGGING
1057         cp "$tmp/mkfile.tmp"   "$SRC/makefiles.out~"         ## DEBUGGING
1058       if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then
1059         AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure])
1060         rm "$tmp/mkfile.tmp"
1061       else
1062         AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure])
1063         mv "$tmp/mkfile.tmp" "$SRC/Makefile"
1064       fi
1065     fi
1066     AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)])
1067     xxxx="####"
1068     echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile
1069   fi
1070 popdef([END])dnl
1071 AS_VAR_POPDEF([SED])dnl
1072 AS_VAR_POPDEF([AUX])dnl
1073 AS_VAR_POPDEF([SRC])dnl
1074 AS_VAR_POPDEF([TOP])dnl
1075 AS_VAR_POPDEF([SUB])dnl
1076 ],[dnl
1077 ax_enable_builddir_srcdir="$srcdir"                    # $srcdir
1078 ax_enable_builddir_host="$HOST"                        # $HOST / $host
1079 ax_enable_builddir_version="$VERSION"                  # $VERSION
1080 ax_enable_builddir_package="$PACKAGE"                  # $PACKAGE
1081 ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX
1082 ax_enable_builddir_sed="$ax_enable_builddir_sed"       # $SED
1083 ax_enable_builddir="$ax_enable_builddir"               # $SUB
1084 ])dnl
1085 ])
1086
1087 dnl ______ /usr/share/aclocal/guidod/ax_warning_default_pkgconfig.m4 ______
1088 dnl @* AX_WARNING_DEFAULT_PKGCONFIGDIR [(dirvariable [,defsetting])]
1089 dnl
1090 dnl print a warning message if the $(datadir)/aclocal directory
1091 dnl is not in the dirlist searched by the aclocal tool. This macro
1092 dnl is useful if some `make install` would target $(datadir)/aclocal
1093 dnl to install an autoconf m4 file of your project to be picked up
1094 dnl by other projects.
1095 dnl
1096 dnl  default $1 dirvariable = pkgconfigdir
1097 dnl  default $2 defsetting  = ${libdir}/pkgconfig
1098 dnl  (the defsetting is not placed in dirvariable nor is it ac_subst'ed)
1099 dnl 
1100 dnl @: guidod@gmx.de
1101 dnl @%Id: %
1102
1103 AC_DEFUN([AX_WARNING_DEFAULT_PKGCONFIGDIR],[dnl
1104 AC_REQUIRE([AX_EXPAND_PREFIX])dnl
1105 AS_VAR_PUSHDEF([DIR],[ax_warning_default_pkgconfig_dir])dnl
1106 AS_VAR_PUSHDEF([BIN],[ax_warning_default_pkgconfig_bin])dnl
1107 AS_VAR_PUSHDEF([LOC],[ax_warning_default_pkgconfig_loc])dnl
1108 if test ".$PKG_CONFIG" = "." ; then # we use the same default as in pkg.m4
1109    AC_PATH_PROG([PKG_CONFIG],[pkg-config],[no])
1110 fi
1111 LOC='m4_if([$2],,[${libdir}/pkgconfig],[$2])'
1112 m4_ifval([$1],[test ".$[]$1" != "." && LOC="$[]$1"])
1113 if test "$PKG_CONFIG" = "no"
1114 then DIR="/" ; test -d "/usr/lib/pkgconfig" && DIR="/usr/lib/pkgconfig"
1115 else BIN=`AS_DIRNAME(["$DIR"])` ;
1116      if test -d "$BIN/lib/pkgconfig" ; then
1117           DIR="$BIN/lib/pkgconfig"
1118      else BIN=`AS_DIRNAME(["$DIR"])` 
1119      if test -d "$BIN/lib/pkgconfig" ; then
1120           DIR="$BIN/lib/pkgconfig"
1121      else
1122      if test -d "/usr/lib/pkgconfig" ; then
1123           DIR="/usr/lib/pkgconfig"
1124      else
1125           DIR="/"
1126      fi fi fi
1127 fi
1128 AC_RUN_LOG([: last pkgconfig dir is assumed as "$DIR"])
1129 DIR=`eval "echo $DIR"`
1130 DIR=`eval "echo $DIR"`
1131 LOC=`eval "echo $LOC"`
1132 LOC=`eval "echo $LOC"`
1133 LOC=`eval "echo $LOC"`
1134 for DIR in `echo "$PKG_CONFIG_PATH:$DIR" | sed -e 's,:, ,g'` ; do
1135     AC_RUN_LOG([: test ".$LOC" = ".$DIR"])
1136     test ".$LOC" = ".$DIR" && break
1137 done
1138 if  test "$LOC" != "$DIR" ; then
1139    AC_MSG_NOTICE([warning: m4_if([$1],,[pkgconfigdir],[$1])=$LOC dnl
1140 (see config.log)])
1141    AC_MSG_NOTICE([perhaps: make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR])
1142    cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
1143  pkgconfigdir:  the m4_if([$1],,[default pkgconfigdir],[$1 value]) of $LOC
1144  pkgconfigdir:  is not listed in the dirlist where pkg-config will look for
1145  pkgconfigdir:  package-configs - you can override the install-path using
1146  pkgconfigdir:  make install m4_if([$1],,[pkgconfigdir],[$1])=$DIR
1147  pkgconfigdir:  or set/append the directory to the environment variable
1148  pkgconfigdir:  PKG_CONFIG_PATH="$LOC"
1149 EOF
1150 fi
1151 AS_VAR_POPDEF([LOC])dnl
1152 AS_VAR_POPDEF([BIN])dnl
1153 AS_VAR_POPDEF([DIR])dnl
1154 ])
1155
1156 dnl ______ /usr/share/aclocal/Miscellaneous/ac_compile_check_sizeof.m4 ______
1157 dnl @synopsis AC_COMPILE_CHECK_SIZEOF(TYPE [, HEADERS [, EXTRA_SIZES...]])
1158 dnl
1159 dnl This macro checks for the size of TYPE using compile checks, not
1160 dnl run checks. You can supply extra HEADERS to look into. the check
1161 dnl will cycle through 1 2 4 8 16 and any EXTRA_SIZES the user
1162 dnl supplies. If a match is found, it will #define SIZEOF_`TYPE' to
1163 dnl that value. Otherwise it will emit a configure time error
1164 dnl indicating the size of the type could not be determined.
1165 dnl
1166 dnl The trick is that C will not allow duplicate case labels. While
1167 dnl this is valid C code:
1168 dnl
1169 dnl      switch (0) case 0: case 1:;
1170 dnl
1171 dnl The following is not:
1172 dnl
1173 dnl      switch (0) case 0: case 0:;
1174 dnl
1175 dnl Thus, the AC_TRY_COMPILE will fail if the currently tried size
1176 dnl does not match.
1177 dnl
1178 dnl Here is an example skeleton configure.in script, demonstrating the
1179 dnl macro's usage:
1180 dnl
1181 dnl      AC_PROG_CC
1182 dnl      AC_CHECK_HEADERS(stddef.h unistd.h)
1183 dnl      AC_TYPE_SIZE_T
1184 dnl      AC_CHECK_TYPE(ssize_t, int)
1185 dnl
1186 dnl      headers='#ifdef HAVE_STDDEF_H
1187 dnl      #include <stddef.h>
1188 dnl      #endif
1189 dnl      #ifdef HAVE_UNISTD_H
1190 dnl      #include <unistd.h>
1191 dnl      #endif
1192 dnl      '
1193 dnl
1194 dnl      AC_COMPILE_CHECK_SIZEOF(char)
1195 dnl      AC_COMPILE_CHECK_SIZEOF(short)
1196 dnl      AC_COMPILE_CHECK_SIZEOF(int)
1197 dnl      AC_COMPILE_CHECK_SIZEOF(long)
1198 dnl      AC_COMPILE_CHECK_SIZEOF(unsigned char *)
1199 dnl      AC_COMPILE_CHECK_SIZEOF(void *)
1200 dnl      AC_COMPILE_CHECK_SIZEOF(size_t, $headers)
1201 dnl      AC_COMPILE_CHECK_SIZEOF(ssize_t, $headers)
1202 dnl      AC_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers)
1203 dnl      AC_COMPILE_CHECK_SIZEOF(off_t, $headers)
1204 dnl
1205 dnl @author Kaveh Ghazi <ghazi@caip.rutgers.edu>
1206 dnl @version %Id: ac_compile_check_sizeof.m4,v 1.1.1.1 2001/07/26 00:46:24 guidod Exp %
1207 dnl
1208 AC_DEFUN([AC_COMPILE_CHECK_SIZEOF],
1209 [changequote(<<, >>)dnl
1210 dnl The name to #define.
1211 define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
1212 dnl The cache variable name.
1213 define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
1214 changequote([, ])dnl
1215 AC_MSG_CHECKING(size of $1)
1216 AC_CACHE_VAL(AC_CV_NAME,
1217 [for ac_size in 4 8 1 2 16 $2 ; do # List sizes in rough order of prevalence.
1218   AC_TRY_COMPILE([#include "confdefs.h"
1219 #include <sys/types.h>
1220 $2
1221 ], [switch (0) case 0: case (sizeof ($1) == $ac_size):;], AC_CV_NAME=$ac_size)
1222   if test x$AC_CV_NAME != x ; then break; fi
1223 done
1224 ])
1225 if test x$AC_CV_NAME = x ; then
1226   AC_MSG_ERROR([cannot determine a size for $1])
1227 fi
1228 AC_MSG_RESULT($AC_CV_NAME)
1229 AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
1230 undefine([AC_TYPE_NAME])dnl
1231 undefine([AC_CV_NAME])dnl
1232 ])
1233
1234 dnl ______ /usr/share/aclocal/guidod/patch_libtool_to_add_host_cc.m4 ______
1235 dnl @* PATCH_LIBTOOL_TO_ADD_HOST_CC
1236 dnl
1237 dnl The libtool 1.4.x processing (and patched 1.3.5) uses a little
1238 dnl "impgen" tool to turn a "*.dll" into an import "*.lib" as it is
1239 dnl needed for win32 targets. However, this little tool is not shipped
1240 dnl by binutils, it is not even a command option of dlltool or dllwrap.
1241 dnl It happens to be a C source snippet implanted into the libtool
1242 dnl sources - it gets written to ".libs", compiled into a binary 
1243 dnl on-the-fly, and executed right away on the "dll" file to create
1244 dnl the import-lib (dll.a files in gcc-speak).
1245 dnl
1246 dnl This mode works fine for a native build within mingw or cygwin,
1247 dnl but it does not work in cross-compile mode since CC is a
1248 dnl crosscompiler - it will create an .exe file on a non-win32
1249 dnl system, and as a result an impgen.exe is created on-the-fly
1250 dnl that can not be executed on-the-fly. Luckily, the actual
1251 dnl libtool snippet uses HOST_CC to compile the sources which
1252 dnl has a fallback to CC when the HOST_CC variable was not set.
1253 dnl
1254 dnl this ac-macro is trying to detect a valid HOST_CC which is not
1255 dnl a cross-compiler. This is done by looking into the $PATH for
1256 dnl a "cc" and the result is patched into libtool a HOST_CC, iow
1257 dnl it adds another configured variable at the top of the libtool
1258 dnl script.
1259 dnl
1260 dnl In discussions on the libtool mailinglist it occurred that
1261 dnl later gcc/binutils generations are able to link with dlls 
1262 dnl directly, i.e. there is no import-lib needed anymore. The
1263 dnl import-table is created within the linker itself (in-memory)
1264 dnl and bound to the .exe/.dll currently in the making. The
1265 dnl whole stuff of impgen exe and compiling it on-the-fly, well,
1266 dnl it is superflouos then. 
1267 dnl
1268 dnl Since mingw crosscompilers tend to be quite a fresh development
1269 dnl it was agreed to remove the impgen stuff completly from
1270 dnl libtool sources. Still however, this macro does not hurt
1271 dnl since it does not patch impgen cmds but it just adds HOST_CC
1272 dnl which might be useful in other cross-compiling cases as well.
1273 dnl Therefore, you can leave it in for maximum compatibility and
1274 dnl portability.
1275 dnl
1276 dnl @= guidod@gmx.de
1277 dnl @%Id: patch_libtool_to_add_host_cc.m4,v 1.3 2003/03/23 13:20:27 guidod Exp %
1278
1279 AC_DEFUN([PATCH_LIBTOOL_TO_ADD_HOST_CC],
1280 [# patch libtool to add HOST_CC sometimes needed in crosscompiling a win32 dll
1281 if grep "HOST_CC" libtool >/dev/null; then
1282   if test "$build" != "$host" ; then
1283     if test "_$HOST_CC" = "_" ; then
1284       HOST_CC="false"
1285       for i in `echo $PATH | sed 's,:, ,g'` ; do
1286       test -x $i/cc && HOST_CC=$i/cc
1287       done
1288     fi
1289 AC_MSG_RESULT(patching libtool to add HOST_CC=$HOST_CC)
1290     test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
1291     sed -e "/BEGIN.*LIBTOOL.*CONFIG/a\\
1292 HOST_CC=$HOST_CC" libtool >libtool.new
1293     (test -s libtool.new || rm libtool.new) 2>/dev/null
1294     test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
1295     test -f libtool     || mv libtool.old libtool
1296   fi
1297 fi
1298 ])
1299 dnl ______ /usr/share/aclocal/guidod/patch_libtool_on_darwin_zsh_overquoting.m4 ______
1300 dnl @* PATCH_LIBTOOL_ON_DARWIN_ZSH_OVERQUOTING
1301 dnl
1302 dnl libtool 1.4.x has a bug on darwin where the "zsh" is installed
1303 dnl as the bourne shell replacement. Of course, the zsh is called in
1304 dnl a compatibility mode but there is a common problem with it,
1305 dnl probably a bug of zsh. Newer darwin systems have a "bash"
1306 dnl installed now, but the configure-default will be "zsh" in most
1307 dnl systems still.
1308 dnl
1309 dnl The bug revelas itself as an overquoted statement in the
1310 dnl libtool cmds-spec for sharedlib creation on testing for
1311 dnl "module" builds. Later libtool has gone rid of it by simply
1312 dnl removing the quotes at that point . Here we maintain the 
1313 dnl original style and simply remove the extra escape character,
1314 dnl i.e. we look for "archive_cmds" and replace a sequence of
1315 dnl triple-backslash-and-doublequote with single-backslash-and-doublequote.
1316 dnl 
1317 dnl @= guidod@gmx.de
1318 dnl %Id: patch_libtool_on_darwin_zsh_overquoting.m4,v 1.4 2003/03/24 16:58:21 guidod Exp %
1319
1320 AC_DEFUN([PATCH_LIBTOOL_ON_DARWIN_ZSH_OVERQUOTING],
1321 [# libtool-1.4 specific, on zsh target the final requoting does one too much
1322 case "$host_os" in
1323   darwin*)
1324     if grep "1.92" libtool >/dev/null ; then
1325 AC_MSG_RESULT(patching libtool on .so-sharedlib creation (zsh overquoting))
1326       test -f libtool.old || (mv libtool libtool.old && cp libtool.old libtool)
1327       sed -e '/archive_cmds=/s:[[\\]][[\\]][[\\]]*":\\":g' libtool >libtool.new
1328       (test -s libtool.new || rm libtool.new) 2>/dev/null
1329       test -f libtool.new && mv libtool.new libtool # not 2>/dev/null !!
1330       test -f libtool     || mv libtool.old libtool
1331     fi
1332   ;;
1333 esac
1334 ])
1335 dnl ______ /usr/share/aclocal/guidod/ac_sys_largefile_sensitive.m4 ______
1336 dnl @synopsis AC_SYS_LARGEFILE_SENSITIVE
1337 dnl
1338 dnl checker whether the current system is sensitive to -Ddefines
1339 dnl making off_t having different types/sizes. Automatically define
1340 dnl a config.h symbol LARGEFILE_SENSITIVE if that is the case,
1341 dnl otherwise leave everything as is. 
1342 dnl
1343 dnl This macro builds on top of AC_SYS_LARGEFILE to detect whether
1344 dnl special options are neede to make the code use 64bit off_t - in
1345 dnl many setups this will also make the code use 64bit off_t immediatly.
1346 dnl
1347 dnl The common use of a LARGEFILE_SENSITIVE config.h-define is to rename
1348 dnl exported functions, usually adding a 64 to the original function name.
1349 dnl Such renamings are only needed on systems being both (a) 32bit off_t
1350 dnl by default and (b) implementing large.file extensions (as for unix98).
1351 dnl
1352 dnl a renaming section could look like this:
1353 dnl  #if defined LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 == 64
1354 dnl  #define zzip_open zzip_open64
1355 dnl  #define zzip_seek zzip_seek64
1356 dnl  #endif
1357 dnl
1358 dnl for libraries, it is best to take advantage of the prefix-config.h
1359 dnl macro, otherwise you want to export a renamed LARGEFILE_SENSITIVE
1360 dnl in an installed header file. -> see AX_PREFIX_CONFIG_H
1361 dnl
1362 dnl @, System Headers
1363 dnl @Author Guido Draheim <guidod@gmx.de>
1364 dnl @Version %Id: ac_sys_largefile_sensitive.m4,v 1.2 2003/05/13 18:46:22 guidod Exp %
1365
1366 AC_DEFUN([AC_SYS_LARGEFILE_SENSITIVE],[dnl
1367 AC_REQUIRE([AC_SYS_LARGEFILE])dnl
1368 # we know about some internals of ac_sys_largefile here...
1369 AC_MSG_CHECKING(whether system differentiates 64bit off_t by defines)
1370 ac_cv_sys_largefile_sensitive="no"
1371 if test ".$ac_cv_sys_file_offset_bits$ac_cv_sys_large_files" != ".nono"
1372 then ac_cv_sys_largefile_sensitive="yes" 
1373   AC_DEFINE(LARGEFILE_SENSITIVE, 1,
1374   [whether the system defaults to 32bit off_t but can do 64bit when requested])
1375 fi
1376 AC_MSG_RESULT([$ac_cv_sys_largefile_sensitive])
1377 ])
1378
1379 dnl ______ /usr/share/aclocal/guidod/ax_maintainer_mode_auto_silent.m4 ______
1380 dnl @* AX_MAINTAINER_MODE_AUTO_SILENT
1381 dnl
1382 dnl Set autotools to error/sleep settings so that they are not run when
1383 dnl being errornously triggered. Likewise make libtool-silent when 
1384 dnl libtool has been used.
1385 dnl
1386 dnl @: guidod@gmx.de
1387 dnl @%Id: %
1388
1389 AC_DEFUN([AX_MAINTAINER_MODE_AUTO_SILENT],[dnl
1390 dnl ac_REQUIRE([am_MAINTAINER_MODE])dn
1391 AC_MSG_CHECKING(auto silent in maintainer mode)
1392 if test "$USE_MAINTAINER_MODE" = "no" ; then
1393    test ".$TIMEOUT" = "." && TIMEOUT="9"
1394    AUTOHEADER="sleep $TIMEOUT ; true || autoheader || skipped"
1395    AUTOMAKE="sleep $TIMEOUT ; true || automake || skipped"
1396    AUTOCONF="sleep $TIMEOUT ; true || autoconf || skipped"
1397    if test ".$LIBTOOL" != "." ; then
1398       LIBTOOL="$LIBTOOL --silent"
1399       AC_MSG_RESULT([libtool-silent, auto-sleep-9])
1400    else
1401       AC_MSG_RESULT([auto-sleep-9])
1402    fi
1403 else
1404       AC_MSG_RESULT([no])
1405 fi
1406 ])
1407
1408 dnl ______ /usr/share/aclocal/guidod/ax_expand_prefix.m4 ______
1409 dnl @* AX_EXPAND_PREFIX
1410 dnl
1411 dnl when $prefix and $exec_prefix are still set to NONE then set them
1412 dnl to the usual default values - being based on $ac_default_prefix.
1413 dnl - this macro can be AC_REQUIREd by other macros that need to
1414 dnl compute values for installation directories. It has been observed
1415 dnl that it was done wrong over and over again, so this is a bit
1416 dnl more safe to do.
1417 dnl
1418 dnl remember - setting exec_prefix='${prefix}' needs you interpolate
1419 dnl directories multiple times, it is not sufficient to just say
1420 dnl MYVAR="${datadir}/putter" but you do have to run `eval` a few 
1421 dnl times, sth. like MYVAR=`eval "echo \"$MYVAR\""` done atleast
1422 dnl two times.
1423 dnl 
1424 dnl The implementation of this macro simply picks up the lines that
1425 dnl would be run at the start of AC_OUTPUT anyway to set the
1426 dnl prefix/exec_prefix defaults. Between AC_INIT and the first
1427 dnl command to AC_REQUIRE this macro you can set the two variables
1428 dnl to something explicit instead. Probably, any command to compute
1429 dnl installation directories should be run _after_ AM_INIT_AUTOMAKE
1430 dnl
1431 dnl @: guidod@gmx.de
1432 dnl @%Id: %
1433
1434 AC_DEFUN([AX_EXPAND_PREFIX],[dnl
1435   # The prefix default can be set in configure.ac (otherwise it is /usr/local)
1436   test "x$prefix" = xNONE && prefix=$ac_default_prefix
1437   # Let make expand exec_prefix. Allows to override the makevar 'prefix' later
1438   test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1439 ])
1440
1441 dnl ______ /usr/share/aclocal/guidod/ax_create_pkgconfig_info.m4 ______
1442 dnl @* AX_CREATE_PKGCONFIG_INFO [(outputfile, [requires [,libs [,summary]]])]
1443 dnl defaults:
1444 dnl   $1 = $PACKAGE_NAME.pc
1445 dnl   $2 = (empty)
1446 dnl   $3 = $PACKAGE_LIBS $LIBS (as set at that point in configure.ac)
1447 dnl   $4 = $PACKAGE_SUMMARY (or $1 Library)
1448 dnl   $5 = $CPPFLAGS $PACKAGE_CFLAGS (as set at the point in configure.ac)
1449 dnl
1450 dnl   PACKAGE_NAME defaults to $PACKAGE if not set.
1451 dnl   PACKAGE_LIBS defaults to -l$PACKAGE_NAME if not set.
1452 dnl
1453 dnl the resulting file is called $PACKAGE.pc.in / $PACKAGE.pc
1454 dnl
1455 dnl @%Id: %
1456
1457 AC_DEFUN([AX_CREATE_PKGCONFIG_INFO],[dnl
1458 AS_VAR_PUSHDEF([PKGCONFIG_libdir],[ax_create_pkgconfig_libdir])dnl
1459 AS_VAR_PUSHDEF([PKGCONFIG_libfile],[ax_create_pkgconfig_libfile])dnl
1460 AS_VAR_PUSHDEF([PKGCONFIG_libname],[ax_create_pkgconfig_libname])dnl
1461 AS_VAR_PUSHDEF([PKGCONFIG_version],[ax_create_pkgconfig_version])dnl
1462 AS_VAR_PUSHDEF([PKGCONFIG_description],[ax_create_pkgconfig_description])dnl
1463 AS_VAR_PUSHDEF([PKGCONFIG_requires],[ax_create_pkgconfig_requires])dnl
1464 AS_VAR_PUSHDEF([PKGCONFIG_pkglibs],[ax_create_pkgconfig_pkglibs])dnl
1465 AS_VAR_PUSHDEF([PKGCONFIG_libs],[ax_create_pkgconfig_libs])dnl
1466 AS_VAR_PUSHDEF([PKGCONFIG_cppflags],[ax_create_pkgconfig_cppflags])dnl
1467 AS_VAR_PUSHDEF([PKGCONFIG_generate],[ax_create_pkgconfig_generate])dnl
1468 AS_VAR_PUSHDEF([PKGCONFIG_src_libdir],[ax_create_pkgconfig_src_libdir])dnl
1469 AS_VAR_PUSHDEF([PKGCONFIG_src_headers],[ax_create_pkgconfig_src_headers])dnl
1470
1471 # we need the expanded forms...
1472 test "x$prefix" = xNONE && prefix=$ac_default_prefix
1473 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
1474
1475 AC_MSG_CHECKING(our pkgconfig libname)
1476 test ".$PKGCONFIG_libname" != "." || \
1477 PKGCONFIG_libname="ifelse($1,,${PACKAGE_NAME},`basename $1 .pc`)"
1478 test ".$PKGCONFIG_libname" != "." || \
1479 PKGCONFIG_libname="$PACKAGE"
1480 PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"`
1481 PKGCONFIG_libname=`eval echo "$PKGCONFIG_libname"`
1482 AC_MSG_RESULT($PKGCONFIG_libname)
1483
1484 AC_MSG_CHECKING(our pkgconfig version)
1485 test ".$PKGCONFIG_version" != "." || \
1486 PKGCONFIG_version="${PACKAGE_VERSION}"
1487 test ".$PKGCONFIG_version" != "." || \
1488 PKGCONFIG_version="$VERSION"
1489 PKGCONFIG_version=`eval echo "$PKGCONFIG_version"`
1490 PKGCONFIG_version=`eval echo "$PKGCONFIG_version"`
1491 AC_MSG_RESULT($PKGCONFIG_version)
1492
1493 AC_MSG_CHECKING(our pkgconfig_libdir)
1494 test ".$pkgconfig_libdir" = "." && \
1495 pkgconfig_libdir='${libdir}/pkgconfig'
1496 PKGCONFIG_libdir=`eval echo "$pkgconfig_libdir"`
1497 PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"`
1498 PKGCONFIG_libdir=`eval echo "$PKGCONFIG_libdir"`
1499 AC_MSG_RESULT($pkgconfig_libdir)
1500 test "$pkgconfig_libdir" != "$PKGCONFIG_libdir" && (
1501 AC_MSG_RESULT(expanded our pkgconfig_libdir... $PKGCONFIG_libdir))
1502 AC_SUBST([pkgconfig_libdir])
1503
1504 AC_MSG_CHECKING(our pkgconfig_libfile)
1505 test ".$pkgconfig_libfile" != "." || \
1506 pkgconfig_libfile="ifelse($1,,$PKGCONFIG_libname.pc,`basename $1`)"
1507 PKGCONFIG_libfile=`eval echo "$pkgconfig_libfile"`
1508 PKGCONFIG_libfile=`eval echo "$PKGCONFIG_libfile"`
1509 AC_MSG_RESULT($pkgconfig_libfile)
1510 test "$pkgconfig_libfile" != "$PKGCONFIG_libfile" && (
1511 AC_MSG_RESULT(expanded our pkgconfig_libfile... $PKGCONFIG_libfile))
1512 AC_SUBST([pkgconfig_libfile])
1513
1514 AC_MSG_CHECKING(our pkgconfig description)
1515 PKGCONFIG_description="ifelse($4,,$PACKAGE_SUMMARY,$4)"
1516 test ".$PKGCONFIG_description" != "." || \
1517 PKGCONFIG_description="$PKGCONFIG_libname Library"
1518 PKGCONFIG_description=`eval echo "$PKGCONFIG_description"`
1519 PKGCONFIG_description=`eval echo "$PKGCONFIG_description"`
1520 AC_MSG_RESULT($PKGCONFIG_description)
1521
1522 AC_MSG_CHECKING(our pkgconfig requires)
1523 PKGCONFIG_requires="ifelse($2,,$PACKAGE_REQUIRES,$2)"
1524 PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"`
1525 PKGCONFIG_requires=`eval echo "$PKGCONFIG_requires"`
1526 AC_MSG_RESULT($PKGCONFIG_requires)
1527
1528 AC_MSG_CHECKING(our pkgconfig ext libs)
1529 PKGCONFIG_pkglibs="$PACKAGE_LIBS"
1530 test ".$PKGCONFIG_pkglibs" != "." || PKGCONFIG_pkglibs="-l$PKGCONFIG_libname"
1531 PKGCONFIG_libs="ifelse($3,,$PKGCONFIG_pkglibs $LIBS,$3)"
1532 PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"`
1533 PKGCONFIG_libs=`eval echo "$PKGCONFIG_libs"`
1534 AC_MSG_RESULT($PKGCONFIG_libs)
1535
1536 AC_MSG_CHECKING(our pkgconfig cppflags)
1537 PKGCONFIG_cppflags="ifelse($5,,$CPPFLAGS $PACKAGE_CFLAGS,$5)"
1538 PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"`
1539 PKGCONFIG_cppflags=`eval echo "$PKGCONFIG_cppflags"`
1540 AC_MSG_RESULT($PKGCONFIG_cppflags)
1541
1542 test ".$PKGCONFIG_generate" != "." || \
1543 PKGCONFIG_generate="ifelse($1,,$PKGCONFIG_libname.pc,$1)"
1544 PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"`
1545 PKGCONFIG_generate=`eval echo "$PKGCONFIG_generate"`
1546 test "$pkgconfig_libfile" != "$PKGCONFIG_generate" && (
1547 AC_MSG_RESULT(generate the pkgconfig later... $PKGCONFIG_generate))
1548
1549 if test ".$PKGCONFIG_src_libdir" = "." ; then
1550 PKGCONFIG_src_libdir=`pwd`
1551 PKGCONFIG_src_libdir=`AX_DIRNAME("$PKGCONFIG_src_libdir/$PKGCONFIG_generate")`
1552 test ! -d $PKGCONFIG_src_libdir/src || \
1553 PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/src"
1554 case ".$objdir" in 
1555 *libs) PKGCONFIG_src_libdir="$PKGCONFIG_src_libdir/$objdir" ;; esac
1556 AC_MSG_RESULT(noninstalled pkgconfig -L $PKGCONFIG_src_libdir)
1557 fi
1558
1559 if test ".$PKGCONFIG_src_headers" = "." ; then
1560 PKGCONFIG_src_headers=`pwd`
1561 v="$ac_top_srcdir" ; 
1562 test ".$v" != "." || v="$ax_spec_dir"
1563 test ".$v" != "." || v="$srcdir"
1564 case "$v" in /*) PKG_CONFIG_src_headers="" ;; esac
1565 PKGCONFIG_src_headers=`AX_DIRNAME("$PKGCONFIG_src_headers/$v/x")`
1566 test ! -d $PKGCONFIG_src_headers/incl[]ude || \
1567 PKGCONFIG_src_headers="$PKGCONFIG_src_headers/incl[]ude"
1568 AC_MSG_RESULT(noninstalled pkgconfig -I $PKGCONFIG_src_headers)
1569 fi
1570
1571 dnl AC_CONFIG_COMMANDS crap disallows to use $PKGCONFIG_libfile here...
1572 AC_CONFIG_COMMANDS([$ax_create_pkgconfig_generate],[ 
1573 pkgconfig_generate="$ax_create_pkgconfig_generate"
1574 if test ! -f "$pkgconfig_generate.in" 
1575 then generate="true"
1576 elif grep ' generated by configure ' $pkgconfig_generate.in >/dev/null 
1577 then generate="true"
1578 else generate="false"; 
1579 fi
1580 if $generate ; then
1581 AC_MSG_NOTICE(creating $pkgconfig_generate.in)
1582 cat > $pkgconfig_generate.in <<_EOF
1583 # generated by configure / remove this line to disable regeneration
1584 prefix=@prefix@
1585 exec_prefix=@exec_prefix@
1586 libdir=@libdir@
1587 includedir=@includedir@
1588
1589 Name: @PACKAGE_NAME@
1590 Description: @PACKAGE_DESCRIPTION@
1591 Version: @PACKAGE_VERSION@
1592 Requires: @PACKAGE_REQUIRES@
1593 Libs: -L\${libdir} @LIBS@
1594 Cflags: -I\${includedir} @CPPFLAGS@
1595 _EOF
1596 fi # DONE generate $pkgconfig_generate.in
1597 AC_MSG_NOTICE(creating $pkgconfig_generate)
1598 sed -e "s|@prefix@|${pkgconfig_prefix}|" \
1599     -e "s|@exec_prefix@|${pkgconfig_execprefix}|" \
1600     -e "s|@libdir@|${pkgconfig_libdir}|" \
1601     -e "s|@includedir@|${pkgconfig_includedir}|" \
1602     -e "s|@PACKAGE_NAME@|${pkgconfig_libname}|" \
1603     -e "s|@PACKAGE_DESCRIPTION@|${pkgconfig_description}|" \
1604     -e "s|@PACKAGE_VERSION@|${pkgconfig_version}|" \
1605     -e "s|@PACKAGE_REQUIRES@|${pkgconfig_requires}|" \
1606     -e "s|@LIBS@|${pkgconfig_libs}|" \
1607     -e "s|@CPPFLAGS@|${pkgconfig_cppflags}|" \
1608     $pkgconfig_generate.in > $pkgconfig_generate
1609 if test ! -s $pkgconfig_generate ; then 
1610     AC_MSG_ERROR([$pkgconfig_generate is empty])
1611 fi # DONE generate $pkgconfig_generate
1612 pkgconfig_uninstalled=`echo $pkgconfig_generate |sed 's/.pc$/-uninstalled.pc/'`
1613 AC_MSG_NOTICE(creating $pkgconfig_uninstalled)
1614 sed -e "s|@prefix@|${pkgconfig_prefix}|" \
1615     -e "s|@exec_prefix@|${pkgconfig_execprefix}|" \
1616     -e "s|@libdir@|${pkgconfig_src_libdir}|" \
1617     -e "s|@includedir@|${pkgconfig_src_headers}|" \
1618     -e "s|@PACKAGE_NAME@|${pkgconfig_libname}|" \
1619     -e "s|@PACKAGE_DESCRIPTION@|${pkgconfig_description}|" \
1620     -e "s|@PACKAGE_VERSION@|${pkgconfig_version}|" \
1621     -e "s|@PACKAGE_REQUIRES@|${pkgconfig_requires}|" \
1622     -e "s|@LIBS@|${pkgconfig_libs}|" \
1623     -e "s|@CPPFLAGS@|${pkgconfig_cppflags}|" \
1624     $pkgconfig_generate.in > $pkgconfig_uninstalled
1625 if test ! -s $pkgconfig_uninstalled ; then 
1626     AC_MSG_ERROR([$pkgconfig_uninstalled is empty])
1627 fi # DONE generate $pkgconfig_uninstalled
1628 ],[
1629 dnl AC_CONFIG_COMMANDS crap, the AS_PUSHVAR defines are invalid here...
1630 ax_create_pkgconfig_generate="$ax_create_pkgconfig_generate"
1631 pkgconfig_prefix='$prefix'
1632 pkgconfig_execprefix='$exec_prefix'
1633 pkgconfig_libdir='$libdir'
1634 pkgconfig_includedir='$includedir'
1635 pkgconfig_libname='$ax_create_pkgconfig_libname'
1636 pkgconfig_description='$ax_create_pkgconfig_description'
1637 pkgconfig_version='$ax_create_pkgconfig_version'
1638 pkgconfig_requires='$ax_create_pkgconfig_requires'
1639 pkgconfig_libs='$ax_create_pkgconfig_libs'
1640 pkgconfig_cppflags='$ax_create_pkgconfig_cppflags'
1641 pkgconfig_src_libdir='$ax_create_pkgconfig_src_libdir'
1642 pkgconfig_src_headers='$ax_create_pkgconfig_src_headers'
1643 ])dnl
1644 AS_VAR_POPDEF([PKGCONFIG_libdir])dnl
1645 AS_VAR_POPDEF([PKGCONFIG_libfile])dnl
1646 AS_VAR_POPDEF([PKGCONFIG_libname])dnl
1647 AS_VAR_POPDEF([PKGCONFIG_version])dnl
1648 AS_VAR_POPDEF([PKGCONFIG_description])dnl
1649 AS_VAR_POPDEF([PKGCONFIG_requires])dnl
1650 AS_VAR_POPDEF([PKGCONFIG_pkglibs])dnl
1651 AS_VAR_POPDEF([PKGCONFIG_libs])dnl
1652 AS_VAR_POPDEF([PKGCONFIG_cppflags])dnl
1653 AS_VAR_POPDEF([PKGCONFIG_generate])dnl
1654 AS_VAR_POPDEF([PKGCONFIG_src_libdir])dnl
1655 AS_VAR_POPDEF([PKGCONFIG_src_headers])dnl
1656 ])
1657
1658 dnl ______ /usr/share/aclocal/guidod/ax_dirname.m4 ______
1659 dnl @* AX_DIRNAME(PATHNAME)
1660 dnl
1661 dnl Parts of the implementation have been taken from AS_DIRNAME from the
1662 dnl main autoconf package in generation 2.5x. However, we do only use 
1663 dnl "sed" to cut out the dirname, and we do additionally clean up some 
1664 dnl dir/.. parts in the resulting pattern.
1665 dnl
1666 dnl this macro may be used in autoconf 2.13 scripts as well.
1667 dnl
1668 dnl @%Id: ax_dirname.m4,v 1.1 2003/07/02 23:42:59 guidod Exp %
1669
1670 AC_DEFUN([AX_DIRNAME],
1671 [echo X[]$1 |
1672     sed ['s/\/[^\/:][^\/:]*\/..\//\//g
1673           s/\/[^\/:][^\/:]*\/..\//\//g
1674           s/\/[^\/:][^\/:]*\/..\//\//g
1675           s/\/[^\/:][^\/:]*\/..\//\//g
1676           /^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
1677           /^X\(\/\/\)[^/].*/{ s//\1/; q; }
1678           /^X\(\/\/\)$/{ s//\1/; q; }
1679           /^X\(\/\).*/{ s//\1/; q; }
1680           s/.*/./; q']])
1681
1682 dnl ______ /usr/share/aclocal/guidod/ax_prefix_config_h.m4 ______
1683 dnl @synopsis AX_PREFIX_CONFIG_H [(OUTPUT-HEADER [,PREFIX [,ORIG-HEADER]])]
1684 dnl
1685 dnl This is a new variant from ac_prefix_config_ this one will use a
1686 dnl lowercase-prefix if the config-define was starting with a
1687 dnl lowercase-char, e.g. "#define const", "#define restrict", or
1688 dnl "#define off_t", (and this one can live in another directory, e.g.
1689 dnl testpkg/config.h therefore I decided to move the output-header to
1690 dnl be the first arg)
1691 dnl
1692 dnl takes the usual config.h generated header file; looks for each of
1693 dnl the generated "#define SOMEDEF" lines, and prefixes the defined name
1694 dnl (ie. makes it "#define PREFIX_SOMEDEF". The result is written to
1695 dnl the output config.header file. The PREFIX is converted to uppercase
1696 dnl for the conversions.
1697 dnl
1698 dnl Defaults:
1699 dnl
1700 dnl   OUTPUT-HEADER = $PACKAGE-config.h
1701 dnl   PREFIX = $PACKAGE
1702 dnl   ORIG-HEADER, from AM_CONFIG_HEADER(config.h)
1703 dnl
1704 dnl Your configure.ac script should contain both macros in this order,
1705 dnl and unlike the earlier variations of this prefix-macro it is okay to
1706 dnl place the AX_PREFIX_CONFIG_H call before the AC_OUTPUT invokation.
1707 dnl
1708 dnl Example:
1709 dnl
1710 dnl   AC_INIT(config.h.in)        # config.h.in as created by "autoheader"
1711 dnl   AM_INIT_AUTOMAKE(testpkg, 0.1.1)    # makes #undef VERSION and PACKAGE
1712 dnl   AM_CONFIG_HEADER(config.h)          # prep config.h from config.h.in
1713 dnl   AX_PREFIX_CONFIG_H(mylib/_config.h) # prep mylib/_config.h from it..
1714 dnl   AC_MEMORY_H                         # makes "#undef NEED_MEMORY_H"
1715 dnl   AC_C_CONST_H                        # makes "#undef const"
1716 dnl   AC_OUTPUT(Makefile)                 # creates the "config.h" now
1717 dnl                                       # and also mylib/_config.h
1718 dnl
1719 dnl if the argument to AX_PREFIX_CONFIG_H would have been omitted then the
1720 dnl default outputfile would have been called simply "testpkg-config.h", but
1721 dnl even under the name "mylib/_config.h" it contains prefix-defines like
1722 dnl
1723 dnl   #ifndef TESTPKG_VERSION
1724 dnl   #define TESTPKG_VERSION "0.1.1"
1725 dnl   #endif
1726 dnl   #ifndef TESTPKG_NEED_MEMORY_H
1727 dnl   #define TESTPKG_NEED_MEMORY_H 1
1728 dnl   #endif
1729 dnl   #ifndef _testpkg_const
1730 dnl   #define _testpkg_const _const
1731 dnl   #endif
1732 dnl
1733 dnl and this "mylib/_config.h" can be installed along with other
1734 dnl header-files, which is most convenient when creating a shared
1735 dnl library (that has some headers) where some functionality is
1736 dnl dependent on the OS-features detected at compile-time. No
1737 dnl need to invent some "mylib-confdefs.h.in" manually. :-)
1738 dnl
1739 dnl Note that some AC_DEFINEs that end up in the config.h file are
1740 dnl actually self-referential - e.g. AC_C_INLINE, AC_C_CONST, and the
1741 dnl AC_TYPE_OFF_T say that they "will define inline|const|off_t if the
1742 dnl system does not do it by itself". You might want to clean up about
1743 dnl these - consider an extra mylib/conf.h that reads something like:
1744 dnl
1745 dnl    #include <mylib/_config.h>
1746 dnl    #ifndef _testpkg_const
1747 dnl    #define _testpkg_const const
1748 dnl    #endif
1749 dnl
1750 dnl and then start using _testpkg_const in the header files. That is
1751 dnl also a good thing to differentiate whether some library-user has
1752 dnl starting to take up with a different compiler, so perhaps it could
1753 dnl read something like this:
1754 dnl
1755 dnl   #ifdef _MSC_VER
1756 dnl   #include <mylib/_msvc.h>
1757 dnl   #else
1758 dnl   #include <mylib/_config.h>
1759 dnl   #endif
1760 dnl   #ifndef _testpkg_const
1761 dnl   #define _testpkg_const const
1762 dnl   #endif
1763 dnl
1764 dnl @version %Id: ax_prefix_config_h.m4,v 1.5 2003/07/02 23:29:23 guidod Exp %
1765 dnl @author  Guiodo Draheim <guidod@gmx.de>
1766 dnl
1767 AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER])
1768 AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
1769 AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
1770 AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
1771 AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
1772 AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
1773 AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
1774 AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
1775 m4_pushdef([_script],[conftest.prefix])dnl
1776 m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
1777 _OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
1778 _DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
1779 _PKG=`echo ifelse($2, , $PACKAGE, $2)`
1780 _LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
1781 _UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:"  -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
1782 _INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
1783 if test ".$_INP" = "."; then
1784    for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
1785      case "$ac_file" in
1786         *.h) _INP=$ac_file ;;
1787         *)
1788      esac
1789      test ".$_INP" != "." && break
1790    done
1791 fi
1792 if test ".$_INP" = "."; then
1793    case "$_OUT" in
1794       */*) _INP=`basename "$_OUT"`
1795       ;;
1796       *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
1797       ;;
1798       *) _INP=config.h
1799       ;;
1800    esac
1801 fi
1802 if test -z "$_PKG" ; then
1803    AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
1804 else
1805   if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
1806      _INP="$srcdir/$_INP"
1807   fi fi
1808   AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
1809   if test -f $_INP ; then
1810     echo "s/@%:@undef  *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script
1811     echo "s/@%:@undef  *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script
1812     echo "s/@%:@def[]ine  *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script
1813     echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script
1814     echo "@%:@endif/" >>_script
1815     echo "s/@%:@def[]ine  *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script
1816     echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script
1817     echo "@%:@endif/" >> _script
1818     # now executing _script on _DEF input to create _OUT output file
1819     echo "@%:@ifndef $_DEF"      >$tmp/pconfig.h
1820     echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
1821     echo ' ' >>$tmp/pconfig.h
1822     echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
1823
1824     sed -f _script $_INP >>$tmp/pconfig.h
1825     echo ' ' >>$tmp/pconfig.h
1826     echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
1827     echo "@%:@endif" >>$tmp/pconfig.h
1828     if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
1829       AC_MSG_NOTICE([$_OUT is unchanged])
1830     else
1831       ac_dir=`AS_DIRNAME(["$_OUT"])`
1832       AS_MKDIR_P(["$ac_dir"])
1833       rm -f "$_OUT"
1834       mv $tmp/pconfig.h "$_OUT"
1835     fi
1836     cp _script _configs.sed
1837   else
1838     AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
1839   fi
1840   rm -f conftest.*
1841 fi
1842 m4_popdef([_symbol])dnl
1843 m4_popdef([_script])dnl
1844 AS_VAR_POPDEF([_INP])dnl
1845 AS_VAR_POPDEF([_UPP])dnl
1846 AS_VAR_POPDEF([_LOW])dnl
1847 AS_VAR_POPDEF([_PKG])dnl
1848 AS_VAR_POPDEF([_DEF])dnl
1849 AS_VAR_POPDEF([_OUT])dnl
1850 ],[PACKAGE="$PACKAGE"])])
1851
1852 dnl ______ /usr/share/aclocal/guidod/ax_not_enable_frame_pointer.m4 ______
1853 dnl @* AX_NOT_ENABLE_FRAME_POINTER ([shellvar])
1854 dnl
1855 dnl add --enable-frame-pointer option, the default will add the gcc
1856 dnl --fomit-frame-pointer option to the shellvar (per default CFLAGS)
1857 dnl and remove the " -g " debuginfo option from it. In other words,
1858 dnl the default is "--disable-frame-pointer"
1859 dnl
1860 dnl @: guidod@gmx.de
1861 dnl @%Id: %
1862
1863 AC_DEFUN([AX_NOT_ENABLE_FRAME_POINTER],[dnl
1864 AS_VAR_PUSHDEF([VAR],[enable_frame_pointer])dnl
1865 AC_MSG_CHECKING([m4_ifval($1,$1,CFLAGS) frame-pointer])
1866 AC_ARG_ENABLE([frame-pointer], AC_HELP_STRING(
1867   [--enable-frame-pointer],[enable callframe generation for debugging]))
1868 case ".$VAR" in
1869   .|.no|.no,*) test ".$VAR" = "." && VAR="no"
1870      m4_ifval($1,$1,CFLAGS)=`echo dnl
1871   " $m4_ifval($1,$1,CFLAGS) " | sed -e 's/ -g / /'`
1872      if test ".$GCC" = ".yes" ; then
1873         m4_ifval($1,$1,CFLAGS)="$m4_ifval($1,$1,CFLAGS) -fomit-frame-pointer" 
1874         AC_MSG_RESULT([$VAR, -fomit-frame-pointer added]) 
1875      else
1876         AC_MSG_RESULT([$VAR, -g removed])
1877      fi  ;;
1878    *)  AC_MSG_RESULT([$VAR, kept]) ;;
1879 esac
1880 AS_VAR_POPDEF([VAR])dnl
1881 ])
1882
1883 dnl ______ /usr/share/aclocal/guidod/ac_set_default_paths_system.m4 ______
1884 dnl @synopsis AC_SET_DEFAULT_PATHS_SYSTEM
1885 dnl
1886 dnl the most interesting changes go about windows-targets - where the
1887 dnl default_prefix is set to /programs, and quite some directories
1888 dnl are aliased: sbindir := libdir := bindir  and the docprefix-defaults
1889 dnl are also a bit different, even on FHS2-compliant systems where the
1890 dnl mandir is going to $prefix/man only if prefix=/usr, otherwise they
1891 dnl shall go to $datadir/man. We use an extra docprefix to express it
1892 dnl which is either defined as being prefix or datadir. not SUBSTed here.
1893 dnl
1894 dnl @, (very useful)
1895 dnl @version %Id: ac_set_default_paths_system.m4,v 1.5 2003/02/02 19:32:30 guidod Exp %
1896 dnl @author Guido Draheim <guidod@gmx.de>
1897 AC_DEFUN([AC_SET_DEFAULT_PATHS_SYSTEM],
1898 [AC_REQUIRE([AC_CANONICAL_HOST]) # --------------------------------------------
1899 case "$prefix:$ac_default_prefix" in
1900   NONE:/usr/local)
1901     result=""
1902     AC_MSG_CHECKING(default prefix path)
1903     case "${target_os}" in
1904       *cygwin* | *mingw* | *uwin* | *djgpp | *emx* )
1905         if test "${host_os}" = "${target_os}" ; then
1906            ac_default_prefix="/programs"
1907            result="(win/dos target)"
1908         else
1909            case "$PATH" in
1910               *:/usr/local/cross-tools/$target_alias/bin:*)
1911                   ac_default_prefix="/usr/local/cross-tools/$target_alias" ;;
1912               *:/usr/local/$target_alias/bin:*)
1913                   ac_default_prefix="/usr/local/$target_alias" ;;
1914               *:/usr/local/$target_cpu-$target_os/bin:*)
1915                   ac_default_prefix="/usr/local/$target_cpu-$target_os" ;;
1916               *)  
1917                   ac_default_prefix="/programs" ;;
1918            esac
1919            result="(win/dos cross-compiler)"
1920         fi
1921     ;;
1922     esac
1923     AC_MSG_RESULT($ac_default_prefix $result)
1924   ;;
1925 esac
1926 AC_MSG_CHECKING(default prefix system)
1927 result="$prefix" ; test "$result" = "NONE" && result="$ac_default_prefix"
1928 case ${result} in
1929   /programs | /programs/*) result="is win-/programs"
1930      # on win/dos, .exe .dll and .cfg live in the same directory
1931      libdir=`echo $libdir |sed -e 's:^..exec_prefix./lib$:${bindir}:'`
1932      sbindir=`echo $sbindir |sed -e 's:^..exec_prefix./sbin$:${libdir}:'`
1933      sysconfdir=`echo $sysconfdir |sed -e 's:^..prefix./etc$:${sbindir}:'`
1934      libexecdir=`echo $libexecdir |sed -e 's:/libexec$:/system:'`
1935      # help-files shall be set with --infodir, docprefix is datadir
1936      docprefix="${datadir}"
1937      mandir=`echo $mandir \
1938                              |sed -e 's:^..prefix./man$:${datadir}/info:'`
1939      includedir=`echo $includedir \
1940                 |sed -e 's:^..prefix./include$:${datadir}/include:'`
1941      # other state files (but /etc) are moved to datadir
1942      sharedstatedir=`echo $sharedstatedir \
1943                      |sed -e 's:^..prefix./com$:${datadir}/default:'`
1944      localstatedir=`echo $localstatedir \
1945                      |sed -e 's:^..prefix./var$:${datadir}/current:'`
1946   ;;
1947   /usr) result="is /usr-shipped"
1948      # doc files are left at prefix
1949      docprefix="${prefix}"
1950      # state files go under /top
1951      sysconfdir=`echo $sysconfdir |sed -e 's:^..prefix./etc$:/etc:'`
1952      sharedstatedir=`echo $sharedstatedir \
1953                      |sed -e 's:^..prefix./com$:/etc/default:'`
1954      # $prefix/var is going to end up in /var/lib
1955      localstatedir=`echo $localstatedir \
1956                      |sed -e 's:^..prefix./var$:/var/lib:'`
1957   ;;
1958   /opt | /opt/*) result="is /opt-package"
1959      # state files go under /top/prefix
1960      sysconfdir=`echo $sysconfdir \
1961                      |sed -e 's:^..prefix./etc$:/etc${prefix}:'`
1962      sharedstatedir=`echo $sharedstatedir \
1963                      |sed -e 's:^..prefix./com$:/etc/default${prefix}:'`
1964      # $prefix/var is going to to be /var$prefix... once again
1965      localstatedir=`echo $localstatedir \
1966                      |sed -e 's:^..prefix./var$:/var${prefix}:'`
1967      # doc files are left at prefix
1968      docprefix="${prefix}"
1969   ;;
1970   *) result="is /local-package"
1971      # doc files are moved from prefix down to datadir
1972      docprefix="${datadir}"
1973      mandir=`echo $mandir \
1974                      |sed -e 's:^..prefix./man$:${datadir}/man:'`
1975      infodir=`echo $infodir \
1976                      |sed -e 's:^..prefix./infodir$:${datadir}/info:'`
1977      # never use $prefix/com - that is no good idea
1978      sharedstatedir=`echo $sharedstatedir \
1979                      |sed -e 's:^..prefix./com$:${sysconfdir}/default:'`
1980   ;;
1981 esac
1982 AC_MSG_RESULT($result)
1983 # -------------------------------------------------------- 
1984 ])     
1985
1986 dnl ______ /usr/share/aclocal/guidod/ax_cflags_no_writable_strings.m4 ______
1987 dnl @synopsis AX_CFLAGS_NO_WRITABLE_STRINGS [(shellvar [,default, [A/NA]])]
1988 dnl
1989 dnl Try to find a compiler option that makes all stringliteral readonly.
1990 dnl
1991 dnl The sanity check is done by looking at string.h which has a set
1992 dnl of strcpy definitions that should be defined with const-modifiers
1993 dnl to not emit a warning in all so many places.
1994 dnl
1995 dnl For the GNU CC compiler it will be -fno-writable-strings -Wwrite-strings
1996 dnl The result is added to the shellvar being CFLAGS by default.
1997 dnl
1998 dnl DEFAULTS:
1999 dnl
2000 dnl  - $1 shell-variable-to-add-to : CFLAGS
2001 dnl  - $2 add-value-if-not-found : nothing
2002 dnl  - $3 action-if-found : add value to shellvariable
2003 dnl  - $4 action-if-not-found : nothing
2004 dnl
2005 dnl @version %Id: ax_cflags_no_writable_strings.m4,v 1.6 2003/06/05 00:52:15 guidod Exp %
2006 dnl @author Guido Draheim <guidod@gmx.de>
2007 dnl
2008 AC_DEFUN([AX_CFLAGS_NO_WRITABLE_STRINGS],[dnl
2009 AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
2010 AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_no_writable_strings])dnl
2011 AC_CACHE_CHECK([m4_ifval([$1],[$1],FLAGS) making strings readonly],
2012 VAR,[VAR="no, unknown"
2013  AC_LANG_SAVE
2014  AC_LANG_C
2015  ac_save_[]FLAGS="$[]FLAGS"
2016 # IRIX C compiler:
2017 #      -use_readonly_const is the default for IRIX C,
2018 #       puts them into .rodata, but they are copied later.
2019 #       need to be "-G0 -rdatashared" for strictmode but
2020 #       I am not sure what effect that has really.         - guidod
2021 for ac_arg dnl
2022 in "-Wall     % -fno-writable-strings -Wwrite-strings" dnl   GCC
2023    "-v -Xc    % -xstrconst" dnl Solaris C - strings go into readonly segment
2024    "+w1 -Aa   % +ESlit"      dnl HP-UX C - strings go into readonly segment
2025    "-w0 -std1 % -readonly_strings" dnl Digital Unix - again readonly segment
2026    "-fullwarn -use_readonly_const %% ok, its the default" dnl IRIX C
2027    #
2028 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
2029    AC_TRY_COMPILE([],[return 0;],
2030    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
2031 done
2032 case ".$VAR" in
2033    .|.no|.no,*) ;;
2034    *) # sanity check - testing strcpy() from string.h
2035       cp config.log config.tmp
2036       AC_TRY_COMPILE([#include <string.h>],[
2037       char test[16];
2038       if (strcpy (test, "test")) return 1;],
2039       dnl the original did use test -n `$CC testprogram.c`
2040       [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
2041   then VAR="no, suppressed, string.h," ; fi],
2042       [VAR="no, suppressed, string.h"])
2043       rm config.tmp
2044    ;;
2045 esac
2046    FLAGS="$ac_save_[]FLAGS"
2047    AC_LANG_RESTORE
2048 ])
2049 case ".$VAR" in
2050      .ok|.ok,*) m4_ifvaln($3,$3) ;;
2051    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
2052         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
2053                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
2054    *) m4_ifvaln($3,$3,[
2055    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
2056    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
2057    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
2058                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
2059    fi ]) ;;
2060 esac
2061 AS_VAR_POPDEF([VAR])dnl
2062 AS_VAR_POPDEF([FLAGS])dnl
2063 ])
2064
2065 dnl the only difference - the LANG selection... and the default FLAGS
2066
2067 AC_DEFUN([AX_CXXFLAGS_NO_WRITABLE_STRINGS],[dnl
2068 AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
2069 AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_no_writable_strings])dnl
2070 AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) making strings readonly],
2071 VAR,[VAR="no, unknown"
2072  AC_LANG_SAVE
2073  AC_LANG_CXX
2074  ac_save_[]FLAGS="$[]FLAGS"
2075 # IRIX C compiler:
2076 #      -use_readonly_const is the default for IRIX C,
2077 #       puts them into .rodata, but they are copied later.
2078 #       need to be "-G0 -rdatashared" for strictmode but
2079 #       I am not sure what effect that has really.         - guidod
2080 for ac_arg dnl
2081 in "-Wall     % -fno-writable-strings -Wwrite-strings" dnl   GCC
2082    "-v -Xc    % -xstrconst" dnl Solaris C - strings go into readonly segment
2083    "+w1 -Aa   % +ESlit"      dnl HP-UX C - strings go into readonly segment
2084    "-w0 -std1 % -readonly_strings" dnl Digital Unix - again readonly segment
2085    "-fullwarn -use_readonly_const %% ok, its the default" dnl IRIX C
2086    #
2087 do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
2088    AC_TRY_COMPILE([],[return 0;],
2089    [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
2090 done
2091 case ".$VAR" in
2092    .|.no|.no,*) ;;
2093    *) # sanity check - testing strcpy() from string.h
2094       cp config.log config.tmp
2095       AC_TRY_COMPILE([#include <string.h>],[[
2096       char test[16];
2097       if (strcpy (test, "test")) return 1;]],
2098       dnl the original did use test -n `$CC testprogram.c`
2099       [if test `diff config.log config.tmp | grep -i warning | wc -l` != 0
2100   then VAR="no, suppressed, string.h," ; fi],
2101       [VAR="no, suppressed, string.h"])
2102       rm config.tmp
2103    ;;
2104 esac
2105  FLAGS="$ac_save_[]FLAGS"
2106  AC_LANG_RESTORE
2107 ])
2108 case ".$VAR" in
2109      .ok|.ok,*) m4_ifvaln($3,$3) ;;
2110    .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
2111         AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
2112                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
2113    *) m4_ifvaln($3,$3,[
2114    if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
2115    then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
2116    else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
2117                       m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
2118    fi ]) ;;
2119 esac
2120 AS_VAR_POPDEF([VAR])dnl
2121 AS_VAR_POPDEF([FLAGS])dnl
2122 ])
2123
2124 dnl ______ /usr/share/aclocal/guidod/ax_spec_file.m4 ______
2125 dnl @* AX_SPEC_FILE [(rpmspecfile [,subdirpath])]
2126 dnl
2127 dnl set the specfile - if no argument has been given then check whether
2128 dnl the ac_unique_file looks like a .spec file and use it. This macro
2129 dnl is ac_REQUIRED by many AX_SPEC_ routines.
2130 dnl
2131 dnl the AX_SPEC_EXTRACT macro is a helper used by many AX_SPEC_
2132 dnl routines and therefore placed here to be automatically included
2133 dnl in the macro set of (older) aclocal/acinclude.
2134 dnl
2135 dnl AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]])
2136 dnl
2137 dnl @version %Id: %
2138 dnl @author Guido Draheim <guidod@gmx.de>
2139
2140 AC_DEFUN([AX_SPEC_FILE],
2141 [ AC_MSG_CHECKING([rpm spec file])
2142   if test ".$1" != "." ; then
2143     ax_spec_file_="$1"
2144     ax_spec_file=`basename $1`
2145   else
2146     case ".$ac_unique_file" in
2147       *.spec) ax_spec_file="$ac_unique_file" 
2148               ax_spec_file_="$ac_unique_file" ;;
2149       *) ax_spec_file="TODO"
2150          if test ".$PACKAGE" != "." 
2151          then ax_spec_file_="$PACKAGE.spec"
2152          else ax_spec_file_="README"
2153          fi
2154    cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) <<EOF
2155          no ax_spec_file argument has been given, using defaults of
2156          (1) $ax_spec_file_ 
2157          (2) $ax_spec_file
2158 EOF
2159          ;;
2160     esac
2161   fi
2162   # find specfile
2163   for i in ifelse($2,,,$2) . $srcdir $srcdir/.. .. ; do
2164     if test -f "$i/$ax_spec_file_" ; then
2165       ax_spec_dir="$i"
2166       ax_spec_file="$ax_spec_dir/$ax_spec_file_"
2167       break
2168     fi
2169     if test -f "$i/$ax_spec_file" ; then
2170       ax_spec_dir="$i"
2171       ax_spec_file="$ax_spec_dir/$ax_spec_file"
2172       break
2173     fi
2174   done
2175   case "$ax_spec_file" in
2176    ./*) if test "$ax_spec_file" = "./$ax_spec_file_" ; then
2177           ax_spec_file="$ax_spec_file_"
2178         fi
2179         AC_MSG_RESULT([$ax_spec_file]) ;;
2180    */*) AC_MSG_RESULT([$ax_spec_file]) ;;
2181    *)   AC_MSG_ERROR([no rpm spec file found]) ;;
2182   esac
2183   m4_define([m4_ax_spec_file],[ax_spec_file])
2184 ])
2185
2186 dnl AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]])
2187
2188 AC_DEFUN([AX_SPEC_EXTRACT],
2189
2190     if test ".$[]$1" = "." ; then
2191     $1=`grep -i '^[[    ]]*m4_ifval([$2],[$2],[$1])[[   ]]*:' dnl
2192   "$ax_spec_file" | sed -e 's/.*:[[     ]]*//' dnl
2193     -e 's/[[    ]][[    ]]*/ /g' -e 's/^ //' -e 's/ $[]//' -e 'q'`
2194     if test ".$[]$1" = "." ; then
2195   for $1 in $2 $1 m4_tolower([$1]) ; do
2196     $1=`echo "$[]$1" | sed -e 's/^%//g'` 
2197     $1=`sed dnl
2198     -e  "/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]/!d"  dnl
2199     -e "s/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]*//" dnl
2200     -e 's/[[    ]][[    ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file`
2201     test ".$1" != "." && break 
2202   done
2203     fi 
2204   case ".$[]$1" in
2205     .%{*) 
2206     $1=`echo "$[]$1" | sed -e 's/%{//' -e 's/}$[]//'`
2207     $1=`sed dnl
2208    -e  "/^%[[   ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]/!d"  dnl
2209    -e "s/^%[[   ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]*//" dnl
2210    -e 's/[[     ]][[    ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file` ;;
2211     .%*) 
2212     $1=`echo "$[]$1" | sed -e 's/%//'` 
2213     $1=`sed dnl
2214     -e  "/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]/!d"  dnl
2215     -e "s/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]*//" dnl
2216     -e 's/[[    ]][[    ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file` ;;
2217   esac 
2218   m4_ifval([$3],[test ".$[]$1" = "." && $1="$3"])
2219     fi # test ".$[]$1" = "."
2220 ])
2221