re PR libfortran/16135 (libfortran doesn't build, use of C99 types)
PR target/16135 * acinclude.m4 (LIBGFOR_TARGET_ILP32): New check. * configure.ac: Include LIBGFOR_TARGET_ILP32. * configure: Regenerate. * config.h.in: Likewise. * libgfortran.h: Provide default definitions for C99 types on ILP32 targets that don't have them. PR target/17999 * configure.ac: Check for snprintf. * configure: Regenerate. * config.h.in: Likewise. * intrinsics/date_and_time.c (date_and_time): Do not use snprinf if it is not available. * io/write.c (output_float): Likewise. From-SVN: r90964
This commit is contained in:
parent
e7a531ae61
commit
3969c39f61
8 changed files with 160 additions and 2 deletions
|
@ -1,3 +1,21 @@
|
|||
2004-11-20 Eric Botcazou <ebotcazou@libertysurf.fr>
|
||||
|
||||
PR target/16135
|
||||
* acinclude.m4 (LIBGFOR_TARGET_ILP32): New check.
|
||||
* configure.ac: Include LIBGFOR_TARGET_ILP32.
|
||||
* configure: Regenerate.
|
||||
* config.h.in: Likewise.
|
||||
* libgfortran.h: Provide default definitions for C99 types
|
||||
on ILP32 targets that don't have them.
|
||||
|
||||
PR target/17999
|
||||
* configure.ac: Check for snprintf.
|
||||
* configure: Regenerate.
|
||||
* config.h.in: Likewise.
|
||||
* intrinsics/date_and_time.c (date_and_time): Do not
|
||||
use snprinf if it is not available.
|
||||
* io/write.c (output_float): Likewise.
|
||||
|
||||
2004-11-20 Steven G. Kargl <kargls@comcast.net>
|
||||
|
||||
* Makefile.am: Add intrinsics/{umask.c,unlink.c,exit.c}
|
||||
|
|
|
@ -83,3 +83,22 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN])
|
|||
AC_DEFUN([AC_PROG_LD])
|
||||
])
|
||||
|
||||
dnl Check whether the target is ILP32.
|
||||
AC_DEFUN([LIBGFOR_TARGET_ILP32], [
|
||||
AC_CACHE_CHECK([whether the target is ILP32], target_ilp32, [
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-O2"
|
||||
AC_TRY_LINK(,[
|
||||
if (sizeof(int) == 4 && sizeof(long) == 4 && sizeof(void *) == 4)
|
||||
;
|
||||
else
|
||||
undefined_function ();
|
||||
],
|
||||
target_ilp32=yes,
|
||||
target_ilp32=no)
|
||||
CFLAGS="$save_CFLAGS"])
|
||||
if test $target_ilp32 = yes; then
|
||||
AC_DEFINE(TARGET_ILP32, 1,
|
||||
[Define to 1 if the target is ILP32.])
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -135,6 +135,9 @@
|
|||
/* libm includes sinhf */
|
||||
#undef HAVE_SINHF
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* libm includes sqrtf */
|
||||
#undef HAVE_SQRTF
|
||||
|
||||
|
@ -234,6 +237,9 @@
|
|||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if the target is ILP32. */
|
||||
#undef TARGET_ILP32
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
|
|
83
libgfortran/configure
vendored
83
libgfortran/configure
vendored
|
@ -6822,7 +6822,8 @@ fi
|
|||
|
||||
|
||||
|
||||
for ac_func in getrusage times mkstemp strtof
|
||||
|
||||
for ac_func in getrusage times mkstemp strtof snprintf
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
|
@ -10716,6 +10717,86 @@ _ACEOF
|
|||
fi
|
||||
fi
|
||||
|
||||
# Attempt to assert that the target is of common type in case we don't
|
||||
# have C99 integer types at all.
|
||||
|
||||
echo "$as_me:$LINENO: checking whether the target is ILP32" >&5
|
||||
echo $ECHO_N "checking whether the target is ILP32... $ECHO_C" >&6
|
||||
if test "${target_ilp32+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="-O2"
|
||||
if test x$gcc_no_link = xyes; then
|
||||
{ { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
|
||||
echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
if (sizeof(int) == 4 && sizeof(long) == 4 && sizeof(void *) == 4)
|
||||
;
|
||||
else
|
||||
undefined_function ();
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
target_ilp32=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
target_ilp32=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
CFLAGS="$save_CFLAGS"
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $target_ilp32" >&5
|
||||
echo "${ECHO_T}$target_ilp32" >&6
|
||||
if test $target_ilp32 = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define TARGET_ILP32 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
# tests run on this system so they can be shared between configure
|
||||
|
|
|
@ -159,7 +159,7 @@ AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists]
|
|||
AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
|
||||
|
||||
# Check for library functions.
|
||||
AC_CHECK_FUNCS(getrusage times mkstemp strtof)
|
||||
AC_CHECK_FUNCS(getrusage times mkstemp strtof snprintf)
|
||||
|
||||
# Check libc for getgid, getpid, getuid
|
||||
AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
|
||||
|
@ -226,6 +226,10 @@ AC_SUBST([MATH_OBJ],["$extra_math_obj"])
|
|||
# to call gettimeofday if we have it.
|
||||
LIBGFOR_GETTIMEOFDAY
|
||||
|
||||
# Attempt to assert that the target is of common type in case we don't
|
||||
# have C99 integer types at all.
|
||||
LIBGFOR_TARGET_ILP32
|
||||
|
||||
AC_CACHE_SAVE
|
||||
|
||||
if test ${multilib} = yes; then
|
||||
|
|
|
@ -182,20 +182,35 @@ date_and_time (char *__date,
|
|||
|
||||
if (__date)
|
||||
{
|
||||
#if HAVE_SNPRINTF
|
||||
snprintf (date, DATE_LEN + 1, "%04d%02d%02d",
|
||||
values[0], values[1], values[2]);
|
||||
#else
|
||||
sprintf (date, "%04d%02d%02d",
|
||||
values[0], values[1], values[2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (__time)
|
||||
{
|
||||
#if HAVE_SNPRINTF
|
||||
snprintf (timec, TIME_LEN + 1, "%02d%02d%02d.%03d",
|
||||
values[4], values[5], values[6], values[7]);
|
||||
#else
|
||||
sprintf (timec, "%02d%02d%02d.%03d",
|
||||
values[4], values[5], values[6], values[7]);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (__zone)
|
||||
{
|
||||
#if HAVE_SNPRINTF
|
||||
snprintf (zone, ZONE_LEN + 1, "%+03d%02d",
|
||||
values[3] / 60, abs (values[3] % 60));
|
||||
#else
|
||||
sprintf (zone, "%+03d%02d",
|
||||
values[3] / 60, abs (values[3] % 60));
|
||||
#endif
|
||||
}
|
||||
#else /* if defined HAVE_NO_DATE_TIME */
|
||||
/* We really have *nothing* to return, so return blanks and HUGE(0). */
|
||||
|
|
|
@ -615,7 +615,11 @@ output_float (fnode *f, double value, int len)
|
|||
*(out++) = expchar;
|
||||
edigits--;
|
||||
}
|
||||
#if HAVE_SNPRINTF
|
||||
snprintf (buffer, 32, "%+0*d", edigits, e);
|
||||
#else
|
||||
sprintf (buffer, "%+0*d", edigits, e);
|
||||
#endif
|
||||
memcpy (out, buffer, edigits);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,17 @@ Boston, MA 02111-1307, USA. */
|
|||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && defined(TARGET_ILP32)
|
||||
typedef char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
typedef long long int64_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue