Merge branch 'nd/fopen-errors'
authorJunio C Hamano <gitster@pobox.com>
Thu, 22 Jun 2017 21:15:20 +0000 (14:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Jun 2017 21:15:20 +0000 (14:15 -0700)
Hotfix for a topic that is already in 'master'.

* nd/fopen-errors:
configure.ac: loosen FREAD_READS_DIRECTORIES test program

1  2 
Makefile
configure.ac
diff --combined Makefile
index f4848016380058ffdfc01966bc587ca7306415d9,4307588419789b501364a134843f9c9f40791db8..b94cd5633c8ebda7e09874a1012fb75cbccc64e0
+++ b/Makefile
@@@ -19,33 -19,17 +19,34 @@@ all:
  # have been written to the final string if enough space had been available.
  #
  # Define FREAD_READS_DIRECTORIES if you are on a system which succeeds
- # when attempting to read from an fopen'ed directory.
+ # when attempting to read from an fopen'ed directory (or even to fopen
+ # it at all).
  #
  # Define NO_OPENSSL environment variable if you do not have OpenSSL.
  # This also implies BLK_SHA1.
  #
 -# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
 -# able to use Perl-compatible regular expressions.
 -#
 -# Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in
 -# /foo/bar/include and /foo/bar/lib directories.
 +# Define USE_LIBPCRE if you have and want to use libpcre. Various
 +# commands such as log and grep offer runtime options to use
 +# Perl-compatible regular expressions instead of standard or extended
 +# POSIX regular expressions.
 +#
 +# Currently USE_LIBPCRE is a synonym for USE_LIBPCRE1, define
 +# USE_LIBPCRE2 instead if you'd like to use version 2 of the PCRE
 +# library. The USE_LIBPCRE flag will likely be changed to mean v2 by
 +# default in future releases.
 +#
 +# When using USE_LIBPCRE1, define NO_LIBPCRE1_JIT if the PCRE v1
 +# library is compiled without --enable-jit. We will auto-detect
 +# whether the version of the PCRE v1 library in use has JIT support at
 +# all, but we unfortunately can't auto-detect whether JIT support
 +# hasn't been compiled in in an otherwise JIT-supporting version. If
 +# you have link-time errors about a missing `pcre_jit_exec` define
 +# this, or recompile PCRE v1 with --enable-jit.
 +#
 +# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are
 +# in /foo/bar/include and /foo/bar/lib directories. Which version of
 +# PCRE this points to determined by the USE_LIBPCRE1 and USE_LIBPCRE2
 +# variables.
  #
  # Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
  #
@@@ -735,7 -719,6 +736,7 @@@ LIB_OBJS += argv-array.
  LIB_OBJS += attr.o
  LIB_OBJS += base85.o
  LIB_OBJS += bisect.o
 +LIB_OBJS += blame.o
  LIB_OBJS += blob.o
  LIB_OBJS += branch.o
  LIB_OBJS += bulk-checkin.o
@@@ -860,7 -843,6 +861,7 @@@ LIB_OBJS += streaming.
  LIB_OBJS += string-list.o
  LIB_OBJS += submodule.o
  LIB_OBJS += submodule-config.o
 +LIB_OBJS += sub-process.o
  LIB_OBJS += symlinks.o
  LIB_OBJS += tag.o
  LIB_OBJS += tempfile.o
@@@ -1104,29 -1086,13 +1105,29 @@@ ifdef NO_LIBGEN_
        COMPAT_OBJS += compat/basename.o
  endif
  
 -ifdef USE_LIBPCRE
 -      BASIC_CFLAGS += -DUSE_LIBPCRE
 -      ifdef LIBPCREDIR
 -              BASIC_CFLAGS += -I$(LIBPCREDIR)/include
 -              EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
 +USE_LIBPCRE1 ?= $(USE_LIBPCRE)
 +
 +ifneq (,$(USE_LIBPCRE1))
 +      ifdef USE_LIBPCRE2
 +$(error Only set USE_LIBPCRE1 (or its alias USE_LIBPCRE) or USE_LIBPCRE2, not both!)
        endif
 +
 +      BASIC_CFLAGS += -DUSE_LIBPCRE1
        EXTLIBS += -lpcre
 +
 +ifdef NO_LIBPCRE1_JIT
 +      BASIC_CFLAGS += -DNO_LIBPCRE1_JIT
 +endif
 +endif
 +
 +ifdef USE_LIBPCRE2
 +      BASIC_CFLAGS += -DUSE_LIBPCRE2
 +      EXTLIBS += -lpcre2-8
 +endif
 +
 +ifdef LIBPCREDIR
 +      BASIC_CFLAGS += -I$(LIBPCREDIR)/include
 +      EXTLIBS += -L$(LIBPCREDIR)/$(lib) $(CC_LD_DYNPATH)$(LIBPCREDIR)/$(lib)
  endif
  
  ifdef HAVE_ALLOCA_H
        DC_SHA1 := YesPlease
        LIB_OBJS += sha1dc/sha1.o
        LIB_OBJS += sha1dc/ubc_check.o
 -      BASIC_CFLAGS += -DSHA1_DC
 +      BASIC_CFLAGS += \
 +              -DSHA1_DC \
 +              -DSHA1DC_NO_STANDARD_INCLUDES \
 +              -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 \
 +              -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" \
 +              -DSHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_C="\"sha1dc_git.c\"" \
 +              -DSHA1DC_CUSTOM_TRAILING_INCLUDE_SHA1_H="\"sha1dc_git.h\"" \
 +              -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\""
  endif
  endif
  endif
@@@ -2280,11 -2239,8 +2281,11 @@@ GIT-BUILD-OPTIONS: FORC
        @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
        @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
        @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
 -      @echo USE_LIBPCRE=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE)))'\' >>$@+
 +      @echo USE_LIBPCRE1=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE1)))'\' >>$@+
 +      @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
 +      @echo NO_LIBPCRE1_JIT=\''$(subst ','\'',$(subst ','\'',$(NO_LIBPCRE1_JIT)))'\' >>$@+
        @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
 +      @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+
        @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
        @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
        @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+
@@@ -2315,9 -2271,6 +2316,9 @@@ endi
  ifdef GIT_PERF_MAKE_OPTS
        @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
  endif
 +ifdef GIT_PERF_MAKE_COMMAND
 +      @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+
 +endif
  ifdef GIT_INTEROP_MAKE_OPTS
        @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+
  endif
diff --combined configure.ac
index 11d083fbe0efa23eee5e56ccdce3b49effd946be,ceeb9de57566000c9199887d9207b0be3c416e78..2f55237e65acfcf9b7fed15ac0386d353eaf0105
@@@ -250,66 -250,24 +250,66 @@@ AS_HELP_STRING([--with-openssl],[use Op
  AS_HELP_STRING([],              [ARG can be prefix for openssl library and headers]),
  GIT_PARSE_WITH([openssl]))
  
 -# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
 -# able to use Perl-compatible regular expressions.
 +# Define USE_LIBPCRE if you have and want to use libpcre. Various
 +# commands such as log and grep offer runtime options to use
 +# Perl-compatible regular expressions instead of standard or extended
 +# POSIX regular expressions.
  #
 -# Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in
 +# Currently USE_LIBPCRE is a synonym for USE_LIBPCRE1, define
 +# USE_LIBPCRE2 instead if you'd like to use version 2 of the PCRE
 +# library. The USE_LIBPCRE flag will likely be changed to mean v2 by
 +# default in future releases.
 +#
 +# Define LIBPCREDIR=/foo/bar if your PCRE header and library files are in
  # /foo/bar/include and /foo/bar/lib directories.
  #
  AC_ARG_WITH(libpcre,
 -AS_HELP_STRING([--with-libpcre],[support Perl-compatible regexes (default is NO)])
 +AS_HELP_STRING([--with-libpcre],[synonym for --with-libpcre1]),
 +    if test "$withval" = "no"; then
 +      USE_LIBPCRE1=
 +    elif test "$withval" = "yes"; then
 +      USE_LIBPCRE1=YesPlease
 +    else
 +      USE_LIBPCRE1=YesPlease
 +      LIBPCREDIR=$withval
 +      AC_MSG_NOTICE([Setting LIBPCREDIR to $LIBPCREDIR])
 +        dnl USE_LIBPCRE1 can still be modified below, so don't substitute
 +        dnl it yet.
 +      GIT_CONF_SUBST([LIBPCREDIR])
 +    fi)
 +
 +AC_ARG_WITH(libpcre1,
 +AS_HELP_STRING([--with-libpcre1],[support Perl-compatible regexes via libpcre1 (default is NO)])
 +AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and headers]),
 +    if test "$withval" = "no"; then
 +      USE_LIBPCRE1=
 +    elif test "$withval" = "yes"; then
 +      USE_LIBPCRE1=YesPlease
 +    else
 +      USE_LIBPCRE1=YesPlease
 +      LIBPCREDIR=$withval
 +      AC_MSG_NOTICE([Setting LIBPCREDIR to $LIBPCREDIR])
 +        dnl USE_LIBPCRE1 can still be modified below, so don't substitute
 +        dnl it yet.
 +      GIT_CONF_SUBST([LIBPCREDIR])
 +    fi)
 +
 +AC_ARG_WITH(libpcre2,
 +AS_HELP_STRING([--with-libpcre2],[support Perl-compatible regexes via libpcre2 (default is NO)])
  AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and headers]),
 +    if test -n "$USE_LIBPCRE1"; then
 +        AC_MSG_ERROR([Only supply one of --with-libpcre1 or --with-libpcre2!])
 +    fi
 +
      if test "$withval" = "no"; then
 -      USE_LIBPCRE=
 +      USE_LIBPCRE2=
      elif test "$withval" = "yes"; then
 -      USE_LIBPCRE=YesPlease
 +      USE_LIBPCRE2=YesPlease
      else
 -      USE_LIBPCRE=YesPlease
 +      USE_LIBPCRE2=YesPlease
        LIBPCREDIR=$withval
        AC_MSG_NOTICE([Setting LIBPCREDIR to $LIBPCREDIR])
 -        dnl USE_LIBPCRE can still be modified below, so don't substitute
 +        dnl USE_LIBPCRE2 can still be modified below, so don't substitute
          dnl it yet.
        GIT_CONF_SUBST([LIBPCREDIR])
      fi)
@@@ -541,11 -499,11 +541,11 @@@ GIT_CONF_SUBST([NEEDS_SSL_WITH_CRYPTO]
  GIT_CONF_SUBST([NO_OPENSSL])
  
  #
 -# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
 -# able to use Perl-compatible regular expressions.
 +# Handle the USE_LIBPCRE1 and USE_LIBPCRE2 options potentially set
 +# above.
  #
  
 -if test -n "$USE_LIBPCRE"; then
 +if test -n "$USE_LIBPCRE1"; then
  
  GIT_STASH_FLAGS($LIBPCREDIR)
  
@@@ -555,22 -513,7 +555,22 @@@ AC_CHECK_LIB([pcre], [pcre_version]
  
  GIT_UNSTASH_FLAGS($LIBPCREDIR)
  
 -GIT_CONF_SUBST([USE_LIBPCRE])
 +GIT_CONF_SUBST([USE_LIBPCRE1])
 +
 +fi
 +
 +
 +if test -n "$USE_LIBPCRE2"; then
 +
 +GIT_STASH_FLAGS($LIBPCREDIR)
 +
 +AC_CHECK_LIB([pcre2-8], [pcre2_config_8],
 +[USE_LIBPCRE2=YesPlease],
 +[USE_LIBPCRE2=])
 +
 +GIT_UNSTASH_FLAGS($LIBPCREDIR)
 +
 +GIT_CONF_SUBST([USE_LIBPCRE2])
  
  fi
  
@@@ -922,9 -865,9 +922,9 @@@ AC_CACHE_CHECK([whether system succeed
  [
  AC_RUN_IFELSE(
        [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
-               [[char c;
+               [[
                FILE *f = fopen(".", "r");
-               return f && fread(&c, 1, 1, f)]])],
+               return f)]])],
        [ac_cv_fread_reads_directories=no],
        [ac_cv_fread_reads_directories=yes])
  ])