OSDN Git Service

PR fortran/18218
[pf3gnuchains/gcc-fork.git] / libgfortran / configure.ac
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 # -------
9 # Options
10 # -------
11
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 ],
15 [case "$enableval" in
16  yes) version_specific_libs=yes ;;
17  no)  version_specific_libs=no ;;
18  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
19  esac],
20 [version_specific_libs=no])
21 AC_MSG_RESULT($version_specific_libs)
22
23
24 # Gets build, host, target, *_vendor, *_cpu, *_os, etc.
25 #
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/.
28 #
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.  :-)
33 #
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.
36 #
37 # Do not delete or change the following two lines.  For why, see
38 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
39 AC_CANONICAL_SYSTEM
40 target_alias=${target_alias-$host_alias}
41
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])
54
55 AM_MAINTAINER_MODE
56 AM_ENABLE_MULTILIB(, ..)
57
58 # Handy for debugging:
59 #AC_MSG_NOTICE($build / $host / $target / $host_alias / $target_alias); sleep 5
60
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
66   GCC_NO_EXECUTABLES
67 else
68   LIBGFOR_IS_NATIVE=true
69 fi
70
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/'`
75 AC_SUBST(gcc_version)
76
77 # Calculate toolexeclibdir
78 # Also toolexecdir, though it's only used in toolexeclibdir
79 case ${version_specific_libs} in
80   yes)
81     # Need the gcc compiler version to know where to install libraries
82     # and header files if --enable-version-specific-runtime-libs option
83     # is selected.
84     toolexecdir='$(libdir)/gcc/$(target_alias)'
85     toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
86     ;;
87   no)
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'
93     else
94       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
95       toolexeclibdir='$(libdir)'
96     fi
97     multi_os_directory=`$CC -print-multi-os-directory`
98     case $multi_os_directory in
99       .) ;; # Avoid trailing /.
100       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
101     esac
102     ;;
103 esac
104 AC_SUBST(toolexecdir)
105 AC_SUBST(toolexeclibdir)
106
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.
112
113 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
114 m4_define([_AC_ARG_VAR_PRECIOUS],[])
115 AC_PROG_CC
116 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
117
118 AC_SUBST(CFLAGS)
119
120 # Add -Wall if we are using GCC.
121 if test "x$GCC" = "xyes"; then
122   CFLAGS="$CFLAGS -Wall"
123 fi
124
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)
129 AC_PROG_MAKE_SET
130 AC_PROG_INSTALL
131
132 # Configure libtool
133 #AC_MSG_NOTICE([====== Starting libtool configuration])
134 AC_LIBTOOL_DLOPEN
135 AM_PROG_LIBTOOL
136 AC_SUBST(enable_shared)
137 AC_SUBST(enable_static)
138 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
139
140 # We need gfortran to compile parts of the library
141 # We can't use AC_PROG_FC because it expects a fully working gfortran.
142 #AC_PROG_FC(gfortran)
143 FC="$GFORTRAN"
144 AC_PROG_FC(gfortran)
145 FCFLAGS="$FCFLAGS -Wall -fno-repack-arrays -fno-underscoring"
146
147 AC_SYS_LARGEFILE
148 AC_FUNC_MMAP
149 AC_TYPE_OFF_T
150
151 # check header files
152 AC_STDC_HEADERS
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_HEADERS(sys/mman.h)
156 AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
157
158 # Check for complex math functions
159 AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
160
161 # Check for library functions.
162 AC_CHECK_FUNCS(getrusage times mkstemp strtof)
163
164 # Check libc for getgid, getpid, getuid
165 AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
166 AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])
167 AC_CHECK_LIB([c],[getuid],[AC_DEFINE([HAVE_GETUID],[1],[libc includes getuid])])
168
169 # Check for C99 (and other IEEE) math functions
170 # ??? This list seems awful long. Is there a better way to test for these?
171 AC_CHECK_LIB([m],[acosf],[AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
172 AC_CHECK_LIB([m],[asinf],[AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
173 AC_CHECK_LIB([m],[atan2f],[AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
174 AC_CHECK_LIB([m],[atanf],[AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
175 AC_CHECK_LIB([m],[ceilf],[AC_DEFINE([HAVE_CEILF],[1],[libm includes ceilf])])
176 AC_CHECK_LIB([m],[copysignf],[AC_DEFINE([HAVE_COPYSIGNF],[1],[libm includes copysignf])])
177 AC_CHECK_LIB([m],[cosf],[AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])])
178 AC_CHECK_LIB([m],[coshf],[AC_DEFINE([HAVE_COSHF],[1],[libm includes coshf])])
179 AC_CHECK_LIB([m],[expf],[AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])])
180 AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
181 AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])])
182 AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
183 AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
184 AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
185 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
186 AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
187 AC_CHECK_LIB([m],[powf],[AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
188 AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
189 AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
190 AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes scalbnf])])
191 AC_CHECK_LIB([m],[sinf],[AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
192 AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
193 AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
194 AC_CHECK_LIB([m],[tanf],[AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
195 AC_CHECK_LIB([m],[tanhf],[AC_DEFINE([HAVE_TANHF],[1],[libm includes tanhf])])
196 AC_CHECK_LIB([m],[erf],[AC_DEFINE([HAVE_ERF],[1],[libm includes erf])])
197 AC_CHECK_LIB([m],[erfc],[AC_DEFINE([HAVE_ERFC],[1],[libm includes erfc])])
198 AC_CHECK_LIB([m],[erfcf],[AC_DEFINE([HAVE_ERFCF],[1],[libm includes erfcf])])
199 AC_CHECK_LIB([m],[erff],[AC_DEFINE([HAVE_ERFF],[1],[libm includes erff])])
200 AC_CHECK_LIB([m],[j0],[AC_DEFINE([HAVE_J0],[1],[libm includes j0])])
201 AC_CHECK_LIB([m],[j0f],[AC_DEFINE([HAVE_J0F],[1],[libm includes j0f])])
202 AC_CHECK_LIB([m],[j1],[AC_DEFINE([HAVE_J1],[1],[libm includes j1])])
203 AC_CHECK_LIB([m],[j1f],[AC_DEFINE([HAVE_J1F],[1],[libm includes j1f])])
204 AC_CHECK_LIB([m],[jn],[AC_DEFINE([HAVE_JN],[1],[libm includes jn])])
205 AC_CHECK_LIB([m],[jnf],[AC_DEFINE([HAVE_JNF],[1],[libm includes jnf])])
206 AC_CHECK_LIB([m],[y0],[AC_DEFINE([HAVE_Y0],[1],[libm includes y0])])
207 AC_CHECK_LIB([m],[y0f],[AC_DEFINE([HAVE_Y0F],[1],[libm includes y0f])])
208 AC_CHECK_LIB([m],[y1],[AC_DEFINE([HAVE_Y1],[1],[libm includes y1])])
209 AC_CHECK_LIB([m],[y1f],[AC_DEFINE([HAVE_Y1F],[1],[libm includes y1f])])
210 AC_CHECK_LIB([m],[yn],[AC_DEFINE([HAVE_YN],[1],[libm includes yn])])
211 AC_CHECK_LIB([m],[ynf],[AC_DEFINE([HAVE_YNF],[1],[libm includes ynf])])
212
213 # Let the user override this
214 AC_ARG_ENABLE(cmath,
215         AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
216         [need_math=$enableval])
217 if test "$need_math" = "yes"; then
218         AC_MSG_NOTICE([Including complex math functions in libgfor]);
219   extra_math_obj='$(gfor_cmath_obj)'
220 fi
221
222 AC_SUBST([MATH_OBJ],["$extra_math_obj"])
223
224 # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
225 # for struct timezone, as you might think.  We also need to check how
226 # to call gettimeofday if we have it.
227 LIBGFOR_GETTIMEOFDAY
228
229 AC_CACHE_SAVE
230
231 if test ${multilib} = yes; then
232   multilib_arg="--enable-multilib"
233 else
234   multilib_arg=
235 fi
236
237 # Write our Makefile.
238 AC_CONFIG_FILES(Makefile)
239 AC_OUTPUT