| 1 |
# -*- Autoconf -*- |
| 2 |
# Process this file with autoconf to produce a configure script. |
| 3 |
|
| 4 |
AC_INIT(cpplib, [ ], [email protected], cpplib) |
| 5 |
AC_CONFIG_SRCDIR(ucnid.h) |
| 6 |
AC_CONFIG_MACRO_DIR(../config) |
| 7 |
AC_CANONICAL_SYSTEM |
| 8 |
|
| 9 |
# Checks for programs. |
| 10 |
AC_PROG_MAKE_SET |
| 11 |
AC_PROG_INSTALL |
| 12 |
AC_PROG_CC |
| 13 |
AC_PROG_CXX |
| 14 |
AC_PROG_RANLIB |
| 15 |
AC_CHECK_TOOL(AR, ar) |
| 16 |
|
| 17 |
AC_USE_SYSTEM_EXTENSIONS |
| 18 |
AC_SYS_LARGEFILE |
| 19 |
|
| 20 |
MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing |
| 21 |
AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal]) |
| 22 |
AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf]) |
| 23 |
AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader]) |
| 24 |
|
| 25 |
if test -z "$ETAGS"; then |
| 26 |
ETAGS=etags |
| 27 |
fi |
| 28 |
AC_SUBST([ETAGS]) |
| 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 -Wno-narrowing -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 |
# Disable exceptions and RTTI if building with g++ |
| 40 |
ACX_PROG_CC_WARNING_OPTS( |
| 41 |
m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags]) |
| 42 |
|
| 43 |
# Only enable with --enable-werror-always until existing warnings are |
| 44 |
# corrected. |
| 45 |
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]) |
| 46 |
|
| 47 |
# Dependency checking. |
| 48 |
ZW_CREATE_DEPDIR |
| 49 |
AC_LANG_PUSH([C++]) |
| 50 |
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], [], |
| 51 |
[AC_MSG_ERROR([C++ compiler missing or inoperational])]) |
| 52 |
AC_LANG_POP([C++]) |
| 53 |
ZW_PROG_COMPILER_DEPENDENCIES([CXX]) |
| 54 |
|
| 55 |
# Checks for header files. |
| 56 |
AC_HEADER_TIME |
| 57 |
ACX_HEADER_STRING |
| 58 |
|
| 59 |
AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ |
| 60 |
stdlib.h strings.h string.h sys/file.h unistd.h) |
| 61 |
|
| 62 |
# Checks for typedefs, structures, and compiler characteristics. |
| 63 |
AC_C_BIGENDIAN |
| 64 |
AC_C_CONST |
| 65 |
AC_C_INLINE |
| 66 |
AC_FUNC_OBSTACK |
| 67 |
AC_TYPE_OFF_T |
| 68 |
AC_TYPE_SIZE_T |
| 69 |
AC_TYPE_SSIZE_T |
| 70 |
AC_TYPE_UINTPTR_T |
| 71 |
AC_CHECK_TYPE(ptrdiff_t, int) |
| 72 |
AC_TYPE_UINT64_T |
| 73 |
if test x"$ac_cv_c_uint64_t" = x"no"; then |
| 74 |
AC_MSG_ERROR([uint64_t not found]) |
| 75 |
fi |
| 76 |
AC_STRUCT_TM |
| 77 |
AC_CHECK_SIZEOF(int) |
| 78 |
AC_CHECK_SIZEOF(long) |
| 79 |
define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl |
| 80 |
ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl |
| 81 |
fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl |
| 82 |
fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl |
| 83 |
putchar_unlocked putc_unlocked) |
| 84 |
AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS setlocale) |
| 85 |
AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf]) |
| 86 |
AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS))) |
| 87 |
|
| 88 |
# Checks for library functions. |
| 89 |
AC_FUNC_ALLOCA |
| 90 |
AC_HEADER_STDC |
| 91 |
AM_LANGINFO_CODESET |
| 92 |
ZW_GNU_GETTEXT_SISTER_DIR |
| 93 |
|
| 94 |
AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar, |
| 95 |
[AC_TRY_COMPILE([ |
| 96 |
#include <sys/types.h> |
| 97 |
], |
| 98 |
[if ((uchar *)0) return 0; |
| 99 |
if (sizeof(uchar)) return 0;], |
| 100 |
ac_cv_type_uchar=yes, ac_cv_type_uchar=no)]) |
| 101 |
if test $ac_cv_type_uchar = yes; then |
| 102 |
AC_DEFINE(HAVE_UCHAR, 1, |
| 103 |
[Define if <sys/types.h> defines \`uchar'.]) |
| 104 |
fi |
| 105 |
|
| 106 |
AC_CHECK_SIZEOF(ino_t) |
| 107 |
AC_CHECK_SIZEOF(dev_t) |
| 108 |
|
| 109 |
# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different |
| 110 |
# iconv() prototype. |
| 111 |
AC_LANG_PUSH([C++]) |
| 112 |
AM_ICONV |
| 113 |
AC_LANG_POP([C++]) |
| 114 |
|
| 115 |
# More defines and substitutions. |
| 116 |
PACKAGE="$PACKAGE_TARNAME" |
| 117 |
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.]) |
| 118 |
AC_SUBST(PACKAGE) |
| 119 |
|
| 120 |
if test "x$enable_nls" != xno; then |
| 121 |
USED_CATALOGS='$(CATALOGS)' |
| 122 |
else |
| 123 |
USED_CATALOGS= |
| 124 |
fi |
| 125 |
AC_SUBST(USED_CATALOGS) |
| 126 |
|
| 127 |
AC_ARG_ENABLE(maintainer-mode, |
| 128 |
[ --enable-maintainer-mode enable rules only needed by maintainers],, |
| 129 |
enable_maintainer_mode=no) |
| 130 |
|
| 131 |
if test "x$enable_maintainer_mode" = xno; then |
| 132 |
MAINT='#' |
| 133 |
else |
| 134 |
MAINT= |
| 135 |
fi |
| 136 |
AC_SUBST(MAINT) |
| 137 |
|
| 138 |
# Enable expensive internal checks |
| 139 |
is_release= |
| 140 |
if test -f $srcdir/../gcc/DEV-PHASE \ |
| 141 |
&& test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then |
| 142 |
is_release=yes |
| 143 |
fi |
| 144 |
|
| 145 |
AC_ARG_ENABLE(checking, |
| 146 |
[AS_HELP_STRING([[--enable-checking[=LIST]]], |
| 147 |
[enable expensive run-time checks. With LIST, |
| 148 |
enable only specific categories of checks. |
| 149 |
Categories are: yes,no,all,none,release. |
| 150 |
Flags are: misc,valgrind or other strings])], |
| 151 |
[ac_checking_flags="${enableval}"],[ |
| 152 |
# Determine the default checks. |
| 153 |
if test x$is_release = x ; then |
| 154 |
ac_checking_flags=yes |
| 155 |
else |
| 156 |
ac_checking_flags=release |
| 157 |
fi]) |
| 158 |
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," |
| 159 |
for check in release $ac_checking_flags |
| 160 |
do |
| 161 |
case $check in |
| 162 |
# these set all the flags to specific states |
| 163 |
yes|all) ac_checking=1 ; ac_assert_checking=1 ; ac_valgrind_checking= ;; |
| 164 |
no|none) ac_checking= ; ac_assert_checking= ; ac_valgrind_checking= ;; |
| 165 |
release) ac_checking= ; ac_assert_checking=1 ; ac_valgrind_checking= ;; |
| 166 |
# these enable particular checks |
| 167 |
assert) ac_assert_checking=1 ;; |
| 168 |
misc) ac_checking=1 ;; |
| 169 |
valgrind) ac_valgrind_checking=1 ;; |
| 170 |
# accept |
| 171 |
*) ;; |
| 172 |
esac |
| 173 |
done |
| 174 |
IFS="$ac_save_IFS" |
| 175 |
|
| 176 |
if test x$ac_checking != x ; then |
| 177 |
AC_DEFINE(CHECKING_P, 1, |
| 178 |
[Define to 1 if you want more run-time sanity checks.]) |
| 179 |
else |
| 180 |
AC_DEFINE(CHECKING_P, 0) |
| 181 |
fi |
| 182 |
|
| 183 |
if test x$ac_assert_checking != x ; then |
| 184 |
AC_DEFINE(ENABLE_ASSERT_CHECKING, 1, |
| 185 |
[Define if you want assertions enabled. This is a cheap check.]) |
| 186 |
fi |
| 187 |
|
| 188 |
AC_ARG_ENABLE(canonical-system-headers, |
| 189 |
[ --enable-canonical-system-headers |
| 190 |
enable or disable system headers canonicalization], |
| 191 |
[], |
| 192 |
enable_canonical_system_headers=yes) |
| 193 |
if test $enable_canonical_system_headers != no; then |
| 194 |
AC_DEFINE(ENABLE_CANONICAL_SYSTEM_HEADERS, |
| 195 |
1, [Define to enable system headers canonicalization.]) |
| 196 |
fi |
| 197 |
|
| 198 |
case $target in |
| 199 |
i?86-* | x86_64-*) |
| 200 |
AC_TRY_COMPILE([], [asm ("pshufb %xmm0, %xmm1")], |
| 201 |
[AC_DEFINE([HAVE_SSSE3], [1], |
| 202 |
[Define to 1 if you can assemble SSSE3 insns.])]) |
| 203 |
esac |
| 204 |
|
| 205 |
# Enable --enable-host-shared. |
| 206 |
AC_ARG_ENABLE(host-shared, |
| 207 |
[AS_HELP_STRING([--enable-host-shared], |
| 208 |
[build host code as shared libraries])]) |
| 209 |
AC_SUBST(enable_host_shared) |
| 210 |
|
| 211 |
# Enable --enable-host-pie. |
| 212 |
AC_ARG_ENABLE(host-pie, |
| 213 |
[AS_HELP_STRING([--enable-host-pie], |
| 214 |
[build host code as PIE])]) |
| 215 |
AC_SUBST(enable_host_pie) |
| 216 |
|
| 217 |
if test x$enable_host_shared = xyes; then |
| 218 |
PICFLAG=-fPIC |
| 219 |
elif test x$enable_host_pie = xyes; then |
| 220 |
PICFLAG=-fPIE |
| 221 |
else |
| 222 |
PICFLAG= |
| 223 |
fi |
| 224 |
|
| 225 |
AC_SUBST(PICFLAG) |
| 226 |
|
| 227 |
# Enable Intel CET on Intel CET enabled host if jit is enabled. |
| 228 |
GCC_CET_HOST_FLAGS(CET_HOST_FLAGS) |
| 229 |
case x$enable_languages in |
| 230 |
*jit*) |
| 231 |
;; |
| 232 |
*) |
| 233 |
CET_HOST_FLAGS= |
| 234 |
;; |
| 235 |
esac |
| 236 |
AC_SUBST(CET_HOST_FLAGS) |
| 237 |
|
| 238 |
AC_ARG_ENABLE(valgrind-annotations, |
| 239 |
[AS_HELP_STRING([--enable-valgrind-annotations], |
| 240 |
[enable valgrind runtime interaction])], [], |
| 241 |
[enable_valgrind_annotations=no]) |
| 242 |
if test x$enable_valgrind_annotations != xno \ |
| 243 |
|| test x$ac_valgrind_checking != x; then |
| 244 |
AC_DEFINE(ENABLE_VALGRIND_WORKAROUNDS, 1, |
| 245 |
[Define if you want to workaround Valgrind warnings about |
| 246 |
possible memory leaks because of libcpp use of interior pointers.]) |
| 247 |
fi |
| 248 |
|
| 249 |
# Output. |
| 250 |
|
| 251 |
AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1]) |
| 252 |
AC_CONFIG_FILES(Makefile) |
| 253 |
AC_OUTPUT |