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