OSDN Git Service

* c-common.h (check_case_value): Remove prototype.
[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_F77 because it expects a fully working gfortran.
142 #AC_PROG_F77(gfortran)
143 F77="$GFORTRAN"
144 AC_PROG_F77(gfortran)
145 FFLAGS="$FFLAGS -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_HEADER([complex.h],[AC_DEFINE([HAVE_COMPLEX_H], [1], [complex.h exists])])
156
157 # Check for complex math functions
158 AC_CHECK_LIB([m],[csin],[need_math="no"],[need_math="yes"])
159
160 # Check for library functions.
161 AC_CHECK_FUNCS(getrusage times)
162
163 # Check for some C99 functions
164 AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],["c99 function"])])
165 AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],["c99 function"])])
166 # And other IEEE math functions
167 AC_CHECK_LIB([m],[nextafter],[AC_DEFINE([HAVE_NEXTAFTER],[1],[libm includes nextafter])])
168 AC_CHECK_LIB([m],[nextafterf],[AC_DEFINE([HAVE_NEXTAFTERF],[1],[libm includes nextafterf])])
169
170 # Let the user override this
171 AC_ARG_ENABLE(cmath,
172         AC_HELP_STRING([--enable-cmath],[Include complex math functions]),
173         [need_math=$enableval])
174 if test "$need_math" = "yes"; then
175         AC_MSG_NOTICE([Including complex math functions in libgfor]);
176   extra_math_obj='$(gfor_cmath_obj)'
177 fi
178
179 AC_SUBST([MATH_OBJ],["$extra_math_obj"])
180
181 # The standard autoconf HAVE_STRUCT_TIMEZONE doesn't actually check
182 # for struct timezone, as you might think.  We also need to check how
183 # to call gettimeofday if we have it.
184 LIBGFOR_GETTIMEOFDAY
185
186 AC_CACHE_SAVE
187
188 if test ${multilib} = yes; then
189   multilib_arg="--enable-multilib"
190 else
191   multilib_arg=
192 fi
193
194 # Write our Makefile.
195 AC_CONFIG_FILES(Makefile)
196 AC_OUTPUT