VirtualBox

Changeset 3613 in kBuild for trunk/src/sed/configure.ac


Ignore:
Timestamp:
Sep 19, 2024 12:34:43 AM (7 months ago)
Author:
bird
Message:

src/sed: Merged in changes between 4.1.5 and 4.9 from the vendor branch. (svn merge /vendor/sed/4.1.5 /vendor/sed/current .)

Location:
trunk/src/sed
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sed

  • trunk/src/sed/configure.ac

    r1158 r3613  
     1# Copyright (C) 1993-2022 Free Software Foundation, Inc.
     2
     3# This program is free software: you can redistribute it and/or modify
     4# it under the terms of the GNU General Public License as published by
     5# the Free Software Foundation, either version 3 of the License, or
     6# (at your option) any later version.
     7
     8# This program is distributed in the hope that it will be useful,
     9# but WITHOUT ANY WARRANTY; without even the implied warranty of
     10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11# GNU General Public License for more details.
     12
     13# You should have received a copy of the GNU General Public License
     14# along with this program.  If not, see <https://www.gnu.org/licenses/>.
     15
    116dnl Process this file with -*- autoconf -*- to produce a configure script.
    2 AC_INIT(sed, 4.1.5, [email protected], sed)
    3 AC_CONFIG_AUX_DIR(config)
     17AC_INIT([GNU sed],
     18        m4_esyscmd([build-aux/git-version-gen .tarball-version]),
     19        [[email protected]])
     20AC_CONFIG_AUX_DIR(build-aux)
    421AC_CONFIG_SRCDIR([sed/sed.c])
    5 AM_CONFIG_HEADER(config.h:config_h.in)
    6 AC_PREREQ(2.59)
    7 AM_INIT_AUTOMAKE
    8 
    9 SED_FEATURE_VERSION=4.1
    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)
     22AC_CONFIG_HEADERS([config.h:config_h.in])
     23AC_PREREQ([2.64])
     24AM_INIT_AUTOMAKE([1.11.1 dist-xz color-tests parallel-tests subdir-objects])
     25AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
     26AC_CONFIG_MACRO_DIR([m4])
    1327
    1428AC_PROG_CC
    15 AC_PROG_RANLIB
    16 AC_GNU_SOURCE
    17 AC_AIX
    18 AC_MINIX
    19 AC_ISC_POSIX
    20 AC_SYS_LARGEFILE
    21 AC_SYS_LONG_FILE_NAMES
     29AM_PROG_CC_C_O
     30gl_EARLY
     31gl_INIT
     32gl_DISABLE_THREADS
     33
     34# Ensure VLAs are not used.
     35# Note -Wvla is implicitly added by gl_MANYWARN_ALL_GCC
     36AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs])
     37
     38# The test suite needs to know if we have a working perl.
     39AM_CONDITIONAL([HAVE_PERL], [test "$gl_cv_prog_perl" != no])
     40
     41# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
     42# ------------------------------------------------
     43# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
     44# Otherwise, run RUN-IF-NOT-FOUND.
     45AC_DEFUN([gl_GCC_VERSION_IFELSE],
     46  [AC_PREPROC_IFELSE(
     47    [AC_LANG_PROGRAM(
     48      [[
     49#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
     50/* ok */
     51#else
     52# error "your version of gcc is older than $1.$2"
     53#endif
     54      ]]),
     55    ], [$3], [$4])
     56  ]
     57)
     58
     59AC_CACHE_CHECK([whether "rt" can be used with fopen], [sed_cv_fopen_rt], [
     60AC_RUN_IFELSE(
     61  [AC_LANG_SOURCE([[
     62#include <stdio.h>
     63#include <errno.h>
     64
     65int main()
     66{
     67  FILE *fp;
     68  int result;
     69  errno = 0;
     70  fp = fopen ("conftest.c", "rt");
     71  if (fp) fclose (fp);
     72  return fp ? 0 : 1;
     73}]])], [sed_cv_fopen_rt=yes],
     74    [sed_cv_fopen_rt=no],
     75    [case $host in
     76       *cygwin* | *mingw*) sed_cv_fopen_rt=yes ;;
     77       *) sed_cv_fopen_rt='assuming no' ;;
     78     esac])])
     79if test "$sed_cv_fopen_rt" = yes; then
     80  AC_DEFINE([HAVE_FOPEN_RT], [1],
     81            [Defined if "rt" can be used as a mode to fopen.])
     82fi
    2283
    2384AC_CACHE_CHECK([whether -lcP is needed], [sed_cv_libcp_needed], [
    24 AC_TRY_RUN([
     85AC_RUN_IFELSE(
     86  [AC_LANG_SOURCE([[
    2587#include <stdio.h>
    2688#include <errno.h>
     
    3698  fclose (fp);
    3799  return result;
    38 }], [sed_cv_libcp_needed=no],
     100}]])], [sed_cv_libcp_needed=no],
    39101    [sed_cv_libcp_needed=yes],
    40102    [sed_cv_libcp_needed="assuming no"])
     
    44106fi
    45107
    46 AC_HEADER_DIRENT
    47 AC_CHECK_HEADERS(io.h limits.h locale.h stdarg.h alloca.h stddef.h errno.h \
    48                  wchar.h wctype.h sys/file.h mcheck.h, [], [],
    49                  [AC_INCLUDES_DEFAULT])
     108AC_CHECK_HEADERS_ONCE(locale.h errno.h wchar.h wctype.h mcheck.h,
     109                      [], [], [AC_INCLUDES_DEFAULT])
    50110AC_C_CONST
    51111AC_TYPE_SIZE_T
    52 AC_CHECK_TYPE(ssize_t, int)
    53 
    54 AC_HEADER_STDBOOL
    55 if test "$ac_cv_type__Bool" = no; then
    56   HAVE__BOOL=0
    57 else
    58   HAVE__BOOL=1
    59 fi
    60 AC_SUBST(HAVE__BOOL)
    61 if test "$ac_cv_header_stdbool_h" = no; then
    62   AC_CONFIG_FILES(lib/stdbool.h:lib/stdbool_.h)
    63 fi
    64 
    65 AC_FUNC_ALLOCA
    66 AC_FUNC_VPRINTF
    67 AM_FUNC_GETLINE
    68 AC_FUNC_OBSTACK
    69 AC_FUNC_MBRTOWC
    70 AC_TYPE_MBSTATE_T
    71 gl_FUNC_STRVERSCMP
    72 AC_REPLACE_FUNCS(memchr memcmp memmove strerror mkstemp)
    73 AC_CHECK_FUNCS(isatty bcopy bzero isascii memcpy memset strchr strtoul popen \
    74                 pathconf isblank fchown fchmod setlocale wcrtomb wcscoll btowc)
     112
     113AM_GNU_GETTEXT_VERSION([0.19.2])
     114AM_GNU_GETTEXT([external])
     115
     116AC_CHECK_FUNCS_ONCE(isatty isascii memcpy strchr strtoul readlink
     117                    popen pathconf fchown fchmod setlocale)
     118
     119AM_CONDITIONAL([TEST_SYMLINKS],
     120          [test "$ac_cv_func_readlink" = yes])
    75121
    76122AC_ARG_ENABLE(i18n,
    77 [  --disable-i18n          disable internationalization (default=yes)], ,
     123[  --disable-i18n          disable internationalization (default=enabled)], ,
    78124enable_i18n=yes)
    79125if test "x$enable_i18n" = xno; then
    80   ac_cv_func_wcscoll=false
     126  ac_cv_func_wcscoll=no
    81127fi
    82128
    83 AC_ARG_WITH(included-regex,
    84 [  --with-included-regex   use included regex matcher (default=yes)], ,
    85 with_included_regex=yes)
    86 
    87 if test "x$with_included_regex" = xno; then
    88   AC_CHECK_HEADERS(regex.h)
    89   AC_CHECK_LIB(regex, re_search)
    90   AC_CHECK_FUNC(re_search)
    91   if test $ac_cv_header_regex_h = no || test $ac_cv_func_re_search = no; then
    92     AC_MSG_WARN([GNU regex not found, falling back to the included version])
    93     with_included_regex=yes
     129
     130# Determine whether we should run UTF-8 tests by checking if cyrillic
     131# letters are case-folded properly.  The test for UTF-8 locales (both
     132# in general and specifically for a Russian one) is a bit weak, but it
     133# should match exactly what is done in the testsuite.  In fact, sed's
     134# logic is portable (though testing it requires care) so it is enough to
     135# have a couple of platforms where these tests pass.  Right now, only
     136# Windows and HP/UX do not support the tests.
     137AC_MSG_CHECKING([whether UTF-8 case folding tests should pass])
     138AC_RUN_IFELSE(
     139  [AC_LANG_SOURCE([[
     140#include <locale.h>
     141#include <string.h>
     142#include <stdlib.h>
     143#include <wchar.h>
     144#ifdef HAVE_WCTYPE_H
     145#include <wctype.h>
     146#endif
     147
     148int test(void)
     149{
     150  char in[] = "\xD0\xB4";
     151  char good[] = "\xD0\x94";
     152  char out[10];
     153  wchar_t in_wc, good_wc;
     154  if (mbtowc (&in_wc, in, 3) == -1)
     155    return 0;
     156  if (mbtowc (&good_wc, good, 3) == -1)
     157    return 0;
     158  if (towupper (in_wc) != good_wc)
     159    return 0;
     160  if (wctomb (out, good_wc) != 2)
     161    return 0;
     162  if (memcmp (out, good, 2))
     163    return 0;
     164  return 1;
     165}
     166
     167int main()
     168{
     169  char *old;
     170  int len;
     171
     172  /* Try hardcoding a Russian UTF-8 locale.  If the name "ru_RU.UTF-8"
     173     is invalid, use setlocale again just to get the current locale.  */
     174  old = setlocale (LC_CTYPE, "ru_RU.UTF-8");
     175  if (old)
     176    {
     177      if (test())
     178        exit (0);
     179    }
     180  else
     181    old = setlocale (LC_CTYPE, "C");
     182
     183  /* Maybe cyrillic case folding is implemented for all UTF-8 locales.
     184     If the current locale is not UTF-8, the test will be skipped.  */
     185  len = strlen (old);
     186  if ((len > 6 && !strcmp (old + len - 6, ".UTF-8"))
     187      || (len > 6 && !strcmp (old + len - 6, ".utf-8"))
     188      || (len > 5 && !strcmp (old + len - 5, ".UTF8"))
     189      || (len > 5 && !strcmp (old + len - 5, ".utf8")))
     190
     191    /* ok */
     192    ;
     193  else
     194    exit (1);
     195
     196  /* Run the test in the detected UTF-8 locale.  */
     197  setlocale (LC_CTYPE, old);
     198  exit (!test ());
     199}
     200]])], [AC_MSG_RESULT([yes]); XFAIL_TESTS=],
     201   [AC_MSG_RESULT([no]); XFAIL_TESTS='testsuite/utf8-1 testsuite/utf8-2 \
     202                                      testsuite/utf8-3 testsuite/utf8-4'],
     203   [AC_MSG_RESULT([don't care (cross compiling)]); XFAIL_TESTS=])
     204
     205# Under MinGW, the bsd.sh test fails because of the EOF character (^Z).
     206case $host in
     207  *mingw*) XFAIL_TESTS="$XFAIL_TESTS bsd" ;;
     208  *) ;;
     209esac
     210AC_SUBST([XFAIL_TESTS])
     211
     212AC_ARG_ENABLE([gcc-warnings],
     213  [AS_HELP_STRING([--enable-gcc-warnings],
     214     [turn on many GCC warnings (for developers; best with GNU make)])],
     215  [case $enableval in
     216     yes|no) ;;
     217     *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
     218   esac
     219   gl_gcc_warnings=$enableval],
     220  [
     221   # GCC provides fine-grained control over diagnostics which
     222   # is used in gnulib for example to suppress warnings from
     223   # certain sections of code.  So if this is available and
     224   # we're running from a git repo, then auto enable the warnings.
     225   gl_gcc_warnings=no
     226   gl_GCC_VERSION_IFELSE([4], [6],
     227                         [test -d "$srcdir"/.git \
     228                          && ! test -f "$srcdir"/.tarball-version \
     229                          && gl_gcc_warnings=yes])]
     230)
     231
     232if test "$gl_gcc_warnings" = yes; then
     233  gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
     234  AC_SUBST([WERROR_CFLAGS])
     235
     236  nw=
     237  # This, $nw, is the list of warnings we disable.
     238  nw="$nw -Wdeclaration-after-statement" # too useful to forbid
     239  nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
     240  nw="$nw -Wsign-conversion"        # Too many warnings for now
     241  nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
     242  nw="$nw -Wswitch-default"         # Too many warnings for now
     243
     244  gl_MANYWARN_ALL_GCC([ws])
     245  gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
     246  for w in $ws; do
     247    gl_WARN_ADD([$w])
     248  done
     249  gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
     250
     251  # clang is unduly picky about some things.
     252  AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang],
     253    [AC_COMPILE_IFELSE(
     254       [AC_LANG_PROGRAM([[
     255            #ifndef __clang__
     256              #error "not clang"
     257            #endif
     258          ]])],
     259       [utils_cv_clang=yes],
     260       [utils_cv_clang=no])])
     261  if test $utils_cv_clang = yes; then
     262    gl_WARN_ADD([-Wno-format-extra-args])
     263    gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
    94264  fi
     265
     266  gl_WARN_ADD([-fdiagnostics-show-option])
     267  gl_WARN_ADD([-funit-at-a-time])
     268
     269  AC_SUBST([WARN_CFLAGS])
     270
     271  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
     272  AH_VERBATIM([FORTIFY_SOURCE],
     273  [/* Enable compile-time and run-time bounds-checking, and some warnings,
     274      without upsetting glibc 2.15+. */
     275   #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__
     276   # define _FORTIFY_SOURCE 2
     277   #endif
     278  ])
     279  AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
     280
     281  # For gnulib-tests, the set is slightly smaller still.
     282  nw=
     283  gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
     284                         [$WARN_CFLAGS], [$nw])
     285  AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
    95286fi
    96287
    97 AC_ARG_ENABLE(regex-tests,
    98 [  --enable-regex-tests    enable regex matcher regression tests (default=yes)],
    99 [if test "x$with_included_regex" = xno; then
    100   enable_regex_tests=no
    101 fi],
    102 enable_regex_tests=$with_included_regex)
    103 
    104 AM_CONDITIONAL(TEST_REGEX, test "x$enable_regex_tests" != xno)
    105 if test "x$with_included_regex" != xno; then
    106   AC_CONFIG_LINKS(lib/regex.h:lib/regex_.h)
    107   AC_LIBOBJ(regex)
    108 fi
    109 if test "x$enable_regex_tests" = xyes; then
    110   AC_DEFINE_UNQUOTED(_REGEX_RE_COMP, 1,
    111     [Include BSD functions in regex, used by the testsuite])
    112 fi
    113 
    114 AC_ARG_ENABLE(html,
    115 [  --enable-html           build HTML manual (default=no)], ,
    116 enable_html=no)
    117 
    118 AM_CONDITIONAL(BUILD_HTML, test "x$enable_html" != xno)
    119 
    120 : ${TEXI2HTML=texi2html -monolithic}
    121 AC_SUBST(TEXI2HTML)
    122 
    123 AC_MSG_CHECKING(how to build HTML documentation)
    124 if eval $am_missing_run makeinfo --help 2>&1 | grep .-html > /dev/null; then
    125   AC_MSG_RESULT(with makeinfo)
    126   enable_html=makeinfo
    127 else
    128   if $TEXI2HTML --help 2>&1 | grep monolithic > /dev/null; then
    129     AC_MSG_RESULT(with texi2html)
    130     enable_html=texi2html
    131   else
    132     AC_MSG_RESULT(not built)
    133     if test "x$enable_html" != xno; then
    134       AC_MSG_ERROR(cannot build HTML documentation, install makeinfo 4.0 or texi2html)
    135     fi
    136     enable_html=no
    137   fi
    138 fi
    139 
    140 AM_CONDITIONAL(MAKEINFO_HTML, test "x$enable_html" = xmakeinfo)
    141 AM_CONDITIONAL(TEXI2HTML_HTML, test "x$enable_html" = xtexi2html)
    142 
    143 
    144 AC_DEFUN([AM_MKINSTALLDIRS], [MKINSTALLDIRS="$mkdir_p" AC_SUBST(MKINSTALLDIRS)])
    145 AM_GNU_GETTEXT_VERSION(0.14)
    146 AM_GNU_GETTEXT(no-libtool, need-ngettext, ../intl)
    147 dnl bird: made the 'expr/a\' stuff work on BSD. a\ only works when scripting there.
    148 AC_CONFIG_COMMANDS([gettext-fix], [
    149   echo '/^mkinstalldirs *=/a\' > tmp.sed
    150   echo "install_sh=$install_sh" >> tmp.sed
    151   echo 's/^mkinstalldirs *=.*/mkinstalldirs=$(MKINSTALLDIRS)/' >> tmp.sed
    152   sed -f tmp.sed intl/Makefile > intl/Makefile.tmp
    153   mv intl/Makefile.tmp intl/Makefile
    154   sed -f tmp.sed po/Makefile > po/Makefile.tmp
    155   mv po/Makefile.tmp po/Makefile
    156   rm -f tmp.sed], [
    157   install_sh="$install_sh"])
    158 
    159 AC_CONFIG_FILES([bootstrap.sh], chmod +x bootstrap.sh)
    160 AC_CONFIG_FILES([Makefile doc/Makefile \
    161 lib/Makefile sed/Makefile testsuite/Makefile \
    162 po/Makefile.in intl/Makefile])
     288AC_ARG_ENABLE([bold-man-page-references],
     289  [AS_HELP_STRING([--disable-bold-man-page-references],
     290     [When generating man pages, do not apply bold style around any
     291      references like name(1) etc.])],
     292  [gl_bold_manpages=yes ;
     293   case $enableval in
     294     no|yes) gl_bold_manpages=$enableval ;;
     295     *)      AC_MSG_ERROR([bad value $enableval for bold-man-page-references.
     296                           Options are: yes, no.]) ;;
     297   esac],
     298  [gl_bold_manpages=yes]
     299)
     300AM_CONDITIONAL([BOLD_MAN_REFS], [test "$gl_bold_manpages" != no])
     301
     302AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
     303
     304# Perl is needed for help2man
     305AC_PATH_PROG([PERL], [perl])
     306
     307# This is needed when building outside the source dir
     308# with --disable-dependency-tracking, see https://bugs.gnu.org/25371
     309AS_MKDIR_P([lib])
     310AS_MKDIR_P([sed])
     311AS_MKDIR_P([doc])
     312AS_MKDIR_P([testsuite])
     313
     314AC_CONFIG_FILES([
     315  Makefile
     316  po/Makefile.in
     317  gnulib-tests/Makefile
     318])
    163319AC_OUTPUT
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette