2011-12-09 François Dumont <fdumont@gcc.gnu.org>
[official-gcc.git] / fixincludes / configure.ac
blobe7de791826790862ab40540a91083c9ddc93ac72
1 AC_PREREQ(2.64)
3 AC_INIT(fixincludes, [ ])
4 AC_CONFIG_SRCDIR(inclhack.def)
5 AC_CONFIG_AUX_DIR(..)
6 m4_sinclude(../libtool.m4)
7 AC_CANONICAL_SYSTEM
8 AC_PROG_CC
9 AC_USE_SYSTEM_EXTENSIONS
10 AC_PROG_SED
12 # Figure out what compiler warnings we can enable.
13 # See config/warnings.m4 for details.
15 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
16                           -Wmissing-prototypes -Wold-style-definition \
17                           -Wmissing-format-attribute -Wno-overlength-strings])
18 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
20 # Only enable with --enable-werror-always until existing warnings are
21 # corrected.
22 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
24 # Determine the noncanonical target name, for directory use.
25 ACX_NONCANONICAL_TARGET
27 # Specify the local prefix
28 local_prefix=
29 AC_ARG_WITH(local-prefix,
30 [  --with-local-prefix=DIR specifies directory to put local include],
31 [case "${withval}" in
32 yes)    AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
33 no)     ;;
34 *)      local_prefix=$with_local_prefix ;;
35 esac])
37 # Default local prefix if it is empty
38 if test x$local_prefix = x; then
39         local_prefix=/usr/local
42 # Choose one or two-process fix methodology.  Systems that cannot handle
43 # bi-directional pipes must use the two process method.
45 AC_ARG_ENABLE([twoprocess],
46 [  --enable-twoprocess       Use a separate process to apply the fixes],
47 [if test "x$enable_twoprocess" = xyes; then
48         TARGET=twoprocess
49 else
50         TARGET=oneprocess
51 fi],
52 [case $host in
53         i?86-*-msdosdjgpp* | \
54         i?86-*-mingw32* | \
55         x86_64-*-mingw32* | \
56         *-*-beos* )
57                 TARGET=twoprocess
58                 ;;
60         * )
61                 TARGET=oneprocess
62                 ;;
63 esac])
64 AC_SUBST(TARGET)
66 if test $TARGET = twoprocess; then
67         AC_DEFINE(SEPARATE_FIX_PROC, 1,
68                   [Define if testing and fixing are done by separate process])
71 case $host in
72         vax-dec-bsd* )
73                 AC_DEFINE(exit, xexit, [Define to xexit if the host system does not support atexit])
74                 AC_DEFINE(atexit, xatexit, [Define to xatexit if the host system does not support atexit])
75                 ;;
76 esac
78 AC_DEFINE_UNQUOTED([EXE_EXT], "$ac_exeext",
79   [Defined to the executable file extension on the host system])
81 # Checks for header files.
82 AC_HEADER_STDC
83 AC_CHECK_HEADERS([stddef.h stdlib.h strings.h unistd.h fcntl.h sys/file.h \
84         sys/stat.h])
85 define(fixincludes_UNLOCKED_FUNCS, clearerr_unlocked feof_unlocked dnl
86   ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked dnl
87   fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked dnl
88   fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked dnl
89   putchar_unlocked putc_unlocked)
90 AC_CHECK_FUNCS(fixincludes_UNLOCKED_FUNCS)
91 AC_CHECK_DECLS([abort, asprintf, basename(char *), errno, vasprintf])
92 AC_CHECK_DECLS(m4_split(m4_normalize(fixincludes_UNLOCKED_FUNCS)))
94 # Checks for typedefs, structures, and compiler characteristics.
95 AC_C_CONST
97 # Checks for library functions.
98 gcc_AC_FUNC_MMAP_BLACKLIST
100 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
101 AC_ARG_ENABLE(maintainer-mode,
102 [  --enable-maintainer-mode enable make rules and dependencies not useful
103                           (and sometimes confusing) to the casual installer],
104       USE_MAINTAINER_MODE=$enableval,
105       USE_MAINTAINER_MODE=no)
106 AC_MSG_RESULT($USE_MAINTAINER_MODE)
107 if test "$USE_MAINTAINER_MODE" = yes; then
108   MAINT=
109 else
110   MAINT='#'
111 fi      
112 AC_SUBST(MAINT)
113 AC_DEFINE_UNQUOTED([SED_PROGRAM], "${SED}",
114    [Defined to the best working sed program on the host system])
116 AC_CONFIG_HEADERS(config.h, [echo timestamp > stamp-h])
117 AC_CONFIG_FILES(Makefile mkheaders.almost:mkheaders.in)
118 AC_OUTPUT