1# Process this file with autoconf to produce a configure script, like so:
2# aclocal && autoconf && autoheader && automake
3
4AC_PREREQ(2.64)
5AC_INIT([GNU Fortran Runtime Library], 0.3,,[libgfortran])
6AC_CONFIG_HEADER(config.h)
7GCC_TOPLEV_SUBDIRS
8
9# -------
10# Options
11# -------
12
13AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
14AC_ARG_ENABLE(version-specific-runtime-libs,
15AS_HELP_STRING([--enable-version-specific-runtime-libs],
16  [specify that runtime libraries should be installed in a compiler-specific directory]),
17[case "$enableval" in
18 yes) version_specific_libs=yes ;;
19 no)  version_specific_libs=no ;;
20 *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
21 esac],
22[version_specific_libs=no])
23AC_MSG_RESULT($version_specific_libs)
24
25# Build with intermodule optimisations
26AC_MSG_CHECKING([for --enable-intermodule])
27AC_ARG_ENABLE(intermodule,
28AS_HELP_STRING([--enable-intermodule],[build the library in one step]),
29[case "$enable_intermodule" in
30  yes) onestep="-onestep";;
31    *) onestep="";;
32esac],
33[onestep=""])
34AC_MSG_RESULT($enable_intermodule)
35AM_CONDITIONAL(onestep,[test x$onestep = x-onestep])
36AC_SUBST(onestep)
37
38# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
39#
40# You will slowly go insane if you do not grok the following fact:  when
41# building this library, the top-level /target/ becomes the library's /host/.
42#
43# configure then causes --target to default to --host, exactly like any
44# other package using autoconf.  Therefore, 'target' and 'host' will
45# always be the same.  This makes sense both for native and cross compilers
46# just think about it for a little while.  :-)
47#
48# Also, if this library is being configured as part of a cross compiler, the
49# top-level configure script will pass the "real" host as $with_cross_host.
50#
51# Do not delete or change the following two lines.  For why, see
52# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
53AC_CANONICAL_SYSTEM
54ACX_NONCANONICAL_TARGET
55
56target_alias=${target_alias-$host_alias}
57AC_SUBST(target_alias)
58
59# Sets up automake.  Must come after AC_CANONICAL_SYSTEM.  Each of the
60# following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
61#  1.9.6:  minimum required version
62#  no-define:  PACKAGE and VERSION will not be #define'd in config.h (a bunch
63#              of other PACKAGE_* variables will, however, and there's nothing
64#              we can do about that; they come from AC_INIT).
65#  foreign:  we don't follow the normal rules for GNU packages (no COPYING
66#            file in the top srcdir, etc, etc), so stop complaining.
67#  no-dist:  we don't want 'dist' and related rules.
68#  -Wall:  turns on all automake warnings...
69#  -Wno-portability:  ...except this one, since GNU make is required.
70AM_INIT_AUTOMAKE([1.9.6 no-define foreign no-dist -Wall -Wno-portability])
71
72AM_MAINTAINER_MODE
73AM_ENABLE_MULTILIB(, ..)
74
75# Handy for debugging:
76#AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
77
78# Are we being configured with some form of cross compiler?
79# NB: We don't actually need to know this just now, but when, say, a test
80#     suite is included, we'll have to know.
81if test "$build" != "$host"; then
82  LIBGFOR_IS_NATIVE=false
83  GCC_NO_EXECUTABLES
84else
85  LIBGFOR_IS_NATIVE=true
86fi
87
88AC_USE_SYSTEM_EXTENSIONS
89
90# Calculate toolexeclibdir
91# Also toolexecdir, though it's only used in toolexeclibdir
92case ${version_specific_libs} in
93  yes)
94    # Need the gcc compiler version to know where to install libraries
95    # and header files if --enable-version-specific-runtime-libs option
96    # is selected.
97    toolexecdir='$(libdir)/gcc/$(target_alias)'
98    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
99    ;;
100  no)
101    if test -n "$with_cross_host" &&
102       test x"$with_cross_host" != x"no"; then
103      # Install a library built with a cross compiler in tooldir, not libdir.
104      toolexecdir='$(exec_prefix)/$(target_alias)'
105      toolexeclibdir='$(toolexecdir)/lib'
106    else
107      toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
108      toolexeclibdir='$(libdir)'
109    fi
110    multi_os_directory=`$CC -print-multi-os-directory`
111    case $multi_os_directory in
112      .) ;; # Avoid trailing /.
113      *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
114    esac
115    ;;
116esac
117AC_SUBST(toolexecdir)
118AC_SUBST(toolexeclibdir)
119
120# Create a spec file, so that compile/link tests don't fail
121test -f libgfortran.spec || touch libgfortran.spec
122
123AC_LANG_C
124# Check the compiler.
125# The same as in boehm-gc and libstdc++. Have to borrow it from there.
126# We must force CC to /not/ be precious variables; otherwise
127# the wrong, non-multilib-adjusted value will be used in multilibs.
128# As a side effect, we have to subst CFLAGS ourselves.
129
130m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
131m4_define([_AC_ARG_VAR_PRECIOUS],[])
132AC_PROG_CC
133m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
134
135AC_SUBST(CFLAGS)
136
137AM_PROG_CC_C_O
138
139# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
140if test "x$GCC" = "xyes"; then
141  AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
142  ## We like to use C99 routines when available.  This makes sure that
143  ## __STDC_VERSION__ is set such that libc includes make them available.
144  AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
145  ## Compile the following tests with the same system header contents
146  ## that we'll encounter when compiling our own source files.
147  CFLAGS="-std=gnu99 $CFLAGS"
148fi
149AC_SUBST(AM_FCFLAGS)
150AC_SUBST(AM_CFLAGS)
151AC_SUBST(CFLAGS)
152
153# Check for symbol versioning (copied from libssp).
154AC_MSG_CHECKING([whether symbol versioning is supported])
155AC_ARG_ENABLE(symvers,
156AS_HELP_STRING([--disable-symvers],
157  [disable symbol versioning for libgfortran]),
158gfortran_use_symver=$enableval,
159gfortran_use_symver=yes)
160if test "x$gfortran_use_symver" != xno; then
161  save_LDFLAGS="$LDFLAGS"
162  LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
163  cat > conftest.map <<EOF
164FOO_1.0 {
165  global: *foo*; bar; local: *;
166};
167EOF
168  AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]],[[]])],[gfortran_use_symver=gnu],[gfortran_use_symver=no])
169  if test x$gfortran_use_symver = xno; then
170    case "$target_os" in
171      solaris2*)
172        LDFLAGS="$save_LDFLAGS"
173        LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
174        # Sun ld cannot handle wildcards and treats all entries as undefined.
175        cat > conftest.map <<EOF
176FOO_1.0 {
177  global: foo; local: *;
178};
179EOF
180        AC_LINK_IFELSE([AC_LANG_PROGRAM([[int foo;]],[[]])],[gfortran_use_symver=sun],[gfortran_use_symver=no])
181        ;;
182    esac
183  fi
184  LDFLAGS="$save_LDFLAGS"
185fi
186AC_MSG_RESULT($gfortran_use_symver)
187AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno])
188AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu])
189AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun])
190
191# Figure out whether the compiler supports "-ffunction-sections -fdata-sections",
192# similarly to how libstdc++ does it
193ac_test_CFLAGS="${CFLAGS+set}"
194ac_save_CFLAGS="$CFLAGS"
195
196# Check for -ffunction-sections -fdata-sections
197AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections])
198CFLAGS='-Werror -ffunction-sections -fdata-sections'
199AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int foo;]])], [ac_fdsections=yes], [ac_fdsections=no])
200if test "$ac_test_CFLAGS" = set; then
201  CFLAGS="$ac_save_CFLAGS"
202else
203  # this is the suspicious part
204  CFLAGS=""
205fi
206if test x"$ac_fdsections" = x"yes"; then
207  SECTION_FLAGS='-ffunction-sections -fdata-sections'
208fi
209AC_MSG_RESULT($ac_fdsections)
210AC_SUBST(SECTION_FLAGS)
211
212# Find other programs we need.
213AC_CHECK_TOOL(AS, as)
214AC_CHECK_TOOL(AR, ar)
215AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
216AC_PROG_MAKE_SET
217AC_PROG_INSTALL
218
219# Configure libtool
220#AC_MSG_NOTICE([====== Starting libtool configuration])
221AC_LIBTOOL_DLOPEN
222AM_PROG_LIBTOOL
223ACX_LT_HOST_FLAGS
224AC_SUBST(enable_shared)
225AC_SUBST(enable_static)
226#AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
227
228# We need gfortran to compile parts of the library
229#AC_PROG_FC(gfortran)
230FC="$GFORTRAN"
231AC_PROG_FC(gfortran)
232
233# extra LD Flags which are required for targets
234case "${host}" in
235  *-darwin*)
236    # Darwin needs -single_module when linking libgfortran
237    extra_ldflags_libgfortran=-Wl,-single_module
238    ;;
239esac
240AC_SUBST(extra_ldflags_libgfortran)
241
242# We need a working compiler at that point, otherwise give a clear
243# error message and bail out.
244LIBGFOR_WORKING_GFORTRAN
245
246AC_SYS_LARGEFILE
247
248# Types
249AC_TYPE_OFF_T
250AC_TYPE_INTPTR_T
251AC_TYPE_UINTPTR_T
252AC_CHECK_TYPES([ptrdiff_t])
253
254# check header files (we assume C89 is available, so don't check for that)
255AC_CHECK_HEADERS_ONCE(unistd.h sys/time.h sys/times.h sys/resource.h \
256sys/types.h sys/stat.h sys/wait.h floatingpoint.h ieeefp.h fenv.h fptrap.h \
257pwd.h complex.h)
258
259GCC_HEADER_STDINT(gstdint.h)
260
261AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
262
263# Check for library functions.
264AC_CHECK_FUNCS_ONCE(getrusage times mkstemp strtof strtold snprintf \
265ftruncate chsize chdir getlogin gethostname kill link symlink sleep ttyname \
266alarm access fork execl wait setmode execve pipe dup2 close \
267strcasestr getrlimit gettimeofday stat fstat lstat getpwuid vsnprintf dup \
268getcwd localtime_r gmtime_r getpwuid_r ttyname_r clock_gettime \
269readlink getgid getpid getppid getuid geteuid umask getegid \
270secure_getenv __secure_getenv)
271
272# Check strerror_r, cannot be above as versions with two and three arguments exist
273LIBGFOR_CHECK_STRERROR_R
274
275# Check for C99 (and other IEEE) math functions
276GCC_CHECK_MATH_FUNC([acosf])
277GCC_CHECK_MATH_FUNC([acos])
278GCC_CHECK_MATH_FUNC([acosl])
279GCC_CHECK_MATH_FUNC([acoshf])
280GCC_CHECK_MATH_FUNC([acosh])
281GCC_CHECK_MATH_FUNC([acoshl])
282GCC_CHECK_MATH_FUNC([asinf])
283GCC_CHECK_MATH_FUNC([asin])
284GCC_CHECK_MATH_FUNC([asinl])
285GCC_CHECK_MATH_FUNC([asinhf])
286GCC_CHECK_MATH_FUNC([asinh])
287GCC_CHECK_MATH_FUNC([asinhl])
288GCC_CHECK_MATH_FUNC([atan2f])
289GCC_CHECK_MATH_FUNC([atan2])
290GCC_CHECK_MATH_FUNC([atan2l])
291GCC_CHECK_MATH_FUNC([atanf])
292GCC_CHECK_MATH_FUNC([atan])
293GCC_CHECK_MATH_FUNC([atanl])
294GCC_CHECK_MATH_FUNC([atanhf])
295GCC_CHECK_MATH_FUNC([atanh])
296GCC_CHECK_MATH_FUNC([atanhl])
297GCC_CHECK_MATH_FUNC([cargf])
298GCC_CHECK_MATH_FUNC([carg])
299GCC_CHECK_MATH_FUNC([cargl])
300GCC_CHECK_MATH_FUNC([ceilf])
301GCC_CHECK_MATH_FUNC([ceil])
302GCC_CHECK_MATH_FUNC([ceill])
303GCC_CHECK_MATH_FUNC([copysignf])
304GCC_CHECK_MATH_FUNC([copysign])
305GCC_CHECK_MATH_FUNC([copysignl])
306GCC_CHECK_MATH_FUNC([cosf])
307GCC_CHECK_MATH_FUNC([cos])
308GCC_CHECK_MATH_FUNC([cosl])
309GCC_CHECK_MATH_FUNC([ccosf])
310GCC_CHECK_MATH_FUNC([ccos])
311GCC_CHECK_MATH_FUNC([ccosl])
312GCC_CHECK_MATH_FUNC([coshf])
313GCC_CHECK_MATH_FUNC([cosh])
314GCC_CHECK_MATH_FUNC([coshl])
315GCC_CHECK_MATH_FUNC([ccoshf])
316GCC_CHECK_MATH_FUNC([ccosh])
317GCC_CHECK_MATH_FUNC([ccoshl])
318GCC_CHECK_MATH_FUNC([expf])
319GCC_CHECK_MATH_FUNC([exp])
320GCC_CHECK_MATH_FUNC([expl])
321GCC_CHECK_MATH_FUNC([cexpf])
322GCC_CHECK_MATH_FUNC([cexp])
323GCC_CHECK_MATH_FUNC([cexpl])
324GCC_CHECK_MATH_FUNC([fabsf])
325GCC_CHECK_MATH_FUNC([fabs])
326GCC_CHECK_MATH_FUNC([fabsl])
327GCC_CHECK_MATH_FUNC([cabsf])
328GCC_CHECK_MATH_FUNC([cabs])
329GCC_CHECK_MATH_FUNC([cabsl])
330GCC_CHECK_MATH_FUNC([floorf])
331GCC_CHECK_MATH_FUNC([floor])
332GCC_CHECK_MATH_FUNC([floorl])
333GCC_CHECK_MATH_FUNC([fmodf])
334GCC_CHECK_MATH_FUNC([fmod])
335GCC_CHECK_MATH_FUNC([fmodl])
336GCC_CHECK_MATH_FUNC([frexpf])
337GCC_CHECK_MATH_FUNC([frexp])
338GCC_CHECK_MATH_FUNC([frexpl])
339GCC_CHECK_MATH_FUNC([hypotf])
340GCC_CHECK_MATH_FUNC([hypot])
341GCC_CHECK_MATH_FUNC([hypotl])
342GCC_CHECK_MATH_FUNC([ldexpf])
343GCC_CHECK_MATH_FUNC([ldexp])
344GCC_CHECK_MATH_FUNC([ldexpl])
345GCC_CHECK_MATH_FUNC([logf])
346GCC_CHECK_MATH_FUNC([log])
347GCC_CHECK_MATH_FUNC([logl])
348GCC_CHECK_MATH_FUNC([clogf])
349GCC_CHECK_MATH_FUNC([clog])
350GCC_CHECK_MATH_FUNC([clogl])
351GCC_CHECK_MATH_FUNC([log10f])
352GCC_CHECK_MATH_FUNC([log10])
353GCC_CHECK_MATH_FUNC([log10l])
354GCC_CHECK_MATH_FUNC([clog10f])
355GCC_CHECK_MATH_FUNC([clog10])
356GCC_CHECK_MATH_FUNC([clog10l])
357GCC_CHECK_MATH_FUNC([nextafterf])
358GCC_CHECK_MATH_FUNC([nextafter])
359GCC_CHECK_MATH_FUNC([nextafterl])
360GCC_CHECK_MATH_FUNC([powf])
361GCC_CHECK_MATH_FUNC([pow])
362GCC_CHECK_MATH_FUNC([powl])
363GCC_CHECK_MATH_FUNC([cpowf])
364GCC_CHECK_MATH_FUNC([cpow])
365GCC_CHECK_MATH_FUNC([cpowl])
366GCC_CHECK_MATH_FUNC([roundf])
367GCC_CHECK_MATH_FUNC([round])
368GCC_CHECK_MATH_FUNC([roundl])
369GCC_CHECK_MATH_FUNC([lroundf])
370GCC_CHECK_MATH_FUNC([lround])
371GCC_CHECK_MATH_FUNC([lroundl])
372GCC_CHECK_MATH_FUNC([llroundf])
373GCC_CHECK_MATH_FUNC([llround])
374GCC_CHECK_MATH_FUNC([llroundl])
375GCC_CHECK_MATH_FUNC([scalbnf])
376GCC_CHECK_MATH_FUNC([scalbn])
377GCC_CHECK_MATH_FUNC([scalbnl])
378GCC_CHECK_MATH_FUNC([sinf])
379GCC_CHECK_MATH_FUNC([sin])
380GCC_CHECK_MATH_FUNC([sinl])
381GCC_CHECK_MATH_FUNC([csinf])
382GCC_CHECK_MATH_FUNC([csin])
383GCC_CHECK_MATH_FUNC([csinl])
384GCC_CHECK_MATH_FUNC([sinhf])
385GCC_CHECK_MATH_FUNC([sinh])
386GCC_CHECK_MATH_FUNC([sinhl])
387GCC_CHECK_MATH_FUNC([csinhf])
388GCC_CHECK_MATH_FUNC([csinh])
389GCC_CHECK_MATH_FUNC([csinhl])
390GCC_CHECK_MATH_FUNC([sqrtf])
391GCC_CHECK_MATH_FUNC([sqrt])
392GCC_CHECK_MATH_FUNC([sqrtl])
393GCC_CHECK_MATH_FUNC([csqrtf])
394GCC_CHECK_MATH_FUNC([csqrt])
395GCC_CHECK_MATH_FUNC([csqrtl])
396GCC_CHECK_MATH_FUNC([tanf])
397GCC_CHECK_MATH_FUNC([tan])
398GCC_CHECK_MATH_FUNC([tanl])
399GCC_CHECK_MATH_FUNC([ctanf])
400GCC_CHECK_MATH_FUNC([ctan])
401GCC_CHECK_MATH_FUNC([ctanl])
402GCC_CHECK_MATH_FUNC([tanhf])
403GCC_CHECK_MATH_FUNC([tanh])
404GCC_CHECK_MATH_FUNC([tanhl])
405GCC_CHECK_MATH_FUNC([ctanhf])
406GCC_CHECK_MATH_FUNC([ctanh])
407GCC_CHECK_MATH_FUNC([ctanhl])
408GCC_CHECK_MATH_FUNC([truncf])
409GCC_CHECK_MATH_FUNC([trunc])
410GCC_CHECK_MATH_FUNC([truncl])
411GCC_CHECK_MATH_FUNC([erff])
412GCC_CHECK_MATH_FUNC([erf])
413GCC_CHECK_MATH_FUNC([erfl])
414GCC_CHECK_MATH_FUNC([erfcf])
415GCC_CHECK_MATH_FUNC([erfc])
416GCC_CHECK_MATH_FUNC([erfcl])
417GCC_CHECK_MATH_FUNC([j0f])
418GCC_CHECK_MATH_FUNC([j0])
419GCC_CHECK_MATH_FUNC([j0l])
420GCC_CHECK_MATH_FUNC([j1f])
421GCC_CHECK_MATH_FUNC([j1])
422GCC_CHECK_MATH_FUNC([j1l])
423GCC_CHECK_MATH_FUNC([jnf])
424GCC_CHECK_MATH_FUNC([jn])
425GCC_CHECK_MATH_FUNC([jnl])
426GCC_CHECK_MATH_FUNC([y0f])
427GCC_CHECK_MATH_FUNC([y0])
428GCC_CHECK_MATH_FUNC([y0l])
429GCC_CHECK_MATH_FUNC([y1f])
430GCC_CHECK_MATH_FUNC([y1])
431GCC_CHECK_MATH_FUNC([y1l])
432GCC_CHECK_MATH_FUNC([ynf])
433GCC_CHECK_MATH_FUNC([yn])
434GCC_CHECK_MATH_FUNC([ynl])
435GCC_CHECK_MATH_FUNC([tgamma])
436GCC_CHECK_MATH_FUNC([tgammaf])
437GCC_CHECK_MATH_FUNC([tgammal])
438GCC_CHECK_MATH_FUNC([lgamma])
439GCC_CHECK_MATH_FUNC([lgammaf])
440GCC_CHECK_MATH_FUNC([lgammal])
441
442# Check for GFORTRAN_C99_1.1 funcs
443GCC_CHECK_MATH_FUNC([cacos])
444GCC_CHECK_MATH_FUNC([cacosf])
445GCC_CHECK_MATH_FUNC([cacosh])
446GCC_CHECK_MATH_FUNC([cacoshf])
447GCC_CHECK_MATH_FUNC([cacoshl])
448GCC_CHECK_MATH_FUNC([cacosl])
449GCC_CHECK_MATH_FUNC([casin])
450GCC_CHECK_MATH_FUNC([casinf])
451GCC_CHECK_MATH_FUNC([casinh])
452GCC_CHECK_MATH_FUNC([casinhf])
453GCC_CHECK_MATH_FUNC([casinhl])
454GCC_CHECK_MATH_FUNC([casinl])
455GCC_CHECK_MATH_FUNC([catan])
456GCC_CHECK_MATH_FUNC([catanf])
457GCC_CHECK_MATH_FUNC([catanh])
458GCC_CHECK_MATH_FUNC([catanhf])
459GCC_CHECK_MATH_FUNC([catanhl])
460GCC_CHECK_MATH_FUNC([catanl])
461
462# On AIX, clog is present in libm as __clog
463AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
464
465# Check whether the system has a working stat()
466LIBGFOR_CHECK_WORKING_STAT
467
468# Check whether __mingw_snprintf() is present
469LIBGFOR_CHECK_MINGW_SNPRINTF
470
471# Check whether libquadmath should be used
472AC_ARG_ENABLE(libquadmath-support,
473AS_HELP_STRING([--disable-libquadmath-support],
474  [disable libquadmath support for Fortran]),
475ENABLE_LIBQUADMATH_SUPPORT=$enableval,
476ENABLE_LIBQUADMATH_SUPPORT=yes)
477enable_libquadmath_support=
478if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
479  enable_libquadmath_support=no
480fi
481
482# Check whether we have a __float128 type, depends on enable_libquadmath_support
483LIBGFOR_CHECK_FLOAT128
484
485# Check for GNU libc feenableexcept
486AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
487
488# At least for glibc, clock_gettime is in librt.  But don't
489# pull that in if it still doesn't give us the function we want.  This
490# test is copied from libgomp, and modified to not link in -lrt as
491# libgfortran calls clock_gettime via a weak reference if it's found
492# in librt.
493if test $ac_cv_func_clock_gettime = no; then
494  AC_CHECK_LIB(rt, clock_gettime,
495    [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1,
496               [Define to 1 if you have the `clock_gettime' function in librt.])])
497fi
498
499# Check for SysV fpsetmask
500LIBGFOR_CHECK_FPSETMASK
501
502# Check for AIX fp_trap and fp_enable
503AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])
504AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])])
505
506# Runs configure.host to set up necessary host-dependent shell variables.
507# We then display a message about it, and propagate them through the
508# build chain.
509. ${srcdir}/configure.host
510AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h])
511FPU_HOST_HEADER=config/${fpu_host}.h
512AC_SUBST(FPU_HOST_HEADER)
513
514# Some targets require additional compiler options for IEEE compatibility.
515IEEE_FLAGS="${ieee_flags}"
516AC_SUBST(IEEE_FLAGS)
517
518
519# Check for POSIX getpwuid_r
520#
521# There are two versions of getpwuid_r, the POSIX one with 5
522# arguments, and another one with 4 arguments used by at least HP-UX
523# 10.2.
524if test "$ac_cv_func_getpwuid_r" = "yes"; then
525   AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [
526   AC_LINK_IFELSE([AC_LANG_PROGRAM([
527#include <stdio.h>
528#include <sys/types.h>
529#include <pwd.h>], [
530    getpwuid_r(0, NULL, NULL, 0, NULL);
531    ])],  [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])])
532fi
533if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then
534    AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.])
535fi
536
537
538# Check out attribute support.
539LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
540LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT
541LIBGFOR_CHECK_ATTRIBUTE_ALIAS
542
543# Check out sync builtins support.
544LIBGFOR_CHECK_SYNC_FETCH_AND_ADD
545
546# Check out #pragma weak.
547LIBGFOR_GTHREAD_WEAK
548
549# Various other checks on target
550LIBGFOR_CHECK_UNLINK_OPEN_FILE
551
552# Check whether line terminator is LF or CRLF
553LIBGFOR_CHECK_CRLF
554
555# Check whether we have _Unwind_GetIPInfo for backtrace
556GCC_CHECK_UNWIND_GETIPINFO
557
558AC_CACHE_SAVE
559
560if test ${multilib} = yes; then
561  multilib_arg="--enable-multilib"
562else
563  multilib_arg=
564fi
565
566# Write our Makefile and spec file.
567AC_CONFIG_FILES([
568Makefile
569libgfortran.spec
570])
571AC_OUTPUT
572