]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'rc/configure-use-libs-when-checking-a-lib' into maint
authorJeff King <peff@peff.net>
Tue, 1 Dec 2015 22:19:06 +0000 (17:19 -0500)
committerJeff King <peff@peff.net>
Tue, 1 Dec 2015 22:19:06 +0000 (17:19 -0500)
The "configure" script did not test for -lpthread correctly, which
upset some linkers.

* rc/configure-use-libs-when-checking-a-lib:
  configure.ac: use $LIBS not $CFLAGS when testing -lpthread

1  2 
configure.ac

diff --combined configure.ac
index fd22d41b2f654ce92f66292b3276616086958892,7b3ade9fc0e9c976f155d6746cb8b8871547cbb1..1f55009bba756322dca30cd945d2695666422a71
@@@ -272,14 -272,6 +272,14 @@@ AS_HELP_STRING([],           [ARG can b
        GIT_CONF_SUBST([LIBPCREDIR])
      fi)
  #
 +# Define HAVE_ALLOCA_H if you have working alloca(3) defined in that header.
 +AC_FUNC_ALLOCA
 +case $ac_cv_working_alloca_h in
 +    yes)    HAVE_ALLOCA_H=YesPlease;;
 +    *)      HAVE_ALLOCA_H='';;
 +esac
 +GIT_CONF_SUBST([HAVE_ALLOCA_H])
 +#
  # Define NO_CURL if you do not have curl installed.  git-http-pull and
  # git-http-push are not built, and you cannot use http:// and https://
  # transports.
@@@ -521,33 -513,10 +521,33 @@@ AC_CHECK_LIB([curl], [curl_global_init]
  [NO_CURL=],
  [NO_CURL=YesPlease])
  
 +if test -z "${NO_CURL}" && test -z "${NO_OPENSSL}"; then
 +
 +AC_CHECK_LIB([curl], [Curl_ssl_init],
 +[NEEDS_SSL_WITH_CURL=YesPlease],
 +[NEEDS_SSL_WITH_CURL=])
 +
 +GIT_CONF_SUBST([NEEDS_SSL_WITH_CURL])
 +
 +fi
 +
  GIT_UNSTASH_FLAGS($CURLDIR)
  
  GIT_CONF_SUBST([NO_CURL])
  
 +if test -z "$NO_CURL"; then
 +
 +AC_CHECK_PROG([CURL_CONFIG], [curl-config],
 +[curl-config],
 +[no])
 +
 +if test $CURL_CONFIG != no; then
 +    GIT_CONF_SUBST([CURL_CONFIG])
 +fi
 +
 +fi
 +
 +
  #
  # Define NO_EXPAT if you do not have expat installed.  git-http-push is
  # not built, and you cannot push using http:// and https:// transports.
@@@ -769,27 -738,6 +769,27 @@@ case $ac_cv_type_socklen_t i
  esac
  GIT_CONF_SUBST([SOCKLEN_T])
  
 +#
 +# Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval.
 +AC_CHECK_TYPES([struct itimerval],
 +[NO_STRUCT_ITIMERVAL=],
 +[NO_STRUCT_ITIMERVAL=UnfortunatelyYes],
 +[#include <sys/time.h>])
 +GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL])
 +#
 +# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exists.
 +# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor
 +# stat.st_mtimespec.tv_nsec exists.
 +AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec])
 +AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec])
 +if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes; then
 +      USE_ST_TIMESPEC=YesPlease
 +      GIT_CONF_SUBST([USE_ST_TIMESPEC])
 +elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes; then
 +      NO_NSEC=YesPlease
 +      GIT_CONF_SUBST([NO_NSEC])
 +fi
 +#
  # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
  AC_CHECK_MEMBER(struct dirent.d_ino,
  [NO_D_INO_IN_DIRENT=],
@@@ -909,29 -857,6 +909,29 @@@ els
        SNPRINTF_RETURNS_BOGUS=
  fi
  GIT_CONF_SUBST([SNPRINTF_RETURNS_BOGUS])
 +#
 +# Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
 +# bits in mode values.
 +AC_CACHE_CHECK([whether the platform uses typical file type bits],
 + [ac_cv_sane_mode_bits], [
 +AC_EGREP_CPP(yippeeyeswehaveit,
 +      AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
 +[#if S_IFMT == 0170000 && \
 +      S_IFREG == 0100000 && S_IFDIR == 0040000 && S_IFLNK == 0120000 && \
 +      S_IFBLK == 0060000 && S_IFCHR == 0020000 && \
 +      S_IFIFO == 0010000 && S_IFSOCK == 0140000
 +yippeeyeswehaveit
 +#endif
 +]),
 +      [ac_cv_sane_mode_bits=yes],
 +      [ac_cv_sane_mode_bits=no])
 +])
 +if test $ac_cv_sane_mode_bits = yes; then
 +      NEEDS_MODE_TRANSLATION=
 +else
 +      NEEDS_MODE_TRANSLATION=UnfortunatelyYes
 +fi
 +GIT_CONF_SUBST([NEEDS_MODE_TRANSLATION])
  
  
  ## Checks for library functions.
@@@ -970,38 -895,6 +970,38 @@@ AC_CHECK_LIB([iconv], [locale_charset]
                       [CHARSET_LIB=-lcharset])])
  GIT_CONF_SUBST([CHARSET_LIB])
  #
 +# Define NO_HMAC_CTX_CLEANUP=YesPlease if HMAC_CTX_cleanup is missing.
 +AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup],
 +      [], [GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP], [YesPlease])])
 +#
 +# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
 +GIT_CHECK_FUNC(clock_gettime,
 +      [HAVE_CLOCK_GETTIME=YesPlease],
 +      [HAVE_CLOCK_GETTIME=])
 +GIT_CONF_SUBST([HAVE_CLOCK_GETTIME])
 +
 +AC_DEFUN([CLOCK_MONOTONIC_SRC], [
 +AC_LANG_PROGRAM([[
 +#include <time.h>
 +clockid_t id = CLOCK_MONOTONIC;
 +]])])
 +
 +#
 +# Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available.
 +AC_MSG_CHECKING([for CLOCK_MONOTONIC])
 +AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC],
 +      [AC_MSG_RESULT([yes])
 +      HAVE_CLOCK_MONOTONIC=YesPlease],
 +      [AC_MSG_RESULT([no])
 +      HAVE_CLOCK_MONOTONIC=])
 +GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC])
 +#
 +# Define NO_SETITIMER if you don't have setitimer.
 +GIT_CHECK_FUNC(setitimer,
 +[NO_SETITIMER=],
 +[NO_SETITIMER=YesPlease])
 +GIT_CONF_SUBST([NO_SETITIMER])
 +#
  # Define NO_STRCASESTR if you don't have strcasestr.
  GIT_CHECK_FUNC(strcasestr,
  [NO_STRCASESTR=],
@@@ -1064,40 -957,11 +1064,40 @@@ GIT_CHECK_FUNC(initgroups
  [NO_INITGROUPS=YesPlease])
  GIT_CONF_SUBST([NO_INITGROUPS])
  #
 +# Define HAVE_GETDELIM if you have getdelim in the C library.
 +GIT_CHECK_FUNC(getdelim,
 +[HAVE_GETDELIM=YesPlease],
 +[HAVE_GETDELIM=])
 +GIT_CONF_SUBST([HAVE_GETDELIM])
 +#
  #
  # Define NO_MMAP if you want to avoid mmap.
  #
  # Define NO_ICONV if your libc does not properly support iconv.
  
 +AC_DEFUN([BSD_SYSCTL_SRC], [
 +AC_LANG_PROGRAM([[
 +#include <stddef.h>
 +#include <sys/types.h>
 +#include <sys/sysctl.h>
 +]],[[
 +int val, mib[2];
 +size_t len;
 +mib[0] = CTL_HW;
 +mib[1] = 1;
 +len = sizeof(val);
 +return sysctl(mib, 2, &val, &len, NULL, 0) ? 1 : 0;
 +]])])
 +
 +#
 +# Define HAVE_BSD_SYSCTL=YesPlease if a BSD-compatible sysctl function is available.
 +AC_MSG_CHECKING([for BSD sysctl])
 +AC_COMPILE_IFELSE([BSD_SYSCTL_SRC],
 +      [AC_MSG_RESULT([yes])
 +      HAVE_BSD_SYSCTL=YesPlease],
 +      [AC_MSG_RESULT([no])
 +      HAVE_BSD_SYSCTL=])
 +GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
  
  ## Other checks.
  # Define USE_PIC if you need the main git objects to be built with -fPIC
@@@ -1149,7 -1013,12 +1149,12 @@@ elif test -z "$PTHREAD_CFLAGS"; the
    # would then trigger compiler warnings on every single file we compile.
    for opt in "" -mt -pthread -lpthread; do
       old_CFLAGS="$CFLAGS"
-      CFLAGS="$opt $CFLAGS"
+      old_LIBS="$LIBS"
+      case "$opt" in
+         -l*)  LIBS="$opt $LIBS" ;;
+         *)    CFLAGS="$opt $CFLAGS" ;;
+      esac
       AC_MSG_CHECKING([for POSIX Threads with '$opt'])
       AC_LINK_IFELSE([PTHREADTEST_SRC],
        [AC_MSG_RESULT([yes])
        ],
        [AC_MSG_RESULT([no])])
        CFLAGS="$old_CFLAGS"
+       LIBS="$old_LIBS"
    done
    if test $threads_found != yes; then
      AC_CHECK_LIB([pthread], [pthread_create],