top level:
[gcc/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 # Dependency checking.
33 ZW_CREATE_DEPDIR
34 ZW_PROG_COMPILER_DEPENDENCIES([CC])
35
36 # Checks for header files.
37 AC_HEADER_TIME
38 ACX_HEADER_STRING
39 AC_CHECK_HEADERS(iconv.h locale.h fcntl.h limits.h stddef.h \
40         stdlib.h strings.h string.h sys/file.h unistd.h)
41
42 # Checks for typedefs, structures, and compiler characteristics.
43 AC_C_CONST
44 AC_C_INLINE
45 AC_FUNC_OBSTACK
46 AC_TYPE_OFF_T
47 AC_TYPE_SIZE_T
48 AC_STRUCT_TM
49 AC_CHECK_SIZEOF(int)
50 AC_CHECK_SIZEOF(long)
51 define(libcpp_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
52   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
53   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
54   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
55   putchar_unlocked putc_unlocked)
56 AC_CHECK_FUNCS(libcpp_UNLOCKED_FUNCS)
57 AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno getopt \
58   libcpp_UNLOCKED_FUNCS vasprintf)))
59
60 # Checks for library functions.
61 AC_FUNC_ALLOCA
62 AC_HEADER_STDC
63 AM_LANGINFO_CODESET
64 ZW_GNU_GETTEXT_SISTER_DIR
65
66 AC_CACHE_CHECK(for uchar, gcc_cv_type_uchar,
67 [AC_TRY_COMPILE([
68 #include <sys/types.h>
69 ],
70 [if ((uchar *)0) return 0;
71  if (sizeof(uchar)) return 0;],
72 ac_cv_type_uchar=yes, ac_cv_type_uchar=no)])
73 if test $ac_cv_type_uchar = yes; then
74   AC_DEFINE(HAVE_UCHAR, 1,
75   [Define if <sys/types.h> defines \`uchar'.])
76 fi
77
78 AM_ICONV
79
80 # More defines and substitutions.
81 PACKAGE="$PACKAGE_TARNAME"
82 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Define to the name of this package.])
83 AC_SUBST(PACKAGE)
84
85 if test "x$enable_nls" != xno; then
86   USED_CATALOGS='$(CATALOGS)'
87 else
88   USED_CATALOGS=
89 fi
90 AC_SUBST(USED_CATALOGS)
91
92 AC_ARG_ENABLE(maintainer-mode,
93 [  --enable-maintainer-mode enable rules only needed by maintainers],,
94 enable_maintainer_mode=no)
95
96 if test "x$enable_maintainer_mode" = xno; then
97   MAINT='#'
98 else
99   MAINT=
100 fi
101 AC_SUBST(MAINT)
102
103 AC_ARG_ENABLE(checking,
104 [  --enable-checking      enable expensive run-time checks],,
105 enable_checking=no)
106
107 if test $enable_checking != no ; then
108   AC_DEFINE(ENABLE_CHECKING, 1,
109 [Define if you want more run-time sanity checks.])
110 fi
111
112 m4_changequote(,)
113 case $target in
114         alpha*-*-* | \
115         arm*-*-eabi* | \
116         arm*-*-symbianelf* | \
117         x86_64-*-* | \
118         ia64-*-* | \
119         hppa*64*-*-* | parisc*64*-*-* | \
120         i[34567]86-*-solaris2.1[0-9]* | \
121         mips*-*-* | \
122         mmix-*-* | \
123         powerpc*-*-* | \
124         rs6000*-*-* | \
125         s390*-*-* | \
126         sparc64*-*-* | ultrasparc-*-freebsd* | \
127         sparcv9-*-solaris2* | \
128         sparc-*-solaris2.[789] | sparc-*-solaris2.1[0-9]* | \
129         sh[123456789l]*-*-*)
130                 need_64bit_hwint=yes ;;
131         *)
132                 need_64bit_hwint=no ;;
133 esac
134
135 case $need_64bit_hwint:$ac_cv_sizeof_long in
136         *:8 | no:*) host_wide_int=long ;;
137         *) host_wide_int='long long' ;;
138 esac
139 m4_changequote([,])
140
141 AC_DEFINE_UNQUOTED(HOST_WIDE_INT, $host_wide_int,
142 [Define to the widest efficient host integer type at least
143    as wide as the target's size_t type.])
144
145 # Output.
146
147 AC_CONFIG_HEADERS(config.h:config.in, [echo timestamp > stamp-h1])
148 AC_CONFIG_FILES(Makefile)
149 AC_OUTPUT