1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4## Definitions of macros 5# GIT_CONF_APPEND_LINE(LINE) 6# -------------------------- 7# Append LINE to file ${config_append} 8AC_DEFUN([GIT_CONF_APPEND_LINE], 9[echo "$1" >> "${config_append}"])# GIT_CONF_APPEND_LINE 10# 11# GIT_ARG_SET_PATH(PROGRAM) 12# ------------------------- 13# Provide --with-PROGRAM=PATH option to set PATH to PROGRAM 14# Optional second argument allows setting NO_PROGRAM=YesPlease if 15# --without-PROGRAM version used. 16AC_DEFUN([GIT_ARG_SET_PATH], 17[AC_ARG_WITH([$1], 18 [AS_HELP_STRING([--with-$1=PATH], 19 [provide PATH to $1])], 20 [GIT_CONF_APPEND_PATH($1,$2)],[]) 21])# GIT_ARG_SET_PATH 22# 23# GIT_CONF_APPEND_PATH(PROGRAM) 24# ------------------------------ 25# Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH 26# Used by GIT_ARG_SET_PATH(PROGRAM) 27# Optional second argument allows setting NO_PROGRAM=YesPlease if 28# --without-PROGRAM is used. 29AC_DEFUN([GIT_CONF_APPEND_PATH], 30[PROGRAM=m4_toupper($1); \ 31if test "$withval" = "no"; then \ 32 if test -n "$2"; then \ 33 m4_toupper($1)_PATH=$withval; \ 34 AC_MSG_NOTICE([Disabling use of ${PROGRAM}]); \ 35 GIT_CONF_APPEND_LINE(NO_${PROGRAM}=YesPlease); \ 36 GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=); \ 37 else \ 38 AC_MSG_ERROR([You cannot use git without $1]); \ 39 fi; \ 40else \ 41 if test "$withval" = "yes"; then \ 42 AC_MSG_WARN([You should provide path for --with-$1=PATH]); \ 43 else \ 44 m4_toupper($1)_PATH=$withval; \ 45 AC_MSG_NOTICE([Setting m4_toupper($1)_PATH to $withval]); \ 46 GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \ 47 fi; \ 48fi; \ 49]) # GIT_CONF_APPEND_PATH 50# 51# GIT_PARSE_WITH(PACKAGE) 52# ----------------------- 53# For use in AC_ARG_WITH action-if-found, for packages default ON. 54# * Set NO_PACKAGE=YesPlease for --without-PACKAGE 55# * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH 56# * Unset NO_PACKAGE for --with-PACKAGE without ARG 57AC_DEFUN([GIT_PARSE_WITH], 58[PACKAGE=m4_toupper($1); \ 59if test "$withval" = "no"; then \ 60 m4_toupper(NO_$1)=YesPlease; \ 61elif test "$withval" = "yes"; then \ 62 m4_toupper(NO_$1)=; \ 63else \ 64 m4_toupper(NO_$1)=; \ 65 m4_toupper($1)DIR=$withval; \ 66 AC_MSG_NOTICE([Setting m4_toupper($1)DIR to $withval]); \ 67 GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \ 68fi \ 69])# GIT_PARSE_WITH 70# 71# GIT_PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT) 72# --------------------- 73# Set VAR to the value specied by --with-WITHNAME. 74# No verification of arguments is performed, but warnings are issued 75# if either 'yes' or 'no' is specified. 76# HELP_TEXT is presented when --help is called. 77# This is a direct way to allow setting variables in the Makefile. 78AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR], 79[AC_ARG_WITH([$1], 80 [AS_HELP_STRING([--with-$1=VALUE], $3)], 81 if test -n "$withval"; then \ 82 if test "$withval" = "yes" -o "$withval" = "no"; then \ 83 AC_MSG_WARN([You likely do not want either 'yes' or 'no' as] 84 [a value for $1 ($2). Maybe you do...?]); \ 85 fi; \ 86 \ 87 AC_MSG_NOTICE([Setting $2 to $withval]); \ 88 GIT_CONF_APPEND_LINE($2=$withval); \ 89 fi)])# GIT_PARSE_WITH_SET_MAKE_VAR 90 91dnl 92dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE) 93dnl ----------------------------------------- 94dnl Similar to AC_CHECK_FUNC, but on systems that do not generate 95dnl warnings for missing prototypes (e.g. FreeBSD when compiling without 96dnl -Wall), it does not work. By looking for function definition in 97dnl libraries, this problem can be worked around. 98AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[ 99 AC_SEARCH_LIBS([$1],, 100 [$2],[$3]) 101],[$3])]) 102 103dnl 104dnl GIT_STASH_FLAGS(BASEPATH_VAR) 105dnl ----------------------------- 106dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running 107dnl tests that may want to take user settings into account. 108AC_DEFUN([GIT_STASH_FLAGS],[ 109if test -n "$1"; then 110 old_CPPFLAGS="$CPPFLAGS" 111 old_LDFLAGS="$LDFLAGS" 112 CPPFLAGS="-I$1/include $CPPFLAGS" 113 LDFLAGS="-L$1/$lib $LDFLAGS" 114fi 115]) 116 117dnl 118dnl GIT_UNSTASH_FLAGS(BASEPATH_VAR) 119dnl ----------------------------- 120dnl Restore the stashed *FLAGS values. 121AC_DEFUN([GIT_UNSTASH_FLAGS],[ 122if test -n "$1"; then 123 CPPFLAGS="$old_CPPFLAGS" 124 LDFLAGS="$old_LDFLAGS" 125fi 126]) 127 128## Configure body starts here. 129 130AC_PREREQ(2.59) 131AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org]) 132 133AC_CONFIG_SRCDIR([git.c]) 134 135config_file=config.mak.autogen 136config_append=config.mak.append 137config_in=config.mak.in 138 139echo "# ${config_append}. Generated by configure." > "${config_append}" 140 141# Directories holding "saner" versions of common or POSIX binaries. 142AC_ARG_WITH([sane-tool-path], 143 [AS_HELP_STRING( 144 [--with-sane-tool-path=DIR-1[[:DIR-2...:DIR-n]]], 145 [Directories to prepend to PATH in build system and generated scripts])], 146 [if test "$withval" = "no"; then 147 withval='' 148 else 149 AC_MSG_NOTICE([Setting SANE_TOOL_PATH to '$withval']) 150 fi 151 GIT_CONF_APPEND_LINE([SANE_TOOL_PATH=$withval])], 152 [# If the "--with-sane-tool-path" option was not given, don't touch 153 # SANE_TOOL_PATH here, but let defaults in Makefile take care of it. 154 # This should minimize spurious differences in the behaviour of the 155 # Git build system when configure is used w.r.t. when it is not. 156 :]) 157 158## Site configuration related to programs (before tests) 159## --with-PACKAGE[=ARG] and --without-PACKAGE 160# 161# Set lib to alternative name of lib directory (e.g. lib64) 162AC_ARG_WITH([lib], 163 [AS_HELP_STRING([--with-lib=ARG], 164 [ARG specifies alternative name for lib directory])], 165 [if test "$withval" = "no" || test "$withval" = "yes"; then \ 166 AC_MSG_WARN([You should provide name for --with-lib=ARG]); \ 167else \ 168 lib=$withval; \ 169 AC_MSG_NOTICE([Setting lib to '$lib']); \ 170 GIT_CONF_APPEND_LINE(lib=$withval); \ 171fi; \ 172],[]) 173 174if test -z "$lib"; then 175 AC_MSG_NOTICE([Setting lib to 'lib' (the default)]) 176 lib=lib 177fi 178 179AC_ARG_ENABLE([pthreads], 180 [AS_HELP_STRING([--enable-pthreads=FLAGS], 181 [FLAGS is the value to pass to the compiler to enable POSIX Threads.] 182 [The default if FLAGS is not specified is to try first -pthread] 183 [and then -lpthread.] 184 [--without-pthreads will disable threading.])], 185[ 186if test "x$enableval" = "xyes"; then 187 AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads]) 188elif test "x$enableval" != "xno"; then 189 PTHREAD_CFLAGS=$enableval 190 AC_MSG_NOTICE([Setting '$PTHREAD_CFLAGS' as the FLAGS to enable POSIX Threads]) 191else 192 AC_MSG_NOTICE([POSIX Threads will be disabled.]) 193 NO_PTHREADS=YesPlease 194 USER_NOPTHREAD=1 195fi], 196[ 197 AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads.]) 198]) 199 200# Define option to enable JavaScript minification 201AC_ARG_ENABLE([jsmin], 202[AS_HELP_STRING([--enable-jsmin=PATH], 203 [PATH is the name of a JavaScript minifier or the absolute path to one.])], 204[ 205 JSMIN=$enableval; 206 AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying]) 207 GIT_CONF_APPEND_LINE(JSMIN=$enableval); 208]) 209 210# Define option to enable CSS minification 211AC_ARG_ENABLE([cssmin], 212[AS_HELP_STRING([--enable-cssmin=PATH], 213 [PATH is the name of a CSS minifier or the absolute path to one.])], 214[ 215 CSSMIN=$enableval; 216 AC_MSG_NOTICE([Setting CSSMIN to '$CSSMIN' to enable CSS minifying]) 217 GIT_CONF_APPEND_LINE(CSSMIN=$enableval); 218]) 219 220## Site configuration (override autodetection) 221## --with-PACKAGE[=ARG] and --without-PACKAGE 222AC_MSG_NOTICE([CHECKS for site configuration]) 223# 224# Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability 225# tests. These tests take up a significant amount of the total test time 226# but are not needed unless you plan to talk to SVN repos. 227# 228# Define PPC_SHA1 environment variable when running make to make use of 229# a bundled SHA1 routine optimized for PowerPC. 230# 231# Define NO_OPENSSL environment variable if you do not have OpenSSL. 232# This also implies BLK_SHA1. 233# 234# Define OPENSSLDIR=/foo/bar if your openssl header and library files are in 235# /foo/bar/include and /foo/bar/lib directories. 236AC_ARG_WITH(openssl, 237AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)]) 238AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\ 239GIT_PARSE_WITH(openssl)) 240# 241# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be 242# able to use Perl-compatible regular expressions. 243# 244# Define LIBPCREDIR=/foo/bar if your libpcre header and library files are in 245# /foo/bar/include and /foo/bar/lib directories. 246# 247AC_ARG_WITH(libpcre, 248AS_HELP_STRING([--with-libpcre],[support Perl-compatible regexes (default is NO)]) 249AS_HELP_STRING([], [ARG can be also prefix for libpcre library and headers]), 250if test "$withval" = "no"; then \ 251 USE_LIBPCRE=; \ 252elif test "$withval" = "yes"; then \ 253 USE_LIBPCRE=YesPlease; \ 254else 255 USE_LIBPCRE=YesPlease; \ 256 LIBPCREDIR=$withval; \ 257 AC_MSG_NOTICE([Setting LIBPCREDIR to $withval]); \ 258 GIT_CONF_APPEND_LINE(LIBPCREDIR=$withval); \ 259fi \ 260) 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' '7*) 441 ASCIIDOC7=YesPlease 442 AC_MSG_RESULT([${asciidoc_version} > 7]) 443 ;; 444 asciidoc' '8*) 445 ASCIIDOC7= 446 AC_MSG_RESULT([${asciidoc_version}]) 447 ;; 448 *) 449 ASCIIDOC7= 450 AC_MSG_RESULT([${asciidoc_version} (unknown)]) 451 ;; 452 esac 453fi 454AC_SUBST(ASCIIDOC7) 455 456 457## Checks for libraries. 458AC_MSG_NOTICE([CHECKS for libraries]) 459# 460# Define NO_OPENSSL environment variable if you do not have OpenSSL. 461# Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin). 462 463GIT_STASH_FLAGS($OPENSSLDIR) 464 465AC_CHECK_LIB([crypto], [SHA1_Init], 466[NEEDS_SSL_WITH_CRYPTO=], 467[AC_CHECK_LIB([ssl], [SHA1_Init], 468 [NEEDS_SSL_WITH_CRYPTO=YesPlease], 469 [NEEDS_SSL_WITH_CRYPTO= NO_OPENSSL=YesPlease])]) 470 471GIT_UNSTASH_FLAGS($OPENSSLDIR) 472 473AC_SUBST(NEEDS_SSL_WITH_CRYPTO) 474AC_SUBST(NO_OPENSSL) 475 476# 477# Define USE_LIBPCRE if you have and want to use libpcre. git-grep will be 478# able to use Perl-compatible regular expressions. 479# 480 481if test -n "$USE_LIBPCRE"; then 482 483GIT_STASH_FLAGS($LIBPCREDIR) 484 485AC_CHECK_LIB([pcre], [pcre_version], 486[USE_LIBPCRE=YesPlease], 487[USE_LIBPCRE=]) 488 489GIT_UNSTASH_FLAGS($LIBPCREDIR) 490 491AC_SUBST(USE_LIBPCRE) 492 493fi 494 495# 496# Define NO_CURL if you do not have libcurl installed. git-http-pull and 497# git-http-push are not built, and you cannot use http:// and https:// 498# transports. 499 500GIT_STASH_FLAGS($CURLDIR) 501 502AC_CHECK_LIB([curl], [curl_global_init], 503[NO_CURL=], 504[NO_CURL=YesPlease]) 505 506GIT_UNSTASH_FLAGS($CURLDIR) 507 508AC_SUBST(NO_CURL) 509 510# 511# Define NO_EXPAT if you do not have expat installed. git-http-push is 512# not built, and you cannot push using http:// and https:// transports. 513 514GIT_STASH_FLAGS($EXPATDIR) 515 516AC_CHECK_LIB([expat], [XML_ParserCreate], 517[NO_EXPAT=], 518[NO_EXPAT=YesPlease]) 519 520GIT_UNSTASH_FLAGS($EXPATDIR) 521 522AC_SUBST(NO_EXPAT) 523 524# 525# Define NEEDS_LIBICONV if linking with libc is not enough (Darwin and 526# some Solaris installations). 527# Define NO_ICONV if neither libc nor libiconv support iconv. 528 529if test -z "$NO_ICONV"; then 530 531GIT_STASH_FLAGS($ICONVDIR) 532 533AC_DEFUN([ICONVTEST_SRC], 534[AC_LANG_PROGRAM([#include <iconv.h>], 535 [iconv_open("", "");])]) 536 537if test -n "$ICONVDIR"; then 538 lib_order="-liconv -lc" 539else 540 lib_order="-lc -liconv" 541fi 542 543NO_ICONV=YesPlease 544 545for l in $lib_order; do 546 if test "$l" = "-liconv"; then 547 NEEDS_LIBICONV=YesPlease 548 else 549 NEEDS_LIBICONV= 550 fi 551 552 old_LIBS="$LIBS" 553 LIBS="$LIBS $l" 554 AC_MSG_CHECKING([for iconv in $l]) 555 AC_LINK_IFELSE([ICONVTEST_SRC], 556 [AC_MSG_RESULT([yes]) 557 NO_ICONV= 558 break], 559 [AC_MSG_RESULT([no])]) 560 LIBS="$old_LIBS" 561done 562 563#in case of break 564LIBS="$old_LIBS" 565 566GIT_UNSTASH_FLAGS($ICONVDIR) 567 568AC_SUBST(NEEDS_LIBICONV) 569AC_SUBST(NO_ICONV) 570 571if test -n "$NO_ICONV"; then 572 NEEDS_LIBICONV= 573fi 574 575fi 576 577# 578# Define NO_DEFLATE_BOUND if deflateBound is missing from zlib. 579 580GIT_STASH_FLAGS($ZLIB_PATH) 581 582AC_DEFUN([ZLIBTEST_SRC], [ 583AC_LANG_PROGRAM([#include <zlib.h>], 584 [deflateBound(0, 0);])]) 585AC_MSG_CHECKING([for deflateBound in -lz]) 586old_LIBS="$LIBS" 587LIBS="$LIBS -lz" 588AC_LINK_IFELSE([ZLIBTEST_SRC], 589 [AC_MSG_RESULT([yes])], 590 [AC_MSG_RESULT([no]) 591 NO_DEFLATE_BOUND=yes]) 592LIBS="$old_LIBS" 593 594GIT_UNSTASH_FLAGS($ZLIB_PATH) 595 596AC_SUBST(NO_DEFLATE_BOUND) 597 598# 599# Define NEEDS_SOCKET if linking with libc is not enough (SunOS, 600# Patrick Mauritz). 601AC_CHECK_LIB([c], [socket], 602[NEEDS_SOCKET=], 603[NEEDS_SOCKET=YesPlease]) 604AC_SUBST(NEEDS_SOCKET) 605test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" 606 607# 608# The next few tests will define NEEDS_RESOLV if linking with 609# libresolv provides some of the functions we would normally get 610# from libc. 611NEEDS_RESOLV= 612AC_SUBST(NEEDS_RESOLV) 613# 614# Define NO_INET_NTOP if linking with -lresolv is not enough. 615# Solaris 2.7 in particular hos inet_ntop in -lresolv. 616NO_INET_NTOP= 617AC_SUBST(NO_INET_NTOP) 618AC_CHECK_FUNC([inet_ntop], 619 [], 620 [AC_CHECK_LIB([resolv], [inet_ntop], 621 [NEEDS_RESOLV=YesPlease], 622 [NO_INET_NTOP=YesPlease]) 623]) 624# 625# Define NO_INET_PTON if linking with -lresolv is not enough. 626# Solaris 2.7 in particular hos inet_pton in -lresolv. 627NO_INET_PTON= 628AC_SUBST(NO_INET_PTON) 629AC_CHECK_FUNC([inet_pton], 630 [], 631 [AC_CHECK_LIB([resolv], [inet_pton], 632 [NEEDS_RESOLV=YesPlease], 633 [NO_INET_PTON=YesPlease]) 634]) 635# 636# Define NO_HSTRERROR if linking with -lresolv is not enough. 637# Solaris 2.6 in particular has no hstrerror, even in -lresolv. 638NO_HSTRERROR= 639AC_CHECK_FUNC([hstrerror], 640 [], 641 [AC_CHECK_LIB([resolv], [hstrerror], 642 [NEEDS_RESOLV=YesPlease], 643 [NO_HSTRERROR=YesPlease]) 644]) 645AC_SUBST(NO_HSTRERROR) 646# 647# If any of the above tests determined that -lresolv is needed at 648# build-time, also set it here for remaining configure-time checks. 649test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv" 650 651AC_CHECK_LIB([c], [basename], 652[NEEDS_LIBGEN=], 653[NEEDS_LIBGEN=YesPlease]) 654AC_SUBST(NEEDS_LIBGEN) 655test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen" 656 657AC_CHECK_LIB([c], [gettext], 658[LIBC_CONTAINS_LIBINTL=YesPlease], 659[LIBC_CONTAINS_LIBINTL=]) 660AC_SUBST(LIBC_CONTAINS_LIBINTL) 661 662# 663# Define NO_GETTEXT if you don't want Git output to be translated. 664# A translated Git requires GNU libintl or another gettext implementation 665AC_CHECK_HEADER([libintl.h], 666[NO_GETTEXT=], 667[NO_GETTEXT=YesPlease]) 668AC_SUBST(NO_GETTEXT) 669 670if test -z "$NO_GETTEXT"; then 671 test -n "$LIBC_CONTAINS_LIBINTL" || LIBS="$LIBS -lintl" 672fi 673 674## Checks for header files. 675AC_MSG_NOTICE([CHECKS for header files]) 676# 677# Define NO_SYS_SELECT_H if you don't have sys/select.h. 678AC_CHECK_HEADER([sys/select.h], 679[NO_SYS_SELECT_H=], 680[NO_SYS_SELECT_H=UnfortunatelyYes]) 681AC_SUBST(NO_SYS_SELECT_H) 682# 683# Define NO_SYS_POLL_H if you don't have sys/poll.h 684AC_CHECK_HEADER([sys/poll.h], 685[NO_SYS_POLL_H=], 686[NO_SYS_POLL_H=UnfortunatelyYes]) 687AC_SUBST(NO_SYS_POLL_H) 688# 689# Define NO_INTTYPES_H if you don't have inttypes.h 690AC_CHECK_HEADER([inttypes.h], 691[NO_INTTYPES_H=], 692[NO_INTTYPES_H=UnfortunatelyYes]) 693AC_SUBST(NO_INTTYPES_H) 694# 695# Define OLD_ICONV if your library has an old iconv(), where the second 696# (input buffer pointer) parameter is declared with type (const char **). 697AC_DEFUN([OLDICONVTEST_SRC], [ 698AC_LANG_PROGRAM([[ 699#include <iconv.h> 700 701extern size_t iconv(iconv_t cd, 702 char **inbuf, size_t *inbytesleft, 703 char **outbuf, size_t *outbytesleft); 704]], [])]) 705 706GIT_STASH_FLAGS($ICONVDIR) 707 708AC_MSG_CHECKING([for old iconv()]) 709AC_COMPILE_IFELSE([OLDICONVTEST_SRC], 710 [AC_MSG_RESULT([no])], 711 [AC_MSG_RESULT([yes]) 712 OLD_ICONV=UnfortunatelyYes]) 713 714GIT_UNSTASH_FLAGS($ICONVDIR) 715 716AC_SUBST(OLD_ICONV) 717 718## Checks for typedefs, structures, and compiler characteristics. 719AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics]) 720# 721TYPE_SOCKLEN_T 722case $ac_cv_type_socklen_t in 723 yes) ;; 724 *) AC_SUBST([SOCKLEN_T], [$git_cv_socklen_t_equiv]) ;; 725esac 726 727# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. 728AC_CHECK_MEMBER(struct dirent.d_ino, 729[NO_D_INO_IN_DIRENT=], 730[NO_D_INO_IN_DIRENT=YesPlease], 731[#include <dirent.h>]) 732AC_SUBST(NO_D_INO_IN_DIRENT) 733# 734# Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks 735# d_type in struct dirent (latest Cygwin -- will be fixed soonish). 736AC_CHECK_MEMBER(struct dirent.d_type, 737[NO_D_TYPE_IN_DIRENT=], 738[NO_D_TYPE_IN_DIRENT=YesPlease], 739[#include <dirent.h>]) 740AC_SUBST(NO_D_TYPE_IN_DIRENT) 741# 742# Define NO_SOCKADDR_STORAGE if your platform does not have struct 743# sockaddr_storage. 744AC_CHECK_TYPE(struct sockaddr_storage, 745[NO_SOCKADDR_STORAGE=], 746[NO_SOCKADDR_STORAGE=YesPlease],[ 747#include <sys/types.h> 748#include <sys/socket.h> 749]) 750AC_SUBST(NO_SOCKADDR_STORAGE) 751# 752# Define NO_IPV6 if you lack IPv6 support and getaddrinfo(). 753AC_CHECK_TYPE([struct addrinfo],[ 754 GIT_CHECK_FUNC([getaddrinfo], 755 [NO_IPV6=], 756 [NO_IPV6=YesPlease]) 757],[NO_IPV6=YesPlease],[ 758#include <sys/types.h> 759#include <sys/socket.h> 760#include <netdb.h> 761]) 762AC_SUBST(NO_IPV6) 763# 764# Define NO_REGEX if you have no or inferior regex support in your C library. 765AC_CACHE_CHECK([whether the platform regex can handle null bytes], 766 [ac_cv_c_excellent_regex], [ 767AC_EGREP_CPP(yippeeyeswehaveit, 768 AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT 769#include <regex.h> 770], 771[#ifdef REG_STARTEND 772yippeeyeswehaveit 773#endif 774]), 775 [ac_cv_c_excellent_regex=yes], 776 [ac_cv_c_excellent_regex=no]) 777]) 778if test $ac_cv_c_excellent_regex = yes; then 779 NO_REGEX= 780else 781 NO_REGEX=YesPlease 782fi 783AC_SUBST(NO_REGEX) 784# 785# Define FREAD_READS_DIRECTORIES if your are on a system which succeeds 786# when attempting to read from an fopen'ed directory. 787AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory], 788 [ac_cv_fread_reads_directories], 789[ 790AC_RUN_IFELSE( 791 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], 792 [[char c; 793 FILE *f = fopen(".", "r"); 794 return f && fread(&c, 1, 1, f)]])], 795 [ac_cv_fread_reads_directories=no], 796 [ac_cv_fread_reads_directories=yes]) 797]) 798if test $ac_cv_fread_reads_directories = yes; then 799 FREAD_READS_DIRECTORIES=UnfortunatelyYes 800else 801 FREAD_READS_DIRECTORIES= 802fi 803AC_SUBST(FREAD_READS_DIRECTORIES) 804# 805# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf() 806# or vsnprintf() return -1 instead of number of characters which would 807# have been written to the final string if enough space had been available. 808AC_CACHE_CHECK([whether snprintf() and/or vsnprintf() return bogus value], 809 [ac_cv_snprintf_returns_bogus], 810[ 811AC_RUN_IFELSE( 812 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT 813 #include "stdarg.h" 814 815 int test_vsnprintf(char *str, size_t maxsize, const char *format, ...) 816 { 817 int ret; 818 va_list ap; 819 va_start(ap, format); 820 ret = vsnprintf(str, maxsize, format, ap); 821 va_end(ap); 822 return ret; 823 }], 824 [[char buf[6]; 825 if (test_vsnprintf(buf, 3, "%s", "12345") != 5 826 || strcmp(buf, "12")) return 1; 827 if (snprintf(buf, 3, "%s", "12345") != 5 828 || strcmp(buf, "12")) return 1]])], 829 [ac_cv_snprintf_returns_bogus=no], 830 [ac_cv_snprintf_returns_bogus=yes]) 831]) 832if test $ac_cv_snprintf_returns_bogus = yes; then 833 SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes 834else 835 SNPRINTF_RETURNS_BOGUS= 836fi 837AC_SUBST(SNPRINTF_RETURNS_BOGUS) 838 839 840## Checks for library functions. 841## (in default C library and libraries checked by AC_CHECK_LIB) 842AC_MSG_NOTICE([CHECKS for library functions]) 843# 844# Define NO_LIBGEN_H if you don't have libgen.h. 845AC_CHECK_HEADER([libgen.h], 846[NO_LIBGEN_H=], 847[NO_LIBGEN_H=YesPlease]) 848AC_SUBST(NO_LIBGEN_H) 849# 850# Define HAVE_PATHS_H if you have paths.h. 851AC_CHECK_HEADER([paths.h], 852[HAVE_PATHS_H=YesPlease], 853[HAVE_PATHS_H=]) 854AC_SUBST(HAVE_PATHS_H) 855# 856# Define HAVE_LIBCHARSET_H if have libcharset.h 857AC_CHECK_HEADER([libcharset.h], 858[HAVE_LIBCHARSET_H=YesPlease], 859[HAVE_LIBCHARSET_H=]) 860AC_SUBST(HAVE_LIBCHARSET_H) 861# Define CHARSET_LIB if libiconv does not export the locale_charset symbol 862# and libcharset does 863CHARSET_LIB= 864AC_CHECK_LIB([iconv], [locale_charset], 865 [], 866 [AC_CHECK_LIB([charset], [locale_charset], 867 [CHARSET_LIB=-lcharset]) 868 ] 869) 870AC_SUBST(CHARSET_LIB) 871# 872# Define NO_STRCASESTR if you don't have strcasestr. 873GIT_CHECK_FUNC(strcasestr, 874[NO_STRCASESTR=], 875[NO_STRCASESTR=YesPlease]) 876AC_SUBST(NO_STRCASESTR) 877# 878# Define NO_STRTOK_R if you don't have strtok_r 879GIT_CHECK_FUNC(strtok_r, 880[NO_STRTOK_R=], 881[NO_STRTOK_R=YesPlease]) 882AC_SUBST(NO_STRTOK_R) 883# 884# Define NO_FNMATCH if you don't have fnmatch 885GIT_CHECK_FUNC(fnmatch, 886[NO_FNMATCH=], 887[NO_FNMATCH=YesPlease]) 888AC_SUBST(NO_FNMATCH) 889# 890# Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the 891# FNM_CASEFOLD GNU extension. 892AC_CACHE_CHECK([whether the fnmatch function supports the FNMATCH_CASEFOLD GNU extension], 893 [ac_cv_c_excellent_fnmatch], [ 894AC_EGREP_CPP(yippeeyeswehaveit, 895 AC_LANG_PROGRAM([ 896#include <fnmatch.h> 897], 898[#ifdef FNM_CASEFOLD 899yippeeyeswehaveit 900#endif 901]), 902 [ac_cv_c_excellent_fnmatch=yes], 903 [ac_cv_c_excellent_fnmatch=no]) 904]) 905if test $ac_cv_c_excellent_fnmatch = yes; then 906 NO_FNMATCH_CASEFOLD= 907else 908 NO_FNMATCH_CASEFOLD=YesPlease 909fi 910AC_SUBST(NO_FNMATCH_CASEFOLD) 911# 912# Define NO_MEMMEM if you don't have memmem. 913GIT_CHECK_FUNC(memmem, 914[NO_MEMMEM=], 915[NO_MEMMEM=YesPlease]) 916AC_SUBST(NO_MEMMEM) 917# 918# Define NO_STRLCPY if you don't have strlcpy. 919GIT_CHECK_FUNC(strlcpy, 920[NO_STRLCPY=], 921[NO_STRLCPY=YesPlease]) 922AC_SUBST(NO_STRLCPY) 923# 924# Define NO_UINTMAX_T if your platform does not have uintmax_t 925AC_CHECK_TYPE(uintmax_t, 926[NO_UINTMAX_T=], 927[NO_UINTMAX_T=YesPlease],[ 928#include <inttypes.h> 929]) 930AC_SUBST(NO_UINTMAX_T) 931# 932# Define NO_STRTOUMAX if you don't have strtoumax in the C library. 933GIT_CHECK_FUNC(strtoumax, 934[NO_STRTOUMAX=], 935[NO_STRTOUMAX=YesPlease]) 936AC_SUBST(NO_STRTOUMAX) 937# 938# Define NO_SETENV if you don't have setenv in the C library. 939GIT_CHECK_FUNC(setenv, 940[NO_SETENV=], 941[NO_SETENV=YesPlease]) 942AC_SUBST(NO_SETENV) 943# 944# Define NO_UNSETENV if you don't have unsetenv in the C library. 945GIT_CHECK_FUNC(unsetenv, 946[NO_UNSETENV=], 947[NO_UNSETENV=YesPlease]) 948AC_SUBST(NO_UNSETENV) 949# 950# Define NO_MKDTEMP if you don't have mkdtemp in the C library. 951GIT_CHECK_FUNC(mkdtemp, 952[NO_MKDTEMP=], 953[NO_MKDTEMP=YesPlease]) 954AC_SUBST(NO_MKDTEMP) 955# 956# Define NO_MKSTEMPS if you don't have mkstemps in the C library. 957GIT_CHECK_FUNC(mkstemps, 958[NO_MKSTEMPS=], 959[NO_MKSTEMPS=YesPlease]) 960AC_SUBST(NO_MKSTEMPS) 961# 962# Define NO_INITGROUPS if you don't have initgroups in the C library. 963GIT_CHECK_FUNC(initgroups, 964[NO_INITGROUPS=], 965[NO_INITGROUPS=YesPlease]) 966AC_SUBST(NO_INITGROUPS) 967# 968# 969# Define NO_MMAP if you want to avoid mmap. 970# 971# Define NO_ICONV if your libc does not properly support iconv. 972 973 974## Other checks. 975# Define USE_PIC if you need the main git objects to be built with -fPIC 976# in order to build and link perl/Git.so. x86-64 seems to need this. 977# 978# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. 979# Enable it on Windows. By default, symrefs are still used. 980# 981# Define NO_PTHREADS if we do not have pthreads. 982# 983# Define PTHREAD_LIBS to the linker flag used for Pthread support. 984AC_DEFUN([PTHREADTEST_SRC], [ 985AC_LANG_PROGRAM([[ 986#include <pthread.h> 987]], [[ 988 pthread_mutex_t test_mutex; 989 pthread_key_t test_key; 990 int retcode = 0; 991 retcode |= pthread_key_create(&test_key, (void *)0); 992 retcode |= pthread_mutex_init(&test_mutex,(void *)0); 993 retcode |= pthread_mutex_lock(&test_mutex); 994 retcode |= pthread_mutex_unlock(&test_mutex); 995 return retcode; 996]])]) 997 998dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM( 999dnl [[#include <pthread.h>]],1000dnl [[pthread_mutex_t test_mutex;]]1001dnl )])10021003NO_PTHREADS=UnfortunatelyYes1004PTHREAD_LIBS=10051006if test -n "$USER_NOPTHREAD"; then1007 AC_MSG_NOTICE([Skipping POSIX Threads at user request.])1008# handle these separately since PTHREAD_CFLAGS could be '-lpthreads1009# -D_REENTRANT' or some such.1010elif test -z "$PTHREAD_CFLAGS"; then1011 threads_found=no1012 for opt in -mt -pthread -lpthread; do1013 old_CFLAGS="$CFLAGS"1014 CFLAGS="$opt $CFLAGS"1015 AC_MSG_CHECKING([Checking for POSIX Threads with '$opt'])1016 AC_LINK_IFELSE([PTHREADTEST_SRC],1017 [AC_MSG_RESULT([yes])1018 NO_PTHREADS=1019 PTHREAD_LIBS="$opt"1020 PTHREAD_CFLAGS="$opt"1021 threads_found=yes1022 break1023 ],1024 [AC_MSG_RESULT([no])])1025 CFLAGS="$old_CFLAGS"1026 done1027 if test $threads_found != yes; then1028 AC_CHECK_LIB([pthread], [pthread_create],1029 [PTHREAD_LIBS="-lpthread"],1030 [NO_PTHREADS=UnfortunatelyYes])1031 fi1032else1033 old_CFLAGS="$CFLAGS"1034 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"1035 AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS'])1036 AC_LINK_IFELSE([PTHREADTEST_SRC],1037 [AC_MSG_RESULT([yes])1038 NO_PTHREADS=1039 PTHREAD_LIBS="$PTHREAD_CFLAGS"1040 ],1041 [AC_MSG_RESULT([no])])10421043 CFLAGS="$old_CFLAGS"1044fi10451046CFLAGS="$old_CFLAGS"10471048AC_SUBST(PTHREAD_CFLAGS)1049AC_SUBST(PTHREAD_LIBS)1050AC_SUBST(NO_PTHREADS)10511052## Output files1053AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])1054AC_OUTPUT105510561057## Cleanup1058rm -f "${config_append}"