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