OSDN Git Service

2010-10-19 Basile Starynkevitch <basile@starynkevitch.net>
[pf3gnuchains/gcc-fork.git] / libcpp / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.64)
5 AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib)
6 AC_CONFIG_SRCDIR(ucnid.h)
7 AC_CONFIG_MACRO_DIR(../config)
8 AC_CANONICAL_SYSTEM
9
10 # Checks for programs.
11 AC_PROG_MAKE_SET
12 AC_PROG_INSTALL
13 AC_PROG_CC
14 AC_PROG_CXX
15 AC_PROG_RANLIB
16
17 # See if we are building gcc with C++.
18 # Do this early so setting lang to C++ affects following tests
19 AC_ARG_ENABLE(build-with-cxx,
20 [  --enable-build-with-cxx build with C++ compiler instead of C compiler],
21 ENABLE_BUILD_WITH_CXX=$enableval,
22 ENABLE_BUILD_WITH_CXX=no)
23 AC_SUBST(ENABLE_BUILD_WITH_CXX)
24
25 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
26 AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
27 AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
28 AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
29
30 # Figure out what compiler warnings we can enable.
31 # See config/warnings.m4 for details.
32
33 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings \
34                           -Wmissing-format-attribute], [warn])
35 ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \
36                           -Wold-style-definition -Wc++-compat], [c_warn])
37 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
38
39 # Only enable with --enable-werror-always until existing warnings are
40 # corrected.
41 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
42
43 # Dependency checking.
44 ZW_CREATE_DEPDIR
45 if test "$ENABLE_BUILD_WITH_CXX" = "no"; then
46 ZW_PROG_COMPILER_DEPENDENCIES([CC])
47 else
48 AC_LANG_PUSH([C++])
49 AC_COMPILE_IFELSE([[int i;]], [],
50                   [AC_MSG_ERROR([C++ compiler missing or inoperational])])
51 AC_LANG_POP([C++])
52 ZW_PROG_COMPILER_DEPENDENCIES([CXX])
53 fi
54
55 # Checks for header files.
56 AC_HEADER_TIME
57 ACX_HEADER_STRING
58
59 # AC_CHECK_HEADERS is repeated to work around apparent autoconf 2.59 bug.  If
60 # AC_CHECK_HEADERS comes after the if clause, the last AC_LANG call gets used,
61 # no matter which branch is taken.
62 if test "$ENABLE_BUILD_WITH_CXX" = "no"; then
63    AC_LANG(C)
64    AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
65         stdlib.h strings.h string.h sys/file.h unistd.h)
66 else
67    AC_LANG(C++)
68    AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
69         stdlib.h strings.h string.h sys/stat.h sys/file.h unistd.h)
70 fi
71
72 # Checks for typedefs, structures, and compiler characteristics.
73 AC_C_BIGENDIAN
74 AC_C_CONST
75 AC_C_INLINE
76 AC_FUNC_OBSTACK
77 AC_TYPE_OFF_T
78 AC_TYPE_SIZE_T
79 AC_TYPE_SSIZE_T
80 AC_TYPE_UINTPTR_T
81 AC_CHECK_TYPE(ptrdiff_t, int)
82 AC_STRUCT_TM
83 AC_CHECK_SIZEOF(int)
84 AC_CHECK_SIZEOF(long)
85 define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
86   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
87   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
88   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
89   putchar_unlocked putc_unlocked)
90 AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
91 AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf])
92 AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS)))
93
94 # Checks for library functions.
95 AC_FUNC_ALLOCA
96 AC_HEADER_STDC
97 AM_LANGINFO_CODESET
98 ZW_GNU_GETTEXT_SISTER_DIR
99
100 AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
101 [AC_TRY_COMPILE([
102 #include <sys/types.h>
103 ],
104 [if ((uchar *)0) return 0;
105  if (sizeof(uchar)) return 0;],
106 ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
107 if test $ac_cv_type_uchar = yes; then
108   AC_DEFINE(HAVE_UCHAR, 1,
109   [Define if <sys/types.h> defines \`uchar'.])
110 fi
111
112 AM_ICONV
113
114 # More defines and substitutions.
115 PACKAGE="$PACKAGE_TARNAME"
116 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.])
117 AC_SUBST(PACKAGE)
118
119 if test "x$enable_nls" != xno; then
120   USED_CATALOGS='$(CATALOGS)'
121 else
122   USED_CATALOGS=
123 fi
124 AC_SUBST(USED_CATALOGS)
125
126 AC_ARG_ENABLE(maintainer-mode,
127 [  --enable-maintainer-mode enable rules only needed by maintainers],,
128 enable_maintainer_mode=no)
129
130 if test "x$enable_maintainer_mode" = xno; then
131   MAINT='#'
132 else
133   MAINT=
134 fi
135 AC_SUBST(MAINT)
136
137 AC_ARG_ENABLE(checking,
138 [  --enable-checking      enable expensive run-time checks],,
139 enable_checking=no)
140
141 if test $enable_checking != no ; then
142   AC_DEFINE(ENABLE_CHECKING, 1,
143 [Define if you want more run-time sanity checks.])
144 fi
145
146 m4_changequote(,)
147 case $target in
148         alpha*-*-* | \
149         arm*-*-*eabi* | \
150         arm*-*-symbianelf* | \
151         x86_64-*-* | \
152         ia64-*-* | \
153         hppa*64*-*-* | \
154         i[34567]86-*-darwin* | \
155         i[34567]86-*-solaris2.1[0-9]* | \
156         i[34567]86-w64-mingw* | \
157         mips*-*-* | \
158         mmix-*-* | \
159         powerpc*-*-* | \
160         rs6000*-*-* | \
161         s390*-*-* | \
162         sparc*-*-* | \
163         spu-*-* | \
164         sh[123456789lbe]*-*-* | sh-*-*)
165                 need_64bit_hwint=yes ;;
166         i[34567]86-*-linux*)
167                 if test "x$enable_targets" = xall; then
168                         need_64bit_hwint=yes
169                 else
170                         need_64bit_hwint=no
171                 fi
172                 ;;
173         *)
174                 need_64bit_hwint=no ;;
175 esac
176
177 case $need_64bit_hwint:$ac_cv_sizeof_long in
178         *:8 | no:*) host_wide_int=long ;;
179         *) host_wide_int='long long' ;;
180 esac
181 m4_changequote([,])
182
183 AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int,
184 [Define to the widest efficient host integer type at least
185    as wide as the target's size_t type.])
186
187 case $target in
188   i?86-* | x86_64-*)
189     AC_TRY_COMPILE([], [asm ("pcmpestri %0, %%xmm0, %%xmm1" : : "i"(0))],
190       [AC_DEFINE([HAVE_SSE4], [1],
191                  [Define to 1 if you can assemble SSE4 insns.])])
192 esac
193
194 # Output.
195
196 AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
197 AC_CONFIG_FILES(Makefile)
198 AC_OUTPUT