This commit was generated by cvs2svn to track changes on a CVS vendor
[platform/upstream/binutils.git] / gprof / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.2e
2
3 dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
4 dnl This Makefile.in 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 # Do all the work for Automake.  This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
16
17 # serial 1
18
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
21
22 AC_DEFUN(AM_INIT_AUTOMAKE,
23 [AC_REQUIRE([AM_PROG_INSTALL])
24 PACKAGE=[$1]
25 AC_SUBST(PACKAGE)
26 VERSION=[$2]
27 AC_SUBST(VERSION)
28 dnl test to see if srcdir already configured
29 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
30   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
31 fi
32 ifelse([$3],,
33 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
34 AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
35 AC_REQUIRE([AM_SANITY_CHECK])
36 AC_REQUIRE([AC_ARG_PROGRAM])
37 dnl FIXME This is truly gross.
38 missing_dir=`cd $ac_aux_dir && pwd`
39 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
40 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
41 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
42 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
43 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
44 AC_REQUIRE([AC_PROG_MAKE_SET])])
45
46
47 # serial 1
48
49 AC_DEFUN(AM_PROG_INSTALL,
50 [AC_REQUIRE([AC_PROG_INSTALL])
51 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
52 AC_SUBST(INSTALL_SCRIPT)dnl
53 ])
54
55 #
56 # Check to make sure that the build environment is sane.
57 #
58
59 AC_DEFUN(AM_SANITY_CHECK,
60 [AC_MSG_CHECKING([whether build environment is sane])
61 # Just in case
62 sleep 1
63 echo timestamp > conftestfile
64 # Do `set' in a subshell so we don't clobber the current shell's
65 # arguments.  Must try -L first in case configure is actually a
66 # symlink; some systems play weird games with the mod time of symlinks
67 # (eg FreeBSD returns the mod time of the symlink's containing
68 # directory).
69 if (
70    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
71    if test "[$]*" = "X"; then
72       # -L didn't work.
73       set X `ls -t $srcdir/configure conftestfile`
74    fi
75    if test "[$]*" != "X $srcdir/configure conftestfile" \
76       && test "[$]*" != "X conftestfile $srcdir/configure"; then
77
78       # If neither matched, then we have a broken ls.  This can happen
79       # if, for instance, CONFIG_SHELL is bash and it inherits a
80       # broken ls alias from the environment.  This has actually
81       # happened.  Such a system could not be considered "sane".
82       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
83 alias in your environment])
84    fi
85
86    test "[$]2" = conftestfile
87    )
88 then
89    # Ok.
90    :
91 else
92    AC_MSG_ERROR([newly created file is older than distributed files!
93 Check your system clock])
94 fi
95 rm -f conftest*
96 AC_MSG_RESULT(yes)])
97
98 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
99 dnl The program must properly implement --version.
100 AC_DEFUN(AM_MISSING_PROG,
101 [AC_MSG_CHECKING(for working $2)
102 # Run test in a subshell; some versions of sh will print an error if
103 # an executable is not found, even if stderr is redirected.
104 # Redirect stdin to placate older versions of autoconf.  Sigh.
105 if ($2 --version) < /dev/null > /dev/null 2>&1; then
106    $1=$2
107    AC_MSG_RESULT(found)
108 else
109    $1="$3/missing $2"
110    AC_MSG_RESULT(missing)
111 fi
112 AC_SUBST($1)])
113
114
115 # serial 24 AM_PROG_LIBTOOL
116 AC_DEFUN(AM_PROG_LIBTOOL,
117 [AC_REQUIRE([AM_ENABLE_SHARED])dnl
118 AC_REQUIRE([AM_ENABLE_STATIC])dnl
119 AC_REQUIRE([AC_CANONICAL_HOST])dnl
120 AC_REQUIRE([AC_PROG_RANLIB])dnl
121 AC_REQUIRE([AC_PROG_CC])dnl
122 AC_REQUIRE([AM_PROG_LD])dnl
123 AC_REQUIRE([AM_PROG_NM])dnl
124 AC_REQUIRE([AC_PROG_LN_S])dnl
125 dnl
126 # Always use our own libtool.
127 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
128 AC_SUBST(LIBTOOL)dnl
129
130 # Check for any special flags to pass to ltconfig.
131 libtool_flags=
132 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
133 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
134 test "$silent" = yes && libtool_flags="$libtool_flags --silent"
135 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
136 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
137
138 # Some flags need to be propagated to the compiler or linker for good
139 # libtool support.
140 case "$host" in
141 *-*-irix6*)
142   # Find out which ABI we are using.
143   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
144   if AC_TRY_EVAL(ac_compile); then
145     case "`/usr/bin/file conftest.o`" in
146     *32-bit*)
147       LD="${LD-ld} -32"
148       ;;
149     *N32*)
150       LD="${LD-ld} -n32"
151       ;;
152     *64-bit*)
153       LD="${LD-ld} -64"
154       ;;
155     esac
156   fi
157   rm -rf conftest*
158   ;;
159
160 *-*-sco3.2v5*)
161   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
162   CFLAGS="$CFLAGS -belf"
163   ;;
164 esac
165
166 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
167 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
168 LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
169 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
170 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
171 || AC_MSG_ERROR([libtool configure failed])
172 ])
173
174 # AM_ENABLE_SHARED - implement the --enable-shared flag
175 # Usage: AM_ENABLE_SHARED[(DEFAULT)]
176 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
177 #   `yes'.
178 AC_DEFUN(AM_ENABLE_SHARED,
179 [define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
180 AC_ARG_ENABLE(shared,
181 changequote(<<, >>)dnl
182 <<  --enable-shared         build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
183 changequote([, ])dnl
184 [  --enable-shared=PKGS    only build shared libraries if the current package
185                           appears as an element in the PKGS list],
186 [p=${PACKAGE-default}
187 case "$enableval" in
188 yes) enable_shared=yes ;;
189 no) enable_shared=no ;;
190 *)
191   enable_shared=no
192   # Look at the argument we got.  We use all the common list separators.
193   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
194   for pkg in $enableval; do
195     if test "X$pkg" = "X$p"; then
196       enable_shared=yes
197     fi
198   done
199   IFS="$ac_save_ifs"
200   ;;
201 esac],
202 enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
203 ])
204
205 # AM_DISABLE_SHARED - set the default shared flag to --disable-shared
206 AC_DEFUN(AM_DISABLE_SHARED,
207 [AM_ENABLE_SHARED(no)])
208
209 # AM_DISABLE_STATIC - set the default static flag to --disable-static
210 AC_DEFUN(AM_DISABLE_STATIC,
211 [AM_ENABLE_STATIC(no)])
212
213 # AM_ENABLE_STATIC - implement the --enable-static flag
214 # Usage: AM_ENABLE_STATIC[(DEFAULT)]
215 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
216 #   `yes'.
217 AC_DEFUN(AM_ENABLE_STATIC,
218 [define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
219 AC_ARG_ENABLE(static,
220 changequote(<<, >>)dnl
221 <<  --enable-static         build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
222 changequote([, ])dnl
223 [  --enable-static=PKGS    only build shared libraries if the current package
224                           appears as an element in the PKGS list],
225 [p=${PACKAGE-default}
226 case "$enableval" in
227 yes) enable_static=yes ;;
228 no) enable_static=no ;;
229 *)
230   enable_static=no
231   # Look at the argument we got.  We use all the common list separators.
232   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
233   for pkg in $enableval; do
234     if test "X$pkg" = "X$p"; then
235       enable_static=yes
236     fi
237   done
238   IFS="$ac_save_ifs"
239   ;;
240 esac],
241 enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
242 ])
243
244
245 # AM_PROG_LD - find the path to the GNU or non-GNU linker
246 AC_DEFUN(AM_PROG_LD,
247 [AC_ARG_WITH(gnu-ld,
248 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
249 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
250 AC_REQUIRE([AC_PROG_CC])
251 ac_prog=ld
252 if test "$ac_cv_prog_gcc" = yes; then
253   # Check if gcc -print-prog-name=ld gives a path.
254   AC_MSG_CHECKING([for ld used by GCC])
255   ac_prog=`($CC -print-prog-name=ld) 2>&5`
256   case "$ac_prog" in
257   # Accept absolute paths.
258 changequote(,)dnl
259   /* | [A-Za-z]:\\*)
260 changequote([,])dnl
261     test -z "$LD" && LD="$ac_prog"
262     ;;
263   "")
264     # If it fails, then pretend we aren't using GCC.
265     ac_prog=ld
266     ;;
267   *)
268     # If it is relative, then search for the first ld in PATH.
269     with_gnu_ld=unknown
270     ;;
271   esac
272 elif test "$with_gnu_ld" = yes; then
273   AC_MSG_CHECKING([for GNU ld])
274 else
275   AC_MSG_CHECKING([for non-GNU ld])
276 fi
277 AC_CACHE_VAL(ac_cv_path_LD,
278 [if test -z "$LD"; then
279   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
280   for ac_dir in $PATH; do
281     test -z "$ac_dir" && ac_dir=.
282     if test -f "$ac_dir/$ac_prog"; then
283       ac_cv_path_LD="$ac_dir/$ac_prog"
284       # Check to see if the program is GNU ld.  I'd rather use --version,
285       # but apparently some GNU ld's only accept -v.
286       # Break only if it was the GNU/non-GNU ld that we prefer.
287       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
288         test "$with_gnu_ld" != no && break
289       else
290         test "$with_gnu_ld" != yes && break
291       fi
292     fi
293   done
294   IFS="$ac_save_ifs"
295 else
296   ac_cv_path_LD="$LD" # Let the user override the test with a path.
297 fi])
298 LD="$ac_cv_path_LD"
299 if test -n "$LD"; then
300   AC_MSG_RESULT($LD)
301 else
302   AC_MSG_RESULT(no)
303 fi
304 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
305 AC_SUBST(LD)
306 AM_PROG_LD_GNU
307 ])
308
309 AC_DEFUN(AM_PROG_LD_GNU,
310 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
311 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
312 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
313   ac_cv_prog_gnu_ld=yes
314 else
315   ac_cv_prog_gnu_ld=no
316 fi])
317 ])
318
319 # AM_PROG_NM - find the path to a BSD-compatible name lister
320 AC_DEFUN(AM_PROG_NM,
321 [AC_MSG_CHECKING([for BSD-compatible nm])
322 AC_CACHE_VAL(ac_cv_path_NM,
323 [case "$NM" in
324 changequote(,)dnl
325 /* | [A-Za-z]:\\*)
326 changequote([,])dnl
327   ac_cv_path_NM="$NM" # Let the user override the test with a path.
328   ;;
329 *)
330   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
331   for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
332     test -z "$ac_dir" && ac_dir=.
333     if test -f $ac_dir/nm; then
334       # Check to see if the nm accepts a BSD-compat flag.
335       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
336       #   nm: unknown option "B" ignored
337       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
338         ac_cv_path_NM="$ac_dir/nm -B"
339       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
340         ac_cv_path_NM="$ac_dir/nm -p"
341       else
342         ac_cv_path_NM="$ac_dir/nm"
343       fi
344       break
345     fi
346   done
347   IFS="$ac_save_ifs"
348   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
349   ;;
350 esac])
351 NM="$ac_cv_path_NM"
352 AC_MSG_RESULT([$NM])
353 AC_SUBST(NM)
354 ])
355
356 # Like AC_CONFIG_HEADER, but automatically create stamp file.
357
358 AC_DEFUN(AM_CONFIG_HEADER,
359 [AC_PREREQ([2.12])
360 AC_CONFIG_HEADER([$1])
361 dnl When config.status generates a header, we must update the stamp-h file.
362 dnl This file resides in the same directory as the config header
363 dnl that is generated.  We must strip everything past the first ":",
364 dnl and everything past the last "/".
365 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
366 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
367 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
368 <<am_indx=1
369 for am_file in <<$1>>; do
370   case " <<$>>CONFIG_HEADERS " in
371   *" <<$>>am_file "*<<)>>
372     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
373     ;;
374   esac
375   am_indx=`expr "<<$>>am_indx" + 1`
376 done<<>>dnl>>)
377 changequote([,]))])
378
379 # Add --enable-maintainer-mode option to configure.
380 # From Jim Meyering
381
382 # serial 1
383
384 AC_DEFUN(AM_MAINTAINER_MODE,
385 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
386   dnl maintainer-mode is disabled by default
387   AC_ARG_ENABLE(maintainer-mode,
388 [  --enable-maintainer-mode enable make rules and dependencies not useful
389                           (and sometimes confusing) to the casual installer],
390       USE_MAINTAINER_MODE=$enableval,
391       USE_MAINTAINER_MODE=no)
392   AC_MSG_RESULT($USE_MAINTAINER_MODE)
393   if test $USE_MAINTAINER_MODE = yes; then
394     MAINT=
395   else
396     MAINT='#M#'
397   fi
398   AC_SUBST(MAINT)dnl
399 ]
400 )
401
402 # Check to see if we're running under Cygwin32, without using
403 # AC_CANONICAL_*.  If so, set output variable CYGWIN32 to "yes".
404 # Otherwise set it to "no".
405
406 dnl AM_CYGWIN32()
407 AC_DEFUN(AM_CYGWIN32,
408 [AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
409 [AC_TRY_COMPILE(,[return __CYGWIN32__;],
410 am_cv_cygwin32=yes, am_cv_cygwin32=no)
411 rm -f conftest*])
412 CYGWIN32=
413 test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
414
415 # Check to see if we're running under Win32, without using
416 # AC_CANONICAL_*.  If so, set output variable EXEEXT to ".exe".
417 # Otherwise set it to "".
418
419 dnl AM_EXEEXT()
420 dnl This knows we add .exe if we're building in the Cygwin32
421 dnl environment. But if we're not, then it compiles a test program
422 dnl to see if there is a suffix for executables.
423 AC_DEFUN(AM_EXEEXT,
424 [AC_REQUIRE([AM_CYGWIN32])
425 AC_REQUIRE([AM_MINGW32])
426 AC_MSG_CHECKING([for executable suffix])
427 AC_CACHE_VAL(am_cv_exeext,
428 [if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
429 am_cv_exeext=.exe
430 else
431 cat > am_c_test.c << 'EOF'
432 int main() {
433 /* Nothing needed here */
434 }
435 EOF
436 ${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
437 am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//`
438 rm -f am_c_test*])
439 test x"${am_cv_exeext}" = x && am_cv_exeext=no
440 fi
441 EXEEXT=""
442 test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
443 AC_MSG_RESULT(${am_cv_exeext})
444 AC_SUBST(EXEEXT)])
445
446 # Check to see if we're running under Mingw, without using
447 # AC_CANONICAL_*.  If so, set output variable MINGW32 to "yes".
448 # Otherwise set it to "no".
449
450 dnl AM_MINGW32()
451 AC_DEFUN(AM_MINGW32,
452 [AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
453 [AC_TRY_COMPILE(,[return __MINGW32__;],
454 am_cv_mingw32=yes, am_cv_mingw32=no)
455 rm -f conftest*])
456 MINGW32=
457 test "$am_cv_mingw32" = yes && MINGW32=yes])
458