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