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)
12 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
13 AC_ARG_ENABLE(version-specific-runtime-libs,
14 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
16 yes) version_specific_libs=yes ;;
17 no) version_specific_libs=no ;;
18 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
20 [version_specific_libs=no])
21 AC_MSG_RESULT($version_specific_libs)
24 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
26 # You will slowly go insane if you do not grok the following fact: when
27 # building this library, the top-level /target/ becomes the library's /host/.
29 # configure then causes --target to default to --host, exactly like any
30 # other package using autoconf. Therefore, 'target' and 'host' will
31 # always be the same. This makes sense both for native and cross compilers
32 # just think about it for a little while. :-)
34 # Also, if this library is being configured as part of a cross compiler, the
35 # top-level configure script will pass the "real" host as $with_cross_host.
37 # Do not delete or change the following two lines. For why, see
38 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
40 target_alias=${target_alias-$host_alias}
42 # Sets up automake. Must come after AC_CANONICAL_SYSTEM. Each of the
43 # following is magically included in AUTOMAKE_OPTIONS in each Makefile.am.
44 # 1.8.2: minimum required version
45 # no-define: PACKAGE and VERSION will not be #define'd in config.h (a bunch
46 # of other PACKAGE_* variables will, however, and there's nothing
47 # we can do about that; they come from AC_INIT).
48 # foreign: we don't follow the normal rules for GNU packages (no COPYING
49 # file in the top srcdir, etc, etc), so stop complaining.
50 # no-dependencies: turns off auto dependency generation (just for now)
51 # -Wall: turns on all automake warnings...
52 # -Wno-portability: ...except this one, since GNU make is required.
53 AM_INIT_AUTOMAKE([1.8.2 no-define foreign no-dependencies -Wall -Wno-portability])
56 AM_ENABLE_MULTILIB(, ..)
58 # Handy for debugging:
59 #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
61 # Are we being configured with some form of cross compiler?
62 # NB: We don't actually need to know this just now, but when, say, a test
63 # suite is included, we'll have to know.
64 if test "$build" != "$host"; then
65 LIBGFOR_IS_NATIVE=false
68 LIBGFOR_IS_NATIVE=true
71 # Process the option "--enable-version-specific-runtime-libs"
72 gcc_version_trigger=${srcdir}/../gcc/version.c
73 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
74 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
77 # Calculate toolexeclibdir
78 # Also toolexecdir, though it's only used in toolexeclibdir
79 case ${version_specific_libs} in
81 # Need the gcc compiler version to know where to install libraries
82 # and header files if --enable-version-specific-runtime-libs option
84 toolexecdir='$(libdir)/gcc/$(target_alias)'
85 toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
88 if test -n "$with_cross_host" &&
89 test x"$with_cross_host" != x"no"; then
90 # Install a library built with a cross compiler in tooldir, not libdir.
91 toolexecdir='$(exec_prefix)/$(target_alias)'
92 toolexeclibdir='$(toolexecdir)/lib'
94 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
95 toolexeclibdir='$(libdir)'
97 multi_os_directory=`$CC -print-multi-os-directory`
98 case $multi_os_directory in
99 .) ;; # Avoid trailing /.
100 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
104 AC_SUBST(toolexecdir)
105 AC_SUBST(toolexeclibdir)
107 # Check the compiler.
108 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
109 # We must force CC to /not/ be precious variables; otherwise
110 # the wrong, non-multilib-adjusted value will be used in multilibs.
111 # As a side effect, we have to subst CFLAGS ourselves.
113 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
114 m4_define([_AC_ARG_VAR_PRECIOUS],[])
116 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
120 # Add -Wall if we are using GCC.
121 if test "x$GCC" = "xyes"; then
122 CFLAGS="$CFLAGS -Wall"
125 # Find other programs we need.
126 AC_CHECK_TOOL(AS, as)
127 AC_CHECK_TOOL(AR, ar)
128 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
133 #AC_MSG_NOTICE([====== Starting libtool configuration])
136 AC_SUBST(enable_shared)
137 AC_SUBST(enable_static)
138 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
140 # We need gfortran to compile parts of the library
141 # We can't use AC_PROG_F77 because it expects a fully working gfortran.
142 #AC_PROG_F77(gfortran)
144 AC_PROG_F77(gfortran)
145 FFLAGS="$FFLAGS -Wall -fno-repack-arrays -fno-underscoring"
153 AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h)
154 AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h)
155 AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
157 # Check for complex math functions
158 AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
160 # Check for library functions.
161 AC_CHECK_FUNCS(getrusage times)
163 # Check libc for getgid, getpid, getuid
164 AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
165 AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
166 AC_CHECK_LIB([c],[getuid],[AC_DEFINE([HAVE_GETUID],[1],[libc includes getuid])])
168 # Check for C99 (and other IEEE) math functions
169 # ??? This list seems awful long. Is there a better way to test for these?
170 AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
171 AC_CHECK_LIB([m],[asinf],[AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
172 AC_CHECK_LIB([m],[atan2f],[AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
173 AC_CHECK_LIB([m],[atanf],[AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
174 AC_CHECK_LIB([m],[ceilf],[AC_DEFINE([HAVE_CEILF],[1],[libm includes ceilf])])
175 AC_CHECK_LIB([m],[copysignf],[AC_DEFINE([HAVE_COPYSIGNF],[1],[libm includes copysignf])])
176 AC_CHECK_LIB([m],[cosf],[AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])])
177 AC_CHECK_LIB([m],[coshf],[AC_DEFINE([HAVE_COSHF],[1],[libm includes coshf])])
178 AC_CHECK_LIB([m],[expf],[AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])])
179 AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
180 AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])])
181 AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
182 AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
183 AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
184 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
185 AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
186 AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
187 AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
188 AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes scalbnf])])
189 AC_CHECK_LIB([m],[sinf],[AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
190 AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
191 AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
192 AC_CHECK_LIB([m],[tanf],[AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
193 AC_CHECK_LIB([m],[tanhf],[AC_DEFINE([HAVE_TANHF],[1],[libm includes tanhf])])
194 AC_CHECK_LIB([m],[erf],[AC_DEFINE([HAVE_ERF],[1],[libm includes erf])])
195 AC_CHECK_LIB([m],[erfc],[AC_DEFINE([HAVE_ERFC],[1],[libm includes erfc])])
196 AC_CHECK_LIB([m],[erfcf],[AC_DEFINE([HAVE_ERFCF],[1],[libm includes erfcf])])
197 AC_CHECK_LIB([m],[erff],[AC_DEFINE([HAVE_ERFF],[1],[libm includes erff])])
198 AC_CHECK_LIB([m],[j0],[AC_DEFINE([HAVE_J0],[1],[libm includes j0])])
199 AC_CHECK_LIB([m],[j0f],[AC_DEFINE([HAVE_J0F],[1],[libm includes j0f])])
200 AC_CHECK_LIB([m],[j1],[AC_DEFINE([HAVE_J1],[1],[libm includes j1])])
201 AC_CHECK_LIB([m],[j1f],[AC_DEFINE([HAVE_J1F],[1],[libm includes j1f])])
202 AC_CHECK_LIB([m],[jn],[AC_DEFINE([HAVE_JN],[1],[libm includes jn])])
203 AC_CHECK_LIB([m],[jnf],[AC_DEFINE([HAVE_JNF],[1],[libm includes jnf])])
204 AC_CHECK_LIB([m],[y0],[AC_DEFINE([HAVE_Y0],[1],[libm includes y0])])
205 AC_CHECK_LIB([m],[y0f],[AC_DEFINE([HAVE_Y0F],[1],[libm includes y0f])])
206 AC_CHECK_LIB([m],[y1],[AC_DEFINE([HAVE_Y1],[1],[libm includes y1])])
207 AC_CHECK_LIB([m],[y1f],[AC_DEFINE([HAVE_Y1F],[1],[libm includes y1f])])
208 AC_CHECK_LIB([m],[yn],[AC_DEFINE([HAVE_YN],[1],[libm includes yn])])
209 AC_CHECK_LIB([m],[ynf],[AC_DEFINE([HAVE_YNF],[1],[libm includes ynf])])
211 # Let the user override this
213 AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
214 [need_math=$enableval])
215 if test "$need_math" = "yes"; then
216 AC_MSG_NOTICE([Including complex math functions in libgfor]);
217 extra_math_obj='$(gfor_cmath_obj)'
220 AC_SUBST([MATH_OBJ],["$extra_math_obj"])
222 # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
223 # for struct timezone, as you might think. We also need to check how
224 # to call gettimeofday if we have it.
229 if test ${multilib} = yes; then
230 multilib_arg="--enable-multilib"
235 # Write our Makefile.
236 AC_CONFIG_FILES(Makefile)