]>
Commit | Line | Data |
---|---|---|
96b8a615 AJ |
1 | # Process this file with autoconf to produce a configure script, like so: |
2 | # aclocal && autoconf && autoheader && automake | |
3 | ||
4 | AC_PREREQ(2.59) | |
5 | AC_INIT([GNU Fortran Runtime Library], 0.2,,[libgfortran]) | |
6 | AC_CONFIG_HEADER(config.h) | |
7 | ||
8 | # For libtool versioning info, format is CURRENT:REVISION:AGE | |
9 | libtool_VERSION=6:0:0 | |
10 | AC_SUBST(libtool_VERSION) | |
11 | ||
12 | # ------- | |
13 | # Options | |
14 | # ------- | |
15 | ||
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 ], | |
19 | [case "$enableval" in | |
20 | yes) version_specific_libs=yes ;; | |
21 | no) version_specific_libs=no ;; | |
22 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
23 | esac], | |
24 | [version_specific_libs=no]) | |
25 | AC_MSG_RESULT($version_specific_libs) | |
26 | ||
27 | ||
28 | # Gets build, host, target, *_vendor, *_cpu, *_os, etc. | |
29 | # | |
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/. | |
32 | # | |
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. :-) | |
37 | # | |
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. | |
40 | # | |
41 | # Do not delete or change the following two lines. For why, see | |
42 | # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html | |
43 | AC_CANONICAL_SYSTEM | |
44 | target_alias=${target_alias-$host_alias} | |
45 | ||
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]) | |
58 | ||
59 | AM_MAINTAINER_MODE | |
60 | AM_ENABLE_MULTILIB(, ..) | |
61 | ||
62 | # Handy for debugging: | |
63 | #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5 | |
64 | ||
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 | |
70 | GCC_NO_EXECUTABLES | |
71 | else | |
72 | LIBGFOR_IS_NATIVE=true | |
73 | fi | |
74 | ||
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/'` | |
79 | AC_SUBST(gcc_version) | |
80 | ||
81 | # Calculate toolexeclibdir | |
82 | # Also toolexecdir, though it's only used in toolexeclibdir | |
83 | case ${version_specific_libs} in | |
84 | yes) | |
85 | # Need the gcc compiler version to know where to install libraries | |
86 | # and header files if --enable-version-specific-runtime-libs option | |
87 | # is selected. | |
88 | toolexecdir='$(libdir)/gcc/$(target_alias)' | |
89 | toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' | |
90 | ;; | |
91 | no) | |
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' | |
97 | else | |
98 | toolexecdir='$(libdir)/gcc-lib/$(target_alias)' | |
99 | toolexeclibdir='$(libdir)' | |
100 | fi | |
101 | multi_os_directory=`$CC -print-multi-os-directory` | |
102 | case $multi_os_directory in | |
103 | .) ;; # Avoid trailing /. | |
104 | *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; | |
105 | esac | |
106 | ;; | |
107 | esac | |
108 | AC_SUBST(toolexecdir) | |
109 | AC_SUBST(toolexeclibdir) | |
110 | ||
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. | |
116 | ||
117 | m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) | |
118 | m4_define([_AC_ARG_VAR_PRECIOUS],[]) | |
119 | AC_PROG_CC | |
120 | m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) | |
121 | ||
122 | AC_SUBST(CFLAGS) | |
123 | ||
124 | # Add -Wall if we are using GCC. | |
125 | if test "x$GCC" = "xyes"; then | |
126 | CFLAGS="$CFLAGS -Wall" | |
127 | fi | |
128 | ||
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) | |
133 | AC_PROG_MAKE_SET | |
134 | AC_PROG_INSTALL | |
135 | ||
136 | # Configure libtool | |
137 | #AC_MSG_NOTICE([====== Starting libtool configuration]) | |
138 | AC_LIBTOOL_DLOPEN | |
139 | AM_PROG_LIBTOOL | |
140 | AC_SUBST(enable_shared) | |
141 | AC_SUBST(enable_static) | |
142 | #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10 | |
143 | ||
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) | |
147 | F77="$GFORTRAN" | |
148 | AC_PROG_F77(gfortran) | |
149 | FFLAGS="$FFLAGS -Wall -fno-repack-arrays -fno-underscoring" | |
150 | ||
151 | AC_FUNC_MMAP | |
152 | AC_TYPE_OFF_T | |
153 | ||
154 | # check header files | |
155 | AC_STDC_HEADERS | |
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])]) | |
159 | ||
160 | # Check for complex math functions | |
161 | AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"]) | |
162 | ||
163 | # Check for complex math functions in -lmx also | |
164 | AC_CHECK_LIB([mx],[csin],[need_math="no"],[need_math="yes"]) | |
165 | ||
166 | # Check for library functions. | |
167 | AC_CHECK_FUNCS(getrusage times) | |
168 | ||
169 | # Let the user override this | |
170 | AC_ARG_ENABLE(cmath, | |
171 | AC_HELP_STRING([--enable-cmath],[Include complex math functions]), | |
172 | [need_math=$enableval]) | |
173 | if test "$need_math" = "yes"; then | |
174 | AC_MSG_NOTICE([Including complex math functions in libgfor]); | |
175 | extra_math_obj='$(gfor_cmath_obj)' | |
176 | fi | |
177 | ||
178 | AC_SUBST([MATH_OBJ],["$extra_math_obj"]) | |
179 | ||
180 | # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check | |
181 | # for struct timezone, as you might think. We also need to check how | |
182 | # to call gettimeofday if we have it. | |
183 | LIBGFOR_GETTIMEOFDAY | |
184 | ||
185 | AC_CACHE_SAVE | |
186 | ||
187 | if test ${multilib} = yes; then | |
188 | multilib_arg="--enable-multilib" | |
189 | else | |
190 | multilib_arg= | |
191 | fi | |
192 | ||
193 | # Write our Makefile. | |
194 | AC_CONFIG_FILES(Makefile) | |
195 | AC_OUTPUT |