Home | History | Annotate | Download | only in sed-4.2.1
      1 dnl Process this file with -*- autoconf -*- to produce a configure script.
      2 AC_INIT(sed, 4.2.1, bug-gnu-utils (a] gnu.org, sed)
      3 AC_CONFIG_AUX_DIR(build-aux)
      4 AC_CONFIG_SRCDIR([sed/sed.c])
      5 AM_CONFIG_HEADER(config.h:config_h.in)
      6 AC_PREREQ(2.60)
      7 AM_INIT_AUTOMAKE
      8 
      9 SED_FEATURE_VERSION=4.2
     10 AC_DEFINE_UNQUOTED(SED_FEATURE_VERSION, "$SED_FEATURE_VERSION",
     11   [Define to the version of GNU sed whose features are supported by this sed.])
     12 AC_SUBST(SED_FEATURE_VERSION)
     13 
     14 COPYRIGHT_YEAR=2009
     15 AC_DEFINE_UNQUOTED(COPYRIGHT_YEAR, $COPYRIGHT_YEAR,
     16   [Define to the copyright year printed by --version.])
     17 AC_SUBST(COPYRIGHT_YEAR)
     18 
     19 AC_PROG_CC
     20 gl_EARLY
     21 gl_INIT
     22 gl_DISABLE_THREADS
     23 AC_SYS_LONG_FILE_NAMES
     24 AC_CACHE_CHECK([whether -lcP is needed], [sed_cv_libcp_needed], [
     25 AC_TRY_RUN([
     26 #include <stdio.h>
     27 #include <errno.h>
     28 
     29 int main()
     30 {
     31   FILE *fp;
     32   int result;
     33   errno = 0;
     34   fp = fopen ("conftest.c", "r");
     35   if (!fp) return 0;	   /* error, assume not needed */
     36   result = fflush (fp) == EOF && errno == 0;
     37   fclose (fp);
     38   return result;
     39 }], [sed_cv_libcp_needed=no],
     40     [sed_cv_libcp_needed=yes],
     41     [sed_cv_libcp_needed="assuming no"])
     42 ])
     43 if test "$sed_cv_libcp_needed" = yes; then
     44   LIBS="-lcP $LIBS"
     45 fi
     46 
     47 AC_HEADER_DIRENT
     48 AC_CHECK_HEADERS_ONCE(io.h limits.h locale.h stdarg.h alloca.h stddef.h
     49 		      errno.h wchar.h wctype.h sys/file.h mcheck.h, [], [],
     50 		 [AC_INCLUDES_DEFAULT])
     51 AC_C_CONST
     52 AC_TYPE_SIZE_T
     53 AC_CHECK_TYPE(ssize_t, int)
     54 
     55 AC_FUNC_VPRINTF
     56 
     57 AC_DEFUN([AM_MKINSTALLDIRS], [MKINSTALLDIRS="$mkdir_p" AC_SUBST(MKINSTALLDIRS)])
     58 AM_GNU_GETTEXT_VERSION(0.15)
     59 AM_GNU_GETTEXT([external])
     60 
     61 AC_CHECK_FUNCS_ONCE(isatty bcopy bzero isascii memcpy memset strchr strtoul
     62 		    popen pathconf fchown fchmod setlocale)
     63 
     64 AC_ARG_ENABLE(i18n,
     65 [  --disable-i18n          disable internationalization (default=enabled)], ,
     66 enable_i18n=yes)
     67 if test "x$enable_i18n" = xno; then
     68   ac_cv_func_wcscoll=false
     69 fi
     70 
     71 AC_ARG_ENABLE(regex-tests, 
     72 [  --enable-regex-tests    enable regex matcher regression tests (default=yes)],
     73 [if test "x$with_included_regex" = xno; then
     74   enable_regex_tests=no
     75 fi],
     76 enable_regex_tests=$with_included_regex)
     77 
     78 AM_CONDITIONAL(TEST_REGEX, test "x$enable_regex_tests" = xyes)
     79 if test "x$enable_regex_tests" = xyes; then
     80   AC_DEFINE_UNQUOTED(_REGEX_RE_COMP, 1,
     81     [Include BSD functions in regex, used by the testsuite])
     82 fi
     83 
     84 # Check whether we are able to follow symlinks
     85 AC_CHECK_FUNC(lstat, have_lstat=yes)
     86 AC_CHECK_FUNC(readlink, have_readlink=yes)
     87 if test "x$have_lstat" = xyes -a "x$have_readlink" = xyes; then
     88    AC_DEFINE(ENABLE_FOLLOW_SYMLINKS, ,[Follow symlinks when processing in place])
     89 fi
     90 
     91 # Determine whether we should run UTF-8 tests by checking if cyrillic
     92 # letters are case-folded properly.  The test for UTF-8 locales (bot
     93 # in general and specifically for a Russian one) is a bit weak, but it
     94 # should match exactly what is done in the testsuite.  In fact, sed's
     95 # logic is portable (though testing it requires care) so it is enough to
     96 # have a couple of platforms where these tests pass.  Right now, only
     97 # Windows and HP/UX do not support the tests.
     98 AC_MSG_CHECKING([whether UTF-8 case folding tests should pass])
     99 AC_TRY_RUN([
    100 #include <locale.h>
    101 #include <string.h>
    102 #include <stdlib.h>
    103 #include <wchar.h>
    104 #ifdef HAVE_WCTYPE_H
    105 #include <wctype.h>
    106 #endif
    107 
    108 int test(void)
    109 {
    110   char in[] = "\xD0\xB4";
    111   char good[] = "\xD0\x94";
    112   char out[10];
    113   wchar_t in_wc, good_wc;
    114   if (mbtowc (&in_wc, in, 3) == -1)
    115     return 0;
    116   if (mbtowc (&good_wc, good, 3) == -1)
    117     return 0;
    118   if (towupper (in_wc) != good_wc)
    119     return 0;
    120   if (wctomb (out, good_wc) != 2)
    121     return 0;
    122   if (memcmp (out, good, 2))
    123     return 0;
    124   return 1;
    125 }
    126 
    127 int main()
    128 {
    129   char *old;
    130   int len;
    131 
    132   /* Try hardcoding a Russian UTF-8 locale.  If the name "ru_RU.UTF-8"
    133      is invalid, use setlocale again just to get the current locale.  */
    134   old = setlocale (LC_CTYPE, "ru_RU.UTF-8");
    135   if (old)
    136     {
    137       if (test())
    138         exit (0);
    139     }
    140   else
    141     old = setlocale (LC_CTYPE, "C");
    142 
    143   /* Maybe cyrillic case folding is implemented for all UTF-8 locales.
    144      If the current locale is not UTF-8, the test will be skipped.  */
    145   len = strlen (old);
    146   if ((len > 6 && !strcmp (old + len - 6, ".UTF-8"))
    147       || (len > 6 && !strcmp (old + len - 6, ".utf-8"))
    148       || (len > 5 && !strcmp (old + len - 5, ".UTF8"))
    149       || (len > 5 && !strcmp (old + len - 5, ".utf8")))
    150 
    151     /* ok */
    152     ;
    153   else
    154     exit (1);
    155 
    156   /* Run the test in the detected UTF-8 locale.  */
    157   setlocale (LC_CTYPE, old);
    158   exit (!test ());
    159 }
    160 ], [AC_MSG_RESULT([yes]); XFAIL_TESTS=],
    161    [AC_MSG_RESULT([no]); XFAIL_TESTS='utf8-1 utf8-2 utf8-3 utf8-4'],
    162    [AC_MSG_RESULT([don't care (cross compiling)]); XFAIL_TESTS=])
    163 
    164 # Under MinGW, the bsd.sh test fails because of the EOF character (^Z).
    165 case $host in
    166   *mingw*) XFAIL_TESTS="$XFAIL_TESTS bsd" ;;
    167   *) ;;
    168 esac
    169 AC_SUBST([XFAIL_TESTS])
    170 
    171 AC_CONFIG_FILES([bootstrap.sh], chmod +x bootstrap.sh)
    172 AC_CONFIG_FILES([testsuite/version.good:testsuite/version.gin])
    173 AC_CONFIG_FILES([Makefile doc/Makefile \
    174 lib/Makefile sed/Makefile testsuite/Makefile \
    175 po/Makefile.in])
    176 AC_OUTPUT
    177