re PR other/17594 (GCC does not error about unknown options which starts with a valid...
[gcc.git] / libcpp / configure.ac
1 # -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib)
6 AC_CONFIG_SRCDIR(ucnid.h)
7 AC_CONFIG_MACRO_DIR(../config)
8 AC_CANONICAL_SYSTEM
9
10 # Checks for programs.
11 AC_PROG_MAKE_SET
12 AC_PROG_INSTALL
13 AC_PROG_CC
14 AC_PROG_RANLIB
15
16 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
17 AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
18 AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
19 AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
20
21 # Figure out what compiler warnings we can enable.
22 # See config/warnings.m4 for details.
23
24 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
25 -Wmissing-prototypes -Wold-style-definition])
26 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
27
28 # Only enable with --enable-werror-always until existing warnings are
29 # corrected.
30 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
31
32 # Checks for header files.
33 AC_HEADER_TIME
34 ACX_HEADER_STRING
35 AC_CHECK_HEADERS(iconv.h locale.h fcntl.h limits.h stddef.h \
36 stdlib.h strings.h string.h sys/file.h unistd.h)
37
38 # Checks for typedefs, structures, and compiler characteristics.
39 AC_C_CONST
40 AC_C_INLINE
41 AC_FUNC_OBSTACK
42 AC_TYPE_OFF_T
43 AC_TYPE_SIZE_T
44 AC_STRUCT_TM
45 AC_CHECK_SIZEOF(int)
46 AC_CHECK_SIZEOF(long)
47 AC_CHECK_FUNCS(putc_unlocked fputc_unlocked fputs_unlocked \
48 fwrite_unlocked fprintf_unlocked)
49 AC_CHECK_DECLS([abort, errno, putc_unlocked, fputc_unlocked,
50 fputs_unlocked, fwrite_unlocked, fprintf_unlocked])
51
52 # Checks for library functions.
53 AC_FUNC_ALLOCA
54 AC_HEADER_STDC
55 AM_LANGINFO_CODESET
56 ZW_GNU_GETTEXT_SISTER_DIR
57
58 AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
59 [AC_TRY_COMPILE([
60 #include <sys/types.h>
61 ],
62 [if ((uchar *)0) return 0;
63 if (sizeof(uchar)) return 0;],
64 ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
65 if test $ac_cv_type_uchar = yes; then
66 AC_DEFINE(HAVE_UCHAR, 1,
67 [Define if <sys/types.h> defines \`uchar'.])
68 fi
69
70 AM_ICONV
71
72 # More defines and substitutions.
73 PACKAGE="$PACKAGE_TARNAME"
74 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.])
75 AC_SUBST(PACKAGE)
76
77 if test "x$enable_nls" != xno; then
78 USED_CATALOGS='$(CATALOGS)'
79 else
80 USED_CATALOGS=
81 fi
82 AC_SUBST(USED_CATALOGS)
83
84 AC_ARG_ENABLE(maintainer-mode,
85 [ --enable-maintainer-mode enable rules only needed by maintainers],,
86 enable_maintainer_mode=no)
87
88 if test "x$enable_maintainer_mode" = xno; then
89 MAINT='#'
90 else
91 MAINT=
92 fi
93 AC_SUBST(MAINT)
94
95 AC_ARG_ENABLE(checking,
96 [ --enable-checking enable expensive run-time checks],,
97 enable_checking=no)
98
99 if test $enable_checking != no ; then
100 AC_DEFINE(ENABLE_CHECKING, 1,
101 [Define if you want more run-time sanity checks.])
102 fi
103
104 m4_changequote(,)
105 case $target in
106 alpha*-*-* | \
107 arm*-*-eabi* | \
108 arm*-*-symbianelf* | \
109 x86_64-*-* | \
110 ia64-*-* | \
111 hppa*64*-*-* | parisc*64*-*-* | \
112 i[34567]86-*-solaris2.1[0-9]* | \
113 mips*-*-* | \
114 mmix-*-* | \
115 powerpc*-*-* | \
116 rs6000*-*-* | \
117 s390*-*-* | \
118 sparc64*-*-* | ultrasparc-*-freebsd* | \
119 sparcv9-*-solaris2* | \
120 sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9] | \
121 sh[123456789l]*-*-*)
122 need_64bit_hwint=yes ;;
123 *)
124 need_64bit_hwint=no ;;
125 esac
126
127 case $need_64bit_hwint:$ac_cv_sizeof_long in
128 *:8 | no:*) host_wide_int=long ;;
129 *) host_wide_int='long long' ;;
130 esac
131 m4_changequote([,])
132
133 AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int,
134 [Define to the widest efficient host integer type at least
135 as wide as the target's size_t type.])
136
137 # Output.
138
139 AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
140 AC_CONFIG_FILES(Makefile)
141 AC_OUTPUT