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