configure.acon commit git p4: add test for tag import/export enabled via config (e71f6a5)
   1#                                               -*- Autoconf -*-
   2# Process this file with autoconf to produce a configure script.
   3
   4AC_PREREQ(2.59)
   5AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
   6
   7AC_CONFIG_SRCDIR([git.c])
   8
   9config_file=config.mak.autogen
  10config_append=config.mak.append
  11config_in=config.mak.in
  12
  13echo "# ${config_append}.  Generated by configure." > "${config_append}"
  14
  15
  16## Definitions of macros
  17# GIT_CONF_APPEND_LINE(LINE)
  18# --------------------------
  19# Append LINE to file ${config_append}
  20AC_DEFUN([GIT_CONF_APPEND_LINE],
  21[echo "$1" >> "${config_append}"])# GIT_CONF_APPEND_LINE
  22#
  23# GIT_ARG_SET_PATH(PROGRAM)
  24# -------------------------
  25# Provide --with-PROGRAM=PATH option to set PATH to PROGRAM
  26# Optional second argument allows setting NO_PROGRAM=YesPlease if
  27# --without-PROGRAM version used.
  28AC_DEFUN([GIT_ARG_SET_PATH],
  29[AC_ARG_WITH([$1],
  30 [AS_HELP_STRING([--with-$1=PATH],
  31                 [provide PATH to $1])],
  32 [GIT_CONF_APPEND_PATH($1,$2)],[])
  33])# GIT_ARG_SET_PATH
  34#
  35# GIT_CONF_APPEND_PATH(PROGRAM)
  36# ------------------------------
  37# Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH
  38# Used by GIT_ARG_SET_PATH(PROGRAM)
  39# Optional second argument allows setting NO_PROGRAM=YesPlease if
  40# --without-PROGRAM is used.
  41AC_DEFUN([GIT_CONF_APPEND_PATH],
  42[PROGRAM=m4_toupper($1); \
  43if test "$withval" = "no"; then \
  44        if test -n "$2"; then \
  45                m4_toupper($1)_PATH=$withval; \
  46                AC_MSG_NOTICE([Disabling use of ${PROGRAM}]); \
  47                GIT_CONF_APPEND_LINE(NO_${PROGRAM}=YesPlease); \
  48                GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=); \
  49        else \
  50                AC_MSG_ERROR([You cannot use git without $1]); \
  51        fi; \
  52else \
  53        if test "$withval" = "yes"; then \
  54                AC_MSG_WARN([You should provide path for --with-$1=PATH]); \
  55        else \
  56                m4_toupper($1)_PATH=$withval; \
  57                AC_MSG_NOTICE([Setting m4_toupper($1)_PATH to $withval]); \
  58                GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \
  59        fi; \
  60fi; \
  61]) # GIT_CONF_APPEND_PATH
  62#
  63# GIT_PARSE_WITH(PACKAGE)
  64# -----------------------
  65# For use in AC_ARG_WITH action-if-found, for packages default ON.
  66# * Set NO_PACKAGE=YesPlease for --without-PACKAGE
  67# * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH
  68# * Unset NO_PACKAGE for --with-PACKAGE without ARG
  69AC_DEFUN([GIT_PARSE_WITH],
  70[PACKAGE=m4_toupper($1); \
  71if test "$withval" = "no"; then \
  72        m4_toupper(NO_$1)=YesPlease; \
  73elif test "$withval" = "yes"; then \
  74        m4_toupper(NO_$1)=; \
  75else \
  76        m4_toupper(NO_$1)=; \
  77        m4_toupper($1)DIR=$withval; \
  78        AC_MSG_NOTICE([Setting m4_toupper($1)DIR to $withval]); \
  79        GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \
  80fi \
  81])# GIT_PARSE_WITH
  82#
  83# GIT_PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT)
  84# ---------------------
  85# Set VAR to the value specied by --with-WITHNAME.
  86# No verification of arguments is performed, but warnings are issued
  87# if either 'yes' or 'no' is specified.
  88# HELP_TEXT is presented when --help is called.
  89# This is a direct way to allow setting variables in the Makefile.
  90AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR],
  91[AC_ARG_WITH([$1],
  92 [AS_HELP_STRING([--with-$1=VALUE], $3)],
  93 if test -n "$withval"; then \
  94  if test "$withval" = "yes" -o "$withval" = "no"; then \
  95    AC_MSG_WARN([You likely do not want either 'yes' or 'no' as]
  96                     [a value for $1 ($2).  Maybe you do...?]); \
  97  fi; \
  98  \
  99  AC_MSG_NOTICE([Setting $2 to $withval]); \
 100  GIT_CONF_APPEND_LINE($2=$withval); \
 101 fi)])# GIT_PARSE_WITH_SET_MAKE_VAR
 102
 103dnl
 104dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
 105dnl -----------------------------------------
 106dnl Similar to AC_CHECK_FUNC, but on systems that do not generate
 107dnl warnings for missing prototypes (e.g. FreeBSD when compiling without
 108dnl -Wall), it does not work.  By looking for function definition in
 109dnl libraries, this problem can be worked around.
 110AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[
 111  AC_SEARCH_LIBS([$1],,
 112  [$2],[$3])
 113],[$3])])
 114
 115dnl
 116dnl GIT_STASH_FLAGS(BASEPATH_VAR)
 117dnl -----------------------------
 118dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running
 119dnl tests that may want to take user settings into account.
 120AC_DEFUN([GIT_STASH_FLAGS],[
 121if test -n "$1"; then
 122   old_CPPFLAGS="$CPPFLAGS"
 123   old_LDFLAGS="$LDFLAGS"
 124   CPPFLAGS="-I$1/include $CPPFLAGS"
 125   LDFLAGS="-L$1/$lib $LDFLAGS"
 126fi
 127])
 128
 129dnl
 130dnl GIT_UNSTASH_FLAGS(BASEPATH_VAR)
 131dnl -----------------------------
 132dnl Restore the stashed *FLAGS values.
 133AC_DEFUN([GIT_UNSTASH_FLAGS],[
 134if test -n "$1"; then
 135   CPPFLAGS="$old_CPPFLAGS"
 136   LDFLAGS="$old_LDFLAGS"
 137fi
 138])
 139
 140# Directories holding "saner" versions of common or POSIX binaries.
 141AC_ARG_WITH([sane-tool-path],
 142  [AS_HELP_STRING(
 143    [--with-sane-tool-path=DIR-1[[:DIR-2...:DIR-n]]],
 144    [Directories to prepend to PATH in build system and generated scripts])],
 145  [if test "$withval" = "no"; then
 146    withval=''
 147  else
 148    AC_MSG_NOTICE([Setting SANE_TOOL_PATH to '$withval'])
 149  fi
 150  GIT_CONF_APPEND_LINE([SANE_TOOL_PATH=$withval])],
 151  [# If the "--with-sane-tool-path" option was not given, don't touch
 152   # SANE_TOOL_PATH here, but let defaults in Makefile take care of it.
 153   # This should minimize spurious differences in the behaviour of the
 154   # Git build system when configure is used w.r.t. when it is not.
 155   :])
 156
 157## Site configuration related to programs (before tests)
 158## --with-PACKAGE[=ARG] and --without-PACKAGE
 159#
 160# Set lib to alternative name of lib directory (e.g. lib64)
 161AC_ARG_WITH([lib],
 162 [AS_HELP_STRING([--with-lib=ARG],
 163                 [ARG specifies alternative name for lib directory])],
 164 [if test "$withval" = "no" || test "$withval" = "yes"; then \
 165        AC_MSG_WARN([You should provide name for --with-lib=ARG]); \
 166else \
 167        lib=$withval; \
 168        AC_MSG_NOTICE([Setting lib to '$lib']); \
 169        GIT_CONF_APPEND_LINE(lib=$withval); \
 170fi; \
 171],[])
 172
 173if test -z "$lib"; then
 174   AC_MSG_NOTICE([Setting lib to 'lib' (the default)])
 175   lib=lib
 176fi
 177
 178AC_ARG_ENABLE([pthreads],
 179 [AS_HELP_STRING([--enable-pthreads=FLAGS],
 180  [FLAGS is the value to pass to the compiler to enable POSIX Threads.]
 181  [The default if FLAGS is not specified is to try first -pthread]
 182  [and then -lpthread.]
 183  [--without-pthreads will disable threading.])],
 184[
 185if test "x$enableval" = "xyes"; then
 186   AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads])
 187elif test "x$enableval" != "xno"; then
 188   PTHREAD_CFLAGS=$enableval
 189   AC_MSG_NOTICE([Setting '$PTHREAD_CFLAGS' as the FLAGS to enable POSIX Threads])
 190else
 191   AC_MSG_NOTICE([POSIX Threads will be disabled.])
 192   NO_PTHREADS=YesPlease
 193   USER_NOPTHREAD=1
 194fi],
 195[
 196   AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads.])
 197])
 198
 199# Define option to enable JavaScript minification
 200AC_ARG_ENABLE([jsmin],
 201[AS_HELP_STRING([--enable-jsmin=PATH],
 202  [PATH is the name of a JavaScript minifier or the absolute path to one.])],
 203[
 204  JSMIN=$enableval;
 205  AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying])
 206  GIT_CONF_APPEND_LINE(JSMIN=$enableval);
 207])
 208
 209# Define option to enable CSS minification
 210AC_ARG_ENABLE([cssmin],
 211[AS_HELP_STRING([--enable-cssmin=PATH],
 212  [PATH is the name of a CSS minifier or the absolute path to one.])],
 213[
 214  CSSMIN=$enableval;
 215  AC_MSG_NOTICE([Setting CSSMIN to '$CSSMIN' to enable CSS minifying])
 216  GIT_CONF_APPEND_LINE(CSSMIN=$enableval);
 217])
 218
 219## Site configuration (override autodetection)
 220## --with-PACKAGE[=ARG] and --without-PACKAGE
 221AC_MSG_NOTICE([CHECKS for site configuration])
 222#
 223# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
 224# tests.  These tests take up a significant amount of the total test time
 225# but are not needed unless you plan to talk to SVN repos.
 226#
 227# Define PPC_SHA1 environment variable when running make to make use of
 228# a bundled SHA1 routine optimized for PowerPC.
 229#
 230# Define NO_OPENSSL environment variable if you do not have OpenSSL.
 231# This also implies BLK_SHA1.
 232#
 233# Define OPENSSLDIR=/foo/bar if your openssl header and library files are in
 234# /foo/bar/include and /foo/bar/lib directories.
 235AC_ARG_WITH(openssl,
 236AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
 237AS_HELP_STRING([],              [ARG can be prefix for openssl library and headers]),\
 238GIT_PARSE_WITH(openssl))
 239#
 240# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
 241# able to use Perl-compatible regular expressions.
 242#
 243# Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in
 244# /foo/bar/include and /foo/bar/lib directories.
 245#
 246AC_ARG_WITH(libpcre,
 247AS_HELP_STRING([--with-libpcre],[support Perl-compatible regexes (default is NO)])
 248AS_HELP_STRING([],           [ARG can be also prefix for libpcre library and headers]),
 249if test "$withval" = "no"; then \
 250        USE_LIBPCRE=; \
 251elif test "$withval" = "yes"; then \
 252        USE_LIBPCRE=YesPlease; \
 253else
 254        USE_LIBPCRE=YesPlease; \
 255        LIBPCREDIR=$withval; \
 256        AC_MSG_NOTICE([Setting LIBPCREDIR to $withval]); \
 257        GIT_CONF_APPEND_LINE(LIBPCREDIR=$withval); \
 258fi \
 259)
 260#
 261# Define NO_CURL if you do not have curl installed.  git-http-pull and
 262# git-http-push are not built, and you cannot use http:// and https://
 263# transports.
 264#
 265# Define CURLDIR=/foo/bar if your curl header and library files are in
 266# /foo/bar/include and /foo/bar/lib directories.
 267AC_ARG_WITH(curl,
 268AS_HELP_STRING([--with-curl],[support http(s):// transports (default is YES)])
 269AS_HELP_STRING([],           [ARG can be also prefix for curl library and headers]),
 270GIT_PARSE_WITH(curl))
 271#
 272# Define NO_EXPAT if you do not have expat installed.  git-http-push is
 273# not built, and you cannot push using http:// and https:// transports.
 274#
 275# Define EXPATDIR=/foo/bar if your expat header and library files are in
 276# /foo/bar/include and /foo/bar/lib directories.
 277AC_ARG_WITH(expat,
 278AS_HELP_STRING([--with-expat],
 279[support git-push using http:// and https:// transports via WebDAV (default is YES)])
 280AS_HELP_STRING([],            [ARG can be also prefix for expat library and headers]),
 281GIT_PARSE_WITH(expat))
 282#
 283# Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
 284# installed in /sw, but don't want GIT to link against any libraries
 285# installed there.  If defined you may specify your own (or Fink's)
 286# include directories and library directories by defining CFLAGS
 287# and LDFLAGS appropriately.
 288#
 289# Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
 290# have DarwinPorts installed in /opt/local, but don't want GIT to
 291# link against any libraries installed there.  If defined you may
 292# specify your own (or DarwinPort's) include directories and
 293# library directories by defining CFLAGS and LDFLAGS appropriately.
 294#
 295# Define NO_MMAP if you want to avoid mmap.
 296#
 297# Define NO_ICONV if your libc does not properly support iconv.
 298AC_ARG_WITH(iconv,
 299AS_HELP_STRING([--without-iconv],
 300[if your architecture doesn't properly support iconv])
 301AS_HELP_STRING([--with-iconv=PATH],
 302[PATH is prefix for libiconv library and headers])
 303AS_HELP_STRING([],
 304[used only if you need linking with libiconv]),
 305GIT_PARSE_WITH(iconv))
 306
 307## --enable-FEATURE[=ARG] and --disable-FEATURE
 308#
 309# Define USE_NSEC below if you want git to care about sub-second file mtimes
 310# and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
 311# it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
 312# randomly break unless your underlying filesystem supports those sub-second
 313# times (my ext3 doesn't).
 314#
 315# Define USE_STDEV below if you want git to care about the underlying device
 316# change being considered an inode change from the update-index perspective.
 317
 318#
 319# Allow user to set ETC_GITCONFIG variable
 320GIT_PARSE_WITH_SET_MAKE_VAR(gitconfig, ETC_GITCONFIG,
 321                        Use VALUE instead of /etc/gitconfig as the
 322                        global git configuration file.
 323                        If VALUE is not fully qualified it will be interpreted
 324                        as a path relative to the computed prefix at runtime.)
 325
 326#
 327# Allow user to set ETC_GITATTRIBUTES variable
 328GIT_PARSE_WITH_SET_MAKE_VAR(gitattributes, ETC_GITATTRIBUTES,
 329                        Use VALUE instead of /etc/gitattributes as the
 330                        global git attributes file.
 331                        If VALUE is not fully qualified it will be interpreted
 332                        as a path relative to the computed prefix at runtime.)
 333
 334#
 335# Allow user to set the default pager
 336GIT_PARSE_WITH_SET_MAKE_VAR(pager, DEFAULT_PAGER,
 337                        Use VALUE as the fall-back pager instead of 'less'.
 338                        This is used by things like 'git log' when the user
 339                        does not specify a pager to use through alternate
 340                        methods. eg: /usr/bin/pager)
 341#
 342# Allow user to set the default editor
 343GIT_PARSE_WITH_SET_MAKE_VAR(editor, DEFAULT_EDITOR,
 344                        Use VALUE as the fall-back editor instead of 'vi'.
 345                        This is used by things like 'git commit' when the user
 346                        does not specify a preferred editor through other
 347                        methods. eg: /usr/bin/editor)
 348
 349#
 350# Define SHELL_PATH to provide path to shell.
 351GIT_ARG_SET_PATH(shell)
 352#
 353# Define PERL_PATH to provide path to Perl.
 354GIT_ARG_SET_PATH(perl)
 355#
 356# Define PYTHON_PATH to provide path to Python.
 357GIT_ARG_SET_PATH(python, allow-without)
 358#
 359# Define ZLIB_PATH to provide path to zlib.
 360GIT_ARG_SET_PATH(zlib)
 361#
 362# Declare the with-tcltk/without-tcltk options.
 363AC_ARG_WITH(tcltk,
 364AS_HELP_STRING([--with-tcltk],[use Tcl/Tk GUI (default is YES)])
 365AS_HELP_STRING([],[ARG is the full path to the Tcl/Tk interpreter.])
 366AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if])
 367AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),\
 368GIT_PARSE_WITH(tcltk))
 369#
 370
 371
 372## Checks for programs.
 373AC_MSG_NOTICE([CHECKS for programs])
 374#
 375AC_PROG_CC([cc gcc])
 376AC_C_INLINE
 377case $ac_cv_c_inline in
 378  inline | yes | no)    ;;
 379  *)                    AC_SUBST([INLINE], [$ac_cv_c_inline]) ;;
 380esac
 381
 382# which switch to pass runtime path to dynamic libraries to the linker
 383AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
 384   SAVE_LDFLAGS="${LDFLAGS}"
 385   LDFLAGS="${SAVE_LDFLAGS} -R /"
 386   AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])
 387   LDFLAGS="${SAVE_LDFLAGS}"
 388])
 389if test "$git_cv_ld_dashr" = "yes"; then
 390   AC_SUBST(CC_LD_DYNPATH, [-R])
 391else
 392   AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [
 393      SAVE_LDFLAGS="${LDFLAGS}"
 394      LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
 395      AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])
 396      LDFLAGS="${SAVE_LDFLAGS}"
 397   ])
 398   if test "$git_cv_ld_wl_rpath" = "yes"; then
 399      AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,])
 400   else
 401      AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [
 402         SAVE_LDFLAGS="${LDFLAGS}"
 403         LDFLAGS="${SAVE_LDFLAGS} -rpath /"
 404         AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])
 405         LDFLAGS="${SAVE_LDFLAGS}"
 406      ])
 407      if test "$git_cv_ld_rpath" = "yes"; then
 408         AC_SUBST(CC_LD_DYNPATH, [-rpath])
 409      else
 410         AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
 411      fi
 412   fi
 413fi
 414#AC_PROG_INSTALL                # needs install-sh or install.sh in sources
 415AC_CHECK_TOOLS(AR, [gar ar], :)
 416AC_CHECK_PROGS(TAR, [gtar tar])
 417AC_CHECK_PROGS(DIFF, [gnudiff gdiff diff])
 418# TCLTK_PATH will be set to some value if we want Tcl/Tk
 419# or will be empty otherwise.
 420if test -z "$NO_TCLTK"; then
 421  if test "$with_tcltk" = ""; then
 422  # No Tcl/Tk switches given. Do not check for Tcl/Tk, use bare 'wish'.
 423    TCLTK_PATH=wish
 424    AC_SUBST(TCLTK_PATH)
 425  elif test "$with_tcltk" = "yes"; then
 426  # Tcl/Tk check requested.
 427    AC_CHECK_PROGS(TCLTK_PATH, [wish], )
 428  else
 429    AC_MSG_RESULT([Using Tcl/Tk interpreter $with_tcltk])
 430    TCLTK_PATH="$with_tcltk"
 431    AC_SUBST(TCLTK_PATH)
 432  fi
 433fi
 434AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
 435if test -n "$ASCIIDOC"; then
 436        AC_MSG_CHECKING([for asciidoc version])
 437        asciidoc_version=`$ASCIIDOC --version 2>/dev/null`
 438        case "${asciidoc_version}" in
 439        asciidoc' '7*)
 440                ASCIIDOC7=YesPlease
 441                AC_MSG_RESULT([${asciidoc_version} > 7])
 442                ;;
 443        asciidoc' '8*)
 444                ASCIIDOC7=
 445                AC_MSG_RESULT([${asciidoc_version}])
 446                ;;
 447        *)
 448                ASCIIDOC7=
 449                AC_MSG_RESULT([${asciidoc_version} (unknown)])
 450                ;;
 451        esac
 452fi
 453AC_SUBST(ASCIIDOC7)
 454
 455
 456## Checks for libraries.
 457AC_MSG_NOTICE([CHECKS for libraries])
 458#
 459# Define NO_OPENSSL environment variable if you do not have OpenSSL.
 460# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
 461
 462GIT_STASH_FLAGS($OPENSSLDIR)
 463
 464AC_CHECK_LIB([crypto], [SHA1_Init],
 465[NEEDS_SSL_WITH_CRYPTO=],
 466[AC_CHECK_LIB([ssl], [SHA1_Init],
 467 [NEEDS_SSL_WITH_CRYPTO=YesPlease],
 468 [NEEDS_SSL_WITH_CRYPTO= NO_OPENSSL=YesPlease])])
 469
 470GIT_UNSTASH_FLAGS($OPENSSLDIR)
 471
 472AC_SUBST(NEEDS_SSL_WITH_CRYPTO)
 473AC_SUBST(NO_OPENSSL)
 474
 475#
 476# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be
 477# able to use Perl-compatible regular expressions.
 478#
 479
 480if test -n "$USE_LIBPCRE"; then
 481
 482GIT_STASH_FLAGS($LIBPCREDIR)
 483
 484AC_CHECK_LIB([pcre], [pcre_version],
 485[USE_LIBPCRE=YesPlease],
 486[USE_LIBPCRE=])
 487
 488GIT_UNSTASH_FLAGS($LIBPCREDIR)
 489
 490AC_SUBST(USE_LIBPCRE)
 491
 492fi
 493
 494#
 495# Define NO_CURL if you do not have libcurl installed.  git-http-pull and
 496# git-http-push are not built, and you cannot use http:// and https://
 497# transports.
 498
 499GIT_STASH_FLAGS($CURLDIR)
 500
 501AC_CHECK_LIB([curl], [curl_global_init],
 502[NO_CURL=],
 503[NO_CURL=YesPlease])
 504
 505GIT_UNSTASH_FLAGS($CURLDIR)
 506
 507AC_SUBST(NO_CURL)
 508
 509#
 510# Define NO_EXPAT if you do not have expat installed.  git-http-push is
 511# not built, and you cannot push using http:// and https:// transports.
 512
 513GIT_STASH_FLAGS($EXPATDIR)
 514
 515AC_CHECK_LIB([expat], [XML_ParserCreate],
 516[NO_EXPAT=],
 517[NO_EXPAT=YesPlease])
 518
 519GIT_UNSTASH_FLAGS($EXPATDIR)
 520
 521AC_SUBST(NO_EXPAT)
 522
 523#
 524# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin and
 525# some Solaris installations).
 526# Define NO_ICONV if neither libc nor libiconv support iconv.
 527
 528if test -z "$NO_ICONV"; then
 529
 530GIT_STASH_FLAGS($ICONVDIR)
 531
 532AC_DEFUN([ICONVTEST_SRC],
 533[AC_LANG_PROGRAM([#include <iconv.h>],
 534 [iconv_open("", "");])])
 535
 536if test -n "$ICONVDIR"; then
 537   lib_order="-liconv -lc"
 538else
 539   lib_order="-lc -liconv"
 540fi
 541
 542NO_ICONV=YesPlease
 543
 544for l in $lib_order; do
 545    if test "$l" = "-liconv"; then
 546       NEEDS_LIBICONV=YesPlease
 547    else
 548       NEEDS_LIBICONV=
 549    fi
 550
 551    old_LIBS="$LIBS"
 552    LIBS="$LIBS $l"
 553    AC_MSG_CHECKING([for iconv in $l])
 554    AC_LINK_IFELSE([ICONVTEST_SRC],
 555        [AC_MSG_RESULT([yes])
 556        NO_ICONV=
 557        break],
 558        [AC_MSG_RESULT([no])])
 559    LIBS="$old_LIBS"
 560done
 561
 562#in case of break
 563LIBS="$old_LIBS"
 564
 565GIT_UNSTASH_FLAGS($ICONVDIR)
 566
 567AC_SUBST(NEEDS_LIBICONV)
 568AC_SUBST(NO_ICONV)
 569
 570if test -n "$NO_ICONV"; then
 571    NEEDS_LIBICONV=
 572fi
 573
 574fi
 575
 576#
 577# Define NO_DEFLATE_BOUND if deflateBound is missing from zlib.
 578
 579GIT_STASH_FLAGS($ZLIB_PATH)
 580
 581AC_DEFUN([ZLIBTEST_SRC], [
 582AC_LANG_PROGRAM([#include <zlib.h>],
 583 [deflateBound(0, 0);])])
 584AC_MSG_CHECKING([for deflateBound in -lz])
 585old_LIBS="$LIBS"
 586LIBS="$LIBS -lz"
 587AC_LINK_IFELSE([ZLIBTEST_SRC],
 588        [AC_MSG_RESULT([yes])],
 589        [AC_MSG_RESULT([no])
 590        NO_DEFLATE_BOUND=yes])
 591LIBS="$old_LIBS"
 592
 593GIT_UNSTASH_FLAGS($ZLIB_PATH)
 594
 595AC_SUBST(NO_DEFLATE_BOUND)
 596
 597#
 598# Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
 599# Patrick Mauritz).
 600AC_CHECK_LIB([c], [socket],
 601[NEEDS_SOCKET=],
 602[NEEDS_SOCKET=YesPlease])
 603AC_SUBST(NEEDS_SOCKET)
 604test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
 605
 606#
 607# The next few tests will define NEEDS_RESOLV if linking with
 608# libresolv provides some of the functions we would normally get
 609# from libc.
 610NEEDS_RESOLV=
 611AC_SUBST(NEEDS_RESOLV)
 612#
 613# Define NO_INET_NTOP if linking with -lresolv is not enough.
 614# Solaris 2.7 in particular hos inet_ntop in -lresolv.
 615NO_INET_NTOP=
 616AC_SUBST(NO_INET_NTOP)
 617AC_CHECK_FUNC([inet_ntop],
 618        [],
 619    [AC_CHECK_LIB([resolv], [inet_ntop],
 620            [NEEDS_RESOLV=YesPlease],
 621        [NO_INET_NTOP=YesPlease])
 622])
 623#
 624# Define NO_INET_PTON if linking with -lresolv is not enough.
 625# Solaris 2.7 in particular hos inet_pton in -lresolv.
 626NO_INET_PTON=
 627AC_SUBST(NO_INET_PTON)
 628AC_CHECK_FUNC([inet_pton],
 629        [],
 630    [AC_CHECK_LIB([resolv], [inet_pton],
 631            [NEEDS_RESOLV=YesPlease],
 632        [NO_INET_PTON=YesPlease])
 633])
 634#
 635# Define NO_HSTRERROR if linking with -lresolv is not enough.
 636# Solaris 2.6 in particular has no hstrerror, even in -lresolv.
 637NO_HSTRERROR=
 638AC_CHECK_FUNC([hstrerror],
 639        [],
 640    [AC_CHECK_LIB([resolv], [hstrerror],
 641            [NEEDS_RESOLV=YesPlease],
 642        [NO_HSTRERROR=YesPlease])
 643])
 644AC_SUBST(NO_HSTRERROR)
 645#
 646# If any of the above tests determined that -lresolv is needed at
 647# build-time, also set it here for remaining configure-time checks.
 648test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
 649
 650AC_CHECK_LIB([c], [basename],
 651[NEEDS_LIBGEN=],
 652[NEEDS_LIBGEN=YesPlease])
 653AC_SUBST(NEEDS_LIBGEN)
 654test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen"
 655
 656AC_CHECK_LIB([c], [gettext],
 657[LIBC_CONTAINS_LIBINTL=YesPlease],
 658[LIBC_CONTAINS_LIBINTL=])
 659AC_SUBST(LIBC_CONTAINS_LIBINTL)
 660
 661#
 662# Define NO_GETTEXT if you don't want Git output to be translated.
 663# A translated Git requires GNU libintl or another gettext implementation
 664AC_CHECK_HEADER([libintl.h],
 665[NO_GETTEXT=],
 666[NO_GETTEXT=YesPlease])
 667AC_SUBST(NO_GETTEXT)
 668
 669if test -z "$NO_GETTEXT"; then
 670    test -n "$LIBC_CONTAINS_LIBINTL" || LIBS="$LIBS -lintl"
 671fi
 672
 673## Checks for header files.
 674AC_MSG_NOTICE([CHECKS for header files])
 675#
 676# Define NO_SYS_SELECT_H if you don't have sys/select.h.
 677AC_CHECK_HEADER([sys/select.h],
 678[NO_SYS_SELECT_H=],
 679[NO_SYS_SELECT_H=UnfortunatelyYes])
 680AC_SUBST(NO_SYS_SELECT_H)
 681#
 682# Define NO_SYS_POLL_H if you don't have sys/poll.h
 683AC_CHECK_HEADER([sys/poll.h],
 684[NO_SYS_POLL_H=],
 685[NO_SYS_POLL_H=UnfortunatelyYes])
 686AC_SUBST(NO_SYS_POLL_H)
 687#
 688# Define NO_INTTYPES_H if you don't have inttypes.h
 689AC_CHECK_HEADER([inttypes.h],
 690[NO_INTTYPES_H=],
 691[NO_INTTYPES_H=UnfortunatelyYes])
 692AC_SUBST(NO_INTTYPES_H)
 693#
 694# Define OLD_ICONV if your library has an old iconv(), where the second
 695# (input buffer pointer) parameter is declared with type (const char **).
 696AC_DEFUN([OLDICONVTEST_SRC], [
 697AC_LANG_PROGRAM([[
 698#include <iconv.h>
 699
 700extern size_t iconv(iconv_t cd,
 701                    char **inbuf, size_t *inbytesleft,
 702                    char **outbuf, size_t *outbytesleft);
 703]], [])])
 704
 705GIT_STASH_FLAGS($ICONVDIR)
 706
 707AC_MSG_CHECKING([for old iconv()])
 708AC_COMPILE_IFELSE([OLDICONVTEST_SRC],
 709        [AC_MSG_RESULT([no])],
 710        [AC_MSG_RESULT([yes])
 711        OLD_ICONV=UnfortunatelyYes])
 712
 713GIT_UNSTASH_FLAGS($ICONVDIR)
 714
 715AC_SUBST(OLD_ICONV)
 716
 717## Checks for typedefs, structures, and compiler characteristics.
 718AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
 719#
 720TYPE_SOCKLEN_T
 721case $ac_cv_type_socklen_t in
 722  yes)  ;;
 723  *)    AC_SUBST([SOCKLEN_T], [$git_cv_socklen_t_equiv]) ;;
 724esac
 725
 726# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
 727AC_CHECK_MEMBER(struct dirent.d_ino,
 728[NO_D_INO_IN_DIRENT=],
 729[NO_D_INO_IN_DIRENT=YesPlease],
 730[#include <dirent.h>])
 731AC_SUBST(NO_D_INO_IN_DIRENT)
 732#
 733# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
 734# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
 735AC_CHECK_MEMBER(struct dirent.d_type,
 736[NO_D_TYPE_IN_DIRENT=],
 737[NO_D_TYPE_IN_DIRENT=YesPlease],
 738[#include <dirent.h>])
 739AC_SUBST(NO_D_TYPE_IN_DIRENT)
 740#
 741# Define NO_SOCKADDR_STORAGE if your platform does not have struct
 742# sockaddr_storage.
 743AC_CHECK_TYPE(struct sockaddr_storage,
 744[NO_SOCKADDR_STORAGE=],
 745[NO_SOCKADDR_STORAGE=YesPlease],[
 746#include <sys/types.h>
 747#include <sys/socket.h>
 748])
 749AC_SUBST(NO_SOCKADDR_STORAGE)
 750#
 751# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
 752AC_CHECK_TYPE([struct addrinfo],[
 753 GIT_CHECK_FUNC([getaddrinfo],
 754  [NO_IPV6=],
 755  [NO_IPV6=YesPlease])
 756],[NO_IPV6=YesPlease],[
 757#include <sys/types.h>
 758#include <sys/socket.h>
 759#include <netdb.h>
 760])
 761AC_SUBST(NO_IPV6)
 762#
 763# Define NO_REGEX if you have no or inferior regex support in your C library.
 764AC_CACHE_CHECK([whether the platform regex can handle null bytes],
 765 [ac_cv_c_excellent_regex], [
 766AC_EGREP_CPP(yippeeyeswehaveit,
 767        AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
 768#include <regex.h>
 769],
 770[#ifdef REG_STARTEND
 771yippeeyeswehaveit
 772#endif
 773]),
 774        [ac_cv_c_excellent_regex=yes],
 775        [ac_cv_c_excellent_regex=no])
 776])
 777if test $ac_cv_c_excellent_regex = yes; then
 778        NO_REGEX=
 779else
 780        NO_REGEX=YesPlease
 781fi
 782AC_SUBST(NO_REGEX)
 783#
 784# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
 785# when attempting to read from an fopen'ed directory.
 786AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
 787 [ac_cv_fread_reads_directories],
 788[
 789AC_RUN_IFELSE(
 790        [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
 791                [[char c;
 792                FILE *f = fopen(".", "r");
 793                return f && fread(&c, 1, 1, f)]])],
 794        [ac_cv_fread_reads_directories=no],
 795        [ac_cv_fread_reads_directories=yes])
 796])
 797if test $ac_cv_fread_reads_directories = yes; then
 798        FREAD_READS_DIRECTORIES=UnfortunatelyYes
 799else
 800        FREAD_READS_DIRECTORIES=
 801fi
 802AC_SUBST(FREAD_READS_DIRECTORIES)
 803#
 804# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
 805# or vsnprintf() return -1 instead of number of characters which would
 806# have been written to the final string if enough space had been available.
 807AC_CACHE_CHECK([whether snprintf() and/or vsnprintf() return bogus value],
 808 [ac_cv_snprintf_returns_bogus],
 809[
 810AC_RUN_IFELSE(
 811        [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
 812                #include "stdarg.h"
 813
 814                int test_vsnprintf(char *str, size_t maxsize, const char *format, ...)
 815                {
 816                  int ret;
 817                  va_list ap;
 818                  va_start(ap, format);
 819                  ret = vsnprintf(str, maxsize, format, ap);
 820                  va_end(ap);
 821                  return ret;
 822                }],
 823                [[char buf[6];
 824                  if (test_vsnprintf(buf, 3, "%s", "12345") != 5
 825                      || strcmp(buf, "12")) return 1;
 826                  if (snprintf(buf, 3, "%s", "12345") != 5
 827                      || strcmp(buf, "12")) return 1]])],
 828        [ac_cv_snprintf_returns_bogus=no],
 829        [ac_cv_snprintf_returns_bogus=yes])
 830])
 831if test $ac_cv_snprintf_returns_bogus = yes; then
 832        SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes
 833else
 834        SNPRINTF_RETURNS_BOGUS=
 835fi
 836AC_SUBST(SNPRINTF_RETURNS_BOGUS)
 837
 838
 839## Checks for library functions.
 840## (in default C library and libraries checked by AC_CHECK_LIB)
 841AC_MSG_NOTICE([CHECKS for library functions])
 842#
 843# Define NO_LIBGEN_H if you don't have libgen.h.
 844AC_CHECK_HEADER([libgen.h],
 845[NO_LIBGEN_H=],
 846[NO_LIBGEN_H=YesPlease])
 847AC_SUBST(NO_LIBGEN_H)
 848#
 849# Define HAVE_PATHS_H if you have paths.h.
 850AC_CHECK_HEADER([paths.h],
 851[HAVE_PATHS_H=YesPlease],
 852[HAVE_PATHS_H=])
 853AC_SUBST(HAVE_PATHS_H)
 854#
 855# Define HAVE_LIBCHARSET_H if have libcharset.h
 856AC_CHECK_HEADER([libcharset.h],
 857[HAVE_LIBCHARSET_H=YesPlease],
 858[HAVE_LIBCHARSET_H=])
 859AC_SUBST(HAVE_LIBCHARSET_H)
 860# Define CHARSET_LIB if libiconv does not export the locale_charset symbol
 861# and libcharset does
 862CHARSET_LIB=
 863AC_CHECK_LIB([iconv], [locale_charset],
 864       [],
 865       [AC_CHECK_LIB([charset], [locale_charset],
 866                     [CHARSET_LIB=-lcharset])
 867       ]
 868)
 869AC_SUBST(CHARSET_LIB)
 870#
 871# Define NO_STRCASESTR if you don't have strcasestr.
 872GIT_CHECK_FUNC(strcasestr,
 873[NO_STRCASESTR=],
 874[NO_STRCASESTR=YesPlease])
 875AC_SUBST(NO_STRCASESTR)
 876#
 877# Define NO_STRTOK_R if you don't have strtok_r
 878GIT_CHECK_FUNC(strtok_r,
 879[NO_STRTOK_R=],
 880[NO_STRTOK_R=YesPlease])
 881AC_SUBST(NO_STRTOK_R)
 882#
 883# Define NO_FNMATCH if you don't have fnmatch
 884GIT_CHECK_FUNC(fnmatch,
 885[NO_FNMATCH=],
 886[NO_FNMATCH=YesPlease])
 887AC_SUBST(NO_FNMATCH)
 888#
 889# Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the
 890# FNM_CASEFOLD GNU extension.
 891AC_CACHE_CHECK([whether the fnmatch function supports the FNMATCH_CASEFOLD GNU extension],
 892 [ac_cv_c_excellent_fnmatch], [
 893AC_EGREP_CPP(yippeeyeswehaveit,
 894        AC_LANG_PROGRAM([
 895#include <fnmatch.h>
 896],
 897[#ifdef FNM_CASEFOLD
 898yippeeyeswehaveit
 899#endif
 900]),
 901        [ac_cv_c_excellent_fnmatch=yes],
 902        [ac_cv_c_excellent_fnmatch=no])
 903])
 904if test $ac_cv_c_excellent_fnmatch = yes; then
 905        NO_FNMATCH_CASEFOLD=
 906else
 907        NO_FNMATCH_CASEFOLD=YesPlease
 908fi
 909AC_SUBST(NO_FNMATCH_CASEFOLD)
 910#
 911# Define NO_MEMMEM if you don't have memmem.
 912GIT_CHECK_FUNC(memmem,
 913[NO_MEMMEM=],
 914[NO_MEMMEM=YesPlease])
 915AC_SUBST(NO_MEMMEM)
 916#
 917# Define NO_STRLCPY if you don't have strlcpy.
 918GIT_CHECK_FUNC(strlcpy,
 919[NO_STRLCPY=],
 920[NO_STRLCPY=YesPlease])
 921AC_SUBST(NO_STRLCPY)
 922#
 923# Define NO_UINTMAX_T if your platform does not have uintmax_t
 924AC_CHECK_TYPE(uintmax_t,
 925[NO_UINTMAX_T=],
 926[NO_UINTMAX_T=YesPlease],[
 927#include <inttypes.h>
 928])
 929AC_SUBST(NO_UINTMAX_T)
 930#
 931# Define NO_STRTOUMAX if you don't have strtoumax in the C library.
 932GIT_CHECK_FUNC(strtoumax,
 933[NO_STRTOUMAX=],
 934[NO_STRTOUMAX=YesPlease])
 935AC_SUBST(NO_STRTOUMAX)
 936#
 937# Define NO_SETENV if you don't have setenv in the C library.
 938GIT_CHECK_FUNC(setenv,
 939[NO_SETENV=],
 940[NO_SETENV=YesPlease])
 941AC_SUBST(NO_SETENV)
 942#
 943# Define NO_UNSETENV if you don't have unsetenv in the C library.
 944GIT_CHECK_FUNC(unsetenv,
 945[NO_UNSETENV=],
 946[NO_UNSETENV=YesPlease])
 947AC_SUBST(NO_UNSETENV)
 948#
 949# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
 950GIT_CHECK_FUNC(mkdtemp,
 951[NO_MKDTEMP=],
 952[NO_MKDTEMP=YesPlease])
 953AC_SUBST(NO_MKDTEMP)
 954#
 955# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
 956GIT_CHECK_FUNC(mkstemps,
 957[NO_MKSTEMPS=],
 958[NO_MKSTEMPS=YesPlease])
 959AC_SUBST(NO_MKSTEMPS)
 960#
 961# Define NO_INITGROUPS if you don't have initgroups in the C library.
 962GIT_CHECK_FUNC(initgroups,
 963[NO_INITGROUPS=],
 964[NO_INITGROUPS=YesPlease])
 965AC_SUBST(NO_INITGROUPS)
 966#
 967#
 968# Define NO_MMAP if you want to avoid mmap.
 969#
 970# Define NO_ICONV if your libc does not properly support iconv.
 971
 972
 973## Other checks.
 974# Define USE_PIC if you need the main git objects to be built with -fPIC
 975# in order to build and link perl/Git.so.  x86-64 seems to need this.
 976#
 977# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
 978# Enable it on Windows.  By default, symrefs are still used.
 979#
 980# Define NO_PTHREADS if we do not have pthreads.
 981#
 982# Define PTHREAD_LIBS to the linker flag used for Pthread support.
 983AC_DEFUN([PTHREADTEST_SRC], [
 984AC_LANG_PROGRAM([[
 985#include <pthread.h>
 986]], [[
 987        pthread_mutex_t test_mutex;
 988        pthread_key_t test_key;
 989        int retcode = 0;
 990        retcode |= pthread_key_create(&test_key, (void *)0);
 991        retcode |= pthread_mutex_init(&test_mutex,(void *)0);
 992        retcode |= pthread_mutex_lock(&test_mutex);
 993        retcode |= pthread_mutex_unlock(&test_mutex);
 994        return retcode;
 995]])])
 996
 997dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM(
 998dnl   [[#include <pthread.h>]],
 999dnl   [[pthread_mutex_t test_mutex;]]
1000dnl )])
1001
1002NO_PTHREADS=UnfortunatelyYes
1003PTHREAD_LIBS=
1004
1005if test -n "$USER_NOPTHREAD"; then
1006   AC_MSG_NOTICE([Skipping POSIX Threads at user request.])
1007# handle these separately since PTHREAD_CFLAGS could be '-lpthreads
1008# -D_REENTRANT' or some such.
1009elif test -z "$PTHREAD_CFLAGS"; then
1010  threads_found=no
1011  for opt in -mt -pthread -lpthread; do
1012     old_CFLAGS="$CFLAGS"
1013     CFLAGS="$opt $CFLAGS"
1014     AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])
1015     AC_LINK_IFELSE([PTHREADTEST_SRC],
1016        [AC_MSG_RESULT([yes])
1017                NO_PTHREADS=
1018                PTHREAD_LIBS="$opt"
1019                PTHREAD_CFLAGS="$opt"
1020                threads_found=yes
1021                break
1022        ],
1023        [AC_MSG_RESULT([no])])
1024      CFLAGS="$old_CFLAGS"
1025  done
1026  if test $threads_found != yes; then
1027    AC_CHECK_LIB([pthread], [pthread_create],
1028        [PTHREAD_LIBS="-lpthread"],
1029        [NO_PTHREADS=UnfortunatelyYes])
1030  fi
1031else
1032  old_CFLAGS="$CFLAGS"
1033  CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
1034  AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS'])
1035  AC_LINK_IFELSE([PTHREADTEST_SRC],
1036        [AC_MSG_RESULT([yes])
1037                NO_PTHREADS=
1038                PTHREAD_LIBS="$PTHREAD_CFLAGS"
1039        ],
1040        [AC_MSG_RESULT([no])])
1041
1042  CFLAGS="$old_CFLAGS"
1043fi
1044
1045CFLAGS="$old_CFLAGS"
1046
1047AC_SUBST(PTHREAD_CFLAGS)
1048AC_SUBST(PTHREAD_LIBS)
1049AC_SUBST(NO_PTHREADS)
1050
1051## Output files
1052AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
1053AC_OUTPUT
1054
1055
1056## Cleanup
1057rm -f "${config_append}"