| 1 | 266 | jeremybenn | AC_PREREQ(2.64)
 | 
      
         | 2 |  |  |  
 | 
      
         | 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_PROG_SED
 | 
      
         | 10 |  |  |  
 | 
      
         | 11 |  |  | # Figure out what compiler warnings we can enable.
 | 
      
         | 12 |  |  | # See config/warnings.m4 for details.
 | 
      
         | 13 |  |  |  
 | 
      
         | 14 |  |  | ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
 | 
      
         | 15 |  |  |                           -Wmissing-prototypes -Wold-style-definition \
 | 
      
         | 16 |  |  |                           -Wmissing-format-attribute -Wno-overlength-strings])
 | 
      
         | 17 |  |  | ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
 | 
      
         | 18 |  |  |  
 | 
      
         | 19 |  |  | # Only enable with --enable-werror-always until existing warnings are
 | 
      
         | 20 |  |  | # corrected.
 | 
      
         | 21 |  |  | ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
 | 
      
         | 22 |  |  |  
 | 
      
         | 23 |  |  | # Determine the noncanonical target name, for directory use.
 | 
      
         | 24 |  |  | ACX_NONCANONICAL_TARGET
 | 
      
         | 25 |  |  |  
 | 
      
         | 26 |  |  | # Specify the local prefix
 | 
      
         | 27 |  |  | local_prefix=
 | 
      
         | 28 |  |  | AC_ARG_WITH(local-prefix,
 | 
      
         | 29 |  |  | [  --with-local-prefix=DIR specifies directory to put local include],
 | 
      
         | 30 |  |  | [case "${withval}" in
 | 
      
         | 31 |  |  | yes)    AC_MSG_ERROR(bad value ${withval} given for local include directory prefix) ;;
 | 
      
         | 32 |  |  | no)     ;;
 | 
      
         | 33 |  |  | *)      local_prefix=$with_local_prefix ;;
 | 
      
         | 34 |  |  | esac])
 | 
      
         | 35 |  |  |  
 | 
      
         | 36 |  |  | # Default local prefix if it is empty
 | 
      
         | 37 |  |  | if test x$local_prefix = x; then
 | 
      
         | 38 |  |  |         local_prefix=/usr/local
 | 
      
         | 39 |  |  | fi
 | 
      
         | 40 |  |  |  
 | 
      
         | 41 |  |  | # Choose one or two-process fix methodology.  Systems that cannot handle
 | 
      
         | 42 |  |  | # bi-directional pipes must use the two process method.
 | 
      
         | 43 |  |  | #
 | 
      
         | 44 |  |  | AC_ARG_ENABLE([twoprocess],
 | 
      
         | 45 |  |  | [  --enable-twoprocess       Use a separate process to apply the fixes],
 | 
      
         | 46 |  |  | [if test "x$enable_twoprocess" = xyes; then
 | 
      
         | 47 |  |  |         TARGET=twoprocess
 | 
      
         | 48 |  |  | else
 | 
      
         | 49 |  |  |         TARGET=oneprocess
 | 
      
         | 50 |  |  | fi],
 | 
      
         | 51 |  |  | [case $host in
 | 
      
         | 52 |  |  |         i?86-*-msdosdjgpp* | \
 | 
      
         | 53 |  |  |         i?86-*-mingw32* | \
 | 
      
         | 54 |  |  |         x86_64-*-mingw32* | \
 | 
      
         | 55 |  |  |         *-*-beos* )
 | 
      
         | 56 |  |  |                 TARGET=twoprocess
 | 
      
         | 57 |  |  |                 ;;
 | 
      
         | 58 |  |  |  
 | 
      
         | 59 |  |  |         * )
 | 
      
         | 60 |  |  |                 TARGET=oneprocess
 | 
      
         | 61 |  |  |                 ;;
 | 
      
         | 62 |  |  | esac])
 | 
      
         | 63 |  |  | AC_SUBST(TARGET)
 | 
      
         | 64 |  |  |  
 | 
      
         | 65 |  |  | if test $TARGET = twoprocess; then
 | 
      
         | 66 |  |  |         AC_DEFINE(SEPARATE_FIX_PROC, 1,
 | 
      
         | 67 |  |  |                   [Define if testing and fixing are done by separate process])
 | 
      
         | 68 |  |  | fi
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  | case $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 |  |  |                 ;;
 | 
      
         | 75 |  |  | esac
 | 
      
         | 76 |  |  |  
 | 
      
         | 77 |  |  | AC_DEFINE_UNQUOTED([EXE_EXT], "$ac_exeext",
 | 
      
         | 78 |  |  |   [Defined to the executable file extension on the host system])
 | 
      
         | 79 |  |  |  
 | 
      
         | 80 |  |  | # Checks for header files.
 | 
      
         | 81 |  |  | AC_HEADER_STDC
 | 
      
         | 82 |  |  | AC_CHECK_HEADERS([stddef.h stdlib.h strings.h unistd.h fcntl.h sys/file.h \
 | 
      
         | 83 |  |  |         sys/stat.h])
 | 
      
         | 84 |  |  | define(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)
 | 
      
         | 89 |  |  | AC_CHECK_FUNCS(fixincludes_UNLOCKED_FUNCS)
 | 
      
         | 90 |  |  | AC_CHECK_DECLS(m4_split(m4_normalize(abort asprintf basename errno vasprintf fixincludes_UNLOCKED_FUNCS)))
 | 
      
         | 91 |  |  |  
 | 
      
         | 92 |  |  | # Checks for typedefs, structures, and compiler characteristics.
 | 
      
         | 93 |  |  | AC_C_CONST
 | 
      
         | 94 |  |  |  
 | 
      
         | 95 |  |  | # Checks for library functions.
 | 
      
         | 96 |  |  | gcc_AC_FUNC_MMAP_BLACKLIST
 | 
      
         | 97 |  |  |  
 | 
      
         | 98 |  |  | AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
 | 
      
         | 99 |  |  | AC_ARG_ENABLE(maintainer-mode,
 | 
      
         | 100 |  |  | [  --enable-maintainer-mode enable make rules and dependencies not useful
 | 
      
         | 101 |  |  |                           (and sometimes confusing) to the casual installer],
 | 
      
         | 102 |  |  |       USE_MAINTAINER_MODE=$enableval,
 | 
      
         | 103 |  |  |       USE_MAINTAINER_MODE=no)
 | 
      
         | 104 |  |  | AC_MSG_RESULT($USE_MAINTAINER_MODE)
 | 
      
         | 105 |  |  | if test "$USE_MAINTAINER_MODE" = yes; then
 | 
      
         | 106 |  |  |   MAINT=
 | 
      
         | 107 |  |  | else
 | 
      
         | 108 |  |  |   MAINT='#'
 | 
      
         | 109 |  |  | fi
 | 
      
         | 110 |  |  | AC_SUBST(MAINT)
 | 
      
         | 111 |  |  | AC_DEFINE_UNQUOTED([SED_PROGRAM], "${SED}",
 | 
      
         | 112 |  |  |    [Defined to the best working sed program on the host system])
 | 
      
         | 113 |  |  |  
 | 
      
         | 114 |  |  | AC_CONFIG_HEADERS(config.h, [echo timestamp > stamp-h])
 | 
      
         | 115 |  |  | AC_CONFIG_FILES(Makefile mkheaders.almost:mkheaders.in)
 | 
      
         | 116 |  |  | AC_OUTPUT
 |