OSDN Git Service

e9fea87d1fc0acccb1d6a6b077568eda4f2abb0b
[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 # Calculate toolexeclibdir
72 # Also toolexecdir, though it's only used in toolexeclibdir
73 case ${version_specific_libs} in
74   yes)
75     # Need the gcc compiler version to know where to install libraries
76     # and header files if --enable-version-specific-runtime-libs option
77     # is selected.
78     toolexecdir='$(libdir)/gcc/$(target_alias)'
79     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
80     ;;
81   no)
82     if test -n "$with_cross_host" &&
83        test x"$with_cross_host" != x"no"; then
84       # Install a library built with a cross compiler in tooldir, not libdir.
85       toolexecdir='$(exec_prefix)/$(target_alias)'
86       toolexeclibdir='$(toolexecdir)/lib'
87     else
88       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
89       toolexeclibdir='$(libdir)'
90     fi
91     multi_os_directory=`$CC -print-multi-os-directory`
92     case $multi_os_directory in
93       .) ;; # Avoid trailing /.
94       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
95     esac
96     ;;
97 esac
98 AC_SUBST(toolexecdir)
99 AC_SUBST(toolexeclibdir)
100
101 # Check the compiler.
102 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
103 # We must force CC to /not/ be precious variables; otherwise
104 # the wrong, non-multilib-adjusted value will be used in multilibs.
105 # As a side effect, we have to subst CFLAGS ourselves.
106
107 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
108 m4_define([_AC_ARG_VAR_PRECIOUS],[])
109 AC_PROG_CC
110 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
111
112 AC_SUBST(CFLAGS)
113
114 # Add -Wall if we are using GCC.
115 if test "x$GCC" = "xyes"; then
116   CFLAGS="$CFLAGS -Wall"
117 fi
118
119 # Find other programs we need.
120 AC_CHECK_TOOL(AS, as)
121 AC_CHECK_TOOL(AR, ar)
122 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
123 AC_PROG_MAKE_SET
124 AC_PROG_INSTALL
125
126 # Configure libtool
127 #AC_MSG_NOTICE([====== Starting libtool configuration])
128 AC_LIBTOOL_DLOPEN
129 AM_PROG_LIBTOOL
130 AC_SUBST(enable_shared)
131 AC_SUBST(enable_static)
132 #AC_MSG_NOTICE([====== Finished libtool configuration]) ; sleep 10
133
134 # We need gfortran to compile parts of the library
135 # We can't use AC_PROG_FC because it expects a fully working gfortran.
136 #AC_PROG_FC(gfortran)
137 FC="$GFORTRAN"
138 AC_PROG_FC(gfortran)
139 FCFLAGS="$FCFLAGS -Wall -fno-repack-arrays -fno-underscoring"
140
141 AC_SYS_LARGEFILE
142 AC_FUNC_MMAP
143 AC_TYPE_OFF_T
144
145 # check header files
146 AC_STDC_HEADERS
147 AC_HAVE_HEADERS(stdlib.h stdio.h string.h stddef.h math.h unistd.h signal.h)
148 AC_CHECK_HEADERS(time.h sys/params.h sys/time.h sys/times.h sys/resource.h)
149 AC_CHECK_HEADERS(sys/mman.h sys/types.h sys/stat.h ieeefp.h)
150 AC_CHECK_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
151
152 AC_CHECK_MEMBERS([struct stat.st_blksize])
153 AC_CHECK_MEMBERS([struct stat.st_blocks])
154 AC_CHECK_MEMBERS([struct stat.st_rdev])
155
156 # Check for complex math functions
157 AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
158
159 # Check for library functions.
160 AC_CHECK_FUNCS(getrusage times mkstemp strtof snprintf)
161 AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
162 AC_CHECK_FUNCS(sleep time)
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],[fabsf],[AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])])
181 AC_CHECK_LIB([m],[floorf],[AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
182 AC_CHECK_LIB([m],[frexpf],[AC_DEFINE([HAVE_FREXPF],[1],[libm includes frexpf])])
183 AC_CHECK_LIB([m],[hypotf],[AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
184 AC_CHECK_LIB([m],[logf],[AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
185 AC_CHECK_LIB([m],[log10f],[AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
186 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
187 AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
188 AC_CHECK_LIB([m],[powf],[AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
189 AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
190 AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
191 AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes scalbnf])])
192 AC_CHECK_LIB([m],[sinf],[AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
193 AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
194 AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
195 AC_CHECK_LIB([m],[tanf],[AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
196 AC_CHECK_LIB([m],[tanhf],[AC_DEFINE([HAVE_TANHF],[1],[libm includes tanhf])])
197 AC_CHECK_LIB([m],[erf],[AC_DEFINE([HAVE_ERF],[1],[libm includes erf])])
198 AC_CHECK_LIB([m],[erfc],[AC_DEFINE([HAVE_ERFC],[1],[libm includes erfc])])
199 AC_CHECK_LIB([m],[erfcf],[AC_DEFINE([HAVE_ERFCF],[1],[libm includes erfcf])])
200 AC_CHECK_LIB([m],[erff],[AC_DEFINE([HAVE_ERFF],[1],[libm includes erff])])
201 AC_CHECK_LIB([m],[j0],[AC_DEFINE([HAVE_J0],[1],[libm includes j0])])
202 AC_CHECK_LIB([m],[j0f],[AC_DEFINE([HAVE_J0F],[1],[libm includes j0f])])
203 AC_CHECK_LIB([m],[j1],[AC_DEFINE([HAVE_J1],[1],[libm includes j1])])
204 AC_CHECK_LIB([m],[j1f],[AC_DEFINE([HAVE_J1F],[1],[libm includes j1f])])
205 AC_CHECK_LIB([m],[jn],[AC_DEFINE([HAVE_JN],[1],[libm includes jn])])
206 AC_CHECK_LIB([m],[jnf],[AC_DEFINE([HAVE_JNF],[1],[libm includes jnf])])
207 AC_CHECK_LIB([m],[y0],[AC_DEFINE([HAVE_Y0],[1],[libm includes y0])])
208 AC_CHECK_LIB([m],[y0f],[AC_DEFINE([HAVE_Y0F],[1],[libm includes y0f])])
209 AC_CHECK_LIB([m],[y1],[AC_DEFINE([HAVE_Y1],[1],[libm includes y1])])
210 AC_CHECK_LIB([m],[y1f],[AC_DEFINE([HAVE_Y1F],[1],[libm includes y1f])])
211 AC_CHECK_LIB([m],[yn],[AC_DEFINE([HAVE_YN],[1],[libm includes yn])])
212 AC_CHECK_LIB([m],[ynf],[AC_DEFINE([HAVE_YNF],[1],[libm includes ynf])])
213
214 # Fallback in case isfinite is not available.
215 AC_CHECK_LIB([m],[finite],[AC_DEFINE([HAVE_FINITE],[1],[libm includes finite])])
216
217 # Let the user override this
218 AC_ARG_ENABLE(cmath,
219         AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
220         [need_math=$enableval])
221 if test "$need_math" = "yes"; then
222         AC_MSG_NOTICE([Including complex math functions in libgfor]);
223   extra_math_obj='$(gfor_cmath_obj)'
224 fi
225
226 AC_SUBST([MATH_OBJ],["$extra_math_obj"])
227
228 # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
229 # for struct timezone, as you might think.  We also need to check how
230 # to call gettimeofday if we have it.
231 LIBGFOR_GETTIMEOFDAY
232
233 # Attempt to assert that the target is of common type in case we don't
234 # have C99 integer types at all.
235 LIBGFOR_TARGET_ILP32
236
237 # Check out attribute support.
238 LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
239 LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT
240 LIBGFOR_CHECK_ATTRIBUTE_ALIAS
241
242 AC_CACHE_SAVE
243
244 if test ${multilib} = yes; then
245   multilib_arg="--enable-multilib"
246 else
247   multilib_arg=
248 fi
249
250 # Write our Makefile.
251 AC_CONFIG_FILES(Makefile)
252 AC_OUTPUT