OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libgfortran/] [acinclude.m4] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
m4_include(../config/acx.m4)
2
m4_include(../config/no-executables.m4)
3
 
4
dnl Check:
5
dnl * If we have gettimeofday;
6
dnl * If we have struct timezone for use in calling it;
7
dnl * If calling it with a timezone pointer actually works -- this is deemed
8
dnl   obsolete or undefined on some systems which say you should use a null
9
dnl   pointer -- and undefine HAVE_TIMEZONE if so;
10
dnl * Whether it only takes one arg.
11
AC_DEFUN([LIBGFOR_GETTIMEOFDAY], [
12
  AC_CHECK_FUNCS(gettimeofday)
13
  if test "$ac_cv_func_gettimeofday" = yes; then
14
    AC_CACHE_CHECK([for struct timezone], gfor_cv_struct_timezone,
15
      [AC_TRY_COMPILE([#include <sys/time.h>],
16
      [struct timezone tz;],
17
      gfor_cv_struct_timezone=yes, gfor_cv_struct_timezone=no)])
18
    if test $gfor_cv_struct_timezone = yes; then
19
      dnl It may be that we can't call gettimeofday with a non-null pointer.
20
      dnl In that case we'll lie about struct timezone.
21
      AC_TRY_RUN([
22
#ifdef TIME_WITH_SYS_TIME
23
#include <sys/time.h>
24
#include <time.h>
25
#else
26
#ifdef HAVE_SYS_TIME_H
27
#include <sys/time.h>
28
#else
29
#include <time.h>
30
#endif
31
#endif
32
main ()
33
{
34
  struct timeval time;
35
  struct timezone dummy;
36
  if (gettimeofday (&time, &dummy))
37
    exit (1);
38
  else
39
    exit (0);
40
}],
41
        [gfor_have_struct_timezone=yes], [gfor_have_struct_timezone=no],
42
        [gfor_have_struct_timezone=yes])
43
      if test $gfor_have_struct_timezone = yes; then
44
        AC_DEFINE(HAVE_TIMEZONE, 1, [Do we have struct timezone])
45
      fi
46
    fi
47
    AC_REQUIRE([AC_HEADER_TIME])
48
    AC_CACHE_CHECK([whether gettimeofday can accept two arguments],
49
      emacs_cv_gettimeofday_two_arguments,
50
      [AC_TRY_LINK([
51
#ifdef TIME_WITH_SYS_TIME
52
#include <sys/time.h>
53
#include <time.h>
54
#else
55
#ifdef HAVE_SYS_TIME_H
56
#include <sys/time.h>
57
#else
58
#include <time.h>
59
#endif
60
#endif
61
      ],
62
      [
63
      struct timeval time;
64
#ifdef HAVE_TIMEZONE
65
      struct timezone dummy;
66
#define DUMMY &dummy
67
#else
68
#define DUMMY NULL
69
#endif
70
      gettimeofday (&time, DUMMY);],
71
      emacs_cv_gettimeofday_two_arguments=yes,
72
      emacs_cv_gettimeofday_two_arguments=no)])
73
    if test $emacs_cv_gettimeofday_two_arguments = no; then
74
      AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
75
        [Does gettimeofday take a single argument])
76
    fi
77
  fi])
78
 
79
sinclude(../libtool.m4)
80
dnl The lines below arrange for aclocal not to bring an installed
81
dnl libtool.m4 into aclocal.m4, while still arranging for automake to
82
dnl add a definition of LIBTOOL to Makefile.in.
83
ifelse(,,,[AC_SUBST(LIBTOOL)
84
AC_DEFUN([AM_PROG_LIBTOOL])
85
AC_DEFUN([AC_LIBTOOL_DLOPEN])
86
AC_DEFUN([AC_PROG_LD])
87
])
88
 
89
dnl Check whether the target is ILP32.
90
AC_DEFUN([LIBGFOR_TARGET_ILP32], [
91
  AC_CACHE_CHECK([whether the target is ILP32], target_ilp32, [
92
  save_CFLAGS="$CFLAGS"
93
  CFLAGS="-O2"
94
  AC_TRY_LINK(,[
95
if (sizeof(int) == 4 && sizeof(long) == 4 && sizeof(void *) == 4)
96
  ;
97
else
98
  undefined_function ();
99
               ],
100
               target_ilp32=yes,
101
               target_ilp32=no)
102
  CFLAGS="$save_CFLAGS"])
103
  if test $target_ilp32 = yes; then
104
    AC_DEFINE(TARGET_ILP32, 1,
105
      [Define to 1 if the target is ILP32.])
106
  fi
107
  ])
108
 
109
dnl Check whether the target supports hidden visibility.
110
AC_DEFUN([LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY], [
111
  AC_CACHE_CHECK([whether the target supports hidden visibility],
112
                 have_attribute_visibility, [
113
  save_CFLAGS="$CFLAGS"
114
  CFLAGS="$CFLAGS -Werror"
115
  AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
116
                 [], have_attribute_visibility=yes,
117
                 have_attribute_visibility=no)
118
  CFLAGS="$save_CFLAGS"])
119
  if test $have_attribute_visibility = yes; then
120
    AC_DEFINE(HAVE_ATTRIBUTE_VISIBILITY, 1,
121
      [Define to 1 if the target supports __attribute__((visibility(...))).])
122
  fi])
123
 
124
dnl Check whether the target supports dllexport
125
AC_DEFUN([LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT], [
126
  AC_CACHE_CHECK([whether the target supports dllexport],
127
                 have_attribute_dllexport, [
128
  save_CFLAGS="$CFLAGS"
129
  CFLAGS="$CFLAGS -Werror"
130
  AC_TRY_COMPILE([void __attribute__((dllexport)) foo(void) { }],
131
                 [], have_attribute_dllexport=yes,
132
                 have_attribute_dllexport=no)
133
  CFLAGS="$save_CFLAGS"])
134
  if test $have_attribute_dllexport = yes; then
135
    AC_DEFINE(HAVE_ATTRIBUTE_DLLEXPORT, 1,
136
      [Define to 1 if the target supports __attribute__((dllexport)).])
137
  fi])
138
 
139
dnl Check whether the target supports symbol aliases.
140
AC_DEFUN([LIBGFOR_CHECK_ATTRIBUTE_ALIAS], [
141
  AC_CACHE_CHECK([whether the target supports symbol aliases],
142
                 have_attribute_alias, [
143
  AC_TRY_LINK([
144
#define ULP     STR1(__USER_LABEL_PREFIX__)
145
#define STR1(x) STR2(x)
146
#define STR2(x) #x
147
void foo(void) { }
148
extern void bar(void) __attribute__((alias(ULP "foo")));],
149
    [bar();], have_attribute_alias=yes, have_attribute_alias=no)])
150
  if test $have_attribute_alias = yes; then
151
    AC_DEFINE(HAVE_ATTRIBUTE_ALIAS, 1,
152
      [Define to 1 if the target supports __attribute__((alias(...))).])
153
  fi])
154
 
155
dnl Check whether the target supports __sync_fetch_and_add.
156
AC_DEFUN([LIBGFOR_CHECK_SYNC_FETCH_AND_ADD], [
157
  AC_CACHE_CHECK([whether the target supports __sync_fetch_and_add],
158
                 have_sync_fetch_and_add, [
159
  AC_TRY_LINK([int foovar = 0;], [
160
if (foovar <= 0) return __sync_fetch_and_add (&foovar, 1);
161
if (foovar > 10) return __sync_add_and_fetch (&foovar, -1);],
162
              have_sync_fetch_and_add=yes, have_sync_fetch_and_add=no)])
163
  if test $have_sync_fetch_and_add = yes; then
164
    AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD, 1,
165
              [Define to 1 if the target supports __sync_fetch_and_add])
166
  fi])
167
 
168
dnl Check if threads are supported.
169
AC_DEFUN([LIBGFOR_CHECK_GTHR_DEFAULT], [
170
  AC_CACHE_CHECK([configured target thread model],
171
                 target_thread_file, [
172
target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`])
173
 
174
  if test $target_thread_file != single; then
175
    AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
176
              [Define if the compiler has a thread header that is non single.])
177
  fi])
178
 
179
dnl Check for pragma weak.
180
AC_DEFUN([LIBGFOR_GTHREAD_WEAK], [
181
  AC_CACHE_CHECK([whether pragma weak works],
182
                 have_pragma_weak, [
183
  gfor_save_CFLAGS="$CFLAGS"
184
  CFLAGS="$CFLAGS -Wunknown-pragmas"
185
  AC_TRY_COMPILE([void foo (void);
186
#pragma weak foo], [if (foo) foo ();],
187
                 have_pragma_weak=yes, have_pragma_weak=no)])
188
  if test $have_pragma_weak = yes; then
189
    AC_DEFINE(SUPPORTS_WEAK, 1,
190
              [Define to 1 if the target supports #pragma weak])
191
  fi
192
  case "$host" in
193
    *-*-darwin* | *-*-hpux* | *-*-cygwin*)
194
      AC_DEFINE(GTHREAD_USE_WEAK, 0,
195
                [Define to 0 if the target shouldn't use #pragma weak])
196
      ;;
197
  esac])
198
 
199
dnl Check whether target can unlink a file still open.
200
AC_DEFUN([LIBGFOR_CHECK_UNLINK_OPEN_FILE], [
201
  AC_CACHE_CHECK([whether the target can unlink an open file],
202
                  have_unlink_open_file, [
203
  AC_TRY_RUN([
204
#include <errno.h>
205
#include <fcntl.h>
206
#include <unistd.h>
207
#include <sys/stat.h>
208
 
209
int main ()
210
{
211
  int fd;
212
 
213
  fd = open ("testfile", O_RDWR | O_CREAT, S_IWRITE | S_IREAD);
214
  if (fd <= 0)
215
    return 0;
216
  if (unlink ("testfile") == -1)
217
    return 1;
218
  write (fd, "This is a test\n", 15);
219
  close (fd);
220
 
221
  if (open ("testfile", O_RDONLY, S_IWRITE | S_IREAD) == -1 && errno == ENOENT)
222
    return 0;
223
  else
224
    return 1;
225
}], have_unlink_open_file=yes, have_unlink_open_file=no, [
226
case "${target}" in
227
  *mingw*) have_unlink_open_file=no ;;
228
  *) have_unlink_open_file=yes;;
229
esac])])
230
if test x"$have_unlink_open_file" = xyes; then
231
  AC_DEFINE(HAVE_UNLINK_OPEN_FILE, 1, [Define if target can unlink open files.])
232
fi])
233
 
234
dnl Check whether CRLF is the line terminator
235
AC_DEFUN([LIBGFOR_CHECK_CRLF], [
236
  AC_CACHE_CHECK([whether the target has CRLF as line terminator],
237
                  have_crlf, [
238
  AC_TRY_RUN([
239
/* This test program should exit with status 0 if system uses a CRLF as
240
   line terminator, and status 1 otherwise.
241
   Since it is used to check for mingw systems, and should return 0 in any
242
   other case, in case of a failure we will not use CRLF.  */
243
#include <sys/stat.h>
244
#include <stdlib.h>
245
#include <fcntl.h>
246
#include <stdio.h>
247
 
248
int main ()
249
{
250
#ifndef O_BINARY
251
  exit(1);
252
#else
253
  int fd, bytes;
254
  char buff[5];
255
 
256
  fd = open ("foo", O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU);
257
  if (fd < 0)
258
    exit(1);
259
  if (write (fd, "\n", 1) < 0)
260
    perror ("write");
261
 
262
  close (fd);
263
 
264
  if ((fd = open ("foo", O_RDONLY | O_BINARY, S_IRWXU)) < 0)
265
    exit(1);
266
  bytes = read (fd, buff, 5);
267
  if (bytes == 2 && buff[0] == '\r' && buff[1] == '\n')
268
    exit(0);
269
  else
270
    exit(1);
271
#endif
272
}], have_crlf=yes, have_crlf=no, [
273
case "${target}" in
274
  *mingw*) have_crlf=yes ;;
275
  *) have_crlf=no;;
276
esac])])
277
if test x"$have_crlf" = xyes; then
278
  AC_DEFINE(HAVE_CRLF, 1, [Define if CRLF is line terminator.])
279
fi])
280
 
281
dnl Check whether isfinite is broken.
282
dnl The most common problem is that it does not work on long doubles.
283
AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_ISFINITE], [
284
  AC_CACHE_CHECK([whether isfinite is broken],
285
                  have_broken_isfinite, [
286
  libgfor_check_for_broken_isfinite_save_LIBS=$LIBS
287
  LIBS="$LIBS -lm"
288
  AC_TRY_RUN([
289
#ifdef HAVE_MATH_H
290
#include <math.h>
291
#endif
292
#include <float.h>
293
int main ()
294
{
295
#ifdef isfinite
296
#ifdef LDBL_MAX
297
  if (!isfinite(LDBL_MAX)) return 1;
298
#endif
299
#ifdef DBL_MAX
300
  if (!isfinite(DBL_MAX)) return 1;
301
#endif
302
#endif
303
return 0;
304
}], have_broken_isfinite=no, have_broken_isfinite=yes, [
305
case "${target}" in
306
  hppa*-*-hpux*) have_broken_isfinite=yes ;;
307
  *) have_broken_isfinite=no ;;
308
esac])]
309
  LIBS=$libgfor_check_for_broken_isfinite_save_LIBS)
310
if test x"$have_broken_isfinite" = xyes; then
311
  AC_DEFINE(HAVE_BROKEN_ISFINITE, 1, [Define if isfinite is broken.])
312
fi])
313
 
314
dnl Check whether isnan is broken.
315
dnl The most common problem is that it does not work on long doubles.
316
AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_ISNAN], [
317
  AC_CACHE_CHECK([whether isnan is broken],
318
                  have_broken_isnan, [
319
  libgfor_check_for_broken_isnan_save_LIBS=$LIBS
320
  LIBS="$LIBS -lm"
321
  AC_TRY_RUN([
322
#ifdef HAVE_MATH_H
323
#include <math.h>
324
#endif
325
#include <float.h>
326
int main ()
327
{
328
#ifdef isnan
329
#ifdef LDBL_MAX
330
  {
331
    long double x;
332
    x = __builtin_nanl ("");
333
    if (!isnan(x)) return 1;
334
    if (isnan(LDBL_MAX)) return 1;
335
#ifdef NAN
336
    x = (long double) NAN;
337
    if (!isnan(x)) return 1;
338
#endif
339
  }
340
#endif
341
#ifdef DBL_MAX
342
  {
343
    double y;
344
    y = __builtin_nan ("");
345
    if (!isnan(y)) return 1;
346
    if (isnan(DBL_MAX)) return 1;
347
#ifdef NAN
348
    y = (double) NAN;
349
    if (!isnan(y)) return 1;
350
#endif
351
  }
352
#endif
353
#endif
354
return 0;
355
}], have_broken_isnan=no, have_broken_isnan=yes, [
356
case "${target}" in
357
  hppa*-*-hpux*) have_broken_isnan=yes ;;
358
  *) have_broken_isnan=no ;;
359
esac])]
360
  LIBS=$libgfor_check_for_broken_isnan_save_LIBS)
361
if test x"$have_broken_isnan" = xyes; then
362
  AC_DEFINE(HAVE_BROKEN_ISNAN, 1, [Define if isnan is broken.])
363
fi])
364
 
365
dnl Check whether fpclassify is broken.
366
dnl The most common problem is that it does not work on long doubles.
367
AC_DEFUN([LIBGFOR_CHECK_FOR_BROKEN_FPCLASSIFY], [
368
  AC_CACHE_CHECK([whether fpclassify is broken],
369
                  have_broken_fpclassify, [
370
  libgfor_check_for_broken_fpclassify_save_LIBS=$LIBS
371
  LIBS="$LIBS -lm"
372
  AC_TRY_RUN([
373
#ifdef HAVE_MATH_H
374
#include <math.h>
375
#endif
376
#include <float.h>
377
int main ()
378
{
379
#ifdef fpclassify
380
#ifdef LDBL_MAX
381
        if (fpclassify(LDBL_MAX) == FP_NAN
382
            || fpclassify(LDBL_MAX) == FP_INFINITE) return 1;
383
#endif
384
#ifdef DBL_MAX
385
        if (fpclassify(DBL_MAX) == FP_NAN
386
            || fpclassify(DBL_MAX) == FP_INFINITE) return 1;
387
#endif
388
#endif
389
return 0;
390
}], have_broken_fpclassify=no, have_broken_fpclassify=yes, [
391
case "${target}" in
392
  hppa*-*-hpux*) have_broken_fpclassify=yes ;;
393
  *) have_broken_fpclassify=no ;;
394
esac])]
395
  LIBS=$libgfor_check_for_broken_fpclassify_save_LIBS)
396
if test x"$have_broken_fpclassify" = xyes; then
397
  AC_DEFINE(HAVE_BROKEN_FPCLASSIFY, 1, [Define if fpclassify is broken.])
398
fi])
399
 
400
dnl Check whether the st_ino and st_dev stat fields taken together uniquely
401
dnl identify the file within the system. This is should be true for POSIX
402
dnl systems; it is known to be false on mingw32.
403
AC_DEFUN([LIBGFOR_CHECK_WORKING_STAT], [
404
  AC_CACHE_CHECK([whether the target stat is reliable],
405
                  have_working_stat, [
406
  AC_TRY_RUN([
407
#include <stdio.h>
408
#include <sys/types.h>
409
#include <sys/stat.h>
410
#include <unistd.h>
411
 
412
int main ()
413
{
414
  FILE *f, *g;
415
  struct stat st1, st2;
416
 
417
  f = fopen ("foo", "w");
418
  g = fopen ("bar", "w");
419
  if (stat ("foo", &st1) != 0 || stat ("bar", &st2))
420
    return 1;
421
  if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino)
422
    return 1;
423
  fclose(f);
424
  fclose(g);
425
  return 0;
426
}], have_working_stat=yes, have_working_stat=no, [
427
case "${target}" in
428
  *mingw*) have_working_stat=no ;;
429
  *) have_working_stat=yes;;
430
esac])])
431
if test x"$have_working_stat" = xyes; then
432
  AC_DEFINE(HAVE_WORKING_STAT, 1, [Define if target has a reliable stat.])
433
fi])
434
 
435
dnl Checks for fpsetmask function.
436
AC_DEFUN([LIBGFOR_CHECK_FPSETMASK], [
437
  AC_CACHE_CHECK([whether fpsetmask is present], have_fpsetmask, [
438
    AC_TRY_LINK([
439
#if HAVE_FLOATINGPOINT_H
440
# include <floatingpoint.h>
441
#endif /* HAVE_FLOATINGPOINT_H */
442
#if HAVE_IEEEFP_H
443
# include <ieeefp.h>
444
#endif /* HAVE_IEEEFP_H */],[fpsetmask(0);],
445
    eval "have_fpsetmask=yes", eval "have_fpsetmask=no")
446
  ])
447
  if test x"$have_fpsetmask" = xyes; then
448
    AC_DEFINE(HAVE_FPSETMASK, 1, [Define if you have fpsetmask.])
449
  fi
450
])

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.