1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal && autoconf && autoheader && automake
5 AC_INIT([GNU Fortran Runtime Library], 0.3,,[libgfortran])
6 AC_CONFIG_HEADER(config.h)
13 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
14 AC_ARG_ENABLE(version-specific-runtime-libs,
15 AS_HELP_STRING([--enable-version-specific-runtime-libs],
16 [specify that runtime libraries should be installed in a compiler-specific directory]),
18 yes) version_specific_libs=yes ;;
19 no) version_specific_libs=no ;;
20 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
22 [version_specific_libs=no])
23 AC_MSG_RESULT($version_specific_libs)
25 # Build with intermodule optimisations
26 AC_MSG_CHECKING([for --enable-intermodule])
27 AC_ARG_ENABLE(intermodule,
28 AS_HELP_STRING([--enable-intermodule],[build the library in one step]),
29 [case "$enable_intermodule" in
30 yes) onestep="-onestep";;
34 AC_MSG_RESULT($enable_intermodule)
35 AM_CONDITIONAL(onestep,[test x$onestep = x-onestep])
38 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
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/.
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. :-)
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.
51 # Do not delete or change the following two lines. For why, see
52 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
54 target_alias=${target_alias-$host_alias}
56 # Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
57 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
58 # 1.9.6: minimum required version
59 # no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
60 # of other PACKAGE_* variables will, however, and there's nothing
61 # we can do about that; they come from AC_INIT).
62 # foreign: we don't follow the normal rules for GNU packages (no COPYING
63 # file in the top srcdir, etc, etc), so stop complaining.
64 # no-dist: we don't want 'dist' and related rules.
65 # -Wall: turns on all automake warnings...
66 # -Wno-portability: ...except this one, since GNU make is required.
67 AM_INIT_AUTOMAKE([1.9.6 no-define foreign no-dist -Wall -Wno-portability])
70 AM_ENABLE_MULTILIB(, ..)
72 # Handy for debugging:
73 #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
75 # Are we being configured with some form of cross compiler?
76 # NB: We don't actually need to know this just now, but when, say, a test
77 # suite is included, we'll have to know.
78 if test "$build" != "$host"; then
79 LIBGFOR_IS_NATIVE=false
82 LIBGFOR_IS_NATIVE=true
85 AC_USE_SYSTEM_EXTENSIONS
87 # Calculate toolexeclibdir
88 # Also toolexecdir, though it's only used in toolexeclibdir
89 case ${version_specific_libs} in
91 # Need the gcc compiler version to know where to install libraries
92 # and header files if --enable-version-specific-runtime-libs option
94 toolexecdir='$(libdir)/gcc/$(target_alias)'
95 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
98 if test -n "$with_cross_host" &&
99 test x"$with_cross_host" != x"no"; then
100 # Install a library built with a cross compiler in tooldir, not libdir.
101 toolexecdir='$(exec_prefix)/$(target_alias)'
102 toolexeclibdir='$(toolexecdir)/lib'
104 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
105 toolexeclibdir='$(libdir)'
107 multi_os_directory=`$CC -print-multi-os-directory`
108 case $multi_os_directory in
109 .) ;; # Avoid trailing /.
110 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
114 AC_SUBST(toolexecdir)
115 AC_SUBST(toolexeclibdir)
117 # Create a spec file, so that compile/link tests don't fail
118 test -f libgfortran.spec || touch libgfortran.spec
120 # Check the compiler.
121 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
122 # We must force CC to /not/ be precious variables; otherwise
123 # the wrong, non-multilib-adjusted value will be used in multilibs.
124 # As a side effect, we have to subst CFLAGS ourselves.
126 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
127 m4_define([_AC_ARG_VAR_PRECIOUS],[])
129 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
131 # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
132 if test "x$GCC" = "xyes"; then
133 AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
134 ## We like to use C99 routines when available. This makes sure that
135 ## __STDC_VERSION__ is set such that libc includes make them available.
136 AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
137 ## Compile the following tests with the same system header contents
138 ## that we'll encounter when compiling our own source files.
139 CFLAGS="-std=gnu99 $CFLAGS"
145 # Check for symbol versioning (copied from libssp).
146 AC_MSG_CHECKING([whether symbol versioning is supported])
147 save_LDFLAGS="$LDFLAGS"
148 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
149 cat > conftest.map <<EOF
151 global: *foo*; bar; local: *;
154 AC_TRY_LINK([int foo;],[],[gfortran_use_symver=gnu],[gfortran_use_symver=no])
155 if test x$gfortran_use_symver = xno; then
158 LDFLAGS="$save_LDFLAGS"
159 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
160 # Sun ld cannot handle wildcards and treats all entries as undefined.
161 cat > conftest.map <<EOF
163 global: foo; local: *;
166 AC_TRY_LINK([int foo;],[],[gfortran_use_symver=sun],[gfortran_use_symver=no])
170 LDFLAGS="$save_LDFLAGS"
171 AC_MSG_RESULT($gfortran_use_symver)
172 AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" != xno])
173 AM_CONDITIONAL(LIBGFOR_USE_SYMVER_GNU, [test "x$gfortran_use_symver" = xgnu])
174 AM_CONDITIONAL(LIBGFOR_USE_SYMVER_SUN, [test "x$gfortran_use_symver" = xsun])
176 # Figure out whether the compiler supports "-ffunction-sections -fdata-sections",
177 # similarly to how libstdc++ does it
178 ac_test_CFLAGS="${CFLAGS+set}"
179 ac_save_CFLAGS="$CFLAGS"
181 # Check for -ffunction-sections -fdata-sections
182 AC_MSG_CHECKING([for gcc that supports -ffunction-sections -fdata-sections])
183 CFLAGS='-Werror -ffunction-sections -fdata-sections'
184 AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no])
185 if test "$ac_test_CFLAGS" = set; then
186 CFLAGS="$ac_save_CFLAGS"
188 # this is the suspicious part
191 if test x"$ac_fdsections" = x"yes"; then
192 SECTION_FLAGS='-ffunction-sections -fdata-sections'
194 AC_MSG_RESULT($ac_fdsections)
195 AC_SUBST(SECTION_FLAGS)
197 # Find other programs we need.
198 AC_CHECK_TOOL(AS, as)
199 AC_CHECK_TOOL(AR, ar)
200 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
205 #AC_MSG_NOTICE([====== Starting libtool configuration])
209 AC_SUBST(enable_shared)
210 AC_SUBST(enable_static)
211 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
213 # We need gfortran to compile parts of the library
214 #AC_PROG_FC(gfortran)
218 # extra LD Flags which are required for targets
221 # Darwin needs -single_module when linking libgfortran
222 extra_ldflags_libgfortran=-Wl,-single_module
225 AC_SUBST(extra_ldflags_libgfortran)
227 # We need a working compiler at that point, otherwise give a clear
228 # error message and bail out.
229 LIBGFOR_WORKING_GFORTRAN
237 AC_HAVE_HEADERS(stdio.h stdlib.h string.h unistd.h signal.h stdarg.h)
238 AC_CHECK_HEADERS(time.h sys/time.h sys/times.h sys/resource.h)
239 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/wait.h floatingpoint.h ieeefp.h)
240 AC_CHECK_HEADERS(fenv.h fptrap.h float.h execinfo.h pwd.h)
241 AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
242 GCC_HEADER_STDINT(gstdint.h)
244 AC_CHECK_MEMBERS([struct stat.st_blksize])
245 AC_CHECK_MEMBERS([struct stat.st_blocks])
246 AC_CHECK_MEMBERS([struct stat.st_rdev])
248 # Check for library functions.
249 AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
250 AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
251 AC_CHECK_FUNCS(sleep time ttyname signal alarm clock access fork execl)
252 AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
253 AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
254 AC_CHECK_FUNCS(localtime_r gmtime_r strerror_r getpwuid_r ttyname_r)
255 AC_CHECK_FUNCS(clock_gettime strftime)
257 # Check for glibc backtrace functions
258 AC_CHECK_FUNCS(backtrace backtrace_symbols)
261 AC_CHECK_TYPES([intptr_t])
262 AC_CHECK_TYPES([uintptr_t])
264 # Check libc for getgid, getpid, getuid
265 AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
266 AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
267 AC_CHECK_LIB([c],[getppid],[AC_DEFINE([HAVE_GETPPID],[1],[libc includes getppid])])
268 AC_CHECK_LIB([c],[getuid],[AC_DEFINE([HAVE_GETUID],[1],[libc includes getuid])])
269 AC_CHECK_LIB([c],[geteuid],[AC_DEFINE([HAVE_GETEUID],[1],[libc includes geteuid])])
271 # Check for C99 (and other IEEE) math functions
272 AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
273 AC_CHECK_LIB([m],[acos],[AC_DEFINE([HAVE_ACOS],[1],[libm includes acos])])
274 AC_CHECK_LIB([m],[acosl],[AC_DEFINE([HAVE_ACOSL],[1],[libm includes acosl])])
275 AC_CHECK_LIB([m],[acoshf],[AC_DEFINE([HAVE_ACOSHF],[1],[libm includes acoshf])])
276 AC_CHECK_LIB([m],[acosh],[AC_DEFINE([HAVE_ACOSH],[1],[libm includes acosh])])
277 AC_CHECK_LIB([m],[acoshl],[AC_DEFINE([HAVE_ACOSHL],[1],[libm includes acoshl])])
278 AC_CHECK_LIB([m],[asinf],[AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
279 AC_CHECK_LIB([m],[asin],[AC_DEFINE([HAVE_ASIN],[1],[libm includes asin])])
280 AC_CHECK_LIB([m],[asinl],[AC_DEFINE([HAVE_ASINL],[1],[libm includes asinl])])
281 AC_CHECK_LIB([m],[asinhf],[AC_DEFINE([HAVE_ASINHF],[1],[libm includes asinhf])])
282 AC_CHECK_LIB([m],[asinh],[AC_DEFINE([HAVE_ASINH],[1],[libm includes asinh])])
283 AC_CHECK_LIB([m],[asinhl],[AC_DEFINE([HAVE_ASINHL],[1],[libm includes asinhl])])
284 AC_CHECK_LIB([m],[atan2f],[AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
285 AC_CHECK_LIB([m],[atan2],[AC_DEFINE([HAVE_ATAN2],[1],[libm includes atan2])])
286 AC_CHECK_LIB([m],[atan2l],[AC_DEFINE([HAVE_ATAN2L],[1],[libm includes atan2l])])
287 AC_CHECK_LIB([m],[atanf],[AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
288 AC_CHECK_LIB([m],[atan],[AC_DEFINE([HAVE_ATAN],[1],[libm includes atan])])
289 AC_CHECK_LIB([m],[atanl],[AC_DEFINE([HAVE_ATANL],[1],[libm includes atanl])])
290 AC_CHECK_LIB([m],[atanhf],[AC_DEFINE([HAVE_ATANHF],[1],[libm includes atanhf])])
291 AC_CHECK_LIB([m],[atanh],[AC_DEFINE([HAVE_ATANH],[1],[libm includes atanh])])
292 AC_CHECK_LIB([m],[atanhl],[AC_DEFINE([HAVE_ATANHL],[1],[libm includes atanhl])])
293 AC_CHECK_LIB([m],[cargf],[AC_DEFINE([HAVE_CARGF],[1],[libm includes cargf])])
294 AC_CHECK_LIB([m],[carg],[AC_DEFINE([HAVE_CARG],[1],[libm includes carg])])
295 AC_CHECK_LIB([m],[cargl],[AC_DEFINE([HAVE_CARGL],[1],[libm includes cargl])])
296 AC_CHECK_LIB([m],[ceilf],[AC_DEFINE([HAVE_CEILF],[1],[libm includes ceilf])])
297 AC_CHECK_LIB([m],[ceil],[AC_DEFINE([HAVE_CEIL],[1],[libm includes ceil])])
298 AC_CHECK_LIB([m],[ceill],[AC_DEFINE([HAVE_CEILL],[1],[libm includes ceill])])
299 AC_CHECK_LIB([m],[copysignf],[AC_DEFINE([HAVE_COPYSIGNF],[1],[libm includes copysignf])])
300 AC_CHECK_LIB([m],[copysign],[AC_DEFINE([HAVE_COPYSIGN],[1],[libm includes copysign])])
301 AC_CHECK_LIB([m],[copysignl],[AC_DEFINE([HAVE_COPYSIGNL],[1],[libm includes copysignl])])
302 AC_CHECK_LIB([m],[cosf],[AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])])
303 AC_CHECK_LIB([m],[cos],[AC_DEFINE([HAVE_COS],[1],[libm includes cos])])
304 AC_CHECK_LIB([m],[cosl],[AC_DEFINE([HAVE_COSL],[1],[libm includes cosl])])
305 AC_CHECK_LIB([m],[ccosf],[AC_DEFINE([HAVE_CCOSF],[1],[libm includes ccosf])])
306 AC_CHECK_LIB([m],[ccos],[AC_DEFINE([HAVE_CCOS],[1],[libm includes ccos])])
307 AC_CHECK_LIB([m],[ccosl],[AC_DEFINE([HAVE_CCOSL],[1],[libm includes ccosl])])
308 AC_CHECK_LIB([m],[coshf],[AC_DEFINE([HAVE_COSHF],[1],[libm includes coshf])])
309 AC_CHECK_LIB([m],[cosh],[AC_DEFINE([HAVE_COSH],[1],[libm includes cosh])])
310 AC_CHECK_LIB([m],[coshl],[AC_DEFINE([HAVE_COSHL],[1],[libm includes coshl])])
311 AC_CHECK_LIB([m],[ccoshf],[AC_DEFINE([HAVE_CCOSHF],[1],[libm includes ccoshf])])
312 AC_CHECK_LIB([m],[ccosh],[AC_DEFINE([HAVE_CCOSH],[1],[libm includes ccosh])])
313 AC_CHECK_LIB([m],[ccoshl],[AC_DEFINE([HAVE_CCOSHL],[1],[libm includes ccoshl])])
314 AC_CHECK_LIB([m],[expf],[AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])])
315 AC_CHECK_LIB([m],[exp],[AC_DEFINE([HAVE_EXP],[1],[libm includes exp])])
316 AC_CHECK_LIB([m],[expl],[AC_DEFINE([HAVE_EXPL],[1],[libm includes expl])])
317 AC_CHECK_LIB([m],[cexpf],[AC_DEFINE([HAVE_CEXPF],[1],[libm includes cexpf])])
318 AC_CHECK_LIB([m],[cexp],[AC_DEFINE([HAVE_CEXP],[1],[libm includes cexp])])
319 AC_CHECK_LIB([m],[cexpl],[AC_DEFINE([HAVE_CEXPL],[1],[libm includes cexpl])])
320 AC_CHECK_LIB([m],[fabsf],[AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])])
321 AC_CHECK_LIB([m],[fabs],[AC_DEFINE([HAVE_FABS],[1],[libm includes fabs])])
322 AC_CHECK_LIB([m],[fabsl],[AC_DEFINE([HAVE_FABSL],[1],[libm includes fabsl])])
323 AC_CHECK_LIB([m],[cabsf],[AC_DEFINE([HAVE_CABSF],[1],[libm includes cabsf])])
324 AC_CHECK_LIB([m],[cabs],[AC_DEFINE([HAVE_CABS],[1],[libm includes cabs])])
325 AC_CHECK_LIB([m],[cabsl],[AC_DEFINE([HAVE_CABSL],[1],[libm includes cabsl])])
326 AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
327 AC_CHECK_LIB([m],[floor],[AC_DEFINE([HAVE_FLOOR],[1],[libm includes floor])])
328 AC_CHECK_LIB([m],[floorl],[AC_DEFINE([HAVE_FLOORL],[1],[libm includes floorl])])
329 AC_CHECK_LIB([m],[fmodf],[AC_DEFINE([HAVE_FMODF],[1],[libm includes fmodf])])
330 AC_CHECK_LIB([m],[fmod],[AC_DEFINE([HAVE_FMOD],[1],[libm includes fmod])])
331 AC_CHECK_LIB([m],[fmodl],[AC_DEFINE([HAVE_FMODL],[1],[libm includes fmodl])])
332 AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])])
333 AC_CHECK_LIB([m],[frexp],[AC_DEFINE([HAVE_FREXP],[1],[libm includes frexp])])
334 AC_CHECK_LIB([m],[frexpl],[AC_DEFINE([HAVE_FREXPL],[1],[libm includes frexpl])])
335 AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
336 AC_CHECK_LIB([m],[hypot],[AC_DEFINE([HAVE_HYPOT],[1],[libm includes hypot])])
337 AC_CHECK_LIB([m],[hypotl],[AC_DEFINE([HAVE_HYPOTL],[1],[libm includes hypotl])])
338 AC_CHECK_LIB([m],[ldexpf],[AC_DEFINE([HAVE_LDEXPF],[1],[libm includes ldexpf])])
339 AC_CHECK_LIB([m],[ldexp],[AC_DEFINE([HAVE_LDEXP],[1],[libm includes ldexp])])
340 AC_CHECK_LIB([m],[ldexpl],[AC_DEFINE([HAVE_LDEXPL],[1],[libm includes ldexpl])])
341 AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
342 AC_CHECK_LIB([m],[log],[AC_DEFINE([HAVE_LOG],[1],[libm includes log])])
343 AC_CHECK_LIB([m],[logl],[AC_DEFINE([HAVE_LOGL],[1],[libm includes logl])])
344 AC_CHECK_LIB([m],[clogf],[AC_DEFINE([HAVE_CLOGF],[1],[libm includes clogf])])
345 AC_CHECK_LIB([m],[clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
346 AC_CHECK_LIB([m],[clogl],[AC_DEFINE([HAVE_CLOGL],[1],[libm includes clogl])])
347 AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
348 AC_CHECK_LIB([m],[log10],[AC_DEFINE([HAVE_LOG10],[1],[libm includes log10])])
349 AC_CHECK_LIB([m],[log10l],[AC_DEFINE([HAVE_LOG10L],[1],[libm includes log10l])])
350 AC_CHECK_LIB([m],[clog10f],[AC_DEFINE([HAVE_CLOG10F],[1],[libm includes clog10f])])
351 AC_CHECK_LIB([m],[clog10],[AC_DEFINE([HAVE_CLOG10],[1],[libm includes clog10])])
352 AC_CHECK_LIB([m],[clog10l],[AC_DEFINE([HAVE_CLOG10L],[1],[libm includes clog10l])])
353 AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
354 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
355 AC_CHECK_LIB([m],[nextafterl],[AC_DEFINE([HAVE_NEXTAFTERL],[1],[libm includes nextafterl])])
356 AC_CHECK_LIB([m],[powf],[AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
357 AC_CHECK_LIB([m],[pow],[AC_DEFINE([HAVE_POW],[1],[libm includes pow])])
358 AC_CHECK_LIB([m],[powl],[AC_DEFINE([HAVE_POWL],[1],[libm includes powl])])
359 AC_CHECK_LIB([m],[cpowf],[AC_DEFINE([HAVE_CPOWF],[1],[libm includes cpowf])])
360 AC_CHECK_LIB([m],[cpow],[AC_DEFINE([HAVE_CPOW],[1],[libm includes cpow])])
361 AC_CHECK_LIB([m],[cpowl],[AC_DEFINE([HAVE_CPOWL],[1],[libm includes cpowl])])
362 AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
363 AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
364 AC_CHECK_LIB([m],[roundl],[AC_DEFINE([HAVE_ROUNDL],[1],[libm includes roundl])])
365 AC_CHECK_LIB([m],[lroundf],[AC_DEFINE([HAVE_LROUNDF],[1],[libm includes lroundf])])
366 AC_CHECK_LIB([m],[lround],[AC_DEFINE([HAVE_LROUND],[1],[libm includes lround])])
367 AC_CHECK_LIB([m],[lroundl],[AC_DEFINE([HAVE_LROUNDL],[1],[libm includes lroundl])])
368 AC_CHECK_LIB([m],[llroundf],[AC_DEFINE([HAVE_LLROUNDF],[1],[libm includes llroundf])])
369 AC_CHECK_LIB([m],[llround],[AC_DEFINE([HAVE_LLROUND],[1],[libm includes llround])])
370 AC_CHECK_LIB([m],[llroundl],[AC_DEFINE([HAVE_LLROUNDL],[1],[libm includes llroundl])])
371 AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes scalbnf])])
372 AC_CHECK_LIB([m],[scalbn],[AC_DEFINE([HAVE_SCALBN],[1],[libm includes scalbn])])
373 AC_CHECK_LIB([m],[scalbnl],[AC_DEFINE([HAVE_SCALBNL],[1],[libm includes scalbnl])])
374 AC_CHECK_LIB([m],[sinf],[AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
375 AC_CHECK_LIB([m],[sin],[AC_DEFINE([HAVE_SIN],[1],[libm includes sin])])
376 AC_CHECK_LIB([m],[sinl],[AC_DEFINE([HAVE_SINL],[1],[libm includes sinl])])
377 AC_CHECK_LIB([m],[csinf],[AC_DEFINE([HAVE_CSINF],[1],[libm includes csinf])])
378 AC_CHECK_LIB([m],[csin],[AC_DEFINE([HAVE_CSIN],[1],[libm includes csin])])
379 AC_CHECK_LIB([m],[csinl],[AC_DEFINE([HAVE_CSINL],[1],[libm includes csinl])])
380 AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
381 AC_CHECK_LIB([m],[sinh],[AC_DEFINE([HAVE_SINH],[1],[libm includes sinh])])
382 AC_CHECK_LIB([m],[sinhl],[AC_DEFINE([HAVE_SINHL],[1],[libm includes sinhl])])
383 AC_CHECK_LIB([m],[csinhf],[AC_DEFINE([HAVE_CSINHF],[1],[libm includes csinhf])])
384 AC_CHECK_LIB([m],[csinh],[AC_DEFINE([HAVE_CSINH],[1],[libm includes csinh])])
385 AC_CHECK_LIB([m],[csinhl],[AC_DEFINE([HAVE_CSINHL],[1],[libm includes csinhl])])
386 AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
387 AC_CHECK_LIB([m],[sqrt],[AC_DEFINE([HAVE_SQRT],[1],[libm includes sqrt])])
388 AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
389 AC_CHECK_LIB([m],[csqrtf],[AC_DEFINE([HAVE_CSQRTF],[1],[libm includes csqrtf])])
390 AC_CHECK_LIB([m],[csqrt],[AC_DEFINE([HAVE_CSQRT],[1],[libm includes csqrt])])
391 AC_CHECK_LIB([m],[csqrtl],[AC_DEFINE([HAVE_CSQRTL],[1],[libm includes csqrtl])])
392 AC_CHECK_LIB([m],[tanf],[AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
393 AC_CHECK_LIB([m],[tan],[AC_DEFINE([HAVE_TAN],[1],[libm includes tan])])
394 AC_CHECK_LIB([m],[tanl],[AC_DEFINE([HAVE_TANL],[1],[libm includes tanl])])
395 AC_CHECK_LIB([m],[ctanf],[AC_DEFINE([HAVE_CTANF],[1],[libm includes ctanf])])
396 AC_CHECK_LIB([m],[ctan],[AC_DEFINE([HAVE_CTAN],[1],[libm includes ctan])])
397 AC_CHECK_LIB([m],[ctanl],[AC_DEFINE([HAVE_CTANL],[1],[libm includes ctanl])])
398 AC_CHECK_LIB([m],[tanhf],[AC_DEFINE([HAVE_TANHF],[1],[libm includes tanhf])])
399 AC_CHECK_LIB([m],[tanh],[AC_DEFINE([HAVE_TANH],[1],[libm includes tanh])])
400 AC_CHECK_LIB([m],[tanhl],[AC_DEFINE([HAVE_TANHL],[1],[libm includes tanhl])])
401 AC_CHECK_LIB([m],[ctanhf],[AC_DEFINE([HAVE_CTANHF],[1],[libm includes ctanhf])])
402 AC_CHECK_LIB([m],[ctanh],[AC_DEFINE([HAVE_CTANH],[1],[libm includes ctanh])])
403 AC_CHECK_LIB([m],[ctanhl],[AC_DEFINE([HAVE_CTANHL],[1],[libm includes ctanhl])])
404 AC_CHECK_LIB([m],[truncf],[AC_DEFINE([HAVE_TRUNCF],[1],[libm includes truncf])])
405 AC_CHECK_LIB([m],[trunc],[AC_DEFINE([HAVE_TRUNC],[1],[libm includes trunc])])
406 AC_CHECK_LIB([m],[truncl],[AC_DEFINE([HAVE_TRUNCL],[1],[libm includes truncl])])
407 AC_CHECK_LIB([m],[erff],[AC_DEFINE([HAVE_ERFF],[1],[libm includes erff])])
408 AC_CHECK_LIB([m],[erf],[AC_DEFINE([HAVE_ERF],[1],[libm includes erf])])
409 AC_CHECK_LIB([m],[erfl],[AC_DEFINE([HAVE_ERFL],[1],[libm includes erfl])])
410 AC_CHECK_LIB([m],[erfcf],[AC_DEFINE([HAVE_ERFCF],[1],[libm includes erfcf])])
411 AC_CHECK_LIB([m],[erfc],[AC_DEFINE([HAVE_ERFC],[1],[libm includes erfc])])
412 AC_CHECK_LIB([m],[erfcl],[AC_DEFINE([HAVE_ERFCL],[1],[libm includes erfcl])])
413 AC_CHECK_LIB([m],[j0f],[AC_DEFINE([HAVE_J0F],[1],[libm includes j0f])])
414 AC_CHECK_LIB([m],[j0],[AC_DEFINE([HAVE_J0],[1],[libm includes j0])])
415 AC_CHECK_LIB([m],[j0l],[AC_DEFINE([HAVE_J0L],[1],[libm includes j0l])])
416 AC_CHECK_LIB([m],[j1f],[AC_DEFINE([HAVE_J1F],[1],[libm includes j1f])])
417 AC_CHECK_LIB([m],[j1],[AC_DEFINE([HAVE_J1],[1],[libm includes j1])])
418 AC_CHECK_LIB([m],[j1l],[AC_DEFINE([HAVE_J1L],[1],[libm includes j1l])])
419 AC_CHECK_LIB([m],[jnf],[AC_DEFINE([HAVE_JNF],[1],[libm includes jnf])])
420 AC_CHECK_LIB([m],[jn],[AC_DEFINE([HAVE_JN],[1],[libm includes jn])])
421 AC_CHECK_LIB([m],[jnl],[AC_DEFINE([HAVE_JNL],[1],[libm includes jnl])])
422 AC_CHECK_LIB([m],[y0f],[AC_DEFINE([HAVE_Y0F],[1],[libm includes y0f])])
423 AC_CHECK_LIB([m],[y0],[AC_DEFINE([HAVE_Y0],[1],[libm includes y0])])
424 AC_CHECK_LIB([m],[y0l],[AC_DEFINE([HAVE_Y0L],[1],[libm includes y0l])])
425 AC_CHECK_LIB([m],[y1f],[AC_DEFINE([HAVE_Y1F],[1],[libm includes y1f])])
426 AC_CHECK_LIB([m],[y1],[AC_DEFINE([HAVE_Y1],[1],[libm includes y1])])
427 AC_CHECK_LIB([m],[y1l],[AC_DEFINE([HAVE_Y1L],[1],[libm includes y1l])])
428 AC_CHECK_LIB([m],[ynf],[AC_DEFINE([HAVE_YNF],[1],[libm includes ynf])])
429 AC_CHECK_LIB([m],[yn],[AC_DEFINE([HAVE_YN],[1],[libm includes yn])])
430 AC_CHECK_LIB([m],[ynl],[AC_DEFINE([HAVE_YNL],[1],[libm includes ynl])])
431 AC_CHECK_LIB([m],[tgamma],[AC_DEFINE([HAVE_TGAMMA],[1],[libm includes tgamma])])
432 AC_CHECK_LIB([m],[tgammaf],[AC_DEFINE([HAVE_TGAMMAF],[1],[libm includes tgammaf])])
433 AC_CHECK_LIB([m],[tgammal],[AC_DEFINE([HAVE_TGAMMAL],[1],[libm includes tgammal])])
434 AC_CHECK_LIB([m],[lgamma],[AC_DEFINE([HAVE_LGAMMA],[1],[libm includes lgamma])])
435 AC_CHECK_LIB([m],[lgammaf],[AC_DEFINE([HAVE_LGAMMAF],[1],[libm includes lgammaf])])
436 AC_CHECK_LIB([m],[lgammal],[AC_DEFINE([HAVE_LGAMMAL],[1],[libm includes lgammal])])
438 # Check for GFORTRAN_C99_1.1 funcs
439 AC_CHECK_LIB([m],[cacos],[AC_DEFINE([HAVE_CACOS],[1],[libm includes cacos])])
440 AC_CHECK_LIB([m],[cacosf],[AC_DEFINE([HAVE_CACOSF],[1],[libm includes cacosf])])
441 AC_CHECK_LIB([m],[cacosh],[AC_DEFINE([HAVE_CACOSH],[1],[libm includes cacosh])])
442 AC_CHECK_LIB([m],[cacoshf],[AC_DEFINE([HAVE_CACOSHF],[1],[libm includes cacoshf])])
443 AC_CHECK_LIB([m],[cacoshl],[AC_DEFINE([HAVE_CACOSHL],[1],[libm includes cacoshl])])
444 AC_CHECK_LIB([m],[cacosl],[AC_DEFINE([HAVE_CACOSL],[1],[libm includes cacosl])])
445 AC_CHECK_LIB([m],[casin],[AC_DEFINE([HAVE_CASIN],[1],[libm includes casin])])
446 AC_CHECK_LIB([m],[casinf],[AC_DEFINE([HAVE_CASINF],[1],[libm includes casinf])])
447 AC_CHECK_LIB([m],[casinh],[AC_DEFINE([HAVE_CASINH],[1],[libm includes casinh])])
448 AC_CHECK_LIB([m],[casinhf],[AC_DEFINE([HAVE_CASINHF],[1],[libm includes casinhf])])
449 AC_CHECK_LIB([m],[casinhl],[AC_DEFINE([HAVE_CASINHL],[1],[libm includes casinhl])])
450 AC_CHECK_LIB([m],[casinl],[AC_DEFINE([HAVE_CASINL],[1],[libm includes casinl])])
451 AC_CHECK_LIB([m],[catan],[AC_DEFINE([HAVE_CATAN],[1],[libm includes catan])])
452 AC_CHECK_LIB([m],[catanf],[AC_DEFINE([HAVE_CATANF],[1],[libm includes catanf])])
453 AC_CHECK_LIB([m],[catanh],[AC_DEFINE([HAVE_CATANH],[1],[libm includes catanh])])
454 AC_CHECK_LIB([m],[catanhf],[AC_DEFINE([HAVE_CATANHF],[1],[libm includes catanhf])])
455 AC_CHECK_LIB([m],[catanhl],[AC_DEFINE([HAVE_CATANHL],[1],[libm includes catanhl])])
456 AC_CHECK_LIB([m],[catanl],[AC_DEFINE([HAVE_CATANL],[1],[libm includes catanl])])
458 # On AIX, clog is present in libm as __clog
459 AC_CHECK_LIB([m],[__clog],[AC_DEFINE([HAVE_CLOG],[1],[libm includes clog])])
461 # Check whether the system has a working stat()
462 LIBGFOR_CHECK_WORKING_STAT
464 # Check whether __mingw_snprintf() is present
465 LIBGFOR_CHECK_MINGW_SNPRINTF
467 # Check for a broken powf implementation
468 LIBGFOR_CHECK_FOR_BROKEN_POWF
470 # Check whether libquadmath should be used
471 AC_ARG_ENABLE(libquadmath-support,
472 AS_HELP_STRING([--disable-libquadmath-support],
473 [disable libquadmath support for Fortran]),
474 ENABLE_LIBQUADMATH_SUPPORT=$enableval,
475 ENABLE_LIBQUADMATH_SUPPORT=yes)
476 enable_libquadmath_support=
477 if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
478 enable_libquadmath_support=no
481 # Check whether we have a __float128 type, depends on enable_libquadmath_support
482 LIBGFOR_CHECK_FLOAT128
484 # Check for GNU libc feenableexcept
485 AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENABLEEXCEPT],[1],[libm includes feenableexcept])])
487 # At least for glibc, clock_gettime is in librt. But don't pull that
488 # in if it still doesn't give us the function we want.
489 # This test is copied from libgomp, and modified to not link in -lrt
490 # as libgfortran calls clock_gettime via a weak reference.
491 if test $ac_cv_func_clock_gettime = no; then
492 AC_CHECK_LIB(rt, clock_gettime,
493 [AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
494 [Define to 1 if you have the `clock_gettime' function.])])
497 # Check for SysV fpsetmask
498 LIBGFOR_CHECK_FPSETMASK
500 # Check for AIX fp_trap and fp_enable
501 AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])
502 AC_CHECK_FUNC([fp_enable],[have_fp_enable=yes AC_DEFINE([HAVE_FP_ENABLE],[1],[fp_enable is present])])
504 # Runs configure.host to set up necessary host-dependent shell variables.
505 # We then display a message about it, and propagate them through the
507 . ${srcdir}/configure.host
508 AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h])
509 FPU_HOST_HEADER=config/${fpu_host}.h
510 AC_SUBST(FPU_HOST_HEADER)
512 # Some targets require additional compiler options for IEEE compatibility.
513 IEEE_FLAGS="${ieee_flags}"
517 # Check for POSIX getpwuid_r
519 # There are two versions of getpwuid_r, the POSIX one with 5
520 # arguments, and another one with 4 arguments used by at least HP-UX
522 if test "$ac_cv_func_getpwuid_r" = "yes"; then
523 AC_CACHE_CHECK([POSIX version of getpwuid_r with 5 arguments], libgfor_cv_posix_getpwuid_r, [
524 AC_LINK_IFELSE([AC_LANG_PROGRAM([
526 #include <sys/types.h>
528 getpwuid_r(0, NULL, NULL, 0, NULL);
529 ])], [libgfor_cv_posix_getpwuid_r="yes"], [libgfor_cv_posix_getpwuid_r="no"])])
531 if test "$libgfor_cv_posix_getpwuid_r" = "yes"; then
532 AC_DEFINE([HAVE_POSIX_GETPWUID_R], [1], [Define to 1 if we have POSIX getpwuid_r which takes 5 arguments.])
536 # Check out attribute support.
537 LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
538 LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT
539 LIBGFOR_CHECK_ATTRIBUTE_ALIAS
541 # Check out sync builtins support.
542 LIBGFOR_CHECK_SYNC_FETCH_AND_ADD
544 # Check out thread support.
545 LIBGFOR_CHECK_GTHR_DEFAULT
547 # Check out #pragma weak.
550 # Various other checks on target
551 LIBGFOR_CHECK_UNLINK_OPEN_FILE
553 # Check whether line terminator is LF or CRLF
558 if test ${multilib} = yes; then
559 multilib_arg="--enable-multilib"
564 # Write our Makefile and spec file.