OSDN Git Service

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