OSDN Git Service

Add Fred Fish's LN/LN_S patch.
[pf3gnuchains/gcc-fork.git] / gcc / aclocal.m4
1 dnl See whether we need a declaration for a function.
2 AC_DEFUN(GCC_NEED_DECLARATION,
3 [AC_MSG_CHECKING([whether $1 must be declared])
4 AC_CACHE_VAL(gcc_cv_decl_needed_$1,
5 [AC_TRY_COMPILE([
6 #include <stdio.h>
7 #ifdef HAVE_STRING_H
8 #include <string.h>
9 #else
10 #ifdef HAVE_STRINGS_H
11 #include <strings.h>
12 #endif
13 #endif
14 #ifdef HAVE_STDLIB_H
15 #include <stdlib.h>
16 #endif
17 #ifdef HAVE_UNISTD_H
18 #include <unistd.h>
19 #endif],
20 [char *(*pfn) = (char *(*)) $1],
21 gcc_cv_decl_needed_$1=no, gcc_cv_decl_needed_$1=yes)])
22 AC_MSG_RESULT($gcc_cv_decl_needed_$1)
23 if test $gcc_cv_decl_needed_$1 = yes; then
24   gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
25   AC_DEFINE_UNQUOTED($gcc_tr_decl)
26 fi
27 ])dnl
28
29 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
30 AC_DEFUN(GCC_PROG_LN_S,
31 [AC_MSG_CHECKING(whether ln -s works)
32 AC_CACHE_VAL(gcc_cv_prog_LN_S,
33 [rm -f conftestdata_to
34 echo >conftestdata_from
35 if ln -s conftestdata_from conftestdata_to 2>/dev/null
36 then
37   gcc_cv_prog_LN_S="ln -s"
38 else
39   if ln conftestdata_from conftestdata_to 2>/dev/null
40   then
41     gcc_cv_prog_LN_S=ln
42   else
43     gcc_cv_prog_LN_S=cp
44   fi
45 fi
46 rm -f conftestdata_from conftestdata_to
47 ])dnl
48 LN_S="$gcc_cv_prog_LN_S"
49 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
50   AC_MSG_RESULT(yes)
51 else
52   if test "$gcc_cv_prog_LN_S" = "ln"; then
53     AC_MSG_RESULT([no, using ln])
54   else
55     AC_MSG_RESULT([no, and neither does ln, so using cp])
56   fi
57 fi
58 AC_SUBST(LN_S)dnl
59 ])
60
61 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
62 AC_DEFUN(GCC_PROG_LN,
63 [AC_MSG_CHECKING(whether ln works)
64 AC_CACHE_VAL(gcc_cv_prog_LN,
65 [rm -f conftestdata_to
66 echo >conftestdata_from
67 if ln conftestdata_from conftestdata_to 2>/dev/null
68 then
69   gcc_cv_prog_LN="ln"
70 else
71   if ln -s conftestdata_from conftestdata_to 2>/dev/null
72   then
73     gcc_cv_prog_LN="ln -s"
74   else
75     gcc_cv_prog_LN=cp
76   fi
77 fi
78 rm -f conftestdata_from conftestdata_to
79 ])dnl
80 LN="$gcc_cv_prog_LN"
81 if test "$gcc_cv_prog_LN" = "ln"; then
82   AC_MSG_RESULT(yes)
83 else
84   if test "$gcc_cv_prog_LN" = "ln -s"; then
85     AC_MSG_RESULT([no, using ln -s])
86   else
87     AC_MSG_RESULT([no, and neither does ln -s, so using cp])
88   fi
89 fi
90 AC_SUBST(LN)dnl
91 ])