remove empty dir
[ghc-hetmet.git] / rts / gmp / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4a
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  GMP specific autoconf macros
14
15
16 dnl  Copyright (C) 2000 Free Software Foundation, Inc.
17 dnl
18 dnl  This file is part of the GNU MP Library.
19 dnl
20 dnl  The GNU MP Library is free software; you can redistribute it and/or modify
21 dnl  it under the terms of the GNU Lesser General Public License as published
22 dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
23 dnl  your option) any later version.
24 dnl
25 dnl  The GNU MP Library is distributed in the hope that it will be useful, but
26 dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27 dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
28 dnl  License for more details.
29 dnl
30 dnl  You should have received a copy of the GNU Lesser General Public License
31 dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
32 dnl  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
33 dnl  MA 02111-1307, USA.
34
35
36 dnl  GMP_HEADER_GETVAL(NAME,FILE)
37 dnl  ----------------------------
38 dnl  Expand to the value of a "#define NAME" from the given FILE.
39 dnl  The regexps here aren't very rugged, but are enough for gmp.
40 dnl  /dev/null as a parameter prevents a hang if $2 is accidentally omitted.
41
42 define(GMP_HEADER_GETVAL,
43 [patsubst(patsubst(
44 esyscmd([grep "^#define $1 " $2 /dev/null 2>/dev/null]),
45 [^.*$1[         ]+],[]),
46 [[
47         ]*$],[])])
48
49
50 dnl  GMP_VERSION
51 dnl  -----------
52 dnl  The gmp version number, extracted from the #defines in gmp.h.
53 dnl  Two digits like 3.0 if patchlevel <= 0, or three digits like 3.0.1 if
54 dnl  patchlevel > 0.
55
56 define(GMP_VERSION,
57 [GMP_HEADER_GETVAL(__GNU_MP_VERSION,gmp.h)[]dnl
58 .GMP_HEADER_GETVAL(__GNU_MP_VERSION_MINOR,gmp.h)[]dnl
59 ifelse(m4_eval(GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h) > 0),1,
60 [.GMP_HEADER_GETVAL(__GNU_MP_VERSION_PATCHLEVEL,gmp.h)])])
61
62
63 dnl  GMP_PROG_M4()
64 dnl  -------------
65 dnl
66 dnl  Find a working m4, either in $PATH or likely locations, and setup $M4
67 dnl  and an AC_SUBST accordingly.  If $M4 is already set then it's a user
68 dnl  choice and is accepted with no checks.  GMP_PROG_M4 is like
69 dnl  AC_PATH_PROG or AC_CHECK_PROG, but it tests each m4 found to see if
70 dnl  it's good enough.
71 dnl 
72 dnl  See mpn/asm-defs.m4 for details on the known bad m4s.
73
74 AC_DEFUN(GMP_PROG_M4,
75 [AC_CACHE_CHECK([for suitable m4],
76                 gmp_cv_prog_m4,
77 [if test -n "$M4"; then
78   gmp_cv_prog_m4="$M4"
79 else
80   cat >conftest.m4 <<\EOF
81 dnl  must protect this against being expanded during autoconf m4!
82 [define(dollarhash,``$][#'')dnl
83 ifelse(dollarhash(x),1,`define(t1,Y)',
84 ``bad: $][# not supported (SunOS /usr/bin/m4)
85 '')dnl
86 ifelse(eval(89),89,`define(t2,Y)',
87 `bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4)
88 ')dnl
89 ifelse(t1`'t2,YY,`good
90 ')dnl]
91 EOF
92   echo "trying m4" 1>&AC_FD_CC
93   gmp_tmp_val="`(m4 conftest.m4) 2>&AC_FD_CC`"
94   echo "$gmp_tmp_val" 1>&AC_FD_CC
95   if test "$gmp_tmp_val" = good; then
96     gmp_cv_prog_m4="m4"
97   else
98     IFS="${IFS=         }"; ac_save_ifs="$IFS"; IFS=":"
99 dnl $ac_dummy forces splitting on constant user-supplied paths.
100 dnl POSIX.2 word splitting is done only on the output of word expansions,
101 dnl not every word.  This closes a longstanding sh security hole.
102     ac_dummy="$PATH:/usr/5bin"
103     for ac_dir in $ac_dummy; do
104       test -z "$ac_dir" && ac_dir=.
105       echo "trying $ac_dir/m4" 1>&AC_FD_CC
106       gmp_tmp_val="`($ac_dir/m4 conftest.m4) 2>&AC_FD_CC`"
107       echo "$gmp_tmp_val" 1>&AC_FD_CC
108       if test "$gmp_tmp_val" = good; then
109         gmp_cv_prog_m4="$ac_dir/m4"
110         break
111       fi
112     done
113     IFS="$ac_save_ifs"
114     if test -z "$gmp_cv_prog_m4"; then
115       AC_MSG_ERROR([No usable m4 in \$PATH or /usr/5bin (see config.log for reasons).])
116     fi
117   fi
118   rm -f conftest.m4
119 fi])
120 M4="$gmp_cv_prog_m4"
121 AC_SUBST(M4)
122 ])
123
124
125 dnl  GMP_PROG_CC_FIND([CC_LIST], [REQ_64BIT_CC])
126 dnl  Find first working compiler in CC_LIST.
127 dnl  If REQ_64BIT_CC is "yes", the compiler is required to be able to 
128 dnl  produce 64-bit code.
129 dnl  NOTE: If a compiler needs any special flags for producing 64-bit code,
130 dnl  these have to be found in shell variable `gmp_cflags64_{cc}', where `{cc}'
131 dnl  is the name of the compiler.
132 dnl  Set CC to the name of the first working compiler.
133 dnl  If a 64-bit compiler is found, set CC64 to the name of the compiler and
134 dnl  CFLAGS64 to flags to use.
135 dnl  This macro does not test if any of the compilers found is a GNU compiler.
136 dnl  To do this, when you have finally made up your mind on which one to use, 
137 dnl  and set CC accordingly, invoke [GMP_PROG_CC_SELECT].  That macro will 
138 dnl  also make sure that your selection of CFLAGS is valid.
139 dnl
140 AC_DEFUN(GMP_PROG_CC_FIND,
141 [AC_BEFORE([$0], [CC_PROG_CPP])
142 ifelse([$1], , gmp_cc_list="gcc cc", gmp_cc_list="[$1]")
143 ifelse([$2], , gmp_req_64bit_cc="no", gmp_req_64bit_cc="[$2]")
144
145 CC32=
146 CC64=
147 for c in $gmp_cc_list; do
148   # Avoid cache hits.
149   unset CC
150   unset ac_cv_prog_CC
151   AC_CHECK_TOOL(CC, $c, $c)
152   if test -n "$CC"; then
153     eval c_flags=\$gmp_cflags_$c
154     GMP_PROG_CC_WORKS($CC, $c_flags,
155                       gmp_prog_cc_works=yes, 
156                       gmp_prog_cc_works=no)
157
158     if test "$gmp_prog_cc_works" != "yes"; then
159       continue
160     fi
161
162     # Save first working compiler, whether 32- or 64-bit capable.
163     if test -z "$CC32"; then
164       CC32="$CC"
165     fi
166     if test "$gmp_req_64bit_cc" = "yes"; then
167       eval c_flags=\$gmp_cflags64_$c
168
169       # Verify that the compiler works in 64-bit mode as well.
170       # /usr/ucb/cc on Solaris 7 can *compile* in 64-bit mode, but not link.
171       GMP_PROG_CC_WORKS($c, $c_flags,
172                         gmp_prog_cc_works=yes, 
173                         gmp_prog_cc_works=no)
174
175       if test "$gmp_prog_cc_works" = "yes"; then
176         GMP_CHECK_CC_64BIT($c, $c_flags)
177         if test "$gmp_cv_cc_64bit" = "yes"; then
178           test -z "$CC64" && CC64="$c"
179           test -z "$CFLAGS64" && CFLAGS64="$c_flags"
180           # We have CC64 so we're done.
181           break
182         fi
183       fi
184     else
185       # We have CC32, and we don't need a 64-bit compiler so we're done.
186       break
187     fi
188   fi
189 done
190 CC="$CC32"
191 ])dnl
192
193 dnl  GMP_PROG_CC_SELECT
194 dnl  Check that `CC' works with `CFLAGS'.  Check if `CC' is a GNU compiler.
195 dnl  Cache the result as `ac_cv_prog_CC'.
196 AC_DEFUN(GMP_PROG_CC_SELECT,
197 [AC_BEFORE([$0], [CC_PROG_CPP])
198 AC_PROG_CC_WORKS
199 AC_PROG_CC_GNU
200
201 if test "$ac_cv_prog_gcc" = "yes"; then
202   GCC=yes
203 else
204   GCC=
205 fi
206
207 # Set CFLAGS if not already set.
208 if test -z "$CFLAGS"; then
209   CFLAGS="-g"
210   if test "$GCC" = "yes"; then
211     CFLAGS="$CFLAGS -O2"
212   fi
213 fi
214
215 AC_SUBST(CC)
216 AC_CACHE_VAL(ac_cv_prog_CC, ac_cv_prog_CC="$CC")
217 AC_PROVIDE([AC_PROG_CC])
218 ])dnl
219
220 dnl  GMP_CHECK_CC_64BIT(cc, cflags64)
221 dnl  Find out if `CC' can produce 64-bit code.
222 dnl  Requires NM to be set to nm for target.
223 dnl  FIXME: Cache result.
224 AC_DEFUN(GMP_CHECK_CC_64BIT,
225 [
226   gmp_tmp_CC_save="$CC"
227   CC="[$1]"
228   AC_MSG_CHECKING([whether the C compiler ($CC) is 64-bit capable])
229   if test -z "$NM"; then
230     echo; echo ["configure: $0: fatal: need nm"]
231     exit 1
232   fi
233   gmp_tmp_CFLAGS_save="$CFLAGS"
234   CFLAGS="[$2]"
235
236   case "$target" in 
237     hppa2.0*-*-*)
238       # FIXME: If gcc is installed under another name than "gcc", we will 
239       # test the wrong thing.
240       if test "$CC" != "gcc"; then
241         dnl Let compiler version A.10.32.30 or higher be ok.
242         dnl Bad compiler output:
243         dnl   ccom: HP92453-01 G.10.32.05 HP C Compiler
244         dnl Good compiler output:
245         dnl   ccom: HP92453-01 A.10.32.30 HP C Compiler
246         echo >conftest.c
247         gmp_tmp_vs=`$CC $CFLAGS -V -c -o conftest.o conftest.c 2>&1 | grep "^ccom:"`
248         rm conftest*
249         gmp_tmp_v1=`echo $gmp_tmp_vs | sed 's/.* .\.\(.*\)\..*\..* HP C.*/\1/'`
250         gmp_tmp_v2=`echo $gmp_tmp_vs | sed 's/.* .\..*\.\(.*\)\..* HP C.*/\1/'`
251         gmp_tmp_v3=`echo $gmp_tmp_vs | sed 's/.* .\..*\..*\.\(.*\) HP C.*/\1/'`
252         gmp_cv_cc_64bit=no
253         test -n "$gmp_tmp_v1" && test "$gmp_tmp_v1" -ge "10" \
254           && test -n "$gmp_tmp_v2" && test "$gmp_tmp_v2" -ge "32" \
255           && test -n "$gmp_tmp_v3" && test "$gmp_tmp_v3" -ge "30" \
256           && gmp_cv_cc_64bit=yes
257       else      # gcc
258         # FIXME: Compile a minimal file and determine if the resulting object 
259         # file is an ELF file.  If so, gcc can produce 64-bit code.
260         # Do we have file(1) for target?
261         gmp_cv_cc_64bit=no
262       fi
263       ;;
264     mips-sgi-irix6.*)
265       # We use `-n32' to cc and `-mabi=n32' to gcc, resulting in 64-bit 
266       # arithmetic but not 64-bit pointers, so the general test for sizeof
267       # (void *) is not valid.
268       # Simply try to compile an empty main.  If that succeeds return
269       # true.
270       AC_TRY_COMPILE( , ,
271                      gmp_cv_cc_64bit=yes, gmp_cv_cc_64bit=no,
272                      gmp_cv_cc_64bit=no)
273       ;;
274     *-*-*)
275       # Allocate an array of size sizeof (void *) and use nm to determine its 
276       # size.  We depend on the first declared variable being put at address 0.
277       cat >conftest.c <<EOF
278 [char arr[sizeof (void *)]={0};
279 char post=0;]
280 EOF
281       gmp_compile="$CC $CFLAGS -c conftest.c 1>&AC_FD_CC"
282       if AC_TRY_EVAL(gmp_compile); then
283         changequote(<,>)dnl
284         gmp_tmp_val=`$NM conftest.o | grep post | sed -e 's;[[][0-9][]]\(.*\);\1;' \
285           -e 's;[^1-9]*\([0-9]*\).*;\1;'`
286         changequote([, ])dnl
287         if test "$gmp_tmp_val" = "8"; then
288           gmp_cv_cc_64bit=yes
289         else
290           gmp_cv_cc_64bit=no
291         fi
292       else
293         echo "configure: failed program was:" >&AC_FD_CC
294         cat conftest.$ac_ext >&AC_FD_CC
295         gmp_cv_cc_64bit=no
296       fi
297       rm -f conftest*
298       ;;
299   esac
300
301   CC="$gmp_tmp_CC_save"
302   CFLAGS="$gmp_tmp_CFLAGS_save"
303   AC_MSG_RESULT($gmp_cv_cc_64bit)
304 ])dnl
305
306 dnl  GMP_INIT([M4-DEF-FILE])
307 dnl  
308 AC_DEFUN(GMP_INIT,
309 [ifelse([$1], , gmp_configm4=config.m4, gmp_configm4="[$1]")
310 gmp_tmpconfigm4=cnfm4.tmp
311 gmp_tmpconfigm4i=cnfm4i.tmp
312 gmp_tmpconfigm4p=cnfm4p.tmp
313 test -f $gmp_tmpconfigm4 && rm $gmp_tmpconfigm4
314 test -f $gmp_tmpconfigm4i && rm $gmp_tmpconfigm4i
315 test -f $gmp_tmpconfigm4p && rm $gmp_tmpconfigm4p
316 ])dnl
317
318 dnl  GMP_FINISH
319 dnl  ----------
320 dnl  Create config.m4 from its accumulated parts.
321 dnl
322 dnl  __CONFIG_M4_INCLUDED__ is used so that a second or subsequent include
323 dnl  of config.m4 is harmless.
324 dnl
325 dnl  A separate ifdef on the angle bracket quoted part ensures the quoting
326 dnl  style there is respected.  The basic defines from gmp_tmpconfigm4 are
327 dnl  fully quoted but are still put under an ifdef in case any have been
328 dnl  redefined by one of the m4 include files.
329 dnl
330 dnl  Doing a big ifdef within asm-defs.m4 and/or other macro files wouldn't
331 dnl  work, since it'd interpret parentheses and quotes in dnl comments, and
332 dnl  having a whole file as a macro argument would overflow the string space
333 dnl  on BSD m4.
334
335 AC_DEFUN(GMP_FINISH,
336 [AC_REQUIRE([GMP_INIT])
337 echo "creating $gmp_configm4"
338 echo ["dnl $gmp_configm4.  Generated automatically by configure."] > $gmp_configm4
339 if test -f $gmp_tmpconfigm4; then
340   echo ["changequote(<,>)dnl"] >> $gmp_configm4
341   echo ["ifdef(<__CONFIG_M4_INCLUDED__>,,<"] >> $gmp_configm4
342   cat $gmp_tmpconfigm4 >> $gmp_configm4
343   echo [">)"] >> $gmp_configm4
344   echo ["changequote(\`,')dnl"] >> $gmp_configm4
345   rm $gmp_tmpconfigm4
346 fi
347 echo ["ifdef(\`__CONFIG_M4_INCLUDED__',,\`"] >> $gmp_configm4
348 if test -f $gmp_tmpconfigm4i; then
349   cat $gmp_tmpconfigm4i >> $gmp_configm4
350   rm $gmp_tmpconfigm4i
351 fi
352 if test -f $gmp_tmpconfigm4p; then
353   cat $gmp_tmpconfigm4p >> $gmp_configm4
354   rm $gmp_tmpconfigm4p
355 fi
356 echo ["')"] >> $gmp_configm4
357 echo ["define(\`__CONFIG_M4_INCLUDED__')"] >> $gmp_configm4
358 ])dnl
359
360 dnl  GMP_INCLUDE(FILE)
361 AC_DEFUN(GMP_INCLUDE,
362 [AC_REQUIRE([GMP_INIT])
363 echo ["include(\`$1')"] >> $gmp_tmpconfigm4i
364 ])dnl
365
366 dnl  GMP_SINCLUDE(FILE)
367 AC_DEFUN(GMP_SINCLUDE,
368 [AC_REQUIRE([GMP_INIT])
369 echo ["sinclude(\`$1')"] >> $gmp_tmpconfigm4i
370 ])dnl
371
372 dnl GMP_DEFINE(MACRO, DEFINITION [, LOCATION])
373 dnl [ Define M4 macro MACRO as DEFINITION in temporary file.            ]
374 dnl [ If LOCATION is `POST', the definition will appear after any       ]
375 dnl [ include() directives inserted by GMP_INCLUDE/GMP_SINCLUDE.        ]
376 dnl [ Mind the quoting!  No shell variables will get expanded.          ]
377 dnl [ Don't forget to invoke GMP_FINISH to create file config.m4.       ]
378 dnl [ config.m4 uses `<' and '>' as quote characters for all defines.   ]
379 AC_DEFUN(GMP_DEFINE, 
380 [AC_REQUIRE([GMP_INIT])
381 echo ['define(<$1>, <$2>)'] >> ifelse([$3], [POST], $gmp_tmpconfigm4p, $gmp_tmpconfigm4)
382 ])dnl
383
384 dnl GMP_DEFINE_RAW(STRING, [, LOCATION])
385 dnl [ Put STRING in temporary file.                                     ]
386 dnl [ If LOCATION is `POST', the definition will appear after any       ]
387 dnl [ include() directives inserted by GMP_INCLUDE/GMP_SINCLUDE.        ]
388 dnl [ Don't forget to invoke GMP_FINISH to create file config.m4.       ]
389 AC_DEFUN(GMP_DEFINE_RAW,
390 [AC_REQUIRE([GMP_INIT])
391 echo [$1] >> ifelse([$2], [POST], $gmp_tmpconfigm4p, $gmp_tmpconfigm4)
392 ])dnl
393
394 dnl  GMP_CHECK_ASM_LABEL_SUFFIX
395 dnl  Should a label have a colon or not?
396 AC_DEFUN(GMP_CHECK_ASM_LABEL_SUFFIX,
397 [AC_CACHE_CHECK([what assembly label suffix to use],
398                gmp_cv_check_asm_label_suffix,
399 [case "$target" in 
400   *-*-hpux*) gmp_cv_check_asm_label_suffix=[""] ;;
401   *) gmp_cv_check_asm_label_suffix=[":"] ;;
402 esac
403 ])
404 echo ["define(<LABEL_SUFFIX>, <\$][1$gmp_cv_check_asm_label_suffix>)"] >> $gmp_tmpconfigm4
405 ])dnl
406
407 dnl  GMP_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
408 dnl  Shamelessly borrowed from glibc.
409 AC_DEFUN(GMP_CHECK_ASM_UNDERSCORE,
410 [AC_CACHE_CHECK([if symbols are prefixed by underscore], 
411                 gmp_cv_check_asm_underscore,
412 [cat > conftest.$ac_ext <<EOF
413 dnl This sometimes fails to find confdefs.h, for some reason.
414 dnl [#]line __oline__ "[$]0"
415 [#]line __oline__ "configure"
416 #include "confdefs.h"
417 int underscore_test() {
418 return; }
419 EOF
420 if AC_TRY_EVAL(ac_compile); then
421   if grep _underscore_test conftest* >/dev/null; then
422     gmp_cv_check_asm_underscore=yes
423   else
424     gmp_cv_check_asm_underscore=no
425   fi
426 else
427   echo "configure: failed program was:" >&AC_FD_CC
428   cat conftest.$ac_ext >&AC_FD_CC
429 fi
430 rm -f conftest*
431 ])
432 if test "$gmp_cv_check_asm_underscore" = "yes"; then
433   GMP_DEFINE(GSYM_PREFIX, [_])
434   ifelse([$1], , :, [$1])
435 else
436   GMP_DEFINE(GSYM_PREFIX, [])
437   ifelse([$2], , :, [$2])
438 fi    
439 ])dnl
440
441 dnl  GMP_CHECK_ASM_ALIGN_LOG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
442 dnl  Is parameter to `.align' logarithmic?
443 dnl  Requires NM to be set to nm for target.
444 AC_DEFUN(GMP_CHECK_ASM_ALIGN_LOG,
445 [AC_REQUIRE([GMP_CHECK_ASM_GLOBL])
446 AC_REQUIRE([GMP_CHECK_ASM_DATA])
447 AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX])
448 AC_CACHE_CHECK([if .align assembly directive is logarithmic],
449                 gmp_cv_check_asm_align_log,
450 [if test -z "$NM"; then
451   echo; echo ["configure: $0: fatal: need nm"]
452   exit 1
453 fi
454 cat > conftest.s <<EOF
455         $gmp_cv_check_asm_data
456         .align  4
457         $gmp_cv_check_asm_globl foo
458         .byte   1
459         .align  4
460 foo$gmp_cv_check_asm_label_suffix
461         .byte   2
462 EOF
463 ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
464 if AC_TRY_EVAL(ac_assemble); then
465   changequote(<,>)
466   gmp_tmp_val=`$NM conftest.o | grep foo | sed -e 's;[[][0-9][]]\(.*\);\1;' \
467        -e 's;[^1-9]*\([0-9]*\).*;\1;'`
468   changequote([, ])dnl
469   if test "$gmp_tmp_val" = "10" || test "$gmp_tmp_val" = "16"; then
470     gmp_cv_check_asm_align_log=yes
471   else
472     gmp_cv_check_asm_align_log=no
473   fi
474 else 
475   echo "configure: failed program was:" >&AC_FD_CC
476   cat conftest.s >&AC_FD_CC
477 fi
478 rm -f conftest*
479 ])
480 GMP_DEFINE_RAW(["define(<ALIGN_LOGARITHMIC>,<$gmp_cv_check_asm_align_log>)"])
481 if test "$gmp_cv_check_asm_align_log" = "yes"; then
482   ifelse([$1], , :, [$1])
483 else
484   ifelse([$2], , :, [$2])
485 fi  
486 ])dnl
487
488
489 dnl  GMP_CHECK_ASM_ALIGN_FILL_0x90
490 dnl  -----------------------------
491 dnl  Determine whether a ",0x90" suffix works on a .align directive.
492 dnl  This is only meant for use on x86, where 0x90 is a "nop".
493 dnl
494 dnl  Old gas, eg. 1.92.3 - needs ",0x90" or else the fill is an invalid 0x00.
495 dnl  New gas, eg. 2.91 - generates the good multibyte nop fills even when
496 dnl                      ",0x90" is given.
497 dnl  Solaris 2.6 as - doesn't allow ",0x90", gives a fatal error.
498 dnl  Solaris 2.8 as - gives a warning for ",0x90", no ill effect.
499 dnl
500 dnl  Note that both solaris "as"s only care about ",0x90" if they actually
501 dnl  have to use it to fill something, hence the .byte in the sample.  It's
502 dnl  only the second .align that provokes an error or warning.
503 dnl
504 dnl  We prefer to suppress the warning from solaris 2.8 to stop anyone
505 dnl  worrying something might be wrong.
506
507 AC_DEFUN(GMP_CHECK_ASM_ALIGN_FILL_0x90,
508 [AC_CACHE_CHECK([if the .align directive accepts an 0x90 fill in .text],
509                 gmp_cv_check_asm_align_fill_0x90,
510 [AC_REQUIRE([GMP_CHECK_ASM_TEXT])
511 cat > conftest.s <<EOF
512         $gmp_cv_check_asm_text
513         .align  4, 0x90
514         .byte   0
515         .align  4, 0x90
516 EOF
517 gmp_tmp_val="`$CCAS $CFLAGS conftest.s 2>&1`"
518 if test $? = 0; then
519   echo "$gmp_tmp_val" 1>&AC_FD_CC
520   if echo "$gmp_tmp_val" | grep "Warning: Fill parameter ignored for executable section"; then
521     echo "Supressing this warning by omitting 0x90" 1>&AC_FD_CC
522     gmp_cv_check_asm_align_fill_0x90=no
523   else
524     gmp_cv_check_asm_align_fill_0x90=yes
525   fi
526 else
527   echo "Non-zero exit code" 1>&AC_FD_CC
528   echo "$gmp_tmp_val" 1>&AC_FD_CC
529   gmp_cv_check_asm_align_fill_0x90=no
530 fi
531 rm -f conftest*
532 ])
533 GMP_DEFINE_RAW(
534 ["define(<ALIGN_FILL_0x90>,<$gmp_cv_check_asm_align_fill_0x90>)"])
535 ])
536
537
538 dnl  GMP_CHECK_ASM_TEXT
539 AC_DEFUN(GMP_CHECK_ASM_TEXT,
540 [AC_CACHE_CHECK([how to switch to text section], gmp_cv_check_asm_text,
541 [case "$target" in
542   *-*-aix*)
543     changequote({, })
544     gmp_cv_check_asm_text={".csect .text[PR]"}
545     changequote([, ])
546     ;;
547   *-*-hpux*) gmp_cv_check_asm_text=[".code"] ;;
548   *) gmp_cv_check_asm_text=[".text"] ;;
549 esac
550 ])
551 echo ["define(<TEXT>, <$gmp_cv_check_asm_text>)"] >> $gmp_tmpconfigm4
552 ])dnl
553
554 dnl  GMP_CHECK_ASM_DATA
555 dnl  Can we say `.data'?
556 AC_DEFUN(GMP_CHECK_ASM_DATA,
557 [AC_CACHE_CHECK([how to switch to data section], gmp_cv_check_asm_data,
558 [case "$target" in
559   *-*-aix*)
560     changequote({, })
561     gmp_cv_check_asm_data={".csect .data[RW]"}
562     changequote([, ])
563     ;;
564   *) gmp_cv_check_asm_data=[".data"] ;;
565 esac
566 ])
567 echo ["define(<DATA>, <$gmp_cv_check_asm_data>)"] >> $gmp_tmpconfigm4
568 ])dnl
569
570 dnl  GMP_CHECK_ASM_GLOBL
571 dnl  Can we say `.global'?
572 AC_DEFUN(GMP_CHECK_ASM_GLOBL,
573 [AC_CACHE_CHECK([how to export a symbol], gmp_cv_check_asm_globl,
574 [case "$target" in
575   *-*-hpux*) gmp_cv_check_asm_globl=[".export"] ;;
576   *) gmp_cv_check_asm_globl=[".globl"] ;;
577 esac
578 ])
579 echo ["define(<GLOBL>, <$gmp_cv_check_asm_globl>)"] >> $gmp_tmpconfigm4
580 ])dnl
581
582 dnl  GMP_CHECK_ASM_TYPE
583 dnl  Can we say `.type'?
584 AC_DEFUN(GMP_CHECK_ASM_TYPE,
585 [AC_CACHE_CHECK([how the .type assembly directive should be used],
586 gmp_cv_check_asm_type,
587 [ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
588 for gmp_tmp_prefix in @ \# %; do
589   echo "        .type   sym,${gmp_tmp_prefix}function" > conftest.s
590   if AC_TRY_EVAL(ac_assemble); then
591     gmp_cv_check_asm_type="[.type       \$][1,${gmp_tmp_prefix}\$][2]"
592     break
593   fi
594 done
595 if test -z "$gmp_cv_check_asm_type"; then
596   gmp_cv_check_asm_type="[dnl]"
597 fi
598 ])
599 echo ["define(<TYPE>, <$gmp_cv_check_asm_type>)"] >> $gmp_tmpconfigm4
600 ])dnl
601
602 dnl  GMP_CHECK_ASM_SIZE
603 dnl  Can we say `.size'?
604 AC_DEFUN(GMP_CHECK_ASM_SIZE,
605 [AC_CACHE_CHECK([if the .size assembly directive works], gmp_cv_check_asm_size,
606 [ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
607 echo '  .size   sym,1' > conftest.s
608 if AC_TRY_EVAL(ac_assemble); then
609   gmp_cv_check_asm_size="[.size \$][1,\$][2]"
610 else
611   gmp_cv_check_asm_size="[dnl]"
612 fi
613 ])
614 echo ["define(<SIZE>, <$gmp_cv_check_asm_size>)"] >> $gmp_tmpconfigm4
615 ])dnl
616
617 dnl  GMP_CHECK_ASM_LSYM_PREFIX
618 dnl  What is the prefix for a local label?
619 dnl  Requires NM to be set to nm for target.
620 AC_DEFUN(GMP_CHECK_ASM_LSYM_PREFIX,
621 [AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX])
622 AC_CACHE_CHECK([what prefix to use for a local label], 
623 gmp_cv_check_asm_lsym_prefix,
624 [if test -z "$NM"; then
625   echo; echo ["$0: fatal: need nm"]
626   exit 1
627 fi
628 ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
629 gmp_cv_check_asm_lsym_prefix="L"
630 for gmp_tmp_pre in L .L $ L$; do
631   cat > conftest.s <<EOF
632 dummy${gmp_cv_check_asm_label_suffix}
633 ${gmp_tmp_pre}gurkmacka${gmp_cv_check_asm_label_suffix}
634         .byte 0
635 EOF
636   if AC_TRY_EVAL(ac_assemble); then
637     $NM conftest.o >/dev/null 2>&1
638     gmp_rc=$?
639     if test "$gmp_rc" != "0"; then
640       echo "configure: $NM failure, using default"
641       break
642     fi
643     if $NM conftest.o | grep gurkmacka >/dev/null; then true; else
644       gmp_cv_check_asm_lsym_prefix="$gmp_tmp_pre"
645       break
646     fi
647   else
648     echo "configure: failed program was:" >&AC_FD_CC
649     cat conftest.s >&AC_FD_CC
650     # Use default.
651   fi
652 done
653 rm -f conftest*
654 ])
655 echo ["define(<LSYM_PREFIX>, <${gmp_cv_check_asm_lsym_prefix}>)"] >> $gmp_tmpconfigm4
656 ])
657
658 dnl  GMP_CHECK_ASM_W32
659 dnl  How to [define] a 32-bit word.
660 dnl  Requires NM to be set to nm for target.
661 AC_DEFUN(GMP_CHECK_ASM_W32,
662 [AC_REQUIRE([GMP_CHECK_ASM_DATA])
663 AC_REQUIRE([GMP_CHECK_ASM_GLOBL])
664 AC_REQUIRE([GMP_CHECK_ASM_LABEL_SUFFIX])
665 AC_CACHE_CHECK([how to [define] a 32-bit word],
666                gmp_cv_check_asm_w32,
667 [if test -z "$NM"; then
668   echo; echo ["configure: $0: fatal: need nm"]
669   exit 1
670 fi
671
672 # FIXME: HPUX puts first symbol at 0x40000000, breaking our assumption
673 # that it's at 0x0.  We'll have to declare another symbol before the
674 # .long/.word and look at the distance between the two symbols.  The
675 # only problem is that the sed expression(s) barfs (on Solaris, for
676 # example) for the symbol with value 0.  For now, HPUX uses .word.
677
678 case "$target" in 
679   *-*-hpux*)
680     gmp_cv_check_asm_w32=".word"
681     ;;
682   *-*-*)
683     ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
684     for gmp_tmp_op in .long .word; do
685       cat > conftest.s <<EOF
686         $gmp_cv_check_asm_data
687         $gmp_cv_check_asm_globl foo
688         $gmp_tmp_op     0
689 foo${gmp_cv_check_asm_label_suffix}
690         .byte   0
691 EOF
692       if AC_TRY_EVAL(ac_assemble); then
693         changequote(<,>)
694         gmp_tmp_val=`$NM conftest.o | grep foo | sed -e 's;[[][0-9][]]\(.*\);\1;' \
695              -e 's;[^1-9]*\([0-9]*\).*;\1;'`
696         changequote([, ])dnl
697         if test "$gmp_tmp_val" = "4"; then
698           gmp_cv_check_asm_w32="$gmp_tmp_op"
699           break
700         fi
701       fi
702     done
703     ;;
704 esac
705
706 if test -z "$gmp_cv_check_asm_w32"; then
707   echo; echo ["configure: $0: fatal: do not know how to define a 32-bit word"]
708   exit 1
709 fi
710 rm -f conftest*
711 ])
712 echo ["define(<W32>, <$gmp_cv_check_asm_w32>)"] >> $gmp_tmpconfigm4
713 ])
714
715 dnl  GMP_CHECK_ASM_MMX([ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]])
716 dnl  Can we assemble MMX insns?
717 AC_DEFUN(GMP_CHECK_ASM_MMX,
718 [AC_REQUIRE([GMP_CHECK_ASM_TEXT])
719 AC_CACHE_CHECK([if the assembler knows about MMX instructions],
720                 gmp_cv_check_asm_mmx,
721 [cat > conftest.s <<EOF
722         $gmp_cv_check_asm_text
723         por     %mm0, %mm0
724 EOF
725 ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
726 if AC_TRY_EVAL(ac_assemble); then
727   gmp_cv_check_asm_mmx=yes
728 else 
729   gmp_cv_check_asm_mmx=no
730 fi
731 rm -f conftest*
732 ])
733 if test "$gmp_cv_check_asm_mmx" = "yes"; then
734   ifelse([$1], , :, [$1])
735 else
736   AC_MSG_WARN([+----------------------------------------------------------])
737   AC_MSG_WARN([| WARNING WARNING WARNING])
738   AC_MSG_WARN([| Target CPU has MMX code, but it can't be assembled by])
739   AC_MSG_WARN([|     $CCAS $CFLAGS])
740   AC_MSG_WARN([| Non-MMX replacements will be used.])
741   AC_MSG_WARN([| This will be an inferior build.])
742   AC_MSG_WARN([+----------------------------------------------------------])
743   ifelse([$2], , :, [$2])
744 fi
745 ])dnl
746
747 dnl  GMP_CHECK_ASM_SHLDL_CL([ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]])
748 AC_DEFUN(GMP_CHECK_ASM_SHLDL_CL,
749 [AC_REQUIRE([GMP_CHECK_ASM_TEXT])
750 AC_CACHE_CHECK([if the assembler takes cl with shldl],
751                 gmp_cv_check_asm_shldl_cl,
752 [cat > conftest.s <<EOF
753         $gmp_cv_check_asm_text
754         shldl   %cl, %eax, %ebx
755 EOF
756 ac_assemble="$CCAS $CFLAGS conftest.s 1>&AC_FD_CC"
757 if AC_TRY_EVAL(ac_assemble); then
758   gmp_cv_check_asm_shldl_cl=yes
759 else 
760   gmp_cv_check_asm_shldl_cl=no
761 fi
762 rm -f conftest*
763 ])
764 if test "$gmp_cv_check_asm_shldl_cl" = "yes"; then
765   ifelse([$1], , :, [$1])
766 else
767   ifelse([$2], , :, [$2])
768 fi
769 ])dnl
770
771 dnl  GMP_PROG_CC_WORKS(CC, CFLAGS, ACTION-IF-WORKS, [ACTION-IF-NOT-WORKS])
772 dnl  Check if CC can compile and link.  Perform various target specific tests.
773 dnl  FIXME: Require `$target'.
774 AC_DEFUN(GMP_PROG_CC_WORKS,
775 [AC_LANG_C      dnl  Note: Destructive.
776 CC="[$1]"
777 CFLAGS="[$2]"
778 AC_MSG_CHECKING([if the C compiler ($CC) works with flags $CFLAGS])
779
780 # Simple test for all targets.
781 AC_TRY_COMPILER([int main(){return(0);}],
782                 tmp_works, tmp_cross)
783
784 # Target specific tests.
785 if test "$tmp_works" = "yes"; then
786   case "$target" in 
787     *-*-aix*)   # Returning a funcptr.
788       AC_TRY_COMPILE( , [} void *g(); void *f() { return g(); } int bar(){],
789                       tmp_works=yes, tmp_works=no)
790       ;;
791   esac
792 fi
793
794 if test "$tmp_works" = "yes"; then
795   [$3]
796 else
797   ifelse([$4], , :, [$4])
798 fi
799
800 AC_MSG_RESULT($tmp_works)
801 ])dnl
802
803
804 dnl  GMP_C_ANSI2KNR
805 dnl  --------------
806 dnl  Setup to use ansi2knr if necessary.
807 dnl
808 dnl  The test here is simply that if an ANSI style function works then
809 dnl  ansi2knr isn't needed.  The normal tests for whether $CC works mean we
810 dnl  don't need to worry here about anything badly broken.
811 dnl
812 dnl  AM_C_PROTOTYPES is the normal way to set up ansi2knr, but (in automake
813 dnl  March 2000) it gives the wrong answer on a C++ compiler because its
814 dnl  test requires that the compiler accept both ANSI and K&R, or otherwise
815 dnl  ansi2knr is used.  A C++ compiler fails on the K&R part, which makes
816 dnl  AM_C_PROTOTYPES think it needs ansi2knr!  GMP has no bare K&R so we
817 dnl  only need ANSI or K&R to work, not both.
818
819 AC_DEFUN(GMP_C_ANSI2KNR,
820 [AC_CACHE_CHECK([if ansi2knr should be used],
821                 gmp_cv_c_ansi2knr,
822 [cat >conftest.c <<EOF
823 int main (int argc, char *argv[]) { return 0; }
824 EOF
825 if AC_TRY_EVAL(ac_compile); then
826   gmp_cv_c_ansi2knr=no
827 else
828   gmp_cv_c_ansi2knr=yes
829 fi
830 rm -f conftest.*
831 ])
832 if test $gmp_cv_c_ansi2knr = no; then
833   U= ANSI2KNR=
834 else
835   U=_ ANSI2KNR=./ansi2knr
836   # Ensure some checks needed by ansi2knr itself.
837   AC_HEADER_STDC
838   AC_CHECK_HEADERS(string.h)
839 fi
840 AC_SUBST(U)
841 AC_SUBST(ANSI2KNR)
842 ])
843
844
845 dnl  Deal with bad synchronization of Autoconf with Libtool.
846 AC_DEFUN(AC_CANONICAL_BUILD, [_AC_CANONICAL_BUILD])
847 AC_DEFUN(AC_CHECK_TOOL_PREFIX, [_AC_CHECK_TOOL_PREFIX])
848
849
850 # serial 1
851
852 AC_DEFUN(AM_C_PROTOTYPES,
853 [AC_REQUIRE([AM_PROG_CC_STDC])
854 AC_REQUIRE([AC_PROG_CPP])
855 AC_MSG_CHECKING([for function prototypes])
856 if test "$am_cv_prog_cc_stdc" != no; then
857   AC_MSG_RESULT(yes)
858   AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
859   U= ANSI2KNR=
860 else
861   AC_MSG_RESULT(no)
862   U=_ ANSI2KNR=./ansi2knr
863   # Ensure some checks needed by ansi2knr itself.
864   AC_HEADER_STDC
865   AC_CHECK_HEADERS(string.h)
866 fi
867 AC_SUBST(U)dnl
868 AC_SUBST(ANSI2KNR)dnl
869 ])
870
871
872 # serial 1
873
874 # @defmac AC_PROG_CC_STDC
875 # @maindex PROG_CC_STDC
876 # @ovindex CC
877 # If the C compiler in not in ANSI C mode by default, try to add an option
878 # to output variable @code{CC} to make it so.  This macro tries various
879 # options that select ANSI C on some system or another.  It considers the
880 # compiler to be in ANSI C mode if it handles function prototypes correctly.
881 #
882 # If you use this macro, you should check after calling it whether the C
883 # compiler has been set to accept ANSI C; if not, the shell variable
884 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
885 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
886 # program @code{ansi2knr}, which comes with Ghostscript.
887 # @end defmac
888
889 AC_DEFUN(AM_PROG_CC_STDC,
890 [AC_REQUIRE([AC_PROG_CC])
891 AC_BEFORE([$0], [AC_C_INLINE])
892 AC_BEFORE([$0], [AC_C_CONST])
893 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
894 dnl a magic option to avoid problems with ANSI preprocessor commands
895 dnl like #elif.
896 dnl FIXME: can't do this because then AC_AIX won't work due to a
897 dnl circular dependency.
898 dnl AC_BEFORE([$0], [AC_PROG_CPP])
899 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
900 AC_CACHE_VAL(am_cv_prog_cc_stdc,
901 [am_cv_prog_cc_stdc=no
902 ac_save_CC="$CC"
903 # Don't try gcc -ansi; that turns off useful extensions and
904 # breaks some systems' header files.
905 # AIX                   -qlanglvl=ansi
906 # Ultrix and OSF/1      -std1
907 # HP-UX 10.20 and later -Ae
908 # HP-UX older versions  -Aa -D_HPUX_SOURCE
909 # SVR4                  -Xc -D__EXTENSIONS__
910 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
911 do
912   CC="$ac_save_CC $ac_arg"
913   AC_TRY_COMPILE(
914 [#include <stdarg.h>
915 #include <stdio.h>
916 #include <sys/types.h>
917 #include <sys/stat.h>
918 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
919 struct buf { int x; };
920 FILE * (*rcsopen) (struct buf *, struct stat *, int);
921 static char *e (p, i)
922      char **p;
923      int i;
924 {
925   return p[i];
926 }
927 static char *f (char * (*g) (char **, int), char **p, ...)
928 {
929   char *s;
930   va_list v;
931   va_start (v,p);
932   s = g (p, va_arg (v,int));
933   va_end (v);
934   return s;
935 }
936 int test (int i, double x);
937 struct s1 {int (*f) (int a);};
938 struct s2 {int (*f) (double a);};
939 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
940 int argc;
941 char **argv;
942 ], [
943 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
944 ],
945 [am_cv_prog_cc_stdc="$ac_arg"; break])
946 done
947 CC="$ac_save_CC"
948 ])
949 if test -z "$am_cv_prog_cc_stdc"; then
950   AC_MSG_RESULT([none needed])
951 else
952   AC_MSG_RESULT($am_cv_prog_cc_stdc)
953 fi
954 case "x$am_cv_prog_cc_stdc" in
955   x|xno) ;;
956   *) CC="$CC $am_cv_prog_cc_stdc" ;;
957 esac
958 ])
959
960 # Do all the work for Automake.  This macro actually does too much --
961 # some checks are only needed if your package does certain things.
962 # But this isn't really a big deal.
963
964 # serial 1
965
966 dnl Usage:
967 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
968
969 AC_DEFUN(AM_INIT_AUTOMAKE,
970 [AC_REQUIRE([AC_PROG_INSTALL])
971 dnl We require 2.13 because we rely on SHELL being computed by configure.
972 AC_PREREQ([2.13])
973 PACKAGE=[$1]
974 AC_SUBST(PACKAGE)
975 VERSION=[$2]
976 AC_SUBST(VERSION)
977 dnl test to see if srcdir already configured
978 if test "`CDPATH=: && cd $srcdir && pwd`" != "`pwd`" &&
979    test -f $srcdir/config.status; then
980   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
981 fi
982 ifelse([$3],,
983 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
984 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
985 AC_REQUIRE([AM_SANITY_CHECK])
986 AC_REQUIRE([AC_ARG_PROGRAM])
987 AM_MISSING_PROG(ACLOCAL, aclocal)
988 AM_MISSING_PROG(AUTOCONF, autoconf)
989 AM_MISSING_PROG(AUTOMAKE, automake)
990 AM_MISSING_PROG(AUTOHEADER, autoheader)
991 AM_MISSING_PROG(MAKEINFO, makeinfo)
992 AM_MISSING_PROG(AMTAR, tar)
993 AM_MISSING_INSTALL_SH
994 dnl We need awk for the "check" target.  The system "awk" is bad on
995 dnl some platforms.
996 AC_REQUIRE([AC_PROG_AWK])
997 AC_REQUIRE([AC_PROG_MAKE_SET])
998 AC_REQUIRE([AM_DEP_TRACK])
999 AC_REQUIRE([AM_SET_DEPDIR])
1000 ifdef([AC_PROVIDE_AC_PROG_CC], [AM_DEPENDENCIES(CC)], [
1001    define([AC_PROG_CC], defn([AC_PROG_CC])[AM_DEPENDENCIES(CC)])])
1002 ifdef([AC_PROVIDE_AC_PROG_CXX], [AM_DEPENDENCIES(CXX)], [
1003    define([AC_PROG_CXX], defn([AC_PROG_CXX])[AM_DEPENDENCIES(CXX)])])
1004 ])
1005
1006 #
1007 # Check to make sure that the build environment is sane.
1008 #
1009
1010 AC_DEFUN(AM_SANITY_CHECK,
1011 [AC_MSG_CHECKING([whether build environment is sane])
1012 # Just in case
1013 sleep 1
1014 echo timestamp > conftestfile
1015 # Do `set' in a subshell so we don't clobber the current shell's
1016 # arguments.  Must try -L first in case configure is actually a
1017 # symlink; some systems play weird games with the mod time of symlinks
1018 # (eg FreeBSD returns the mod time of the symlink's containing
1019 # directory).
1020 if (
1021    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1022    if test "[$]*" = "X"; then
1023       # -L didn't work.
1024       set X `ls -t $srcdir/configure conftestfile`
1025    fi
1026    if test "[$]*" != "X $srcdir/configure conftestfile" \
1027       && test "[$]*" != "X conftestfile $srcdir/configure"; then
1028
1029       # If neither matched, then we have a broken ls.  This can happen
1030       # if, for instance, CONFIG_SHELL is bash and it inherits a
1031       # broken ls alias from the environment.  This has actually
1032       # happened.  Such a system could not be considered "sane".
1033       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1034 alias in your environment])
1035    fi
1036
1037    test "[$]2" = conftestfile
1038    )
1039 then
1040    # Ok.
1041    :
1042 else
1043    AC_MSG_ERROR([newly created file is older than distributed files!
1044 Check your system clock])
1045 fi
1046 rm -f conftest*
1047 AC_MSG_RESULT(yes)])
1048
1049 dnl AM_MISSING_PROG(NAME, PROGRAM)
1050 AC_DEFUN(AM_MISSING_PROG, [
1051 AC_REQUIRE([AM_MISSING_HAS_RUN])
1052 $1=${$1-"${am_missing_run}$2"}
1053 AC_SUBST($1)])
1054
1055 dnl Like AM_MISSING_PROG, but only looks for install-sh.
1056 dnl AM_MISSING_INSTALL_SH()
1057 AC_DEFUN(AM_MISSING_INSTALL_SH, [
1058 AC_REQUIRE([AM_MISSING_HAS_RUN])
1059 if test -z "$install_sh"; then
1060    install_sh="$ac_aux_dir/install-sh"
1061    test -f "$install_sh" || install_sh="$ac_aux_dir/install.sh"
1062    test -f "$install_sh" || install_sh="${am_missing_run}${ac_auxdir}/install-sh"
1063    dnl FIXME: an evil hack: we remove the SHELL invocation from
1064    dnl install_sh because automake adds it back in.  Sigh.
1065    install_sh="`echo $install_sh | sed -e 's/\${SHELL}//'`"
1066 fi
1067 AC_SUBST(install_sh)])
1068
1069 dnl AM_MISSING_HAS_RUN.
1070 dnl Define MISSING if not defined so far and test if it supports --run.
1071 dnl If it does, set am_missing_run to use it, otherwise, to nothing.
1072 AC_DEFUN([AM_MISSING_HAS_RUN], [
1073 test x"${MISSING+set}" = xset || \
1074   MISSING="\${SHELL} `CDPATH=: && cd $ac_aux_dir && pwd`/missing"
1075 dnl Use eval to expand $SHELL
1076 if eval "$MISSING --run :"; then
1077   am_missing_run="$MISSING --run "
1078 else
1079   am_missing_run=
1080   am_backtick='`'
1081   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
1082 fi
1083 ])
1084
1085 dnl See how the compiler implements dependency checking.
1086 dnl Usage:
1087 dnl AM_DEPENDENCIES(NAME)
1088 dnl NAME is "CC", "CXX" or "OBJC".
1089
1090 dnl We try a few techniques and use that to set a single cache variable.
1091
1092 AC_DEFUN(AM_DEPENDENCIES,[
1093 AC_REQUIRE([AM_SET_DEPDIR])
1094 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])
1095 ifelse([$1],CC,[
1096 AC_REQUIRE([AC_PROG_CC])
1097 AC_REQUIRE([AC_PROG_CPP])
1098 depcc="$CC"
1099 depcpp="$CPP"],[$1],CXX,[
1100 AC_REQUIRE([AC_PROG_CXX])
1101 AC_REQUIRE([AC_PROG_CXXCPP])
1102 depcc="$CXX"
1103 depcpp="$CXXCPP"],[$1],OBJC,[
1104 am_cv_OBJC_dependencies_compiler_type=gcc],[
1105 AC_REQUIRE([AC_PROG_][$1])
1106 depcc="$[$1]"
1107 depcpp=""])
1108 AC_MSG_CHECKING([dependency style of $depcc])
1109 AC_CACHE_VAL(am_cv_[$1]_dependencies_compiler_type,[
1110 if test -z "$AMDEP"; then
1111   echo '#include "conftest.h"' > conftest.c
1112   echo 'int i;' > conftest.h
1113
1114   am_cv_[$1]_dependencies_compiler_type=none
1115   for depmode in `sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < "$am_depcomp"`; do
1116     case "$depmode" in
1117     nosideeffect)
1118       # after this tag, mechanisms are not by side-effect, so they'll
1119       # only be used when explicitly requested
1120       if test "x$enable_dependency_tracking" = xyes; then
1121         continue
1122       else
1123         break
1124       fi
1125       ;;
1126     none) break ;;
1127     esac
1128     if depmode="$depmode" \
1129        source=conftest.c object=conftest.o \
1130        depfile=conftest.Po tmpdepfile=conftest.TPo \
1131        $SHELL $am_depcomp $depcc -c conftest.c 2>/dev/null &&
1132        grep conftest.h conftest.Po > /dev/null 2>&1; then
1133       am_cv_[$1]_dependencies_compiler_type="$depmode"
1134       break
1135     fi
1136   done
1137
1138   rm -f conftest.*
1139 else
1140   am_cv_[$1]_dependencies_compiler_type=none
1141 fi
1142 ])
1143 AC_MSG_RESULT($am_cv_[$1]_dependencies_compiler_type)
1144 [$1]DEPMODE="depmode=$am_cv_[$1]_dependencies_compiler_type"
1145 AC_SUBST([$1]DEPMODE)
1146 ])
1147
1148 dnl Choose a directory name for dependency files.
1149 dnl This macro is AC_REQUIREd in AM_DEPENDENCIES
1150
1151 AC_DEFUN(AM_SET_DEPDIR,[
1152 if test -d .deps || mkdir .deps 2> /dev/null || test -d .deps; then
1153   DEPDIR=.deps
1154 else
1155   DEPDIR=_deps
1156 fi
1157 AC_SUBST(DEPDIR)
1158 ])
1159
1160 AC_DEFUN(AM_DEP_TRACK,[
1161 AC_ARG_ENABLE(dependency-tracking,
1162 [  --disable-dependency-tracking Speeds up one-time builds
1163   --enable-dependency-tracking  Do not reject slow dependency extractors])
1164 if test "x$enable_dependency_tracking" = xno; then
1165   AMDEP="#"
1166 else
1167   am_depcomp="$ac_aux_dir/depcomp"
1168   if test ! -f "$am_depcomp"; then
1169     AMDEP="#"
1170   else
1171     AMDEP=
1172   fi
1173 fi
1174 AC_SUBST(AMDEP)
1175 if test -z "$AMDEP"; then
1176   AMDEPBACKSLASH='\'
1177 else
1178   AMDEPBACKSLASH=
1179 fi
1180 pushdef([subst], defn([AC_SUBST]))
1181 subst(AMDEPBACKSLASH)
1182 popdef([subst])
1183 ])
1184
1185 dnl Generate code to set up dependency tracking.
1186 dnl This macro should only be invoked once -- use via AC_REQUIRE.
1187 dnl Usage:
1188 dnl AM_OUTPUT_DEPENDENCY_COMMANDS
1189
1190 dnl
1191 dnl This code is only required when automatic dependency tracking
1192 dnl is enabled.  FIXME.  This creates each `.P' file that we will
1193 dnl need in order to bootstrap the dependency handling code.
1194 AC_DEFUN(AM_OUTPUT_DEPENDENCY_COMMANDS,[
1195 AC_OUTPUT_COMMANDS([
1196 test x"$AMDEP" != x"" ||
1197 for mf in $CONFIG_FILES; do
1198   case "$mf" in
1199   Makefile) dirpart=.;;
1200   */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;;
1201   *) continue;;
1202   esac
1203   grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
1204   # Extract the definition of DEP_FILES from the Makefile without
1205   # running `make'.
1206   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
1207   test -z "$DEPDIR" && continue
1208   # When using ansi2knr, U may be empty or an underscore; expand it
1209   U=`sed -n -e '/^U = / s///p' < "$mf"`
1210   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
1211   # We invoke sed twice because it is the simplest approach to
1212   # changing $(DEPDIR) to its actual value in the expansion.
1213   for file in `sed -n -e '
1214     /^DEP_FILES = .*\\\\$/ {
1215       s/^DEP_FILES = //
1216       :loop
1217         s/\\\\$//
1218         p
1219         n
1220         /\\\\$/ b loop
1221       p
1222     }
1223     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
1224        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
1225     # Make sure the directory exists.
1226     test -f "$dirpart/$file" && continue
1227     fdir=`echo "$file" | sed -e 's|/[^/]*$||'`
1228     $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1
1229     # echo "creating $dirpart/$file"
1230     echo '# dummy' > "$dirpart/$file"
1231   done
1232 done
1233 ], [AMDEP="$AMDEP"
1234 ac_aux_dir="$ac_aux_dir"])])
1235
1236 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1237
1238 AC_DEFUN(AM_CONFIG_HEADER,
1239 [AC_PREREQ([2.12])
1240 AC_CONFIG_HEADER([$1])
1241 dnl When config.status generates a header, we must update the stamp-h file.
1242 dnl This file resides in the same directory as the config header
1243 dnl that is generated.  We must strip everything past the first ":",
1244 dnl and everything past the last "/".
1245 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1246 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1247 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1248 <<am_indx=1
1249 for am_file in <<$1>>; do
1250   case " <<$>>CONFIG_HEADERS " in
1251   *" <<$>>am_file "*<<)>>
1252     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1253     ;;
1254   esac
1255   am_indx=`expr "<<$>>am_indx" + 1`
1256 done<<>>dnl>>)
1257 changequote([,]))])
1258
1259 # Add --enable-maintainer-mode option to configure.
1260 # From Jim Meyering
1261
1262 # serial 1
1263
1264 AC_DEFUN(AM_MAINTAINER_MODE,
1265 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1266   dnl maintainer-mode is disabled by default
1267   AC_ARG_ENABLE(maintainer-mode,
1268 [  --enable-maintainer-mode enable make rules and dependencies not useful
1269                           (and sometimes confusing) to the casual installer],
1270       USE_MAINTAINER_MODE=$enableval,
1271       USE_MAINTAINER_MODE=no)
1272   AC_MSG_RESULT($USE_MAINTAINER_MODE)
1273   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1274   MAINT=$MAINTAINER_MODE_TRUE
1275   AC_SUBST(MAINT)dnl
1276 ]
1277 )
1278
1279 # Define a conditional.
1280
1281 AC_DEFUN(AM_CONDITIONAL,
1282 [AC_SUBST($1_TRUE)
1283 AC_SUBST($1_FALSE)
1284 if $2; then
1285   $1_TRUE=
1286   $1_FALSE='#'
1287 else
1288   $1_TRUE='#'
1289   $1_FALSE=
1290 fi])
1291
1292
1293 # serial 42 AC_PROG_LIBTOOL
1294 AC_DEFUN(AC_PROG_LIBTOOL,
1295 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
1296
1297 # Save cache, so that ltconfig can load it
1298 AC_CACHE_SAVE
1299
1300 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
1301 AR="$AR" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
1302 MAGIC="$MAGIC" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
1303 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
1304 AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
1305 objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
1306 deplibs_check_method="$deplibs_check_method" file_magic_cmd="$file_magic_cmd" \
1307 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
1308 $libtool_flags --no-verify --build="$build" $ac_aux_dir/ltmain.sh $lt_target \
1309 || AC_MSG_ERROR([libtool configure failed])
1310
1311 # Reload cache, that may have been modified by ltconfig
1312 AC_CACHE_LOAD
1313
1314 # This can be used to rebuild libtool when needed
1315 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
1316
1317 # Always use our own libtool.
1318 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
1319 AC_SUBST(LIBTOOL)dnl
1320
1321 # Redirect the config.log output again, so that the ltconfig log is not
1322 # clobbered by the next message.
1323 exec 5>>./config.log
1324 ])
1325
1326 AC_DEFUN(AC_LIBTOOL_SETUP,
1327 [AC_PREREQ(2.13)dnl
1328 AC_REQUIRE([AC_ENABLE_SHARED])dnl
1329 AC_REQUIRE([AC_ENABLE_STATIC])dnl
1330 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
1331 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1332 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1333 AC_REQUIRE([AC_PROG_CC])dnl
1334 AC_REQUIRE([AC_PROG_LD])dnl
1335 AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
1336 AC_REQUIRE([AC_PROG_NM])dnl
1337 AC_REQUIRE([AC_PROG_LN_S])dnl
1338 AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
1339 AC_REQUIRE([AC_OBJEXT])dnl
1340 AC_REQUIRE([AC_EXEEXT])dnl
1341 dnl
1342
1343 # Only perform the check for file, if the check method requires it
1344 case "$deplibs_check_method" in
1345 file_magic*)
1346   if test "$file_magic_cmd" = '${MAGIC}'; then
1347     AC_PATH_MAGIC
1348   fi
1349   ;;
1350 esac
1351
1352 case "$target" in
1353 NONE) lt_target="$host" ;;
1354 *) lt_target="$target" ;;
1355 esac
1356
1357 AC_CHECK_TOOL(RANLIB, ranlib, :)
1358 AC_CHECK_TOOL(STRIP, strip, :)
1359
1360 # Check for any special flags to pass to ltconfig.
1361 libtool_flags="--cache-file=$cache_file"
1362 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
1363 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
1364 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
1365 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
1366 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
1367 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
1368 [libtool_flags="$libtool_flags --enable-dlopen"])
1369 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1370 [libtool_flags="$libtool_flags --enable-win32-dll"])
1371 AC_ARG_ENABLE(libtool-lock,
1372   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
1373 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
1374 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
1375
1376 AC_ARG_WITH(pic,
1377   [  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
1378      pic_mode="$withval", pic_mode=default)
1379 test x"$pic_mode" = xyes && libtool_flags="$libtool_flags --prefer-pic"
1380 test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
1381
1382 # Some flags need to be propagated to the compiler or linker for good
1383 # libtool support.
1384 case "$lt_target" in
1385 *-*-irix6*)
1386   # Find out which ABI we are using.
1387   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
1388   if AC_TRY_EVAL(ac_compile); then
1389     case "`/usr/bin/file conftest.o`" in
1390     *32-bit*)
1391       LD="${LD-ld} -32"
1392       ;;
1393     *N32*)
1394       LD="${LD-ld} -n32"
1395       ;;
1396     *64-bit*)
1397       LD="${LD-ld} -64"
1398       ;;
1399     esac
1400   fi
1401   rm -rf conftest*
1402   ;;
1403
1404 *-*-sco3.2v5*)
1405   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1406   SAVE_CFLAGS="$CFLAGS"
1407   CFLAGS="$CFLAGS -belf"
1408   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1409     [AC_LANG_SAVE
1410      AC_LANG_C
1411      AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
1412      AC_LANG_RESTORE])
1413   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1414     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1415     CFLAGS="$SAVE_CFLAGS"
1416   fi
1417   ;;
1418
1419 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1420 [*-*-cygwin* | *-*-mingw*)
1421   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
1422   AC_CHECK_TOOL(AS, as, false)
1423   AC_CHECK_TOOL(OBJDUMP, objdump, false)
1424
1425   # recent cygwin and mingw systems supply a stub DllMain which the user
1426   # can override, but on older systems we have to supply one
1427   AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
1428     [AC_TRY_LINK([],
1429       [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
1430       DllMain (0, 0, 0);],
1431       [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
1432
1433   case "$lt_target/$CC" in
1434   *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
1435     # old mingw systems require "-dll" to link a DLL, while more recent ones
1436     # require "-mdll"
1437     SAVE_CFLAGS="$CFLAGS"
1438     CFLAGS="$CFLAGS -mdll"
1439     AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
1440       [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
1441     CFLAGS="$SAVE_CFLAGS" ;;
1442   *-*-cygwin*)
1443     # cygwin systems need to pass --dll to the linker, and not link
1444     # crt.o which will require a WinMain@16 definition.
1445     lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
1446   esac
1447   ;;
1448   ])
1449 esac
1450 ])
1451
1452 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
1453 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
1454
1455 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
1456 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
1457
1458 # AC_ENABLE_SHARED - implement the --enable-shared flag
1459 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
1460 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1461 #   `yes'.
1462 AC_DEFUN(AC_ENABLE_SHARED, [dnl
1463 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
1464 AC_ARG_ENABLE(shared,
1465 changequote(<<, >>)dnl
1466 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
1467 changequote([, ])dnl
1468 [p=${PACKAGE-default}
1469 case "$enableval" in
1470 yes) enable_shared=yes ;;
1471 no) enable_shared=no ;;
1472 *)
1473   enable_shared=no
1474   # Look at the argument we got.  We use all the common list separators.
1475   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1476   for pkg in $enableval; do
1477     if test "X$pkg" = "X$p"; then
1478       enable_shared=yes
1479     fi
1480   done
1481   IFS="$ac_save_ifs"
1482   ;;
1483 esac],
1484 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
1485 ])
1486
1487 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
1488 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1489 AC_ENABLE_SHARED(no)])
1490
1491 # AC_ENABLE_STATIC - implement the --enable-static flag
1492 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
1493 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1494 #   `yes'.
1495 AC_DEFUN(AC_ENABLE_STATIC, [dnl
1496 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
1497 AC_ARG_ENABLE(static,
1498 changequote(<<, >>)dnl
1499 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
1500 changequote([, ])dnl
1501 [p=${PACKAGE-default}
1502 case "$enableval" in
1503 yes) enable_static=yes ;;
1504 no) enable_static=no ;;
1505 *)
1506   enable_static=no
1507   # Look at the argument we got.  We use all the common list separators.
1508   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1509   for pkg in $enableval; do
1510     if test "X$pkg" = "X$p"; then
1511       enable_static=yes
1512     fi
1513   done
1514   IFS="$ac_save_ifs"
1515   ;;
1516 esac],
1517 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
1518 ])
1519
1520 # AC_DISABLE_STATIC - set the default static flag to --disable-static
1521 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1522 AC_ENABLE_STATIC(no)])
1523
1524
1525 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
1526 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
1527 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
1528 #   `yes'.
1529 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
1530 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
1531 AC_ARG_ENABLE(fast-install,
1532 changequote(<<, >>)dnl
1533 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
1534 changequote([, ])dnl
1535 [p=${PACKAGE-default}
1536 case "$enableval" in
1537 yes) enable_fast_install=yes ;;
1538 no) enable_fast_install=no ;;
1539 *)
1540   enable_fast_install=no
1541   # Look at the argument we got.  We use all the common list separators.
1542   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
1543   for pkg in $enableval; do
1544     if test "X$pkg" = "X$p"; then
1545       enable_fast_install=yes
1546     fi
1547   done
1548   IFS="$ac_save_ifs"
1549   ;;
1550 esac],
1551 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
1552 ])
1553
1554 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
1555 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1556 AC_ENABLE_FAST_INSTALL(no)])
1557
1558
1559 # AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
1560 AC_DEFUN(AC_PATH_TOOL_PREFIX,
1561 [AC_MSG_CHECKING([for $1])
1562 AC_CACHE_VAL(lt_cv_path_MAGIC,
1563 [case "$MAGIC" in
1564   /*)
1565   lt_cv_path_MAGIC="$MAGIC" # Let the user override the test with a path.
1566   ;;
1567   ?:/*)
1568   ac_cv_path_MAGIC="$MAGIC" # Let the user override the test with a dos path.
1569   ;;
1570   *)
1571   ac_save_MAGIC="$MAGIC"
1572   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
1573 dnl $ac_dummy forces splitting on constant user-supplied paths.
1574 dnl POSIX.2 word splitting is done only on the output of word expansions,
1575 dnl not every word.  This closes a longstanding sh security hole.
1576   ac_dummy="ifelse([$2], , $PATH, [$2])"
1577   for ac_dir in $ac_dummy; do
1578     test -z "$ac_dir" && ac_dir=.
1579     if test -f $ac_dir/$1; then
1580       lt_cv_path_MAGIC="$ac_dir/$1"
1581       if test -n "$file_magic_test_file"; then
1582         case "$deplibs_check_method" in
1583         "file_magic "*)
1584           file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
1585           MAGIC="$lt_cv_path_MAGIC"
1586           if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
1587             egrep "$file_magic_regex" > /dev/null; then
1588             :
1589           else
1590             cat <<EOF 1>&2
1591
1592 *** Warning: the command libtool uses to detect shared libraries,
1593 *** $file_magic_cmd, produces output that libtool cannot recognize.
1594 *** The result is that libtool may fail to recognize shared libraries
1595 *** as such.  This will affect the creation of libtool libraries that
1596 *** depend on shared libraries, but programs linked with such libtool
1597 *** libraries will work regardless of this problem.  Nevertheless, you
1598 *** may want to report the problem to your system manager and/or to
1599 *** bug-libtool@gnu.org
1600
1601 EOF
1602           fi ;;
1603         esac
1604       fi
1605       break
1606     fi
1607   done
1608   IFS="$ac_save_ifs"
1609   MAGIC="$ac_save_MAGIC"
1610   ;;
1611 esac])
1612 MAGIC="$lt_cv_path_MAGIC"
1613 if test -n "$MAGIC"; then
1614   AC_MSG_RESULT($MAGIC)
1615 else
1616   AC_MSG_RESULT(no)
1617 fi
1618 ])
1619
1620
1621 # AC_PATH_MAGIC - find a file program which can recognise a shared library
1622 AC_DEFUN(AC_PATH_MAGIC,
1623 [AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
1624 AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
1625 if test -z "$lt_cv_path_MAGIC"; then
1626   if test -n "$ac_tool_prefix"; then
1627     AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
1628   else
1629     MAGIC=:
1630   fi
1631 fi
1632 ])
1633
1634
1635 # AC_PROG_LD - find the path to the GNU or non-GNU linker
1636 AC_DEFUN(AC_PROG_LD,
1637 [AC_ARG_WITH(gnu-ld,
1638 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1639 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1640 AC_REQUIRE([AC_PROG_CC])dnl
1641 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1642 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1643 ac_prog=ld
1644 if test "$ac_cv_prog_gcc" = yes; then
1645   # Check if gcc -print-prog-name=ld gives a path.
1646   AC_MSG_CHECKING([for ld used by GCC])
1647   case $lt_target in
1648   *-*-mingw*)
1649     # gcc leaves a trailing carriage return which upsets mingw
1650     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1651   *)
1652     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1653   esac
1654   case "$ac_prog" in
1655     # Accept absolute paths.
1656 changequote(,)dnl
1657     [\\/]* | [A-Za-z]:[\\/]*)
1658       re_direlt='/[^/][^/]*/\.\./'
1659 changequote([,])dnl
1660       # Canonicalize the path of ld
1661       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1662       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1663         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1664       done
1665       test -z "$LD" && LD="$ac_prog"
1666       ;;
1667   "")
1668     # If it fails, then pretend we aren't using GCC.
1669     ac_prog=ld
1670     ;;
1671   *)
1672     # If it is relative, then search for the first ld in PATH.
1673     with_gnu_ld=unknown
1674     ;;
1675   esac
1676 elif test "$with_gnu_ld" = yes; then
1677   AC_MSG_CHECKING([for GNU ld])
1678 else
1679   AC_MSG_CHECKING([for non-GNU ld])
1680 fi
1681 AC_CACHE_VAL(ac_cv_path_LD,
1682 [if test -z "$LD"; then
1683   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1684   for ac_dir in $PATH; do
1685     test -z "$ac_dir" && ac_dir=.
1686     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1687       ac_cv_path_LD="$ac_dir/$ac_prog"
1688       # Check to see if the program is GNU ld.  I'd rather use --version,
1689       # but apparently some GNU ld's only accept -v.
1690       # Break only if it was the GNU/non-GNU ld that we prefer.
1691       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
1692         test "$with_gnu_ld" != no && break
1693       else
1694         test "$with_gnu_ld" != yes && break
1695       fi
1696     fi
1697   done
1698   IFS="$ac_save_ifs"
1699 else
1700   ac_cv_path_LD="$LD" # Let the user override the test with a path.
1701 fi])
1702 LD="$ac_cv_path_LD"
1703 if test -n "$LD"; then
1704   AC_MSG_RESULT($LD)
1705 else
1706   AC_MSG_RESULT(no)
1707 fi
1708 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1709 AC_PROG_LD_GNU
1710 ])
1711
1712 AC_DEFUN(AC_PROG_LD_GNU,
1713 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
1714 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1715 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
1716   ac_cv_prog_gnu_ld=yes
1717 else
1718   ac_cv_prog_gnu_ld=no
1719 fi])
1720 with_gnu_ld=$ac_cv_prog_gnu_ld
1721 ])
1722
1723 # AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
1724 #   -- PORTME Some linkers may need a different reload flag.
1725 AC_DEFUN(AC_PROG_LD_RELOAD_FLAG,
1726 [AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
1727 [lt_cv_ld_reload_flag='-r'])
1728 reload_flag=$lt_cv_ld_reload_flag
1729 test -n "$reload_flag" && reload_flag=" $reload_flag"
1730 ])
1731
1732 # AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
1733 #  -- PORTME fill in with the dynamic library characteristics
1734 AC_DEFUN(AC_DEPLIBS_CHECK_METHOD,
1735 [AC_CACHE_CHECK([how to recognise dependant libraries],
1736 lt_cv_deplibs_check_method,
1737 [lt_cv_file_magic_cmd='${MAGIC}'
1738 lt_cv_file_magic_test_file=
1739 lt_cv_deplibs_check_method='unknown'
1740 # Need to set the preceding variable on all platforms that support
1741 # interlibrary dependencies.
1742 # 'none' -- dependencies not supported.
1743 # `unknown' -- same as none, but documents that we really don't know.
1744 # 'pass_all' -- all dependencies passed with no checks.
1745 # 'test_compile' -- check by making test program.
1746 # 'file_magic [regex]' -- check by looking for files in library path
1747 # which responds to the $file_magic_cmd with a given egrep regex.
1748 # If you have `file' or equivalent on your system and you're not sure
1749 # whether `pass_all' will *always* work, you probably want this one.
1750
1751 case "$host_os" in
1752 aix4* | beos*)
1753   lt_cv_deplibs_check_method=pass_all
1754   ;;
1755
1756 bsdi4*)
1757   changequote(,)dnl
1758   lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
1759   changequote([, ])dnl
1760   lt_cv_file_magic_test_file=/shlib/libc.so
1761   ;;
1762
1763 cygwin* | mingw*)
1764   lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
1765   lt_cv_file_magic_cmd='${OBJDUMP} -f'
1766   ;;
1767
1768 freebsd*)
1769   case "$version_type" in
1770   freebsd-elf*)
1771     lt_cv_deplibs_check_method=pass_all
1772     ;;
1773   esac
1774   ;;
1775
1776 gnu*)
1777   lt_cv_deplibs_check_method=pass_all
1778   ;;
1779
1780 irix5* | irix6*)
1781   case "$host_os" in
1782   irix5*)
1783     # this will be overridden with pass_all, but let us keep it just in case
1784     lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
1785     ;;
1786   *)
1787     case "$LD" in
1788     *-32|*"-32 ") libmagic=32-bit;;
1789     *-n32|*"-n32 ") libmagic=N32;;
1790     *-64|*"-64 ") libmagic=64-bit;;
1791     *) libmagic=never-match;;
1792     esac
1793     # this will be overridden with pass_all, but let us keep it just in case
1794     changequote(,)dnl
1795     lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1"
1796     changequote([, ])dnl
1797     ;;
1798   esac
1799   lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
1800   lt_cv_deplibs_check_method=pass_all
1801   ;;
1802
1803 # This must be Linux ELF.
1804 linux-gnu*)
1805   case "$host_cpu" in
1806   alpha* | i*86 | powerpc* | sparc* )
1807     lt_cv_deplibs_check_method=pass_all ;;
1808   *)
1809     # glibc up to 2.1.1 does not perform some relocations on ARM
1810     changequote(,)dnl
1811     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;;
1812     changequote([, ])dnl
1813   esac
1814   lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
1815   ;;
1816
1817 osf3* | osf4* | osf5*)
1818   # this will be overridden with pass_all, but let us keep it just in case
1819   lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
1820   lt_cv_file_magic_test_file=/shlib/libc.so
1821   lt_cv_deplibs_check_method=pass_all
1822   ;;
1823
1824 sco3.2v5*)
1825   lt_cv_deplibs_check_method=pass_all
1826   ;;
1827
1828 solaris*)
1829   lt_cv_deplibs_check_method=pass_all
1830   lt_cv_file_magic_test_file=/lib/libc.so
1831   ;;
1832
1833 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1834   case "$host_vendor" in
1835   ncr)
1836     lt_cv_deplibs_check_method=pass_all
1837     ;;
1838   motorola)
1839     changequote(,)dnl
1840     lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
1841     changequote([, ])dnl
1842     lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
1843     ;;
1844   esac
1845   ;;
1846 esac
1847 ])
1848 file_magic_cmd=$lt_cv_file_magic_cmd
1849 deplibs_check_method=$lt_cv_deplibs_check_method
1850 ])
1851
1852
1853 # AC_PROG_NM - find the path to a BSD-compatible name lister
1854 AC_DEFUN(AC_PROG_NM,
1855 [AC_MSG_CHECKING([for BSD-compatible nm])
1856 AC_CACHE_VAL(ac_cv_path_NM,
1857 [if test -n "$NM"; then
1858   # Let the user override the test.
1859   ac_cv_path_NM="$NM"
1860 else
1861   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1862   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
1863     test -z "$ac_dir" && ac_dir=.
1864     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
1865       # Check to see if the nm accepts a BSD-compat flag.
1866       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
1867       #   nm: unknown option "B" ignored
1868       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1869         ac_cv_path_NM="$ac_dir/nm -B"
1870         break
1871       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
1872         ac_cv_path_NM="$ac_dir/nm -p"
1873         break
1874       else
1875         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
1876         continue # so that we can try to find one that supports BSD flags
1877       fi
1878     fi
1879   done
1880   IFS="$ac_save_ifs"
1881   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
1882 fi])
1883 NM="$ac_cv_path_NM"
1884 AC_MSG_RESULT([$NM])
1885 ])
1886
1887 # AC_CHECK_LIBM - check for math library
1888 AC_DEFUN(AC_CHECK_LIBM,
1889 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
1890 LIBM=
1891 case "$lt_target" in
1892 *-*-beos* | *-*-cygwin*)
1893   # These system don't have libm
1894   ;;
1895 *-ncr-sysv4.3*)
1896   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
1897   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
1898   ;;
1899 *)
1900   AC_CHECK_LIB(m, main, LIBM="-lm")
1901   ;;
1902 esac
1903 ])
1904
1905 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
1906 # the libltdl convenience library, adds --enable-ltdl-convenience to
1907 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1908 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1909 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1910 # '${top_builddir}/' (note the single quotes!) if your package is not
1911 # flat, and, if you're not using automake, define top_builddir as
1912 # appropriate in the Makefiles.
1913 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1914   case "$enable_ltdl_convenience" in
1915   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
1916   "") enable_ltdl_convenience=yes
1917       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
1918   esac
1919   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
1920   INCLTDL=ifelse($#,1,-I$1,['-I${top_srcdir}/libltdl'])
1921 ])
1922
1923 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
1924 # the libltdl installable library, and adds --enable-ltdl-install to
1925 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
1926 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
1927 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
1928 # '${top_builddir}/' (note the single quotes!) if your package is not
1929 # flat, and, if you're not using automake, define top_builddir as
1930 # appropriate in the Makefiles.
1931 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
1932 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
1933   AC_CHECK_LIB(ltdl, main,
1934   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
1935   [if test x"$enable_ltdl_install" = xno; then
1936      AC_MSG_WARN([libltdl not installed, but installation disabled])
1937    else
1938      enable_ltdl_install=yes
1939    fi
1940   ])
1941   if test x"$enable_ltdl_install" = x"yes"; then
1942     ac_configure_args="$ac_configure_args --enable-ltdl-install"
1943     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
1944     INCLTDL=ifelse($#,1,-I$1,['-I${top_srcdir}/libltdl'])
1945   else
1946     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
1947     LIBLTDL="-lltdl"
1948     INCLTDL=
1949   fi
1950 ])
1951
1952 dnl old names
1953 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
1954 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
1955 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
1956 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
1957 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
1958 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
1959 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
1960
1961 dnl This is just to silence aclocal about the macro not being used
1962 ifelse([AC_DISABLE_FAST_INSTALL])dnl
1963