configure.ac revision 1.3
1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.64) 5AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib) 6AC_CONFIG_SRCDIR(ucnid.h) 7AC_CONFIG_MACRO_DIR(../config) 8AC_CANONICAL_SYSTEM 9 10# Checks for programs. 11AC_PROG_MAKE_SET 12AC_PROG_INSTALL 13AC_PROG_CC 14AC_PROG_CXX 15AC_PROG_RANLIB 16 17AC_USE_SYSTEM_EXTENSIONS 18AC_SYS_LARGEFILE 19 20MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing 21AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal]) 22AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf]) 23AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader]) 24 25# Figure out what compiler warnings we can enable. 26# See config/warnings.m4 for details. 27 28ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \ 29 -Wmissing-format-attribute], [warn]) 30ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \ 31 -Wold-style-definition -Wc++-compat], [c_warn]) 32ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long]) 33 34# Disable exceptions and RTTI if building with g++ 35ACX_PROG_CC_WARNING_OPTS( 36 m4_quote(m4_do([-fno-exceptions -fno-rtti])), [noexception_flags]) 37 38# Only enable with --enable-werror-always until existing warnings are 39# corrected. 40ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]) 41 42# Dependency checking. 43ZW_CREATE_DEPDIR 44AC_LANG_PUSH([C++]) 45AC_COMPILE_IFELSE([[int i;]], [], 46 [AC_MSG_ERROR([C++ compiler missing or inoperational])]) 47AC_LANG_POP([C++]) 48ZW_PROG_COMPILER_DEPENDENCIES([CXX]) 49 50# Checks for header files. 51AC_HEADER_TIME 52ACX_HEADER_STRING 53 54AC_CHECK_HEADERS(locale.h fcntl.h limits.h stddef.h \ 55 stdlib.h strings.h string.h sys/file.h unistd.h) 56 57# Checks for typedefs, structures, and compiler characteristics. 58AC_C_BIGENDIAN 59AC_C_CONST 60AC_C_INLINE 61AC_FUNC_OBSTACK 62AC_TYPE_OFF_T 63AC_TYPE_SIZE_T 64AC_TYPE_SSIZE_T 65AC_TYPE_UINTPTR_T 66AC_CHECK_TYPE(ptrdiff_t, int) 67AC_STRUCT_TM 68AC_CHECK_SIZEOF(int) 69AC_CHECK_SIZEOF(long) 70define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl 71 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl 72 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl 73 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl 74 putchar_unlocked putc_unlocked) 75AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS) 76AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, getopt, vasprintf]) 77AC_CHECK_DECLS(m4_split(m4_normalize(libcpp_UNLOCKED_FUNCS))) 78 79# Checks for library functions. 80AC_FUNC_ALLOCA 81AC_HEADER_STDC 82AM_LANGINFO_CODESET 83ZW_GNU_GETTEXT_SISTER_DIR 84 85AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar, 86[AC_TRY_COMPILE([ 87#include <sys/types.h> 88], 89[if ((uchar *)0) return 0; 90 if (sizeof(uchar)) return 0;], 91ac_cv_type_uchar=yes, ac_cv_type_uchar=no)]) 92if test $ac_cv_type_uchar = yes; then 93 AC_DEFINE(HAVE_UCHAR, 1, 94 [Define if <sys/types.h> defines \`uchar'.]) 95fi 96 97# g++ on Solaris 10+ defines _XOPEN_SOURCE=600, which exposes a different 98# iconv() prototype. 99AC_LANG_PUSH([C++]) 100AM_ICONV 101AC_LANG_POP([C++]) 102 103# More defines and substitutions. 104PACKAGE="$PACKAGE_TARNAME" 105AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.]) 106AC_SUBST(PACKAGE) 107 108if test "x$enable_nls" != xno; then 109 USED_CATALOGS='$(CATALOGS)' 110else 111 USED_CATALOGS= 112fi 113AC_SUBST(USED_CATALOGS) 114 115AC_ARG_ENABLE(maintainer-mode, 116[ --enable-maintainer-mode enable rules only needed by maintainers],, 117enable_maintainer_mode=no) 118 119if test "x$enable_maintainer_mode" = xno; then 120 MAINT='#' 121else 122 MAINT= 123fi 124AC_SUBST(MAINT) 125 126# Enable expensive internal checks 127is_release= 128if test -f $srcdir/../gcc/DEV-PHASE \ 129 && test x"`cat $srcdir/../gcc/DEV-PHASE`" != xexperimental; then 130 is_release=yes 131fi 132 133AC_ARG_ENABLE(checking, 134[AS_HELP_STRING([[--enable-checking[=LIST]]], 135 [enable expensive run-time checks. With LIST, 136 enable only specific categories of checks. 137 Categories are: yes,no,all,none,release. 138 Flags are: misc,valgrind or other strings])], 139[ac_checking_flags="${enableval}"],[ 140# Determine the default checks. 141if test x$is_release = x ; then 142 ac_checking_flags=yes 143else 144 ac_checking_flags=release 145fi]) 146IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," 147for check in release $ac_checking_flags 148do 149 case $check in 150 # these set all the flags to specific states 151 yes|all) ac_checking=1 ; ac_valgrind_checking= ;; 152 no|none|release) ac_checking= ; ac_valgrind_checking= ;; 153 # these enable particular checks 154 misc) ac_checking=1 ;; 155 valgrind) ac_valgrind_checking=1 ;; 156 # accept 157 *) ;; 158 esac 159done 160IFS="$ac_save_IFS" 161 162if test x$ac_checking != x ; then 163 AC_DEFINE(ENABLE_CHECKING, 1, 164[Define if you want more run-time sanity checks.]) 165fi 166 167if test x$ac_valgrind_checking != x ; then 168 AC_DEFINE(ENABLE_VALGRIND_CHECKING, 1, 169[Define if you want to workaround valgrind (a memory checker) warnings about 170 possible memory leaks because of libcpp use of interior pointers.]) 171fi 172 173AC_ARG_ENABLE(canonical-system-headers, 174[ --enable-canonical-system-headers 175 enable or disable system headers canonicalization], 176[], 177enable_canonical_system_headers=yes) 178if test $enable_canonical_system_headers != no; then 179 AC_DEFINE(ENABLE_CANONICAL_SYSTEM_HEADERS, 180 1, [Define to enable system headers canonicalization.]) 181fi 182 183m4_changequote(,) 184case $target in 185 aarch64*-*-* | \ 186 alpha*-*-* | \ 187 arm*-*-* | \ 188 x86_64-*-* | \ 189 ia64-*-* | \ 190 hppa*64*-*-* | \ 191 i[34567]86-*-* | x86_64-*-solaris2.1[0-9]* | \ 192 mips*-*-* | \ 193 mmix-*-* | \ 194 powerpc*-*-* | \ 195 rs6000*-*-* | \ 196 s390*-*-* | \ 197 sparc*-*-* | \ 198 spu-*-* | \ 199 sh[123456789lbe]*-*-* | sh-*-* | \ 200 tilegx-*-* | tilepro-*-* ) 201 need_64bit_hwint=yes ;; 202 *) 203 need_64bit_hwint=no ;; 204esac 205 206case $need_64bit_hwint:$ac_cv_sizeof_long in 207 *:8 | no:*) host_wide_int=long ;; 208 *) host_wide_int='long long' ;; 209esac 210m4_changequote([,]) 211 212AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int, 213[Define to the widest efficient host integer type at least 214 as wide as the target's size_t type.]) 215 216case $target in 217 i?86-* | x86_64-*) 218 AC_TRY_COMPILE([], [asm ("pcmpestri %0, %%xmm0, %%xmm1" : : "i"(0))], 219 [AC_DEFINE([HAVE_SSE4], [1], 220 [Define to 1 if you can assemble SSE4 insns.])]) 221esac 222 223# Output. 224 225AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1]) 226AC_CONFIG_FILES(Makefile) 227AC_OUTPUT 228