1dnl
2dnl record top-level directory (this one)
3dnl A problem.  Some systems use an NFS automounter.  This can generate
4dnl paths of the form /tmp_mnt/... . On SOME systems, that path is
5dnl not recognized, and you need to strip off the /tmp_mnt. On others,
6dnl it IS recognized, so you need to leave it in.  Grumble.
7dnl The real problem is that OTHER nodes on the same NFS system may not
8dnl be able to find a directory based on a /tmp_mnt/... name.
9dnl
10dnl It is WRONG to use $PWD, since that is maintained only by the C shell,
11dnl and if we use it, we may find the 'wrong' directory.  To test this, we
12dnl try writing a file to the directory and then looking for it in the
13dnl current directory.  Life would be so much easier if the NFS automounter
14dnl worked correctly.
15dnl
16dnl PAC_GETWD(varname [, filename ] )
17dnl
18dnl Set varname to current directory.  Use filename (relative to current
19dnl directory) if provided to double check.
20dnl
21dnl Need a way to use "automounter fix" for this.
22dnl
23define(PAC_GETWD,[
24AC_MSG_CHECKING(for current directory name)
25$1=$PWD
26if test "${$1}" != "" -a -d "${$1}" ; then
27    if test -r ${$1}/.foo$$ ; then
28        rm -f ${$1}/.foo$$
29        rm -f .foo$$
30    fi
31    if test -r ${$1}/.foo$$ -o -r .foo$$ ; then
32        $1=
33    else
34        echo "test" > ${$1}/.foo$$
35        if test ! -r .foo$$ ; then
36            rm -f ${$1}/.foo$$
37            $1=
38        else
39            rm -f ${$1}/.foo$$
40        fi
41    fi
42fi
43if test "${$1}" = "" ; then
44    $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
45fi
46dnl
47dnl First, test the PWD is sensible
48ifelse($2,,,
49if test ! -r ${$1}/$2 ; then
50    dnl PWD must be messed up
51    $1=`pwd`
52    if test ! -r ${$1}/$2 ; then
53        AC_MSG_ERROR([Cannot determine the root directory!])
54    fi
55    $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
56    if test ! -d ${$1} ; then
57        AC_MSG_WARN([Warning: your default path uses the automounter; this may
58cause some problems if you use other NFS-connected systems.])
59        $1=`pwd`
60    fi
61fi)
62if test -z "${$1}" ; then
63    $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`
64    if test ! -d ${$1} ; then
65        AC_MSG_WARN([Warning: your default path uses the automounter; this may
66cause some problems if you use other NFS-connected systems.])
67        $1=`pwd`
68    fi
69fi
70AC_MSG_RESULT(${$1})
71])dnl
72dnl
73dnl This version compiles an entire function; used to check for
74dnl things like varargs done correctly
75dnl
76dnl PAC_COMPILE_CHECK_FUNC(msg,function,if_true,if_false)
77dnl
78define(PAC_COMPILE_CHECK_FUNC,
79[AC_PROVIDE([$0])dnl
80ifelse([$1], , , [AC_MSG_CHECKING(for $1)]
81)dnl
82if test ! -f confdefs.h ; then
83    AC_MSG_RESULT("!! SHELL ERROR !!")
84    echo "The file confdefs.h created by configure has been removed"
85    echo "This may be a problem with your shell; some versions of LINUX"
86    echo "have this problem.  See the Installation guide for more"
87    echo "information."
88    exit 1
89fi
90cat > conftest.c <<EOF
91#include "confdefs.h"
92[$2]
93EOF
94dnl Don't try to run the program, which would prevent cross-configuring.
95if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
96  ifelse([$1], , , [AC_MSG_RESULT(yes)])
97  ifelse([$3], , :, [rm -rf conftest*
98  $3
99])
100ifelse([$4], , , [else
101  rm -rf conftest*
102  $4
103])dnl
104   ifelse([$1], , , ifelse([$4], ,else) [AC_MSG_RESULT(no)])
105fi
106rm -f conftest*]
107)dnl
108dnl
109dnl PAC_OUTPUT_EXEC(files[,mode]) - takes files (as shell script or others),
110dnl and applies configure to the them.  Basically, this is what AC_OUTPUT
111dnl should do, but without adding a comment line at the top.
112dnl Must be used ONLY after AC_OUTPUT (it needs config.status, which
113dnl AC_OUTPUT creates).
114dnl Optionally, set the mode (+x, a+x, etc)
115dnl
116define(PAC_OUTPUT_EXEC,[
117CONFIG_FILES="$1"
118export CONFIG_FILES
119./config.status
120CONFIG_FILES=""
121for pac_file in $1 ; do
122    rm -f .pactmp
123    sed -e '1d' $pac_file > .pactmp
124    rm -f $pac_file
125    mv .pactmp $pac_file
126    ifelse($2,,,chmod $2 $pac_file)
127done
128])dnl
129dnl
130dnl This is a replacement for AC_PROG_CC that does not prefer gcc and
131dnl that does not mess with CFLAGS.  See acspecific.m4 for the original defn.
132dnl
133dnl/*D
134dnl PAC_PROG_CC - Find a working C compiler
135dnl
136dnl Synopsis:
137dnl PAC_PROG_CC
138dnl
139dnl Output Effect:
140dnl   Sets the variable CC if it is not already set
141dnl
142dnl Notes:
143dnl   Unlike AC_PROG_CC, this does not prefer gcc and does not set CFLAGS.
144dnl   It does check that the compiler can compile a simple C program.
145dnl   It also sets the variable GCC to yes if the compiler is gcc.  It does
146dnl   not yet check for some special options needed in particular for
147dnl   parallel computers, such as -Tcray-t3e, or special options to get
148dnl   full ANSI/ISO C, such as -Aa for HP.
149dnl
150dnlD*/
151AC_DEFUN(PAC_PROG_CC,[
152AC_PROVIDE([AC_PROG_CC])
153AC_CHECK_PROGS(CC, cc xlC xlc pgcc icc gcc )
154test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
155PAC_PROG_CC_WORKS
156AC_PROG_CC_GNU
157if test "$ac_cv_prog_gcc" = yes; then
158    GCC=yes
159else
160    GCC=
161fi
162])
163dnl
164dnl
165dnl This is a replacement that checks that FAILURES are signaled as well
166dnl (later configure macros look for the .o file, not just success from the
167dnl compiler, but they should not HAVE to
168dnl
169dnl --- insert 2.52 compatibility here ---
170dnl 2.52+ does not have AC_PROG_CC_GNU
171ifdef([AC_PROG_CC_GNU],,[AC_DEFUN([AC_PROG_CC_GNU],)])
172dnl 2.52 does not have AC_PROG_CC_WORKS
173ifdef([AC_PROG_CC_WORKS],,[AC_DEFUN([AC_PROG_CC_WORKS],)])
174dnl
175dnl
176AC_DEFUN(PAC_PROG_CC_WORKS,
177[AC_PROG_CC_WORKS
178AC_MSG_CHECKING([whether the C compiler sets its return status correctly])
179AC_LANG_SAVE
180AC_LANG_C
181AC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes)
182AC_MSG_RESULT($notbroken)
183if test "$notbroken" = "no" ; then
184    AC_MSG_ERROR([installation or configuration problem: C compiler does not
185correctly set error code when a fatal error occurs])
186fi
187])
188dnl
189dnl ***TAKEN FROM sowing/confdb/aclocal_cc.m4 IF YOU FIX THIS, FIX THAT
190dnl VERSION AS WELL
191dnl Check whether we need -fno-common to correctly compile the source code.
192dnl This is necessary if global variables are defined without values in
193dnl gcc.  Here is the test
194dnl conftest1.c:
195dnl extern int a; int a;
196dnl conftest2.c:
197dnl extern int a; int main(int argc; char *argv[] ){ return a; }
198dnl Make a library out of conftest1.c and try to link with it.
199dnl If that fails, recompile it with -fno-common and see if that works.
200dnl If so, add -fno-common to CFLAGS
201dnl An alternative is to use, on some systems, ranlib -c to force
202dnl the system to find common symbols.
203dnl
204dnl NOT TESTED
205AC_DEFUN(PAC_PROG_C_BROKEN_COMMON,[
206AC_MSG_CHECKING([whether global variables handled properly])
207AC_REQUIRE([AC_PROG_RANLIB])
208ac_cv_prog_cc_globals_work=no
209echo 'extern int a; int a;' > conftest1.c
210echo 'extern int a; int main( ){ return a; }' > conftest2.c
211if ${CC-cc} $CFLAGS -c conftest1.c >conftest.out 2>&1 ; then
212    if ${AR-ar} cr libconftest.a conftest1.o >/dev/null 2>&1 ; then
213        if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then
214            if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest.a >> conftest.out 2>&1 ; then
215                # Success!  C works
216                ac_cv_prog_cc_globals_work=yes
217            else
218                # Failure!  Do we need -fno-common?
219                ${CC-cc} $CFLAGS -fno-common -c conftest1.c >> conftest.out 2>&1
220                rm -f libconftest.a
221                ${AR-ar} cr libconftest.a conftest1.o >>conftest.out 2>&1
222                ${RANLIB-:} libconftest.a >>conftest.out 2>&1
223                if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest.a >> conftest.out 2>&1 ; then
224                    ac_cv_prog_cc_globals_work="needs -fno-common"
225                    CFLAGS="$CFLAGS -fno-common"
226                fi
227            fi
228        fi
229    fi
230fi
231rm -f conftest* libconftest*
232AC_MSG_RESULT($ac_cv_prog_cc_globals_work)
233])dnl
234dnl
235dnl PAC_MSG_ERROR($enable_softerr,ErrorMsg) -
236dnl return AC_MSG_ERROR(ErrorMsg) if "$enable_softerr" = "yes"
237dnl return AC_MSG_WARN(ErrorMsg) + exit 0 otherwise
238dnl
239define(PAC_MSG_ERROR,[
240if test "$1" = "yes" ; then
241    AC_MSG_WARN([ $2 ])
242    exit 0
243else
244    AC_MSG_ERROR([ $2 ])
245fi
246])dnl
247dnl
248dnl
249dnl Use the value of enable-strict to update CFLAGS
250dnl
251dnl -std=c89 is used to select the C89 version of the ANSI/ISO C standard.
252dnl As of this writing, many C compilers still accepted only this version,
253dnl not the later C99 version.  When all compilers accept C99, this
254dnl should be changed to the appropriate standard level.  Note that we've
255dnl had trouble with gcc 2.95.3 accepting -std=c89 but then trying to
256dnl compile program with a invalid set of options
257dnl (-D __STRICT_ANSI__-trigraphs)
258dnl
259AC_DEFUN(PAC_CHECK_GCC_STD_C89,[
260AC_MSG_CHECKING([whether $1 accepts -std=c89])
261# We must know the compiler type, assumed used in PAC_GET_GCC_STRICT_FLAGS.
262dnl if test -z "CC" ; then
263dnl    AC_CHECK_PROGS(CC,gcc)
264dnl fi
265# See if we can add -std=c89
266savedCFLAGS="[$]$1"
267$1="[$]$1 -std=c89"
268AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[int a;])],
269      stdc_ok=yes,
270      stdc_ok=no)
271AC_MSG_RESULT($stdc_ok)
272if test "$stdc_ok" != yes ; then
273   $1="$savedCFLAGS"
274fi
275])dnl
276dnl
277dnl Modified from mpich2/confdb/aclocal_cc.m4's PAC_CC_STRICT,
278dnl remove all reference to enable_strict_done.  Also, make it
279dnl more flexible by appending the content of $1 with the
280dnl --enable-strict flags.
281dnl
282dnl PAC_GET_GCC_STRICT_CFLAGS([COPTIONS])
283dnl COPTIONS    - returned variable with --enable-strict flags appended.
284dnl
285dnl Use the value of enable-strict to update input COPTIONS.
286dnl be sure no space is inserted after "(" and before ")", otherwise invalid
287dnl /bin/sh shell statement like 'COPTIONS  ="$COPTIONS ..."' will be resulted.
288dnl
289dnl AC_PROG_CC should be called before this macro function.
290dnl
291AC_DEFUN(PAC_GET_GCC_STRICT_FLAGS,[
292# We must know the compiler type
293if test -z "CC" ; then
294    AC_CHECK_PROGS(CC,gcc)
295fi
296case "$enable_strict" in
297    yes)
298        AC_MSG_CHECKING( [whether $1 accepts strict compiler flags] )
299        if test "$ac_cv_prog_gcc" = "yes" ; then
300            $1="[$]$1 -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL"
301            AC_MSG_RESULT([yes])
302            PAC_CHECK_GCC_STD_C89($1)
303        else
304            AC_MSG_WARN([no, strict support for gcc only!])
305        fi
306        ;;
307    all)
308        AC_MSG_CHECKING( [whether $1 accepts strict compiler flags] )
309        if test "$ac_cv_prog_gcc" = "yes" ; then
310            $1="[$]$1 -Wall -O -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL -Wunused -Wshadow -Wmissing-declarations -Wno-long-long"
311            AC_MSG_RESULT([yes, all possible flags.])
312            PAC_CHECK_GCC_STD_C89($1)
313        else
314            AC_MSG_WARN([no, strict support for gcc only!])
315        fi
316        ;;
317    posix)
318        AC_MSG_CHECKING( [whether $1 accepts strict compiler flags] )
319        if test "$ac_cv_prog_gcc" = "yes" ; then
320            $1="[$]$1 -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL -D_POSIX_C_SOURCE=199506L"
321            AC_MSG_RESULT([yes, POSIX flavored flags.])
322            PAC_CHECK_GCC_STD_C89($1)
323        else
324            AC_MSG_WARN([no, strict support for gcc only!])
325        fi
326        ;;
327    noopt)
328        AC_MSG_CHECKING( [whether $1 accepts strict compiler flags] )
329        if test "$ac_cv_prog_gcc" = "yes" ; then
330            $1="[$]$1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wpointer-arith -Wbad-function-cast -ansi -DGCC_WALL"
331            AC_MSG_RESULT([yes, non-optimized flags.])
332            PAC_CHECK_GCC_STD_C89($1)
333        else
334            AC_MSG_WARN([no, strict support for gcc only!])
335        fi
336        ;;
337    no)
338        # Accept and ignore this value
339        :
340        ;;
341    *)
342        if test -n "$enable_strict" ; then
343            AC_MSG_WARN([Unrecognized value for enable-strict:$enable_strict])
344        fi
345        ;;
346esac
347])dnl
348dnl/*D
349dnl PAC_FUNC_NEEDS_DECL - Set NEEDS_<funcname>_DECL if a declaration is needed
350dnl
351dnl Synopsis:
352dnl PAC_FUNC_NEEDS_DECL(headerfiles,funcname)
353dnl
354dnl Output Effect:
355dnl Sets 'NEEDS_<funcname>_DECL' if 'funcname' is not declared by the
356dnl headerfiles.
357dnl
358dnl Approach:
359dnl Try to compile a program with the function, but passed with an incorrect
360dnl calling sequence.  If the compilation fails, then the declaration
361dnl is provided within the header files.  If the compilation succeeds,
362dnl the declaration is required.
363dnl
364dnl We use a 'double' as the first argument to try and catch varargs
365dnl routines that may use an int or pointer as the first argument.
366dnl
367dnl D*/
368AC_DEFUN(PAC_FUNC_NEEDS_DECL,[
369AC_CACHE_CHECK([whether $2 needs a declaration],
370pac_cv_func_decl_$2,[
371AC_TRY_COMPILE([$1],[int a=$2(1.0,27,1.0,"foo");],
372pac_cv_func_decl_$2=yes,pac_cv_func_decl_$2=no)])
373if test "$pac_cv_func_decl_$2" = "yes" ; then
374changequote(<<,>>)dnl
375define(<<PAC_FUNC_NAME>>, translit(NEEDS_$2_DECL, [a-z *], [A-Z__]))dnl
376changequote([, ])dnl
377    AC_DEFINE_UNQUOTED(PAC_FUNC_NAME,1,[Define if $2 needs a declaration])
378undefine([PAC_FUNC_NAME])
379fi
380])dnl
381dnl/*D
382dnl PAC_PROG_CHECK_INSTALL_WORKS - Check whether the install program in INSTALL
383dnl works.
384dnl
385dnl Synopsis:
386dnl PAC_PROG_CHECK_INSTALL_WORKS
387dnl
388dnl Output Effect:
389dnl   Sets the variable 'INSTALL' to the value of 'ac_sh_install' if
390dnl   a file cannot be installed into a local directory with the 'INSTALL'
391dnl   program
392dnl
393dnl Notes:
394dnl   The 'AC_PROG_INSTALL' scripts tries to avoid broken versions of
395dnl   install by avoiding directories such as '/usr/sbin' where some
396dnl   systems are known to have bad versions of 'install'.  Unfortunately,
397dnl   this is exactly the sort of test-on-name instead of test-on-capability
398dnl   that 'autoconf' is meant to eliminate.  The test in this script
399dnl   is very simple but has been adequate for working around problems
400dnl   on Solaris, where the '/usr/sbin/install' program (known by
401dnl   autoconf to be bad because it is in /usr/sbin) is also reached by a
402dnl   soft link through /bin, which autoconf believes is good.
403dnl
404dnl   No variables are cached to ensure that we do not make a mistake in
405dnl   our choice of install program.
406dnl
407dnl   The Solaris configure requires the directory name to immediately
408dnl   follow the '-c' argument, rather than the more common
409dnl.vb
410dnl      args sourcefiles destination-dir
411dnl.ve
412dnl D*/
413AC_DEFUN([PAC_PROG_CHECK_INSTALL_WORKS],[
414if test -z "$INSTALL" ; then
415    AC_MSG_RESULT([No install program available])
416else
417    # Check that this install really works
418    rm -f conftest
419    echo "Test file" > conftest
420    if test ! -d .conftest ; then mkdir .conftest ; fi
421    AC_MSG_CHECKING([whether install works])
422    if $INSTALL conftest .conftest >/dev/null 2>&1 ; then
423        installOk=yes
424    else
425        installOk=no
426    fi
427    rm -rf .conftest conftest
428    AC_MSG_RESULT($installOk)
429    if test "$installOk" = no ; then
430        if test -n "$ac_install_sh" ; then
431            INSTALL=$ac_install_sh
432        else
433            AC_MSG_ERROR([Unable to find working install])
434        fi
435    fi
436fi
437])
438dnl
439dnl Check for a broken install (fails to preserve file modification times,
440dnl thus breaking libraries.
441dnl
442dnl Create a library, install it, and then try to link against it.
443AC_DEFUN([PAC_PROG_INSTALL_BREAKS_LIBS],[
444AC_CACHE_CHECK([whether install breaks libraries],
445ac_cv_prog_install_breaks_libs,[
446AC_REQUIRE([AC_PROG_RANLIB])
447AC_REQUIRE([AC_PROG_INSTALL])
448AC_REQUIRE([AC_PROG_CC])
449ac_cv_prog_install_breaks_libs=yes
450rm -f libconftest* conftest*
451echo 'int foo(int);int foo(int a){return a;}' > conftest1.c
452echo 'extern int foo(int); int main( int argc, char **argv){ return foo(0); }' > conftest2.c
453if ${CC-cc} $CFLAGS -c conftest1.c >conftest.out 2>&1 ; then
454    if ${AR-ar} cr libconftest.a conftest1.o >/dev/null 2>&1 ; then
455        if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then
456            # Anything less than sleep 10, and Mac OS/X (Darwin)
457            # will claim that install works because ranlib won't complain
458            sleep 10
459            libinstall="$INSTALL"
460            eval "libinstall=\"$libinstall\""
461            if ${libinstall} libconftest.a libconftest1.a  >/dev/null 2>&1 ; then
462                if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest1.a >>conftest.out 2>&1 && test -x conftest ; then
463                    # Success!  Install works
464                    ac_cv_prog_install_breaks_libs=no
465                else
466                    # Failure!  Does install -p work?
467                    rm -f libconftest1.a
468                    if ${libinstall} -p libconftest.a libconftest1.a >/dev/null 2>&1 ; then
469                        if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest1.a >>conftest.out 2>&1 && test -x conftest ; then
470                        # Success!  Install works
471                            ac_cv_prog_install_breaks_libs="no, with -p"
472                        fi
473                    fi
474                fi
475            fi
476        fi
477    fi
478fi
479rm -f conftest* libconftest*])
480
481if test -z "$RANLIB_AFTER_INSTALL" ; then
482    RANLIB_AFTER_INSTALL=no
483fi
484case "$ac_cv_prog_install_breaks_libs" in
485        yes)
486            RANLIB_AFTER_INSTALL=yes
487        ;;
488        "no, with -p")
489            INSTALL="$INSTALL -p"
490        ;;
491        *)
492        # Do nothing
493        :
494        ;;
495esac
496AC_SUBST(RANLIB_AFTER_INSTALL)
497])
498dnl
499dnl
500dnl
501dnl Fixes to bugs in AC_xxx macros
502dnl
503dnl (AC_TRY_COMPILE is missing a newline after the end in the Fortran
504dnl branch; that has been fixed in-place)
505dnl
506dnl (AC_PROG_CC makes many dubious assumptions.  One is that -O is safe
507dnl with -g, even with gcc.  This isn't true; gcc will eliminate dead code
508dnl when -O is used, even if you added code explicitly for debugging
509dnl purposes.  -O shouldn't do dead code elimination when -g is selected,
510dnl unless a specific option is selected.  Unfortunately, there is no
511dnl documented option to turn off dead code elimination.
512dnl
513dnl
514dnl (AC_CHECK_HEADER and AC_CHECK_HEADERS both make the erroneous assumption
515dnl that the C-preprocessor and the C (or C++) compilers are the same program
516dnl and have the same search paths.  In addition, CHECK_HEADER looks for
517dnl error messages to decide that the file is not available; unfortunately,
518dnl it also interprets messages such as "evaluation copy" and warning messages
519dnl from broken CPP programs (such as IBM's xlc -E, which often warns about
520dnl "lm not a valid option").  Instead, we try a compilation step with the
521dnl C compiler.
522dnl
523dnl AC_CONFIG_AUX_DIRS only checks for install-sh, but assumes other
524dnl values are present.  Also doesn't provide a way to override the
525dnl sources of the various configure scripts.  This replacement
526dnl version of AC_CONFIG_AUX_DIRS overcomes this.
527dnl Internal subroutine.
528dnl Search for the configuration auxiliary files in directory list $1.
529dnl We look only for install-sh, so users of AC_PROG_INSTALL
530dnl do not automatically need to distribute the other auxiliary files.
531dnl AC_CONFIG_AUX_DIRS(DIR ...)
532dnl Also note that since AC_CONFIG_AUX_DIR_DEFAULT calls this, there
533dnl isn't a easy way to fix it other than replacing it completely.
534dnl This fix applies to 2.13
535dnl/*D
536dnl AC_CONFIG_AUX_DIRS - Find the directory containing auxillery scripts
537dnl for configure
538dnl
539dnl Synopsis:
540dnl AC_CONFIG_AUX_DIRS( [ directories to search ] )
541dnl
542dnl Output Effect:
543dnl Sets 'ac_config_guess' to location of 'config.guess', 'ac_config_sub'
544dnl to location of 'config.sub', 'ac_install_sh' to the location of
545dnl 'install-sh' or 'install.sh', and 'ac_configure' to the location of a
546dnl Cygnus-style 'configure'.  Only 'install-sh' is guaranteed to exist,
547dnl since the other scripts are needed only by some special macros.
548dnl
549dnl The environment variable 'CONFIG_AUX_DIR', if set, overrides the
550dnl directories listed.  This is an extension to the 'autoconf' version of
551dnl this macro.
552dnl D*/
553undefine([AC_CONFIG_AUX_DIRS])
554AC_DEFUN(AC_CONFIG_AUX_DIRS,
555[if test -f $CONFIG_AUX_DIR/install-sh ; then ac_aux_dir=$CONFIG_AUX_DIR
556else
557ac_aux_dir=
558# We force the test to use the absolute path to ensure that the install
559# program can be used if we cd to a different directory before using
560# install.
561for ac_dir in $1; do
562  if test -f $ac_dir/install-sh; then
563    ac_aux_dir=$ac_dir
564    abs_ac_aux_dir=`(cd $ac_aux_dir && pwd)`
565    ac_install_sh="$abs_ac_aux_dir/install-sh -c"
566    break
567  elif test -f $ac_dir/install.sh; then
568    ac_aux_dir=$ac_dir
569    abs_ac_aux_dir=`(cd $ac_aux_dir && pwd)`
570    ac_install_sh="$abs_ac_aux_dir/install.sh -c"
571    break
572  fi
573done
574fi
575if test -z "$ac_aux_dir"; then
576  AC_MSG_ERROR([can not find install-sh or install.sh in $1])
577fi
578ac_config_guess=$ac_aux_dir/config.guess
579ac_config_sub=$ac_aux_dir/config.sub
580ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
581AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
582])
583