2 # Process this file with autoconf to produce a configure script.
4 AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib)
5 AC_CONFIG_SRCDIR(ucnid.h)
6 AC_CONFIG_MACRO_DIR(../config)
16 AC_USE_SYSTEM_EXTENSIONS
19 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
20 AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
21 AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
22 AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
24 # Figure out what compiler warnings we can enable.
25 # See config/warnings.m4 for details.
27 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \
28 -Wmissing-format-attribute], [warn])
29 ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \
30 -Wold-style-definition -Wc++-compat], [c_warn])
31 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
33 # Disable exceptions and RTTI if building with g++
34 ACX_PROG_CC_WARNING_OPTS(
35 m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags])
37 # Only enable with --enable-werror-always until existing warnings are
39 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
41 # Dependency checking.
44 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [],
45 [AC_MSG_ERROR([C++ compiler missing or inoperational])])
47 ZW_PROG_COMPILER_DEPENDENCIES([CXX])
49 # Checks for header files.
53 AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \
54 stdlib.h strings.h string.h sys/file.h unistd.h)
56 # Checks for typedefs, structures, and compiler characteristics.
65 AC_CHECK_TYPE(ptrdiff_t, int)
67 if test x"$ac_cv_c_uint64_t" = x"no"; then
68 AC_MSG_ERROR([uint64_t not found])
73 define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
74 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
75 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
76 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
77 putchar_unlocked putc_unlocked)
78 AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
79 AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf])
80 AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS)))
82 # Checks for library functions.
86 ZW_GNU_GETTEXT_SISTER_DIR
88 AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
90 #include <sys/types.h>
92 [if ((uchar *)0) return 0;
93 if (sizeof(uchar)) return 0;],
94 ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
95 if test $ac_cv_type_uchar = yes; then
96 AC_DEFINE(HAVE_UCHAR, 1,
97 [Define if <sys/types.h> defines \`uchar'.])
100 # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different
106 # More defines and substitutions.
107 PACKAGE="$PACKAGE_TARNAME"
108 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.])
111 if test "x$enable_nls" != xno; then
112 USED_CATALOGS='$(CATALOGS)'
116 AC_SUBST(USED_CATALOGS)
118 AC_ARG_ENABLE(maintainer-mode,
119 [ --enable-maintainer-mode enable rules only needed by maintainers],,
120 enable_maintainer_mode=no)
122 if test "x$enable_maintainer_mode" = xno; then
129 # Enable expensive internal checks
131 if test -f $srcdir/../gcc/DEV-PHASE \
132 && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then
136 AC_ARG_ENABLE(checking,
137 [AS_HELP_STRING([[--enable-checking[=LIST]]],
138 [enable expensive run-time checks. With LIST,
139 enable only specific categories of checks.
140 Categories are: yes,no,all,none,release.
141 Flags are: misc,valgrind or other strings])],
142 [ac_checking_flags="${enableval}"],[
143 # Determine the default checks.
144 if test x$is_release = x ; then
145 ac_checking_flags=yes
147 ac_checking_flags=release
149 IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
150 for check in release $ac_checking_flags
153 # these set all the flags to specific states
154 yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;;
155 no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;;
156 release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;;
157 # these enable particular checks
158 assert) ac_assert_checking=1 ;;
159 misc) ac_checking=1 ;;
160 valgrind) ac_valgrind_checking=1 ;;
167 if test x$ac_checking != x ; then
168 AC_DEFINE(CHECKING_P, 1,
169 [Define to 1 if you want more run-time sanity checks.])
171 AC_DEFINE(CHECKING_P, 0)
174 if test x$ac_assert_checking != x ; then
175 AC_DEFINE(ENABLE_ASSERT_CHECKING, 1,
176 [Define if you want assertions enabled. This is a cheap check.])
179 if test x$ac_valgrind_checking != x ; then
180 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1,
181 [Define if you want to workaround valgrind (a memory checker) warnings about
182 possible memory leaks because of libcpp use of interior pointers.])
185 AC_ARG_ENABLE(canonical-system-headers,
186 [ --enable-canonical-system-headers
187 enable or disable system headers canonicalization],
189 enable_canonical_system_headers=yes)
190 if test $enable_canonical_system_headers != no; then
191 AC_DEFINE(ENABLE_CANONICAL_SYSTEM_HEADERS,
192 1, [Define to enable system headers canonicalization.])
197 AC_TRY_COMPILE([], [asm ("pcmpestri %0, %%xmm0, %%xmm1" : : "i"(0))],
198 [AC_DEFINE([HAVE_SSE4], [1],
199 [Define to 1 if you can assemble SSE4 insns.])])
202 # Enable --enable-host-shared.
203 AC_ARG_ENABLE(host-shared,
204 [AS_HELP_STRING([--enable-host-shared],
205 [build host code as shared libraries])],
206 [PICFLAG=-fPIC], [PICFLAG=])
209 AC_ARG_ENABLE(valgrind-annotations,
210 [AS_HELP_STRING([--enable-valgrind-annotations],
211 [enable valgrind runtime interaction])], [],
212 [enable_valgrind_annotations=no])
213 if test x$enable_valgrind_annotations != xno \
214 || test x$ac_valgrind_checking != x; then
215 if (test $have_valgrind_h = no \
216 && test $gcc_cv_header_memcheck_h = no \
217 && test $gcc_cv_header_valgrind_memcheck_h = no); then
218 AC_MSG_ERROR([*** Can't find valgrind/memcheck.h, memcheck.h or valgrind.h])
220 AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1,
221 [Define to get calls to the valgrind runtime enabled.])
226 AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
227 AC_CONFIG_FILES(Makefile)