]> git.ipfire.org Git - thirdparty/gcc.git/blame - libquadmath/configure.ac
make mcore use constraints.md
[thirdparty/gcc.git] / libquadmath / configure.ac
CommitLineData
1ec601bf
FXC
1# Process this file with autoconf to produce a configure script, like so:
2# aclocal && autoconf && autoheader && automake
3
4AC_PREREQ(2.64)
5AC_INIT([GCC Quad-precision Math Library], 0.1,,[libquadmath])
6AC_CONFIG_HEADER(config.h)
7
8# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
9#
10# You will slowly go insane if you do not grok the following fact: when
11# building this library, the top-level /target/ becomes the library's /host/.
12#
13# configure then causes --target to default to --host, exactly like any
14# other package using autoconf. Therefore, 'target' and 'host' will
15# always be the same. This makes sense both for native and cross compilers
16# just think about it for a little while. :-)
17#
18# Also, if this library is being configured as part of a cross compiler, the
19# top-level configure script will pass the "real" host as $with_cross_host.
20#
21# Do not delete or change the following two lines. For why, see
22# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
23AC_CANONICAL_SYSTEM
fabfcf5e
KT
24ACX_NONCANONICAL_TARGET
25
1ec601bf 26target_alias=${target_alias-$host_alias}
fabfcf5e 27AC_SUBST(target_alias)
1ec601bf 28
a6098a28 29AM_INIT_AUTOMAKE([1.9.0 foreign subdir-objects no-dist -Wall -Wno-override -Werror])
1ec601bf 30
1ec601bf
FXC
31AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
32AC_ARG_ENABLE(version-specific-runtime-libs,
4c993c44
TB
33AS_HELP_STRING([--enable-version-specific-runtime-libs],
34 [specify that runtime libraries should be installed in a compiler-specific directory]),
1ec601bf
FXC
35[case "$enableval" in
36 yes) version_specific_libs=yes ;;
37 no) version_specific_libs=no ;;
38 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
39 esac],
40[version_specific_libs=no])
41AC_MSG_RESULT($version_specific_libs)
42
fabfcf5e 43GCC_NO_EXECUTABLES
1ec601bf 44
4c993c44
TB
45# See if makeinfo has been installed and is modern enough
46# that we can use it.
47ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version],
48 [GNU texinfo.* \([0-9][0-9.]*\)],
49 [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*])
50AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes")
51
642d2873 52ACX_BUGURL([http://gcc.gnu.org/bugs.html])
4c993c44 53
1ec601bf
FXC
54# Configure libtool
55AM_PROG_LIBTOOL
7de6ba7a 56ACX_LT_HOST_FLAGS
1ec601bf
FXC
57AC_SUBST(enable_shared)
58AC_SUBST(enable_static)
59
60AM_MAINTAINER_MODE
61AM_ENABLE_MULTILIB(, ..)
62
fabfcf5e
KT
63AC_LANG_C
64# The same as in boehm-gc and libstdc++. Have to borrow it from there.
65# We must force CC to /not/ be precious variables; otherwise
66# the wrong, non-multilib-adjusted value will be used in multilibs.
67# As a side effect, we have to subst CFLAGS ourselves.
68
69m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
70m4_define([_AC_ARG_VAR_PRECIOUS],[])
71AC_PROG_CC
72m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
73
74AC_SUBST(CFLAGS)
75
76AM_PROG_CC_C_O
77
78if test "x$GCC" != "xyes"; then
79 AC_MSG_ERROR([libquadmath must be built with GCC])
80fi
81AC_PROG_CPP
82
1ec601bf
FXC
83# Calculate toolexeclibdir
84# Also toolexecdir, though it's only used in toolexeclibdir
85case ${version_specific_libs} in
86 yes)
87 # Need the gcc compiler version to know where to install libraries
88 # and header files if --enable-version-specific-runtime-libs option
89 # is selected.
90 toolexecdir='$(libdir)/gcc/$(target_alias)'
91 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
92 ;;
93 no)
94 if test -n "$with_cross_host" &&
95 test x"$with_cross_host" != x"no"; then
96 # Install a library built with a cross compiler in tooldir, not libdir.
97 toolexecdir='$(exec_prefix)/$(target_alias)'
98 toolexeclibdir='$(toolexecdir)/lib'
99 else
100 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
101 toolexeclibdir='$(libdir)'
102 fi
103 multi_os_directory=`$CC -print-multi-os-directory`
104 case $multi_os_directory in
105 .) ;; # Avoid trailing /.
106 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
107 esac
108 ;;
109esac
110AC_SUBST(toolexecdir)
111AC_SUBST(toolexeclibdir)
112
e8d42d28
JJ
113AC_CHECK_HEADERS(fenv.h)
114
6f468984
TB
115# If available, sqrtl and cbrtl speed up the calculation -
116# but they are not required
117if test x$gcc_no_link != xyes; then
118 AC_CHECK_LIB([m],[sqrtl],[AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])])
119 AC_CHECK_LIB([m],[cbrtl],[AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])])
e8d42d28
JJ
120 AC_CHECK_LIB([m],[feholdexcept],[AC_DEFINE([HAVE_FEHOLDEXCEPT],[1],[libm includes feholdexcept])])
121 AC_CHECK_LIB([m],[fesetround],[AC_DEFINE([HAVE_FESETROUND],[1],[libm includes fesetround])])
122 AC_CHECK_LIB([m],[feupdateenv],[AC_DEFINE([HAVE_FEUPDATEENV],[1],[libm includes feupdateenv])])
123 AC_CHECK_LIB([m],[fesetenv],[AC_DEFINE([HAVE_FESETENV],[1],[libm includes fesetenv])])
124 AC_CHECK_LIB([m],[fetestexcept],[AC_DEFINE([HAVE_FETESTEXCEPT],[1],[libm includes fetestexcept])])
6f468984
TB
125else
126 if test "x$ac_cv_lib_m_sqrtl" = x""yes; then
127 AC_DEFINE([HAVE_SQRTL],[1],[libm includes sqrtl])
128 fi
129 if test "x$ac_cv_lib_m_cbrtl" = x""yes; then
130 AC_DEFINE([HAVE_CBRTL],[1],[libm includes cbrtl])
131 fi
e8d42d28
JJ
132 if test "x$ac_cv_lib_m_feholdexcept" = x""yes; then
133 AC_DEFINE([HAVE_FEHOLDEXCEPT],[1],[libm includes feholdexcept])
134 fi
135 if test "x$ac_cv_lib_m_fesetround" = x""yes; then
136 AC_DEFINE([HAVE_FESETROUND],[1],[libm includes fesetround])
137 fi
138 if test "x$ac_cv_lib_m_feupdateenv" = x""yes; then
139 AC_DEFINE([HAVE_FEUPDATEENV],[1],[libm includes feupdateenv])
140 fi
141 if test "x$ac_cv_lib_m_fesetenv" = x""yes; then
142 AC_DEFINE([HAVE_FESETENV],[1],[libm includes fesetenv])
143 fi
144 if test "x$ac_cv_lib_m_fetestexcept" = x""yes; then
145 AC_DEFINE([HAVE_FETESTEXCEPT],[1],[libm includes fetestexcept])
146 fi
6f468984 147fi
1ec601bf
FXC
148
149# Check for symbol versioning (copied from libssp).
150AC_MSG_CHECKING([whether symbol versioning is supported])
fabfcf5e
KT
151if test x$gcc_no_link = xyes; then
152 # If we cannot link, we cannot build shared libraries, so do not use
153 # symbol versioning.
154 quadmath_use_symver=no
155else
156 save_LDFLAGS="$LDFLAGS"
157 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
158 cat > conftest.map <<EOF
1ec601bf
FXC
159FOO_1.0 {
160 global: *foo*; bar; local: *;
161};
162EOF
fabfcf5e
KT
163 AC_TRY_LINK([int foo;],[],[quadmath_use_symver=gnu],[quadmath_use_symver=no])
164 if test x$quadmath_use_symver = xno; then
165 case "$target_os" in
166 solaris2*)
167 LDFLAGS="$save_LDFLAGS"
168 LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map"
169 # Sun ld cannot handle wildcards and treats all entries as undefined.
170 cat > conftest.map <<EOF
1ec601bf
FXC
171FOO_1.0 {
172 global: foo; local: *;
173};
174EOF
fabfcf5e
KT
175 AC_TRY_LINK([int foo;],[],[quadmath_use_symver=sun],[quadmath_use_symver=no])
176 ;;
177 esac
178 fi
179 LDFLAGS="$save_LDFLAGS"
1ec601bf 180fi
1ec601bf
FXC
181AC_MSG_RESULT($quadmath_use_symver)
182AM_CONDITIONAL(LIBQUAD_USE_SYMVER, [test "x$quadmath_use_symver" != xno])
183AM_CONDITIONAL(LIBQUAD_USE_SYMVER_GNU, [test "x$quadmath_use_symver" = xgnu])
184AM_CONDITIONAL(LIBQUAD_USE_SYMVER_SUN, [test "x$quadmath_use_symver" = xsun])
185
abccc9a9
TB
186AC_CACHE_CHECK([whether __float128 is supported], [libquad_cv_have_float128],
187 [GCC_TRY_COMPILE_OR_LINK([
1ec601bf
FXC
188 typedef _Complex float __attribute__((mode(TC))) __complex128;
189
190 __float128 foo (__float128 x)
191 {
192
193 __complex128 z1, z2;
194
195 z1 = x;
196 z2 = x / 7.Q;
197 z2 /= z1;
198
199 return (__float128) z2;
200 }
201
202 __float128 bar (__float128 x)
203 {
204 return x * __builtin_huge_valq ();
205 }
206 ],[
207 foo (1.2Q);
208 bar (1.2Q);
209 ],[
abccc9a9 210 libquad_cv_have_float128=yes
1ec601bf 211 ],[
abccc9a9
TB
212 libquad_cv_have_float128=no
213])])
214AM_CONDITIONAL(BUILD_LIBQUADMATH, [test "x$libquad_cv_have_float128" = xyes])
1ec601bf
FXC
215
216AC_CACHE_SAVE
217
218if test ${multilib} = yes; then
219 multilib_arg="--enable-multilib"
220else
221 multilib_arg=
222fi
223
4c993c44
TB
224
225# We would like our source tree to be readonly. However when releases or
226# pre-releases are generated, the flex/bison generated files as well as the
227# various formats of manuals need to be included along with the rest of the
228# sources. Therefore we have --enable-generated-files-in-srcdir to do
229# just that.
230AC_MSG_CHECKING(generated-files-in-srcdir)
231AC_ARG_ENABLE(generated-files-in-srcdir,
232AS_HELP_STRING([--enable-generated-files-in-srcdir],
233 [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]),
234[case "$enableval" in
235 yes) enable_generated_files_in_srcdir=yes ;;
236 no) enable_generated_files_in_srcdir=no ;;
237 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
238 esac],
239[enable_generated_files_in_srcdir=no])
240AC_MSG_RESULT($enable_generated_files_in_srcdir)
241AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes)
242
243
1ec601bf
FXC
244AC_CONFIG_FILES(Makefile)
245AC_OUTPUT