OSDN Git Service

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