OSDN Git Service

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