]> gcc.gnu.org Git - gcc.git/blob - gcc/aclocal.m4
aclocal.m4 (GCC_FUNC_PRINTF_PTR): New macro to test the printf functions for whether...
[gcc.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 the printf functions in libc support %p in format strings.
46 AC_DEFUN(GCC_FUNC_PRINTF_PTR,
47 [AC_CACHE_CHECK(whether the printf functions support %p,
48 gcc_cv_func_printf_ptr,
49 [AC_TRY_RUN([#include <stdio.h>
50
51 main()
52 {
53 char buf[64];
54 char *p = buf, *q = NULL;
55 sprintf(buf, "%p", p);
56 sscanf(buf, "%p", &q);
57 exit (p != q);
58 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
59 gcc_cv_func_printf_ptr=no)
60 rm -f core core.* *.core])
61 if test $gcc_cv_func_printf_ptr = yes ; then
62 AC_DEFINE(HOST_PTR_PRINTF, "%p")
63 fi
64 ])
65
66 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
67 AC_DEFUN(GCC_PROG_LN_S,
68 [AC_MSG_CHECKING(whether ln -s works)
69 AC_CACHE_VAL(gcc_cv_prog_LN_S,
70 [rm -f conftestdata_t
71 echo >conftestdata_f
72 if ln -s conftestdata_f conftestdata_t 2>/dev/null
73 then
74 gcc_cv_prog_LN_S="ln -s"
75 else
76 if ln conftestdata_f conftestdata_t 2>/dev/null
77 then
78 gcc_cv_prog_LN_S=ln
79 else
80 gcc_cv_prog_LN_S=cp
81 fi
82 fi
83 rm -f conftestdata_f conftestdata_t
84 ])dnl
85 LN_S="$gcc_cv_prog_LN_S"
86 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
87 AC_MSG_RESULT(yes)
88 else
89 if test "$gcc_cv_prog_LN_S" = "ln"; then
90 AC_MSG_RESULT([no, using ln])
91 else
92 AC_MSG_RESULT([no, and neither does ln, so using cp])
93 fi
94 fi
95 AC_SUBST(LN_S)dnl
96 ])
97
98 dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
99 AC_DEFUN(GCC_PROG_LN,
100 [AC_MSG_CHECKING(whether ln works)
101 AC_CACHE_VAL(gcc_cv_prog_LN,
102 [rm -f conftestdata_t
103 echo >conftestdata_f
104 if ln conftestdata_f conftestdata_t 2>/dev/null
105 then
106 gcc_cv_prog_LN="ln"
107 else
108 if ln -s conftestdata_f conftestdata_t 2>/dev/null
109 then
110 gcc_cv_prog_LN="ln -s"
111 else
112 gcc_cv_prog_LN=cp
113 fi
114 fi
115 rm -f conftestdata_f conftestdata_t
116 ])dnl
117 LN="$gcc_cv_prog_LN"
118 if test "$gcc_cv_prog_LN" = "ln"; then
119 AC_MSG_RESULT(yes)
120 else
121 if test "$gcc_cv_prog_LN" = "ln -s"; then
122 AC_MSG_RESULT([no, using ln -s])
123 else
124 AC_MSG_RESULT([no, and neither does ln -s, so using cp])
125 fi
126 fi
127 AC_SUBST(LN)dnl
128 ])
129
130 AC_DEFUN(EGCS_PROG_INSTALL,
131 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
132 # Find a good install program. We prefer a C program (faster),
133 # so one script is as good as another. But avoid the broken or
134 # incompatible versions:
135 # SysV /etc/install, /usr/sbin/install
136 # SunOS /usr/etc/install
137 # IRIX /sbin/install
138 # AIX /bin/install
139 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
140 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
141 # ./install, which can be erroneously created by make from ./install.sh.
142 AC_MSG_CHECKING(for a BSD compatible install)
143 if test -z "$INSTALL"; then
144 AC_CACHE_VAL(ac_cv_path_install,
145 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
146 for ac_dir in $PATH; do
147 # Account for people who put trailing slashes in PATH elements.
148 case "$ac_dir/" in
149 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
150 *)
151 # OSF1 and SCO ODT 3.0 have their own names for install.
152 for ac_prog in ginstall scoinst install; do
153 if test -f $ac_dir/$ac_prog; then
154 if test $ac_prog = install &&
155 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
156 # AIX install. It has an incompatible calling convention.
157 # OSF/1 installbsd also uses dspmsg, but is usable.
158 :
159 else
160 ac_cv_path_install="$ac_dir/$ac_prog -c"
161 break 2
162 fi
163 fi
164 done
165 ;;
166 esac
167 done
168 IFS="$ac_save_IFS"
169 ])dnl
170 if test "${ac_cv_path_install+set}" = set; then
171 INSTALL="$ac_cv_path_install"
172 else
173 # As a last resort, use the slow shell script. We don't cache a
174 # path for INSTALL within a source directory, because that will
175 # break other packages using the cache if that directory is
176 # removed, or if the path is relative.
177 INSTALL="$ac_install_sh"
178 fi
179 fi
180 dnl We do special magic for INSTALL instead of AC_SUBST, to get
181 dnl relative paths right.
182 AC_MSG_RESULT($INSTALL)
183 AC_SUBST(INSTALL)dnl
184
185 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
186 # It thinks the first close brace ends the variable substitution.
187 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
188 AC_SUBST(INSTALL_PROGRAM)dnl
189
190 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
191 AC_SUBST(INSTALL_DATA)dnl
192 ])
This page took 0.052635 seconds and 6 git commands to generate.