blob: 190f53828744dca8589636325ba6812d80032bea [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
Douglas B Rupp20720202011-06-08 21:27:06 +00009AC_USE_SYSTEM_EXTENSIONS
Bruce Korb6aa1f8c2008-09-06 19:57:26 +000010AC_PROG_SED
Paolo Bonzini71b5d512004-08-31 09:27:00 +000011
Kaveh R. Ghazi87fbb652005-07-16 14:17:51 +000012# Figure out what compiler warnings we can enable.
13# See config/warnings.m4 for details.
14
15ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
16 -Wmissing-prototypes -Wold-style-definition \
Mike Stumpde1f8a02006-05-17 00:31:31 +000017 -Wmissing-format-attribute -Wno-overlength-strings])
Kaveh R. Ghazi87fbb652005-07-16 14:17:51 +000018ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
19
20# Only enable with --enable-werror-always until existing warnings are
21# corrected.
22ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
23
Geoffrey Keating53c7ffe72004-11-05 04:49:19 +000024# Determine the noncanonical target name, for directory use.
25ACX_NONCANONICAL_TARGET
26
27# Specify the local prefix
28local_prefix=
29AC_ARG_WITH(local-prefix,
30[ --with-local-prefix=DIR specifies directory to put local include],
31[case "${withval}" in
32yes) AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
33no) ;;
34*) local_prefix=$with_local_prefix ;;
35esac])
36
37# Default local prefix if it is empty
38if test x$local_prefix = x; then
39 local_prefix=/usr/local
40fi
41
Paolo Bonzini71b5d512004-08-31 09:27:00 +000042# Choose one or two-process fix methodology. Systems that cannot handle
43# bi-directional pipes must use the two process method.
44#
Paolo Bonziniad643a72004-10-15 07:58:38 +000045AC_ARG_ENABLE([twoprocess],
46[ --enable-twoprocess Use a separate process to apply the fixes],
Paolo Bonzini5ae4c562004-10-27 14:42:56 +000047[if test "x$enable_twoprocess" = xyes; then
Paolo Bonziniad643a72004-10-15 07:58:38 +000048 TARGET=twoprocess
49else
50 TARGET=oneprocess
51fi],
52[case $host in
Paolo Bonzini71b5d512004-08-31 09:27:00 +000053 i?86-*-msdosdjgpp* | \
Paolo Bonziniad643a72004-10-15 07:58:38 +000054 i?86-*-mingw32* | \
Kai Tietza2085732007-10-12 11:54:16 +000055 x86_64-*-mingw32* | \
Tristan Gingoldc1041242012-04-24 09:24:55 +000056 *-*-beos* | \
57 *-*-*vms*)
Paolo Bonzini71b5d512004-08-31 09:27:00 +000058 TARGET=twoprocess
Paolo Bonzini71b5d512004-08-31 09:27:00 +000059 ;;
60
61 * )
62 TARGET=oneprocess
63 ;;
Paolo Bonziniad643a72004-10-15 07:58:38 +000064esac])
Paolo Bonzini71b5d512004-08-31 09:27:00 +000065AC_SUBST(TARGET)
66
Paolo Bonziniad643a72004-10-15 07:58:38 +000067if test $TARGET = twoprocess; then
68 AC_DEFINE(SEPARATE_FIX_PROC, 1,
69 [Define if testing and fixing are done by separate process])
70fi
71
72case $host in
73 vax-dec-bsd* )
74 AC_DEFINE(exit, xexit, [Define to xexit if the host system does not support atexit])
75 AC_DEFINE(atexit, xatexit, [Define to xatexit if the host system does not support atexit])
76 ;;
77esac
78
79AC_DEFINE_UNQUOTED([EXE_EXT], "$ac_exeext",
80 [Defined to the executable file extension on the host system])
81
Paolo Bonzini71b5d512004-08-31 09:27:00 +000082# Checks for header files.
83AC_HEADER_STDC
84AC_CHECK_HEADERS([stddef.h stdlib.h strings.h unistd.h fcntl.h sys/file.h \
85 sys/stat.h])
Kaveh R. Ghazi0d667712005-04-11 21:46:59 +000086define(fixincludes_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
87 ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
88 fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
89 fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
90 putchar_unlocked putc_unlocked)
91AC_CHECK_FUNCS(fixincludes_UNLOCKED_FUNCS)
Ralf Wildenhuesc3f247f2010-06-03 06:45:02 +000092AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, vasprintf])
93AC_CHECK_DECLS(m4_split(m4_normalize(fixincludes_UNLOCKED_FUNCS)))
Paolo Bonzini71b5d512004-08-31 09:27:00 +000094
95# Checks for typedefs, structures, and compiler characteristics.
96AC_C_CONST
97
98# Checks for library functions.
Thomas Schwinge678abdd2012-05-29 21:28:57 +020099GCC_AC_FUNC_MMAP_BLACKLIST
Paolo Bonzini71b5d512004-08-31 09:27:00 +0000100
101AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
102AC_ARG_ENABLE(maintainer-mode,
103[ --enable-maintainer-mode enable make rules and dependencies not useful
104 (and sometimes confusing) to the casual installer],
105 USE_MAINTAINER_MODE=$enableval,
106 USE_MAINTAINER_MODE=no)
107AC_MSG_RESULT($USE_MAINTAINER_MODE)
108if test "$USE_MAINTAINER_MODE" = yes; then
109 MAINT=
110else
111 MAINT='#'
112fi
113AC_SUBST(MAINT)
H.J. Lu6a4bde92008-09-06 23:00:24 +0000114AC_DEFINE_UNQUOTED([SED_PROGRAM], "${SED}",
Bruce Korb6aa1f8c2008-09-06 19:57:26 +0000115 [Defined to the best working sed program on the host system])
Paolo Bonzini71b5d512004-08-31 09:27:00 +0000116
Jakub Jelinek3c36aa62017-01-17 10:38:48 +0100117# Determine what GCC version number to use in filesystem paths.
118GCC_BASE_VER
119
Paolo Bonzini71b5d512004-08-31 09:27:00 +0000120AC_CONFIG_HEADERS(config.h, [echo timestamp > stamp-h])
Zack Weinberg90ee1362005-03-21 17:50:19 +0000121AC_CONFIG_FILES(Makefile mkheaders.almost:mkheaders.in)
Paolo Bonzini71b5d512004-08-31 09:27:00 +0000122AC_OUTPUT