configure.ac 24 KB

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