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