]>
Commit | Line | Data |
---|---|---|
d856c8a6 | 1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
d856c8a6 | 4 | AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib) |
5 | AC_CONFIG_SRCDIR(ucnid.h) | |
986086aa | 6 | AC_CONFIG_MACRO_DIR(../config) |
d856c8a6 | 7 | AC_CANONICAL_SYSTEM |
d856c8a6 | 8 | |
9 | # Checks for programs. | |
21164c01 | 10 | AC_PROG_MAKE_SET |
11 | AC_PROG_INSTALL | |
d856c8a6 | 12 | AC_PROG_CC |
723ebaea | 13 | AC_PROG_CXX |
d856c8a6 | 14 | AC_PROG_RANLIB |
15 | ||
be04fdf9 | 16 | AC_USE_SYSTEM_EXTENSIONS |
075f1161 | 17 | AC_SYS_LARGEFILE |
18 | ||
a668be26 | 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]) | |
23 | ||
21164c01 | 24 | # Figure out what compiler warnings we can enable. |
25 | # See config/warnings.m4 for details. | |
26 | ||
7e783eb3 | 27 | ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \ |
723ebaea | 28 | -Wmissing-format-attribute], [warn]) |
29 | ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \ | |
30 | -Wold-style-definition -Wc++-compat], [c_warn]) | |
21164c01 | 31 | ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long]) |
32 | ||
7c801b60 | 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]) | |
36 | ||
21164c01 | 37 | # Only enable with --enable-werror-always until existing warnings are |
38 | # corrected. | |
39 | ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]) | |
40 | ||
cbaa9876 | 41 | # Dependency checking. |
42 | ZW_CREATE_DEPDIR | |
9d135bb6 | 43 | AC_LANG_PUSH([C++]) |
f00f02a3 | 44 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [], |
9d135bb6 | 45 | [AC_MSG_ERROR([C++ compiler missing or inoperational])]) |
46 | AC_LANG_POP([C++]) | |
723ebaea | 47 | ZW_PROG_COMPILER_DEPENDENCIES([CXX]) |
cbaa9876 | 48 | |
d856c8a6 | 49 | # Checks for header files. |
50 | AC_HEADER_TIME | |
51 | ACX_HEADER_STRING | |
723ebaea | 52 | |
be04fdf9 | 53 | AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ |
723ebaea | 54 | stdlib.h strings.h string.h sys/file.h unistd.h) |
d856c8a6 | 55 | |
56 | # Checks for typedefs, structures, and compiler characteristics. | |
2431e8ba | 57 | AC_C_BIGENDIAN |
d856c8a6 | 58 | AC_C_CONST |
59 | AC_C_INLINE | |
60 | AC_FUNC_OBSTACK | |
61 | AC_TYPE_OFF_T | |
62 | AC_TYPE_SIZE_T | |
2431e8ba | 63 | AC_TYPE_SSIZE_T |
64 | AC_TYPE_UINTPTR_T | |
65 | AC_CHECK_TYPE(ptrdiff_t, int) | |
1c8ad86a | 66 | AC_TYPE_UINT64_T |
67 | if test x"$ac_cv_c_uint64_t" = x"no"; then | |
68 | AC_MSG_ERROR([uint64_t not found]) | |
69 | fi | |
d856c8a6 | 70 | AC_STRUCT_TM |
71 | AC_CHECK_SIZEOF(int) | |
72 | AC_CHECK_SIZEOF(long) | |
077a3c99 | 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) | |
050318d9 | 79 | AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf]) |
80 | AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS))) | |
d856c8a6 | 81 | |
82 | # Checks for library functions. | |
83 | AC_FUNC_ALLOCA | |
84 | AC_HEADER_STDC | |
85 | AM_LANGINFO_CODESET | |
86 | ZW_GNU_GETTEXT_SISTER_DIR | |
87 | ||
88 | AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar, | |
89 | [AC_TRY_COMPILE([ | |
6e11b263 | 90 | #include <sys/types.h> |
d856c8a6 | 91 | ], |
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'.]) | |
98 | fi | |
99 | ||
6678cb4e | 100 | # g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different |
101 | # iconv() prototype. | |
2b15d2ba | 102 | AC_LANG_PUSH([C++]) |
103 | AM_ICONV | |
104 | AC_LANG_POP([C++]) | |
a668be26 | 105 | |
106 | # More defines and substitutions. | |
25696d3f | 107 | PACKAGE="$PACKAGE_TARNAME" |
a668be26 | 108 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.]) |
109 | AC_SUBST(PACKAGE) | |
110 | ||
111 | if test "x$enable_nls" != xno; then | |
112 | USED_CATALOGS='$(CATALOGS)' | |
113 | else | |
114 | USED_CATALOGS= | |
115 | fi | |
116 | AC_SUBST(USED_CATALOGS) | |
117 | ||
118 | AC_ARG_ENABLE(maintainer-mode, | |
119 | [ --enable-maintainer-mode enable rules only needed by maintainers],, | |
120 | enable_maintainer_mode=no) | |
121 | ||
122 | if test "x$enable_maintainer_mode" = xno; then | |
123 | MAINT='#' | |
124 | else | |
125 | MAINT= | |
126 | fi | |
127 | AC_SUBST(MAINT) | |
128 | ||
61ed1f10 | 129 | # Enable expensive internal checks |
130 | is_release= | |
131 | if test -f $srcdir/../gcc/DEV-PHASE \ | |
132 | && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then | |
133 | is_release=yes | |
134 | fi | |
d856c8a6 | 135 | |
61ed1f10 | 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 | |
146 | else | |
147 | ac_checking_flags=release | |
148 | fi]) | |
149 | IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," | |
150 | for check in release $ac_checking_flags | |
151 | do | |
152 | case $check in | |
153 | # these set all the flags to specific states | |
089d09f7 | 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= ;; | |
61ed1f10 | 157 | # these enable particular checks |
089d09f7 | 158 | assert) ac_assert_checking=1 ;; |
61ed1f10 | 159 | misc) ac_checking=1 ;; |
160 | valgrind) ac_valgrind_checking=1 ;; | |
161 | # accept | |
162 | *) ;; | |
163 | esac | |
164 | done | |
165 | IFS="$ac_save_IFS" | |
166 | ||
167 | if test x$ac_checking != x ; then | |
92a110bb | 168 | AC_DEFINE(CHECKING_P, 1, |
169 | [Define to 1 if you want more run-time sanity checks.]) | |
170 | else | |
171 | AC_DEFINE(CHECKING_P, 0) | |
d856c8a6 | 172 | fi |
173 | ||
089d09f7 | 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.]) | |
177 | fi | |
178 | ||
61ed1f10 | 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.]) | |
183 | fi | |
184 | ||
52bc861d | 185 | AC_ARG_ENABLE(canonical-system-headers, |
186 | [ --enable-canonical-system-headers | |
187 | enable or disable system headers canonicalization], | |
188 | [], | |
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.]) | |
193 | fi | |
194 | ||
b315ae35 | 195 | case $target in |
196 | i?86-* | x86_64-*) | |
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.])]) | |
200 | esac | |
201 | ||
2bd17377 | 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=]) | |
207 | AC_SUBST(PICFLAG) | |
208 | ||
f0f7510b | 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]) | |
219 | fi | |
220 | AC_DEFINE(ENABLE_VALGRIND_ANNOTATIONS, 1, | |
221 | [Define to get calls to the valgrind runtime enabled.]) | |
222 | fi | |
223 | ||
a668be26 | 224 | # Output. |
225 | ||
226 | AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1]) | |
d856c8a6 | 227 | AC_CONFIG_FILES(Makefile) |
228 | AC_OUTPUT |