OSDN Git Service

* aclocal.m4 (GCC_NEED_DECLARATION): Modify macro to accept a
[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 #ifndef HAVE_RINDEX
21 #define rindex strrchr
22 #endif
23 #ifndef HAVE_INDEX
24 #define index strchr
25 #endif],
26 [char *(*pfn) = (char *(*)) $1],
27 eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
28 if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
29   AC_MSG_RESULT(yes)
30   gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
31   AC_DEFINE_UNQUOTED($gcc_tr_decl)
32 else
33   AC_MSG_RESULT(no)
34 fi
35 ])dnl
36
37 dnl Check multiple functions to see whether each needs a declaration.
38 AC_DEFUN(GCC_NEED_DECLARATIONS,
39 [for ac_func in $1
40 do
41 GCC_NEED_DECLARATION($ac_func)
42 done
43 ])
44
45 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
46 AC_DEFUN(GCC_PROG_LN_S,
47 [AC_MSG_CHECKING(whether ln -s works)
48 AC_CACHE_VAL(gcc_cv_prog_LN_S,
49 [rm -f conftestdata_t
50 echo >conftestdata_f
51 if ln -s conftestdata_f conftestdata_t 2>/dev/null
52 then
53   gcc_cv_prog_LN_S="ln -s"
54 else
55   if ln conftestdata_f conftestdata_t 2>/dev/null
56   then
57     gcc_cv_prog_LN_S=ln
58   else
59     gcc_cv_prog_LN_S=cp
60   fi
61 fi
62 rm -f conftestdata_f conftestdata_t
63 ])dnl
64 LN_S="$gcc_cv_prog_LN_S"
65 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
66   AC_MSG_RESULT(yes)
67 else
68   if test "$gcc_cv_prog_LN_S" = "ln"; then
69     AC_MSG_RESULT([no, using ln])
70   else
71     AC_MSG_RESULT([no, and neither does ln, so using cp])
72   fi
73 fi
74 AC_SUBST(LN_S)dnl
75 ])
76
77 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
78 AC_DEFUN(GCC_PROG_LN,
79 [AC_MSG_CHECKING(whether ln works)
80 AC_CACHE_VAL(gcc_cv_prog_LN,
81 [rm -f conftestdata_t
82 echo >conftestdata_f
83 if ln conftestdata_f conftestdata_t 2>/dev/null
84 then
85   gcc_cv_prog_LN="ln"
86 else
87   if ln -s conftestdata_f conftestdata_t 2>/dev/null
88   then
89     gcc_cv_prog_LN="ln -s"
90   else
91     gcc_cv_prog_LN=cp
92   fi
93 fi
94 rm -f conftestdata_f conftestdata_t
95 ])dnl
96 LN="$gcc_cv_prog_LN"
97 if test "$gcc_cv_prog_LN" = "ln"; then
98   AC_MSG_RESULT(yes)
99 else
100   if test "$gcc_cv_prog_LN" = "ln -s"; then
101     AC_MSG_RESULT([no, using ln -s])
102   else
103     AC_MSG_RESULT([no, and neither does ln -s, so using cp])
104   fi
105 fi
106 AC_SUBST(LN)dnl
107 ])
108
109 AC_DEFUN(EGCS_PROG_INSTALL,
110 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
111 # Find a good install program.  We prefer a C program (faster),
112 # so one script is as good as another.  But avoid the broken or
113 # incompatible versions:
114 # SysV /etc/install, /usr/sbin/install
115 # SunOS /usr/etc/install
116 # IRIX /sbin/install
117 # AIX /bin/install
118 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
119 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
120 # ./install, which can be erroneously created by make from ./install.sh.
121 AC_MSG_CHECKING(for a BSD compatible install)
122 if test -z "$INSTALL"; then
123 AC_CACHE_VAL(ac_cv_path_install,
124 [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
125   for ac_dir in $PATH; do
126     # Account for people who put trailing slashes in PATH elements.
127     case "$ac_dir/" in
128     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
129     *)
130       # OSF1 and SCO ODT 3.0 have their own names for install.
131       for ac_prog in ginstall scoinst install; do
132         if test -f $ac_dir/$ac_prog; then
133           if test $ac_prog = install &&
134             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
135             # AIX install.  It has an incompatible calling convention.
136             # OSF/1 installbsd also uses dspmsg, but is usable.
137             :
138           else
139             ac_cv_path_install="$ac_dir/$ac_prog -c"
140             break 2
141           fi
142         fi
143       done
144       ;;
145     esac
146   done
147   IFS="$ac_save_IFS"
148 ])dnl
149   if test "${ac_cv_path_install+set}" = set; then
150     INSTALL="$ac_cv_path_install"
151   else
152     # As a last resort, use the slow shell script.  We don't cache a
153     # path for INSTALL within a source directory, because that will
154     # break other packages using the cache if that directory is
155     # removed, or if the path is relative.
156     INSTALL="$ac_install_sh"
157   fi
158 fi
159 dnl We do special magic for INSTALL instead of AC_SUBST, to get
160 dnl relative paths right.
161 AC_MSG_RESULT($INSTALL)
162 AC_SUBST(INSTALL)dnl
163
164 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
165 # It thinks the first close brace ends the variable substitution.
166 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
167 AC_SUBST(INSTALL_PROGRAM)dnl
168
169 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
170 AC_SUBST(INSTALL_DATA)dnl
171 ])