2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org])
7 AC_CONFIG_SRCDIR([git.c])
9 config_file=config.mak.autogen
10 config_append=config.mak.append
11 config_in=config.mak.in
13 echo "# ${config_append}. Generated by configure." > "${config_append}"
16 ## Definitions of macros
17 # GIT_CONF_APPEND_LINE(LINE)
18 # --------------------------
19 # Append LINE to file ${config_append}
20 AC_DEFUN([GIT_CONF_APPEND_LINE],
21 [echo "$1" >> "${config_append}"])# GIT_CONF_APPEND_LINE
23 # GIT_ARG_SET_PATH(PROGRAM)
24 # -------------------------
25 # Provide --with-PROGRAM=PATH option to set PATH to PROGRAM
26 AC_DEFUN([GIT_ARG_SET_PATH],
28 [AS_HELP_STRING([--with-$1=PATH],
29 [provide PATH to $1])],
30 [GIT_CONF_APPEND_PATH($1)],[])
33 # GIT_CONF_APPEND_PATH(PROGRAM)
34 # ------------------------------
35 # Parse --with-PROGRAM=PATH option to set PROGRAM_PATH=PATH
36 # Used by GIT_ARG_SET_PATH(PROGRAM)
37 AC_DEFUN([GIT_CONF_APPEND_PATH],
38 [PROGRAM=m4_toupper($1); \
39 if test "$withval" = "no"; then \
40 AC_MSG_ERROR([You cannot use git without $1]); \
42 if test "$withval" = "yes"; then \
43 AC_MSG_WARN([You should provide path for --with-$1=PATH]); \
45 GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \
48 ]) # GIT_CONF_APPEND_PATH
50 # GIT_PARSE_WITH(PACKAGE)
51 # -----------------------
52 # For use in AC_ARG_WITH action-if-found, for packages default ON.
53 # * Set NO_PACKAGE=YesPlease for --without-PACKAGE
54 # * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH
55 # * Unset NO_PACKAGE for --with-PACKAGE without ARG
56 AC_DEFUN([GIT_PARSE_WITH],
57 [PACKAGE=m4_toupper($1); \
58 if test "$withval" = "no"; then \
59 m4_toupper(NO_$1)=YesPlease; \
60 elif test "$withval" = "yes"; then \
64 GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \
69 dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE)
70 dnl -----------------------------------------
71 dnl Similar to AC_CHECK_FUNC, but on systems that do not generate
72 dnl warnings for missing prototypes (e.g. FreeBSD when compiling without
73 dnl -Wall), it does not work. By looking for function definition in
74 dnl libraries, this problem can be worked around.
75 AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[
79 ## Site configuration related to programs (before tests)
80 ## --with-PACKAGE[=ARG] and --without-PACKAGE
82 # Set lib to alternative name of lib directory (e.g. lib64)
84 [AS_HELP_STRING([--with-lib=ARG],
85 [ARG specifies alternative name for lib directory])],
86 [if test "$withval" = "no" || test "$withval" = "yes"; then \
87 AC_MSG_WARN([You should provide name for --with-lib=ARG]); \
89 GIT_CONF_APPEND_LINE(lib=$withval); \
93 # Define SHELL_PATH to provide path to shell.
94 GIT_ARG_SET_PATH(shell)
96 # Define PERL_PATH to provide path to Perl.
97 GIT_ARG_SET_PATH(perl)
99 # Define ZLIB_PATH to provide path to zlib.
100 GIT_ARG_SET_PATH(zlib)
102 # Declare the with-tcltk/without-tcltk options.
104 AS_HELP_STRING([--with-tcltk],[use Tcl/Tk GUI (default is YES)])
105 AS_HELP_STRING([],[ARG is the full path to the Tcl/Tk interpreter.])
106 AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if])
107 AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),\
108 GIT_PARSE_WITH(tcltk))
112 ## Checks for programs.
113 AC_MSG_NOTICE([CHECKS for programs])
116 # which switch to pass runtime path to dynamic libraries to the linker
117 AC_CACHE_CHECK([if linker supports -R], ld_dashr, [
118 SAVE_LDFLAGS="${LDFLAGS}"
119 LDFLAGS="${SAVE_LDFLAGS} -R /"
120 AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_dashr=yes], [ld_dashr=no])
121 LDFLAGS="${SAVE_LDFLAGS}"
123 if test "$ld_dashr" = "yes"; then
124 AC_SUBST(CC_LD_DYNPATH, [-R])
126 AC_CACHE_CHECK([if linker supports -Wl,-rpath,], ld_wl_rpath, [
127 SAVE_LDFLAGS="${LDFLAGS}"
128 LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
129 AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_wl_rpath=yes], [ld_wl_rpath=no])
130 LDFLAGS="${SAVE_LD_FLAGS}"
132 if test "$ld_wl_rpath" = "yes"; then
133 AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,])
135 AC_CACHE_CHECK([if linker supports -rpath], ld_rpath, [
136 SAVE_LDFLAGS="${LDFLAGS}"
137 LDFLAGS="${SAVE_LDFLAGS} -rpath /"
138 AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_rpath=yes], [ld_rpath=no])
139 LDFLAGS="${SAVE_LD_FLAGS}"
141 if test "$ld_rpath" = "yes"; then
142 AC_SUBST(CC_LD_DYNPATH, [-rpath])
144 AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
148 #AC_PROG_INSTALL # needs install-sh or install.sh in sources
149 AC_CHECK_TOOLS(AR, [gar ar], :)
150 AC_CHECK_PROGS(TAR, [gtar tar])
151 # TCLTK_PATH will be set to some value if we want Tcl/Tk
152 # or will be empty otherwise.
153 if test -z "$NO_TCLTK"; then
154 if test "$with_tcltk" = ""; then
155 # No Tcl/Tk switches given. Do not check for Tcl/Tk, use bare 'wish'.
158 elif test "$with_tcltk" = "yes"; then
159 # Tcl/Tk check requested.
160 AC_CHECK_PROGS(TCLTK_PATH, [wish], )
162 AC_MSG_RESULT([Using Tcl/Tk interpreter $with_tcltk])
163 TCLTK_PATH="$with_tcltk"
167 AC_CHECK_PROGS(ASCIIDOC, [asciidoc])
168 if test -n "$ASCIIDOC"; then
169 AC_MSG_CHECKING([for asciidoc version])
170 asciidoc_version=`$ASCIIDOC --version 2>&1`
171 case "${asciidoc_version}" in
174 AC_MSG_RESULT([${asciidoc_version} > 7])
178 AC_MSG_RESULT([${asciidoc_version}])
182 AC_MSG_RESULT([${asciidoc_version} (unknown)])
189 ## Checks for libraries.
190 AC_MSG_NOTICE([CHECKS for libraries])
192 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
193 # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin).
194 AC_CHECK_LIB([crypto], [SHA1_Init],
195 [NEEDS_SSL_WITH_CRYPTO=],
196 [AC_CHECK_LIB([ssl], [SHA1_Init],
197 [NEEDS_SSL_WITH_CRYPTO=YesPlease
198 NEEDS_SSL_WITH_CRYPTO=],
199 [NO_OPENSSL=YesPlease])])
200 AC_SUBST(NEEDS_SSL_WITH_CRYPTO)
203 # Define NO_CURL if you do not have libcurl installed. git-http-pull and
204 # git-http-push are not built, and you cannot use http:// and https://
206 AC_CHECK_LIB([curl], [curl_global_init],
211 # Define NO_EXPAT if you do not have expat installed. git-http-push is
212 # not built, and you cannot push using http:// and https:// transports.
213 AC_CHECK_LIB([expat], [XML_ParserCreate],
215 [NO_EXPAT=YesPlease])
218 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin and
219 # some Solaris installations).
220 # Define NO_ICONV if neither libc nor libiconv support iconv.
221 AC_DEFUN([ICONVTEST_SRC], [
230 AC_MSG_CHECKING([for iconv in -lc])
231 AC_LINK_IFELSE(ICONVTEST_SRC,
232 [AC_MSG_RESULT([yes])
237 AC_MSG_CHECKING([for iconv in -liconv])
238 AC_LINK_IFELSE(ICONVTEST_SRC,
239 [AC_MSG_RESULT([yes])
240 NEEDS_LIBICONV=YesPlease],
244 AC_SUBST(NEEDS_LIBICONV)
246 test -n "$NEEDS_LIBICONV" && LIBS="$LIBS -liconv"
248 # Define NO_DEFLATE_BOUND if deflateBound is missing from zlib.
249 AC_DEFUN([ZLIBTEST_SRC], [
258 AC_MSG_CHECKING([for deflateBound in -lz])
261 AC_LINK_IFELSE(ZLIBTEST_SRC,
262 [AC_MSG_RESULT([yes])],
264 NO_DEFLATE_BOUND=yes])
266 AC_SUBST(NO_DEFLATE_BOUND)
268 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
270 AC_CHECK_LIB([c], [socket],
272 [NEEDS_SOCKET=YesPlease])
273 AC_SUBST(NEEDS_SOCKET)
274 test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
277 ## Checks for header files.
278 AC_MSG_NOTICE([CHECKS for header files])
280 # Define NO_SYS_SELECT_H if you don't have sys/select.h.
281 AC_CHECK_HEADER([sys/select.h],
283 [NO_SYS_SELECT_H=UnfortunatelyYes])
284 AC_SUBST(NO_SYS_SELECT_H)
286 # Define OLD_ICONV if your library has an old iconv(), where the second
287 # (input buffer pointer) parameter is declared with type (const char **).
288 AC_DEFUN([OLDICONVTEST_SRC], [[
291 extern size_t iconv(iconv_t cd,
292 char **inbuf, size_t *inbytesleft,
293 char **outbuf, size_t *outbytesleft);
300 AC_MSG_CHECKING([for old iconv()])
301 AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
302 [AC_MSG_RESULT([no])],
303 [AC_MSG_RESULT([yes])
304 OLD_ICONV=UnfortunatelyYes])
308 ## Checks for typedefs, structures, and compiler characteristics.
309 AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
311 # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
312 AC_CHECK_MEMBER(struct dirent.d_ino,
313 [NO_D_INO_IN_DIRENT=],
314 [NO_D_INO_IN_DIRENT=YesPlease],
315 [#include <dirent.h>])
316 AC_SUBST(NO_D_INO_IN_DIRENT)
318 # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
319 # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
320 AC_CHECK_MEMBER(struct dirent.d_type,
321 [NO_D_TYPE_IN_DIRENT=],
322 [NO_D_TYPE_IN_DIRENT=YesPlease],
323 [#include <dirent.h>])
324 AC_SUBST(NO_D_TYPE_IN_DIRENT)
326 # Define NO_SOCKADDR_STORAGE if your platform does not have struct
328 AC_CHECK_TYPE(struct sockaddr_storage,
329 [NO_SOCKADDR_STORAGE=],
330 [NO_SOCKADDR_STORAGE=YesPlease],[
331 #include <sys/types.h>
332 #include <sys/socket.h>
334 AC_SUBST(NO_SOCKADDR_STORAGE)
336 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
337 AC_CHECK_TYPE([struct addrinfo],[
338 GIT_CHECK_FUNC([getaddrinfo],
341 ],[NO_IPV6=YesPlease],[
342 #include <sys/types.h>
343 #include <sys/socket.h>
348 # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
349 # do not support the 'size specifiers' introduced by C99, namely ll, hh,
350 # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t).
351 # some C compilers supported these specifiers prior to C99 as an extension.
352 AC_CACHE_CHECK([whether formatted IO functions support C99 size specifiers],
353 [ac_cv_c_c99_format],
354 [# Actually git uses only %z (%zu) in alloc.c, and %t (%td) in mktag.c
356 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
358 if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5)
360 else if (strcmp(buf, "12345"))
362 [ac_cv_c_c99_format=yes],
363 [ac_cv_c_c99_format=no])
365 if test $ac_cv_c_c99_format = no; then
366 NO_C99_FORMAT=YesPlease
370 AC_SUBST(NO_C99_FORMAT)
372 # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
373 # when attempting to read from an fopen'ed directory.
374 AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
375 [ac_cv_fread_reads_directories],
378 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
380 FILE *f = fopen(".", "r");
381 return f && fread(&c, 1, 1, f)]])],
382 [ac_cv_fread_reads_directories=no],
383 [ac_cv_fread_reads_directories=yes])
385 if test $ac_cv_fread_reads_directories = yes; then
386 FREAD_READS_DIRECTORIES=UnfortunatelyYes
388 FREAD_READS_DIRECTORIES=
390 AC_SUBST(FREAD_READS_DIRECTORIES)
392 # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
393 # or vsnprintf() return -1 instead of number of characters which would
394 # have been written to the final string if enough space had been available.
395 AC_CACHE_CHECK([whether snprintf() and/or vsnprintf() return bogus value],
396 [ac_cv_snprintf_returns_bogus],
399 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
402 int test_vsnprintf(char *str, size_t maxsize, const char *format, ...)
406 va_start(ap, format);
407 ret = vsnprintf(str, maxsize, format, ap);
412 if (test_vsnprintf(buf, 3, "%s", "12345") != 5
413 || strcmp(buf, "12")) return 1;
414 if (snprintf(buf, 3, "%s", "12345") != 5
415 || strcmp(buf, "12")) return 1]])],
416 [ac_cv_snprintf_returns_bogus=no],
417 [ac_cv_snprintf_returns_bogus=yes])
419 if test $ac_cv_snprintf_returns_bogus = yes; then
420 SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes
422 SNPRINTF_RETURNS_BOGUS=
424 AC_SUBST(SNPRINTF_RETURNS_BOGUS)
427 ## Checks for library functions.
428 ## (in default C library and libraries checked by AC_CHECK_LIB)
429 AC_MSG_NOTICE([CHECKS for library functions])
431 # Define NO_STRCASESTR if you don't have strcasestr.
432 GIT_CHECK_FUNC(strcasestr,
434 [NO_STRCASESTR=YesPlease])
435 AC_SUBST(NO_STRCASESTR)
437 # Define NO_MEMMEM if you don't have memmem.
438 GIT_CHECK_FUNC(memmem,
440 [NO_MEMMEM=YesPlease])
443 # Define NO_STRLCPY if you don't have strlcpy.
444 GIT_CHECK_FUNC(strlcpy,
446 [NO_STRLCPY=YesPlease])
449 # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
450 GIT_CHECK_FUNC(strtoumax,
452 [NO_STRTOUMAX=YesPlease])
453 AC_SUBST(NO_STRTOUMAX)
455 # Define NO_SETENV if you don't have setenv in the C library.
456 GIT_CHECK_FUNC(setenv,
458 [NO_SETENV=YesPlease])
461 # Define NO_UNSETENV if you don't have unsetenv in the C library.
462 GIT_CHECK_FUNC(unsetenv,
464 [NO_UNSETENV=YesPlease])
465 AC_SUBST(NO_UNSETENV)
467 # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
468 GIT_CHECK_FUNC(mkdtemp,
470 [NO_MKDTEMP=YesPlease])
473 # Define NO_MMAP if you want to avoid mmap.
475 # Define NO_ICONV if your libc does not properly support iconv.
479 # Define USE_PIC if you need the main git objects to be built with -fPIC
480 # in order to build and link perl/Git.so. x86-64 seems to need this.
482 # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
483 # Enable it on Windows. By default, symrefs are still used.
485 ## Site configuration (override autodetection)
486 ## --with-PACKAGE[=ARG] and --without-PACKAGE
487 AC_MSG_NOTICE([CHECKS for site configuration])
489 # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability
490 # tests. These tests take up a significant amount of the total test time
491 # but are not needed unless you plan to talk to SVN repos.
493 # Define MOZILLA_SHA1 environment variable when running make to make use of
494 # a bundled SHA1 routine coming from Mozilla. It is GPL'd and should be fast
495 # on non-x86 architectures (e.g. PowerPC), while the OpenSSL version (default
496 # choice) has very fast version optimized for i586.
498 # Define PPC_SHA1 environment variable when running make to make use of
499 # a bundled SHA1 routine optimized for PowerPC.
501 # Define ARM_SHA1 environment variable when running make to make use of
502 # a bundled SHA1 routine optimized for ARM.
504 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
505 # This also implies MOZILLA_SHA1.
507 # Define OPENSSLDIR=/foo/bar if your openssl header and library files are in
508 # /foo/bar/include and /foo/bar/lib directories.
510 AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)])
511 AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\
512 GIT_PARSE_WITH(openssl))
514 # Define NO_CURL if you do not have curl installed. git-http-pull and
515 # git-http-push are not built, and you cannot use http:// and https://
518 # Define CURLDIR=/foo/bar if your curl header and library files are in
519 # /foo/bar/include and /foo/bar/lib directories.
521 AS_HELP_STRING([--with-curl],[support http(s):// transports (default is YES)])
522 AS_HELP_STRING([], [ARG can be also prefix for curl library and headers]),
523 GIT_PARSE_WITH(curl))
525 # Define NO_EXPAT if you do not have expat installed. git-http-push is
526 # not built, and you cannot push using http:// and https:// transports.
528 # Define EXPATDIR=/foo/bar if your expat header and library files are in
529 # /foo/bar/include and /foo/bar/lib directories.
531 AS_HELP_STRING([--with-expat],
532 [support git-push using http:// and https:// transports via WebDAV (default is YES)])
533 AS_HELP_STRING([], [ARG can be also prefix for expat library and headers]),
534 GIT_PARSE_WITH(expat))
536 # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink
537 # installed in /sw, but don't want GIT to link against any libraries
538 # installed there. If defined you may specify your own (or Fink's)
539 # include directories and library directories by defining CFLAGS
540 # and LDFLAGS appropriately.
542 # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X,
543 # have DarwinPorts installed in /opt/local, but don't want GIT to
544 # link against any libraries installed there. If defined you may
545 # specify your own (or DarwinPort's) include directories and
546 # library directories by defining CFLAGS and LDFLAGS appropriately.
548 # Define NO_MMAP if you want to avoid mmap.
550 # Define NO_ICONV if your libc does not properly support iconv.
552 AS_HELP_STRING([--without-iconv],
553 [if your architecture doesn't properly support iconv])
554 AS_HELP_STRING([--with-iconv=PATH],
555 [PATH is prefix for libiconv library and headers])
557 [used only if you need linking with libiconv]),
558 GIT_PARSE_WITH(iconv))
560 ## --enable-FEATURE[=ARG] and --disable-FEATURE
562 # Define USE_NSEC below if you want git to care about sub-second file mtimes
563 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
564 # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
565 # randomly break unless your underlying filesystem supports those sub-second
566 # times (my ext3 doesn't).
568 # Define USE_STDEV below if you want git to care about the underlying device
569 # change being considered an inode change from the update-index perspective.
573 AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"])
578 rm -f "${config_append}"