summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-07 13:21:36 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-07 13:21:36 +0000
commit0a0a425efe501cb03ef246ca5b7aeafd3bb8a4af (patch)
tree6bdcb43666cef30b2f83a4a5fc6d613690298236
parent8b482459308d062b5bc6a92af9313c67f5321329 (diff)
downloadgcc-0a0a425efe501cb03ef246ca5b7aeafd3bb8a4af.tar.gz
* aclocal.m4 (GCC_FUNC_PRINTF_PTR): New macro to test the printf
functions for whether they support the %p format specifier. * acconfig.h (HOST_PTR_PRINTF): Insert stub for autoconf. * configure.in (GCC_FUNC_PRINTF_PTR): Use it. * configure, config.in: Rebuild. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17760 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/acconfig.h3
-rw-r--r--gcc/aclocal.m421
-rw-r--r--gcc/config.in3
-rwxr-xr-xgcc/configure115
-rw-r--r--gcc/configure.in2
5 files changed, 139 insertions, 5 deletions
diff --git a/gcc/acconfig.h b/gcc/acconfig.h
index 88da1088157..91173766d75 100644
--- a/gcc/acconfig.h
+++ b/gcc/acconfig.h
@@ -1,3 +1,6 @@
+/* Define to "%p" if printf supports it, else machmode.h will define it. */
+#undef HOST_PTR_PRINTF
+
/* Define if your cpp understands the stringify operator. */
#undef HAVE_CPP_STRINGIFY
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 58dcaa62d75..601af11cec0 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -42,6 +42,27 @@ GCC_NEED_DECLARATION($ac_func)
done
])
+dnl See if the printf functions in libc support %p in format strings.
+AC_DEFUN(GCC_FUNC_PRINTF_PTR,
+[AC_CACHE_CHECK(whether the printf functions support %p,
+ gcc_cv_func_printf_ptr,
+[AC_TRY_RUN([#include <stdio.h>
+
+main()
+{
+ char buf[64];
+ char *p = buf, *q = NULL;
+ sprintf(buf, "%p", p);
+ sscanf(buf, "%p", &q);
+ exit (p != q);
+}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
+ gcc_cv_func_printf_ptr=no)
+rm -f core core.* *.core])
+if test $gcc_cv_func_printf_ptr = yes ; then
+ AC_DEFINE(HOST_PTR_PRINTF, "%p")
+fi
+])
+
dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
AC_DEFUN(GCC_PROG_LN_S,
[AC_MSG_CHECKING(whether ln -s works)
diff --git a/gcc/config.in b/gcc/config.in
index e584b7c547f..6ca695d2bc1 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1,4 +1,7 @@
/* config.in. Generated automatically from configure.in by autoheader. */
+/* Define to "%p" if printf supports it, else machmode.h will define it. */
+#undef HOST_PTR_PRINTF
+
/* Define if your cpp understands the stringify operator. */
#undef HAVE_CPP_STRINGIFY
diff --git a/gcc/configure b/gcc/configure
index 99fe206ed3a..31d9ccf810a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1917,16 +1917,121 @@ fi
done
-GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \
- index rindex getenv atol sbrk abort)
+echo $ac_n "checking whether the printf functions support %p""... $ac_c" 1>&6
+echo "configure:1922: checking whether the printf functions support %p" >&5
+if eval "test \"`echo '$''{'gcc_cv_func_printf_ptr'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ gcc_cv_func_printf_ptr=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1930 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+
+main()
+{
+ char buf[64];
+ char *p = buf, *q = NULL;
+ sprintf(buf, "%p", p);
+ sscanf(buf, "%p", &q);
+ exit (p != q);
+}
+EOF
+if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ gcc_cv_func_printf_ptr=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ gcc_cv_func_printf_ptr=no
+fi
+rm -fr conftest*
+fi
+
+rm -f core core.* *.core
+fi
+
+echo "$ac_t""$gcc_cv_func_printf_ptr" 1>&6
+if test $gcc_cv_func_printf_ptr = yes ; then
+ cat >> confdefs.h <<\EOF
+#define HOST_PTR_PRINTF "%p"
+EOF
+
+fi
+
+
+for ac_func in malloc realloc calloc free bcopy bzero bcmp \
+ index rindex getenv atol sbrk abort
+do
+echo $ac_n "checking whether $ac_func must be declared""... $ac_c" 1>&6
+echo "configure:1971: checking whether $ac_func must be declared" >&5
+if eval "test \"`echo '$''{'gcc_cv_decl_needed_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1976 "configure"
+#include "confdefs.h"
+
+#include <stdio.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifndef HAVE_RINDEX
+#define rindex strrchr
+#endif
+#ifndef HAVE_INDEX
+#define index strchr
+#endif
+int main() {
+char *(*pfn) = (char *(*)) $ac_func
+; return 0; }
+EOF
+if { (eval echo configure:2003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ eval "gcc_cv_decl_needed_$ac_func=no"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "gcc_cv_decl_needed_$ac_func=yes"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$gcc_cv_decl_needed_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ gcc_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $gcc_tr_decl 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+
echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:1925: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+echo "configure:2030: checking for sys_siglist declaration in signal.h or unistd.h" >&5
if eval "test \"`echo '$''{'ac_cv_decl_sys_siglist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1930 "configure"
+#line 2035 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1938,7 +2043,7 @@ int main() {
char *msg = *(sys_siglist + 1);
; return 0; }
EOF
-if { (eval echo configure:1942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_decl_sys_siglist=yes
else
diff --git a/gcc/configure.in b/gcc/configure.in
index 6976bf31253..cdaf6415919 100644
--- a/gcc/configure.in
+++ b/gcc/configure.in
@@ -180,6 +180,8 @@ AC_MSG_RESULT($gcc_cv_header_inttypes_h)
AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen vprintf bcopy bzero bcmp \
index rindex kill getrlimit setrlimit atoll atoq)
+GCC_FUNC_PRINTF_PTR
+
GCC_NEED_DECLARATIONS(malloc realloc calloc free bcopy bzero bcmp \
index rindex getenv atol sbrk abort)