blob: aaa39cd123fe7c03935c99180025d789aebc2cb7 [file] [log] [blame]
Paolo Bonzini71b5d512004-08-31 09:27:00 +00001AC_PREREQ(2.59)
2
3AC_INIT(fixincludes, [ ])
4AC_CONFIG_SRCDIR(inclhack.def)
5AC_CONFIG_AUX_DIR(..)
6AC_CANONICAL_SYSTEM
7AC_PROG_CC
Bruce Korb6aa1f8c2008-09-06 19:57:26 +00008AC_PROG_SED
Paolo Bonzini71b5d512004-08-31 09:27:00 +00009
Kaveh R. Ghazi87fbb652005-07-16 14:17:51 +000010# Figure out what compiler warnings we can enable.
11# See config/warnings.m4 for details.
12
13ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
14 -Wmissing-prototypes -Wold-style-definition \
Mike Stumpde1f8a02006-05-17 00:31:31 +000015 -Wmissing-format-attribute -Wno-overlength-strings])
Kaveh R. Ghazi87fbb652005-07-16 14:17:51 +000016ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
17
18# Only enable with --enable-werror-always until existing warnings are
19# corrected.
20ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
21
Geoffrey Keating53c7ffe72004-11-05 04:49:19 +000022# Determine the noncanonical target name, for directory use.
23ACX_NONCANONICAL_TARGET
24
25# Specify the local prefix
26local_prefix=
27AC_ARG_WITH(local-prefix,
28[ --with-local-prefix=DIR specifies directory to put local include],
29[case "${withval}" in
30yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
31no) ;;
32*) local_prefix=$with_local_prefix ;;
33esac])
34
35# Default local prefix if it is empty
36if test x$local_prefix = x; then
37 local_prefix=/usr/local
38fi
39
Paolo Bonzini71b5d512004-08-31 09:27:00 +000040# Choose one or two-process fix methodology. Systems that cannot handle
41# bi-directional pipes must use the two process method.
42#
Paolo Bonziniad643a72004-10-15 07:58:38 +000043AC_ARG_ENABLE([twoprocess],
44[ --enable-twoprocess Use a separate process to apply the fixes],
Paolo Bonzini5ae4c562004-10-27 14:42:56 +000045[if test "x$enable_twoprocess" = xyes; then
Paolo Bonziniad643a72004-10-15 07:58:38 +000046 TARGET=twoprocess
47else
48 TARGET=oneprocess
49fi],
50[case $host in
Paolo Bonzini71b5d512004-08-31 09:27:00 +000051 i?86-*-msdosdjgpp* | \
Paolo Bonziniad643a72004-10-15 07:58:38 +000052 i?86-*-mingw32* | \
Kai Tietza2085732007-10-12 11:54:16 +000053 x86_64-*-mingw32* | \
Paolo Bonzini71b5d512004-08-31 09:27:00 +000054 *-*-beos* )
55 TARGET=twoprocess
Paolo Bonzini71b5d512004-08-31 09:27:00 +000056 ;;
57
58 * )
59 TARGET=oneprocess
60 ;;
Paolo Bonziniad643a72004-10-15 07:58:38 +000061esac])
Paolo Bonzini71b5d512004-08-31 09:27:00 +000062AC_SUBST(TARGET)
63
Paolo Bonziniad643a72004-10-15 07:58:38 +000064if test $TARGET = twoprocess; then
65 AC_DEFINE(SEPARATE_FIX_PROC, 1,
66 [Define if testing and fixing are done by separate process])
67fi
68
69case $host in
70 vax-dec-bsd* )
71 AC_DEFINE(exit, xexit, [Define to xexit if the host system does not support atexit])
72 AC_DEFINE(atexit, xatexit, [Define to xatexit if the host system does not support atexit])
73 ;;
74esac
75
76AC_DEFINE_UNQUOTED([EXE_EXT], "$ac_exeext",
77 [Defined to the executable file extension on the host system])
78
Paolo Bonzini71b5d512004-08-31 09:27:00 +000079# Checks for header files.
80AC_HEADER_STDC
81AC_CHECK_HEADERS([stddef.h stdlib.h strings.h unistd.h fcntl.h sys/file.h \
82 sys/stat.h])
Kaveh R. Ghazi0d667712005-04-11 21:46:59 +000083define(fixincludes_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
84 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
85 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
86 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
87 putchar_unlocked putc_unlocked)
88AC_CHECK_FUNCS(fixincludes_UNLOCKED_FUNCS)
Marcin Dalecki03e34d02006-01-31 22:18:59 +010089AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno vasprintf fixincludes_UNLOCKED_FUNCS)))
Paolo Bonzini71b5d512004-08-31 09:27:00 +000090
91# Checks for typedefs, structures, and compiler characteristics.
92AC_C_CONST
93
94# Checks for library functions.
95gcc_AC_FUNC_MMAP_BLACKLIST
96
97AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
98AC_ARG_ENABLE(maintainer-mode,
99[ --enable-maintainer-mode enable make rules and dependencies not useful
100 (and sometimes confusing) to the casual installer],
101 USE_MAINTAINER_MODE=$enableval,
102 USE_MAINTAINER_MODE=no)
103AC_MSG_RESULT($USE_MAINTAINER_MODE)
104if test "$USE_MAINTAINER_MODE" = yes; then
105 MAINT=
106else
107 MAINT='#'
108fi
109AC_SUBST(MAINT)
Bruce Korb6aa1f8c2008-09-06 19:57:26 +0000110AC_DEFINE_UNQUITED([SED_PROGRAM], "${SED}",
111 [Defined to the best working sed program on the host system])
Paolo Bonzini71b5d512004-08-31 09:27:00 +0000112
113AC_CONFIG_HEADERS(config.h, [echo timestamp > stamp-h])
Zack Weinberg90ee1362005-03-21 17:50:19 +0000114AC_CONFIG_FILES(Makefile mkheaders.almost:mkheaders.in)
Paolo Bonzini71b5d512004-08-31 09:27:00 +0000115AC_OUTPUT