configure.ac 21 KB

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