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.2,,[libgfortran])
6 AC_CONFIG_HEADER(config.h)
8 # For libtool versioning info, format is CURRENT:REVISION:AGE
10 AC_SUBST(libtool_VERSION)
16 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
17 AC_ARG_ENABLE(version-specific-runtime-libs,
18 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
20 yes) version_specific_libs=yes ;;
21 no) version_specific_libs=no ;;
22 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
24 [version_specific_libs=no])
25 AC_MSG_RESULT($version_specific_libs)
28 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
30 # You will slowly go insane if you do not grok the following fact: when
31 # building this library, the top-level /target/ becomes the library's /host/.
33 # configure then causes --target to default to --host, exactly like any
34 # other package using autoconf. Therefore, 'target' and 'host' will
35 # always be the same. This makes sense both for native and cross compilers
36 # just think about it for a little while. :-)
38 # Also, if this library is being configured as part of a cross compiler, the
39 # top-level configure script will pass the "real" host as $with_cross_host.
41 # Do not delete or change the following two lines. For why, see
42 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
44 target_alias=${target_alias-$host_alias}
46 # Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
47 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
48 # 1.8.2: minimum required version
49 # no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
50 # of other PACKAGE_* variables will, however, and there's nothing
51 # we can do about that; they come from AC_INIT).
52 # foreign: we don't follow the normal rules for GNU packages (no COPYING
53 # file in the top srcdir, etc, etc), so stop complaining.
54 # no-dependencies: turns off auto dependency generation (just for now)
55 # -Wall: turns on all automake warnings...
56 # -Wno-portability: ...except this one, since GNU make is required.
57 AM_INIT_AUTOMAKE([1.8.2 no-define foreign no-dependencies -Wall -Wno-portability])
60 AM_ENABLE_MULTILIB(, ..)
62 # Handy for debugging:
63 #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
65 # Are we being configured with some form of cross compiler?
66 # NB: We don't actually need to know this just now, but when, say, a test
67 # suite is included, we'll have to know.
68 if test "$build" != "$host"; then
69 LIBGFOR_IS_NATIVE=false
72 LIBGFOR_IS_NATIVE=true
75 # Process the option "--enable-version-specific-runtime-libs"
76 gcc_version_trigger=${srcdir}/../gcc/version.c
77 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
78 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
81 # Calculate toolexeclibdir
82 # Also toolexecdir, though it's only used in toolexeclibdir
83 case ${version_specific_libs} in
85 # Need the gcc compiler version to know where to install libraries
86 # and header files if --enable-version-specific-runtime-libs option
88 toolexecdir='$(libdir)/gcc/$(target_alias)'
89 toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
92 if test -n "$with_cross_host" &&
93 test x"$with_cross_host" != x"no"; then
94 # Install a library built with a cross compiler in tooldir, not libdir.
95 toolexecdir='$(exec_prefix)/$(target_alias)'
96 toolexeclibdir='$(toolexecdir)/lib'
98 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
99 toolexeclibdir='$(libdir)'
101 multi_os_directory=`$CC -print-multi-os-directory`
102 case $multi_os_directory in
103 .) ;; # Avoid trailing /.
104 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
108 AC_SUBST(toolexecdir)
109 AC_SUBST(toolexeclibdir)
111 # Check the compiler.
112 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
113 # We must force CC to /not/ be precious variables; otherwise
114 # the wrong, non-multilib-adjusted value will be used in multilibs.
115 # As a side effect, we have to subst CFLAGS ourselves.
117 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
118 m4_define([_AC_ARG_VAR_PRECIOUS],[])
120 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
124 # Add -Wall if we are using GCC.
125 if test "x$GCC" = "xyes"; then
126 CFLAGS="$CFLAGS -Wall"
129 # Find other programs we need.
130 AC_CHECK_TOOL(AS, as)
131 AC_CHECK_TOOL(AR, ar)
132 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
137 #AC_MSG_NOTICE([====== Starting libtool configuration])
140 AC_SUBST(enable_shared)
141 AC_SUBST(enable_static)
142 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
144 # We need gfortran to compile parts of the library
145 # We can't use AC_PROG_F77 because it expects a fully working gfortran.
146 #AC_PROG_F77(gfortran)
148 AC_PROG_F77(gfortran)
149 FFLAGS="$FFLAGS -Wall -fno-repack-arrays -fno-underscoring"
156 AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h)
157 AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h)
158 AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
160 # Check for complex math functions
161 AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
163 # Check for library functions.
164 AC_CHECK_FUNCS(getrusage times)
166 # Check for some C99 functions
167 AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],["c99 function"])])
168 AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],["c99 function"])])
169 # And other IEEE math functions
170 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
171 AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
173 # Let the user override this
175 AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
176 [need_math=$enableval])
177 if test "$need_math" = "yes"; then
178 AC_MSG_NOTICE([Including complex math functions in libgfor]);
179 extra_math_obj='$(gfor_cmath_obj)'
182 AC_SUBST([MATH_OBJ],["$extra_math_obj"])
184 # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
185 # for struct timezone, as you might think. We also need to check how
186 # to call gettimeofday if we have it.
191 if test ${multilib} = yes; then
192 multilib_arg="--enable-multilib"
197 # Write our Makefile.
198 AC_CONFIG_FILES(Makefile)