]>
Commit | Line | Data |
---|---|---|
55667714 JN |
1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. | |
3 | ||
4 | AC_PREREQ(2.59) | |
3900145e | 5 | AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org]) |
55667714 JN |
6 | |
7 | AC_CONFIG_SRCDIR([git.c]) | |
8 | ||
9 | config_file=config.mak.autogen | |
d3a6db98 | 10 | config_append=config.mak.append |
55667714 JN |
11 | config_in=config.mak.in |
12 | ||
d3a6db98 JN |
13 | echo "# ${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} | |
20 | AC_DEFUN([GIT_CONF_APPEND_LINE], | |
21 | [echo "$1" >> "${config_append}"])# GIT_CONF_APPEND_LINE | |
657b062d JN |
22 | # |
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], | |
27 | [AC_ARG_WITH([$1], | |
28 | [AS_HELP_STRING([--with-$1=PATH], | |
29 | [provide PATH to $1])], | |
30 | [GIT_CONF_APPEND_PATH($1)],[]) | |
31 | ])# GIT_ARG_SET_PATH | |
32 | # | |
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 \ | |
b52b1d43 | 40 | AC_MSG_ERROR([You cannot use git without $1]); \ |
657b062d JN |
41 | else \ |
42 | if test "$withval" = "yes"; then \ | |
43 | AC_MSG_WARN([You should provide path for --with-$1=PATH]); \ | |
44 | else \ | |
e068f4f5 BW |
45 | m4_toupper($1)_PATH=$withval; \ |
46 | AC_MSG_NOTICE([Setting m4_toupper($1)_PATH to $withval]); \ | |
657b062d JN |
47 | GIT_CONF_APPEND_LINE(${PROGRAM}_PATH=$withval); \ |
48 | fi; \ | |
49 | fi; \ | |
50 | ]) # GIT_CONF_APPEND_PATH | |
a20b4d89 JN |
51 | # |
52 | # GIT_PARSE_WITH(PACKAGE) | |
53 | # ----------------------- | |
54 | # For use in AC_ARG_WITH action-if-found, for packages default ON. | |
55 | # * Set NO_PACKAGE=YesPlease for --without-PACKAGE | |
56 | # * Set PACKAGEDIR=PATH for --with-PACKAGE=PATH | |
57 | # * Unset NO_PACKAGE for --with-PACKAGE without ARG | |
58 | AC_DEFUN([GIT_PARSE_WITH], | |
59 | [PACKAGE=m4_toupper($1); \ | |
60 | if test "$withval" = "no"; then \ | |
61 | m4_toupper(NO_$1)=YesPlease; \ | |
62 | elif test "$withval" = "yes"; then \ | |
63 | m4_toupper(NO_$1)=; \ | |
64 | else \ | |
65 | m4_toupper(NO_$1)=; \ | |
e068f4f5 BW |
66 | m4_toupper($1)DIR=$withval; \ |
67 | AC_MSG_NOTICE([Setting m4_toupper($1)DIR to $withval]); \ | |
a20b4d89 JN |
68 | GIT_CONF_APPEND_LINE(${PACKAGE}DIR=$withval); \ |
69 | fi \ | |
70 | ])# GIT_PARSE_WITH | |
d79d9e13 BW |
71 | # |
72 | # GIT_PARSE_WITH_SET_MAKE_VAR(WITHNAME, VAR, HELP_TEXT) | |
73 | # --------------------- | |
74 | # Set VAR to the value specied by --with-WITHNAME. | |
75 | # No verification of arguments is performed, but warnings are issued | |
76 | # if either 'yes' or 'no' is specified. | |
77 | # HELP_TEXT is presented when --help is called. | |
78 | # This is a direct way to allow setting variables in the Makefile. | |
79 | AC_DEFUN([GIT_PARSE_WITH_SET_MAKE_VAR], | |
80 | [AC_ARG_WITH([$1], | |
81 | [AS_HELP_STRING([--with-$1=VALUE], $3)], | |
82 | if test -n "$withval"; then \ | |
83 | if test "$withval" = "yes" -o "$withval" = "no"; then \ | |
84 | AC_MSG_WARN([You likely do not want either 'yes' or 'no' as] | |
85 | [a value for $1 ($2). Maybe you do...?]); \ | |
86 | fi; \ | |
87 | \ | |
88 | AC_MSG_NOTICE([Setting $2 to $withval]); \ | |
89 | GIT_CONF_APPEND_LINE($2=$withval); \ | |
90 | fi)])# GIT_PARSE_WITH_SET_MAKE_VAR | |
d3a6db98 | 91 | |
1689c5de DS |
92 | dnl |
93 | dnl GIT_CHECK_FUNC(FUNCTION, IFTRUE, IFFALSE) | |
94 | dnl ----------------------------------------- | |
95 | dnl Similar to AC_CHECK_FUNC, but on systems that do not generate | |
96 | dnl warnings for missing prototypes (e.g. FreeBSD when compiling without | |
97 | dnl -Wall), it does not work. By looking for function definition in | |
98 | dnl libraries, this problem can be worked around. | |
99 | AC_DEFUN([GIT_CHECK_FUNC],[AC_CHECK_FUNC([$1],[ | |
100 | AC_SEARCH_LIBS([$1],, | |
101 | [$2],[$3]) | |
102 | ],[$3])]) | |
918c8120 BW |
103 | |
104 | dnl | |
105 | dnl GIT_STASH_FLAGS(BASEPATH_VAR) | |
106 | dnl ----------------------------- | |
107 | dnl Allow for easy stashing of LDFLAGS and CPPFLAGS before running | |
108 | dnl tests that may want to take user settings into account. | |
109 | AC_DEFUN([GIT_STASH_FLAGS],[ | |
110 | if test -n "$1"; then | |
111 | old_CPPFLAGS="$CPPFLAGS" | |
112 | old_LDFLAGS="$LDFLAGS" | |
113 | CPPFLAGS="-I$1/include $CPPFLAGS" | |
114 | LDFLAGS="-L$1/$lib $LDFLAGS" | |
115 | fi | |
116 | ]) | |
117 | ||
118 | dnl | |
119 | dnl GIT_UNSTASH_FLAGS(BASEPATH_VAR) | |
120 | dnl ----------------------------- | |
121 | dnl Restore the stashed *FLAGS values. | |
122 | AC_DEFUN([GIT_UNSTASH_FLAGS],[ | |
123 | if test -n "$1"; then | |
124 | CPPFLAGS="$old_CPPFLAGS" | |
125 | LDFLAGS="$old_LDFLAGS" | |
126 | fi | |
127 | ]) | |
128 | ||
a20b4d89 | 129 | ## Site configuration related to programs (before tests) |
c4b1b140 JN |
130 | ## --with-PACKAGE[=ARG] and --without-PACKAGE |
131 | # | |
10861bea RS |
132 | # Set lib to alternative name of lib directory (e.g. lib64) |
133 | AC_ARG_WITH([lib], | |
134 | [AS_HELP_STRING([--with-lib=ARG], | |
135 | [ARG specifies alternative name for lib directory])], | |
3c307bfb | 136 | [if test "$withval" = "no" || test "$withval" = "yes"; then \ |
10861bea RS |
137 | AC_MSG_WARN([You should provide name for --with-lib=ARG]); \ |
138 | else \ | |
e068f4f5 BW |
139 | lib=$withval; \ |
140 | AC_MSG_NOTICE([Setting lib to '$lib']); \ | |
10861bea RS |
141 | GIT_CONF_APPEND_LINE(lib=$withval); \ |
142 | fi; \ | |
143 | ],[]) | |
e068f4f5 BW |
144 | |
145 | if test -z "$lib"; then | |
146 | AC_MSG_NOTICE([Setting lib to 'lib' (the default)]) | |
147 | lib=lib | |
148 | fi | |
08df6a30 | 149 | |
1973b0d7 BW |
150 | AC_ARG_ENABLE([pthreads], |
151 | [AS_HELP_STRING([--enable-pthreads=FLAGS], | |
152 | [FLAGS is the value to pass to the compiler to enable POSIX Threads.] | |
153 | [The default if FLAGS is not specified is to try first -pthread] | |
154 | [and then -lpthread.] | |
155 | [--without-pthreads will disable threading.])], | |
156 | [ | |
157 | if test "x$enableval" = "xyes"; then | |
158 | AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads]) | |
159 | elif test "x$enableval" != "xno"; then | |
160 | PTHREAD_CFLAGS=$enableval | |
161 | AC_MSG_NOTICE([Setting '$PTHREAD_CFLAGS' as the FLAGS to enable POSIX Threads]) | |
162 | else | |
163 | AC_MSG_NOTICE([POSIX Threads will be disabled.]) | |
164 | NO_PTHREADS=YesPlease | |
165 | USER_NOPTHREAD=1 | |
166 | fi], | |
167 | [ | |
168 | AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads.]) | |
169 | ]) | |
170 | ||
08df6a30 BW |
171 | ## Site configuration (override autodetection) |
172 | ## --with-PACKAGE[=ARG] and --without-PACKAGE | |
173 | AC_MSG_NOTICE([CHECKS for site configuration]) | |
174 | # | |
175 | # Define NO_SVN_TESTS if you want to skip time-consuming SVN interoperability | |
176 | # tests. These tests take up a significant amount of the total test time | |
177 | # but are not needed unless you plan to talk to SVN repos. | |
178 | # | |
08df6a30 BW |
179 | # Define PPC_SHA1 environment variable when running make to make use of |
180 | # a bundled SHA1 routine optimized for PowerPC. | |
181 | # | |
08df6a30 | 182 | # Define NO_OPENSSL environment variable if you do not have OpenSSL. |
30ae47b4 | 183 | # This also implies BLK_SHA1. |
08df6a30 BW |
184 | # |
185 | # Define OPENSSLDIR=/foo/bar if your openssl header and library files are in | |
186 | # /foo/bar/include and /foo/bar/lib directories. | |
187 | AC_ARG_WITH(openssl, | |
188 | AS_HELP_STRING([--with-openssl],[use OpenSSL library (default is YES)]) | |
189 | AS_HELP_STRING([], [ARG can be prefix for openssl library and headers]),\ | |
190 | GIT_PARSE_WITH(openssl)) | |
191 | # | |
192 | # Define NO_CURL if you do not have curl installed. git-http-pull and | |
193 | # git-http-push are not built, and you cannot use http:// and https:// | |
194 | # transports. | |
195 | # | |
196 | # Define CURLDIR=/foo/bar if your curl header and library files are in | |
197 | # /foo/bar/include and /foo/bar/lib directories. | |
198 | AC_ARG_WITH(curl, | |
199 | AS_HELP_STRING([--with-curl],[support http(s):// transports (default is YES)]) | |
200 | AS_HELP_STRING([], [ARG can be also prefix for curl library and headers]), | |
201 | GIT_PARSE_WITH(curl)) | |
202 | # | |
203 | # Define NO_EXPAT if you do not have expat installed. git-http-push is | |
204 | # not built, and you cannot push using http:// and https:// transports. | |
205 | # | |
206 | # Define EXPATDIR=/foo/bar if your expat header and library files are in | |
207 | # /foo/bar/include and /foo/bar/lib directories. | |
208 | AC_ARG_WITH(expat, | |
209 | AS_HELP_STRING([--with-expat], | |
210 | [support git-push using http:// and https:// transports via WebDAV (default is YES)]) | |
211 | AS_HELP_STRING([], [ARG can be also prefix for expat library and headers]), | |
212 | GIT_PARSE_WITH(expat)) | |
213 | # | |
214 | # Define NO_FINK if you are building on Darwin/Mac OS X, have Fink | |
215 | # installed in /sw, but don't want GIT to link against any libraries | |
216 | # installed there. If defined you may specify your own (or Fink's) | |
217 | # include directories and library directories by defining CFLAGS | |
218 | # and LDFLAGS appropriately. | |
219 | # | |
220 | # Define NO_DARWIN_PORTS if you are building on Darwin/Mac OS X, | |
221 | # have DarwinPorts installed in /opt/local, but don't want GIT to | |
222 | # link against any libraries installed there. If defined you may | |
223 | # specify your own (or DarwinPort's) include directories and | |
224 | # library directories by defining CFLAGS and LDFLAGS appropriately. | |
225 | # | |
226 | # Define NO_MMAP if you want to avoid mmap. | |
227 | # | |
228 | # Define NO_ICONV if your libc does not properly support iconv. | |
229 | AC_ARG_WITH(iconv, | |
230 | AS_HELP_STRING([--without-iconv], | |
231 | [if your architecture doesn't properly support iconv]) | |
232 | AS_HELP_STRING([--with-iconv=PATH], | |
233 | [PATH is prefix for libiconv library and headers]) | |
234 | AS_HELP_STRING([], | |
235 | [used only if you need linking with libiconv]), | |
236 | GIT_PARSE_WITH(iconv)) | |
237 | ||
238 | ## --enable-FEATURE[=ARG] and --disable-FEATURE | |
239 | # | |
240 | # Define USE_NSEC below if you want git to care about sub-second file mtimes | |
241 | # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and | |
242 | # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely | |
243 | # randomly break unless your underlying filesystem supports those sub-second | |
244 | # times (my ext3 doesn't). | |
245 | # | |
246 | # Define USE_STDEV below if you want git to care about the underlying device | |
247 | # change being considered an inode change from the update-index perspective. | |
248 | ||
5ca5377d BW |
249 | # |
250 | # Allow user to set ETC_GITCONFIG variable | |
251 | GIT_PARSE_WITH_SET_MAKE_VAR(gitconfig, ETC_GITCONFIG, | |
252 | Use VALUE instead of /etc/gitconfig as the | |
253 | global git configuration file. | |
254 | If VALUE is not fully qualified it will be interpretted | |
255 | as a path relative to the computed prefix at runtime.) | |
256 | ||
257 | # | |
258 | # Allow user to set the default pager | |
259 | GIT_PARSE_WITH_SET_MAKE_VAR(pager, DEFAULT_PAGER, | |
260 | Use VALUE as the fall-back pager instead of 'less'. | |
261 | This is used by things like 'git log' when the user | |
262 | does not specify a pager to use through alternate | |
263 | methods. eg: /usr/bin/pager) | |
264 | # | |
265 | # Allow user to set the default editor | |
266 | GIT_PARSE_WITH_SET_MAKE_VAR(editor, DEFAULT_EDITOR, | |
267 | Use VALUE as the fall-back editor instead of 'vi'. | |
268 | This is used by things like 'git commit' when the user | |
269 | does not specify a preferred editor through other | |
270 | methods. eg: /usr/bin/editor) | |
271 | ||
10861bea | 272 | # |
465e649d JN |
273 | # Define SHELL_PATH to provide path to shell. |
274 | GIT_ARG_SET_PATH(shell) | |
275 | # | |
276 | # Define PERL_PATH to provide path to Perl. | |
277 | GIT_ARG_SET_PATH(perl) | |
278 | # | |
bef19da9 RS |
279 | # Define ZLIB_PATH to provide path to zlib. |
280 | GIT_ARG_SET_PATH(zlib) | |
281 | # | |
81b63c70 ER |
282 | # Declare the with-tcltk/without-tcltk options. |
283 | AC_ARG_WITH(tcltk, | |
284 | AS_HELP_STRING([--with-tcltk],[use Tcl/Tk GUI (default is YES)]) | |
285 | AS_HELP_STRING([],[ARG is the full path to the Tcl/Tk interpreter.]) | |
286 | AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if]) | |
287 | AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),\ | |
288 | GIT_PARSE_WITH(tcltk)) | |
289 | # | |
c4b1b140 JN |
290 | |
291 | ||
633b4239 | 292 | ## Checks for programs. |
fd22c027 | 293 | AC_MSG_NOTICE([CHECKS for programs]) |
f6719572 | 294 | # |
60a144f2 | 295 | AC_PROG_CC([cc gcc]) |
798a9450 | 296 | # which switch to pass runtime path to dynamic libraries to the linker |
a1a587ef | 297 | AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [ |
798a9450 GF |
298 | SAVE_LDFLAGS="${LDFLAGS}" |
299 | LDFLAGS="${SAVE_LDFLAGS} -R /" | |
a1a587ef | 300 | AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no]) |
798a9450 GF |
301 | LDFLAGS="${SAVE_LDFLAGS}" |
302 | ]) | |
a1a587ef | 303 | if test "$git_cv_ld_dashr" = "yes"; then |
798a9450 GF |
304 | AC_SUBST(CC_LD_DYNPATH, [-R]) |
305 | else | |
a1a587ef | 306 | AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [ |
798a9450 GF |
307 | SAVE_LDFLAGS="${LDFLAGS}" |
308 | LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/" | |
a1a587ef | 309 | AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no]) |
50a4b352 | 310 | LDFLAGS="${SAVE_LDFLAGS}" |
798a9450 | 311 | ]) |
a1a587ef | 312 | if test "$git_cv_ld_wl_rpath" = "yes"; then |
798a9450 GF |
313 | AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,]) |
314 | else | |
a1a587ef | 315 | AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [ |
798a9450 GF |
316 | SAVE_LDFLAGS="${LDFLAGS}" |
317 | LDFLAGS="${SAVE_LDFLAGS} -rpath /" | |
a1a587ef | 318 | AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no]) |
50a4b352 | 319 | LDFLAGS="${SAVE_LDFLAGS}" |
798a9450 | 320 | ]) |
a1a587ef | 321 | if test "$git_cv_ld_rpath" = "yes"; then |
798a9450 GF |
322 | AC_SUBST(CC_LD_DYNPATH, [-rpath]) |
323 | else | |
324 | AC_MSG_WARN([linker does not support runtime path to dynamic libraries]) | |
325 | fi | |
326 | fi | |
327 | fi | |
fd22c027 | 328 | #AC_PROG_INSTALL # needs install-sh or install.sh in sources |
96e24abc | 329 | AC_CHECK_TOOLS(AR, [gar ar], :) |
fd22c027 | 330 | AC_CHECK_PROGS(TAR, [gtar tar]) |
81b63c70 ER |
331 | # TCLTK_PATH will be set to some value if we want Tcl/Tk |
332 | # or will be empty otherwise. | |
333 | if test -z "$NO_TCLTK"; then | |
334 | if test "$with_tcltk" = ""; then | |
335 | # No Tcl/Tk switches given. Do not check for Tcl/Tk, use bare 'wish'. | |
336 | TCLTK_PATH=wish | |
337 | AC_SUBST(TCLTK_PATH) | |
338 | elif test "$with_tcltk" = "yes"; then | |
339 | # Tcl/Tk check requested. | |
340 | AC_CHECK_PROGS(TCLTK_PATH, [wish], ) | |
68daee08 | 341 | else |
81b63c70 ER |
342 | AC_MSG_RESULT([Using Tcl/Tk interpreter $with_tcltk]) |
343 | TCLTK_PATH="$with_tcltk" | |
344 | AC_SUBST(TCLTK_PATH) | |
81b63c70 ER |
345 | fi |
346 | fi | |
923db42e JN |
347 | AC_CHECK_PROGS(ASCIIDOC, [asciidoc]) |
348 | if test -n "$ASCIIDOC"; then | |
349 | AC_MSG_CHECKING([for asciidoc version]) | |
29adc8ba | 350 | asciidoc_version=`$ASCIIDOC --version 2>/dev/null` |
923db42e JN |
351 | case "${asciidoc_version}" in |
352 | asciidoc' '8*) | |
353 | ASCIIDOC8=YesPlease | |
354 | AC_MSG_RESULT([${asciidoc_version} > 7]) | |
355 | ;; | |
356 | asciidoc' '7*) | |
357 | ASCIIDOC8= | |
358 | AC_MSG_RESULT([${asciidoc_version}]) | |
359 | ;; | |
360 | *) | |
361 | ASCIIDOC8= | |
362 | AC_MSG_RESULT([${asciidoc_version} (unknown)]) | |
363 | ;; | |
364 | esac | |
365 | fi | |
366 | AC_SUBST(ASCIIDOC8) | |
367 | ||
633b4239 JN |
368 | |
369 | ## Checks for libraries. | |
ebdf5321 | 370 | AC_MSG_NOTICE([CHECKS for libraries]) |
f6719572 | 371 | # |
633b4239 | 372 | # Define NO_OPENSSL environment variable if you do not have OpenSSL. |
ebdf5321 | 373 | # Define NEEDS_SSL_WITH_CRYPTO if you need -lcrypto with -lssl (Darwin). |
310386f0 BW |
374 | |
375 | GIT_STASH_FLAGS($OPENSSLDIR) | |
376 | ||
d5c31a1c | 377 | AC_CHECK_LIB([crypto], [SHA1_Init], |
424adc50 | 378 | [NEEDS_SSL_WITH_CRYPTO=], |
3068f6c4 | 379 | [AC_CHECK_LIB([ssl], [SHA1_Init], |
0ad8ff2c BC |
380 | [NEEDS_SSL_WITH_CRYPTO=YesPlease], |
381 | [NEEDS_SSL_WITH_CRYPTO= NO_OPENSSL=YesPlease])]) | |
310386f0 BW |
382 | |
383 | GIT_UNSTASH_FLAGS($OPENSSLDIR) | |
384 | ||
424adc50 JN |
385 | AC_SUBST(NEEDS_SSL_WITH_CRYPTO) |
386 | AC_SUBST(NO_OPENSSL) | |
310386f0 | 387 | |
f6719572 | 388 | # |
8da1e212 | 389 | # Define NO_CURL if you do not have libcurl installed. git-http-pull and |
633b4239 JN |
390 | # git-http-push are not built, and you cannot use http:// and https:// |
391 | # transports. | |
310386f0 BW |
392 | |
393 | GIT_STASH_FLAGS($CURLDIR) | |
394 | ||
d5c31a1c | 395 | AC_CHECK_LIB([curl], [curl_global_init], |
424adc50 JN |
396 | [NO_CURL=], |
397 | [NO_CURL=YesPlease]) | |
310386f0 BW |
398 | |
399 | GIT_UNSTASH_FLAGS($CURLDIR) | |
400 | ||
424adc50 | 401 | AC_SUBST(NO_CURL) |
310386f0 | 402 | |
f6719572 | 403 | # |
633b4239 JN |
404 | # Define NO_EXPAT if you do not have expat installed. git-http-push is |
405 | # not built, and you cannot push using http:// and https:// transports. | |
310386f0 BW |
406 | |
407 | GIT_STASH_FLAGS($EXPATDIR) | |
408 | ||
d5c31a1c | 409 | AC_CHECK_LIB([expat], [XML_ParserCreate], |
424adc50 JN |
410 | [NO_EXPAT=], |
411 | [NO_EXPAT=YesPlease]) | |
310386f0 BW |
412 | |
413 | GIT_UNSTASH_FLAGS($EXPATDIR) | |
414 | ||
424adc50 | 415 | AC_SUBST(NO_EXPAT) |
310386f0 | 416 | |
f6719572 | 417 | # |
e63ccb84 FK |
418 | # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin and |
419 | # some Solaris installations). | |
6ff88de7 | 420 | # Define NO_ICONV if neither libc nor libiconv support iconv. |
310386f0 | 421 | |
934f82a7 MN |
422 | if test -z "$NO_ICONV"; then |
423 | ||
310386f0 BW |
424 | GIT_STASH_FLAGS($ICONVDIR) |
425 | ||
e63ccb84 FK |
426 | AC_DEFUN([ICONVTEST_SRC], [ |
427 | #include <iconv.h> | |
428 | ||
429 | int main(void) | |
430 | { | |
431 | iconv_open("", ""); | |
432 | return 0; | |
433 | } | |
434 | ]) | |
a8304f7a BW |
435 | |
436 | if test -n "$ICONVDIR"; then | |
437 | lib_order="-liconv -lc" | |
438 | else | |
439 | lib_order="-lc -liconv" | |
440 | fi | |
441 | ||
442 | NO_ICONV=YesPlease | |
443 | ||
444 | for l in $lib_order; do | |
445 | if test "$l" = "-liconv"; then | |
446 | NEEDS_LIBICONV=YesPlease | |
447 | else | |
448 | NEEDS_LIBICONV= | |
449 | fi | |
450 | ||
451 | old_LIBS="$LIBS" | |
452 | LIBS="$LIBS $l" | |
453 | AC_MSG_CHECKING([for iconv in $l]) | |
454 | AC_LINK_IFELSE(ICONVTEST_SRC, | |
e63ccb84 | 455 | [AC_MSG_RESULT([yes]) |
a8304f7a BW |
456 | NO_ICONV= |
457 | break], | |
458 | [AC_MSG_RESULT([no])]) | |
459 | LIBS="$old_LIBS" | |
460 | done | |
461 | ||
462 | #in case of break | |
463 | LIBS="$old_LIBS" | |
310386f0 BW |
464 | |
465 | GIT_UNSTASH_FLAGS($ICONVDIR) | |
466 | ||
424adc50 | 467 | AC_SUBST(NEEDS_LIBICONV) |
baf1219a | 468 | AC_SUBST(NO_ICONV) |
310386f0 | 469 | |
934f82a7 MN |
470 | if test -n "$NO_ICONV"; then |
471 | NEEDS_LIBICONV= | |
472 | fi | |
473 | ||
474 | fi | |
475 | ||
f6719572 | 476 | # |
609a2289 | 477 | # Define NO_DEFLATE_BOUND if deflateBound is missing from zlib. |
310386f0 BW |
478 | |
479 | GIT_STASH_FLAGS($ZLIB_PATH) | |
480 | ||
609a2289 DS |
481 | AC_DEFUN([ZLIBTEST_SRC], [ |
482 | #include <zlib.h> | |
483 | ||
484 | int main(void) | |
485 | { | |
486 | deflateBound(0, 0); | |
487 | return 0; | |
488 | } | |
489 | ]) | |
490 | AC_MSG_CHECKING([for deflateBound in -lz]) | |
491 | old_LIBS="$LIBS" | |
492 | LIBS="$LIBS -lz" | |
493 | AC_LINK_IFELSE(ZLIBTEST_SRC, | |
494 | [AC_MSG_RESULT([yes])], | |
495 | [AC_MSG_RESULT([no]) | |
496 | NO_DEFLATE_BOUND=yes]) | |
497 | LIBS="$old_LIBS" | |
310386f0 BW |
498 | |
499 | GIT_UNSTASH_FLAGS($ZLIB_PATH) | |
500 | ||
609a2289 | 501 | AC_SUBST(NO_DEFLATE_BOUND) |
310386f0 | 502 | |
609a2289 | 503 | # |
633b4239 JN |
504 | # Define NEEDS_SOCKET if linking with libc is not enough (SunOS, |
505 | # Patrick Mauritz). | |
d5c31a1c | 506 | AC_CHECK_LIB([c], [socket], |
424adc50 JN |
507 | [NEEDS_SOCKET=], |
508 | [NEEDS_SOCKET=YesPlease]) | |
509 | AC_SUBST(NEEDS_SOCKET) | |
d1b9944d | 510 | test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket" |
633b4239 | 511 | |
8fccb009 RW |
512 | # |
513 | # Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough. | |
514 | # Notably on Solaris hstrerror resides in libresolv and on Solaris 7 | |
515 | # inet_ntop and inet_pton additionally reside there. | |
a1142892 | 516 | AC_CHECK_LIB([c], [hstrerror], |
8fccb009 RW |
517 | [NEEDS_RESOLV=], |
518 | [NEEDS_RESOLV=YesPlease]) | |
519 | AC_SUBST(NEEDS_RESOLV) | |
520 | test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv" | |
633b4239 | 521 | |
a1142892 | 522 | AC_CHECK_LIB([c], [basename], |
ecc395c1 BC |
523 | [NEEDS_LIBGEN=], |
524 | [NEEDS_LIBGEN=YesPlease]) | |
525 | AC_SUBST(NEEDS_LIBGEN) | |
526 | test -n "$NEEDS_LIBGEN" && LIBS="$LIBS -lgen" | |
527 | ||
633b4239 | 528 | ## Checks for header files. |
0f7a9c9b JN |
529 | AC_MSG_NOTICE([CHECKS for header files]) |
530 | # | |
3cf32374 JN |
531 | # Define NO_SYS_SELECT_H if you don't have sys/select.h. |
532 | AC_CHECK_HEADER([sys/select.h], | |
533 | [NO_SYS_SELECT_H=], | |
534 | [NO_SYS_SELECT_H=UnfortunatelyYes]) | |
535 | AC_SUBST(NO_SYS_SELECT_H) | |
536 | # | |
0f7a9c9b JN |
537 | # Define OLD_ICONV if your library has an old iconv(), where the second |
538 | # (input buffer pointer) parameter is declared with type (const char **). | |
539 | AC_DEFUN([OLDICONVTEST_SRC], [[ | |
540 | #include <iconv.h> | |
541 | ||
542 | extern size_t iconv(iconv_t cd, | |
543 | char **inbuf, size_t *inbytesleft, | |
544 | char **outbuf, size_t *outbytesleft); | |
545 | ||
546 | int main(void) | |
547 | { | |
548 | return 0; | |
549 | } | |
550 | ]]) | |
a8304f7a BW |
551 | |
552 | GIT_STASH_FLAGS($ICONVDIR) | |
553 | ||
0f7a9c9b JN |
554 | AC_MSG_CHECKING([for old iconv()]) |
555 | AC_COMPILE_IFELSE(OLDICONVTEST_SRC, | |
556 | [AC_MSG_RESULT([no])], | |
557 | [AC_MSG_RESULT([yes]) | |
558 | OLD_ICONV=UnfortunatelyYes]) | |
633b4239 | 559 | |
a8304f7a BW |
560 | GIT_UNSTASH_FLAGS($ICONVDIR) |
561 | ||
562 | AC_SUBST(OLD_ICONV) | |
633b4239 JN |
563 | |
564 | ## Checks for typedefs, structures, and compiler characteristics. | |
eb0f255d | 565 | AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics]) |
f6719572 | 566 | # |
633b4239 | 567 | # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. |
d5c31a1c | 568 | AC_CHECK_MEMBER(struct dirent.d_ino, |
424adc50 JN |
569 | [NO_D_INO_IN_DIRENT=], |
570 | [NO_D_INO_IN_DIRENT=YesPlease], | |
eb0f255d | 571 | [#include <dirent.h>]) |
424adc50 | 572 | AC_SUBST(NO_D_INO_IN_DIRENT) |
f6719572 | 573 | # |
633b4239 JN |
574 | # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks |
575 | # d_type in struct dirent (latest Cygwin -- will be fixed soonish). | |
d5c31a1c | 576 | AC_CHECK_MEMBER(struct dirent.d_type, |
424adc50 JN |
577 | [NO_D_TYPE_IN_DIRENT=], |
578 | [NO_D_TYPE_IN_DIRENT=YesPlease], | |
eb0f255d | 579 | [#include <dirent.h>]) |
424adc50 | 580 | AC_SUBST(NO_D_TYPE_IN_DIRENT) |
f6719572 | 581 | # |
633b4239 JN |
582 | # Define NO_SOCKADDR_STORAGE if your platform does not have struct |
583 | # sockaddr_storage. | |
d5c31a1c | 584 | AC_CHECK_TYPE(struct sockaddr_storage, |
424adc50 | 585 | [NO_SOCKADDR_STORAGE=], |
ab5573ae DS |
586 | [NO_SOCKADDR_STORAGE=YesPlease],[ |
587 | #include <sys/types.h> | |
588 | #include <sys/socket.h> | |
589 | ]) | |
424adc50 JN |
590 | AC_SUBST(NO_SOCKADDR_STORAGE) |
591 | # | |
8c6ab35e JH |
592 | # Define NO_IPV6 if you lack IPv6 support and getaddrinfo(). |
593 | AC_CHECK_TYPE([struct addrinfo],[ | |
1689c5de | 594 | GIT_CHECK_FUNC([getaddrinfo], |
424adc50 JN |
595 | [NO_IPV6=], |
596 | [NO_IPV6=YesPlease]) | |
597 | ],[NO_IPV6=YesPlease],[ | |
8c6ab35e JH |
598 | #include <sys/types.h> |
599 | #include <sys/socket.h> | |
600 | #include <netdb.h> | |
601 | ]) | |
424adc50 | 602 | AC_SUBST(NO_IPV6) |
656517b9 JN |
603 | # |
604 | # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.) | |
605 | # do not support the 'size specifiers' introduced by C99, namely ll, hh, | |
606 | # j, z, t. (representing long long int, char, intmax_t, size_t, ptrdiff_t). | |
607 | # some C compilers supported these specifiers prior to C99 as an extension. | |
f685d07d JN |
608 | AC_CACHE_CHECK([whether formatted IO functions support C99 size specifiers], |
609 | [ac_cv_c_c99_format], | |
656517b9 JN |
610 | [# Actually git uses only %z (%zu) in alloc.c, and %t (%td) in mktag.c |
611 | AC_RUN_IFELSE( | |
612 | [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | |
613 | [[char buf[64]; | |
614 | if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5) | |
3c307bfb | 615 | return 1; |
656517b9 | 616 | else if (strcmp(buf, "12345")) |
3c307bfb | 617 | return 2;]])], |
656517b9 JN |
618 | [ac_cv_c_c99_format=yes], |
619 | [ac_cv_c_c99_format=no]) | |
620 | ]) | |
621 | if test $ac_cv_c_c99_format = no; then | |
424adc50 | 622 | NO_C99_FORMAT=YesPlease |
d5c31a1c | 623 | else |
424adc50 | 624 | NO_C99_FORMAT= |
656517b9 | 625 | fi |
424adc50 | 626 | AC_SUBST(NO_C99_FORMAT) |
c4582f93 | 627 | # |
8ce1f243 MR |
628 | # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds |
629 | # when attempting to read from an fopen'ed directory. | |
630 | AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory], | |
631 | [ac_cv_fread_reads_directories], | |
632 | [ | |
633 | AC_RUN_IFELSE( | |
634 | [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | |
635 | [[char c; | |
636 | FILE *f = fopen(".", "r"); | |
637 | return f && fread(&c, 1, 1, f)]])], | |
638 | [ac_cv_fread_reads_directories=no], | |
639 | [ac_cv_fread_reads_directories=yes]) | |
640 | ]) | |
641 | if test $ac_cv_fread_reads_directories = yes; then | |
642 | FREAD_READS_DIRECTORIES=UnfortunatelyYes | |
643 | else | |
644 | FREAD_READS_DIRECTORIES= | |
645 | fi | |
646 | AC_SUBST(FREAD_READS_DIRECTORIES) | |
647 | # | |
c4582f93 MR |
648 | # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf() |
649 | # or vsnprintf() return -1 instead of number of characters which would | |
650 | # have been written to the final string if enough space had been available. | |
651 | AC_CACHE_CHECK([whether snprintf() and/or vsnprintf() return bogus value], | |
652 | [ac_cv_snprintf_returns_bogus], | |
653 | [ | |
654 | AC_RUN_IFELSE( | |
655 | [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | |
656 | #include "stdarg.h" | |
657 | ||
658 | int test_vsnprintf(char *str, size_t maxsize, const char *format, ...) | |
659 | { | |
660 | int ret; | |
661 | va_list ap; | |
662 | va_start(ap, format); | |
663 | ret = vsnprintf(str, maxsize, format, ap); | |
664 | va_end(ap); | |
665 | return ret; | |
666 | }], | |
667 | [[char buf[6]; | |
668 | if (test_vsnprintf(buf, 3, "%s", "12345") != 5 | |
669 | || strcmp(buf, "12")) return 1; | |
670 | if (snprintf(buf, 3, "%s", "12345") != 5 | |
671 | || strcmp(buf, "12")) return 1]])], | |
672 | [ac_cv_snprintf_returns_bogus=no], | |
673 | [ac_cv_snprintf_returns_bogus=yes]) | |
674 | ]) | |
675 | if test $ac_cv_snprintf_returns_bogus = yes; then | |
676 | SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes | |
677 | else | |
678 | SNPRINTF_RETURNS_BOGUS= | |
679 | fi | |
680 | AC_SUBST(SNPRINTF_RETURNS_BOGUS) | |
633b4239 | 681 | |
a20b4d89 | 682 | |
633b4239 | 683 | ## Checks for library functions. |
1bbbadbc JN |
684 | ## (in default C library and libraries checked by AC_CHECK_LIB) |
685 | AC_MSG_NOTICE([CHECKS for library functions]) | |
f6719572 | 686 | # |
e1c06886 DA |
687 | # Define NO_LIBGEN_H if you don't have libgen.h. |
688 | AC_CHECK_HEADER([libgen.h], | |
689 | [NO_LIBGEN_H=], | |
690 | [NO_LIBGEN_H=YesPlease]) | |
691 | AC_SUBST(NO_LIBGEN_H) | |
692 | # | |
633b4239 | 693 | # Define NO_STRCASESTR if you don't have strcasestr. |
1689c5de | 694 | GIT_CHECK_FUNC(strcasestr, |
424adc50 JN |
695 | [NO_STRCASESTR=], |
696 | [NO_STRCASESTR=YesPlease]) | |
697 | AC_SUBST(NO_STRCASESTR) | |
f6719572 | 698 | # |
24397556 | 699 | # Define NO_MEMMEM if you don't have memmem. |
1689c5de | 700 | GIT_CHECK_FUNC(memmem, |
24397556 JN |
701 | [NO_MEMMEM=], |
702 | [NO_MEMMEM=YesPlease]) | |
703 | AC_SUBST(NO_MEMMEM) | |
704 | # | |
633b4239 | 705 | # Define NO_STRLCPY if you don't have strlcpy. |
1689c5de | 706 | GIT_CHECK_FUNC(strlcpy, |
424adc50 JN |
707 | [NO_STRLCPY=], |
708 | [NO_STRLCPY=YesPlease]) | |
709 | AC_SUBST(NO_STRLCPY) | |
f6719572 | 710 | # |
0bc3e781 DS |
711 | # Define NO_UINTMAX_T if your platform does not have uintmax_t |
712 | AC_CHECK_TYPE(uintmax_t, | |
713 | [NO_UINTMAX_T=], | |
714 | [NO_UINTMAX_T=YesPlease],[ | |
715 | #include <inttypes.h> | |
716 | ]) | |
717 | AC_SUBST(NO_UINTMAX_T) | |
718 | # | |
24397556 | 719 | # Define NO_STRTOUMAX if you don't have strtoumax in the C library. |
1689c5de | 720 | GIT_CHECK_FUNC(strtoumax, |
24397556 JN |
721 | [NO_STRTOUMAX=], |
722 | [NO_STRTOUMAX=YesPlease]) | |
723 | AC_SUBST(NO_STRTOUMAX) | |
724 | # | |
633b4239 | 725 | # Define NO_SETENV if you don't have setenv in the C library. |
1689c5de | 726 | GIT_CHECK_FUNC(setenv, |
424adc50 JN |
727 | [NO_SETENV=], |
728 | [NO_SETENV=YesPlease]) | |
729 | AC_SUBST(NO_SETENV) | |
f6719572 | 730 | # |
bfa8fccf | 731 | # Define NO_UNSETENV if you don't have unsetenv in the C library. |
1689c5de | 732 | GIT_CHECK_FUNC(unsetenv, |
bfa8fccf JN |
733 | [NO_UNSETENV=], |
734 | [NO_UNSETENV=YesPlease]) | |
735 | AC_SUBST(NO_UNSETENV) | |
736 | # | |
24397556 | 737 | # Define NO_MKDTEMP if you don't have mkdtemp in the C library. |
1689c5de | 738 | GIT_CHECK_FUNC(mkdtemp, |
24397556 JN |
739 | [NO_MKDTEMP=], |
740 | [NO_MKDTEMP=YesPlease]) | |
741 | AC_SUBST(NO_MKDTEMP) | |
742 | # | |
0620b39b DA |
743 | # Define NO_MKSTEMPS if you don't have mkstemps in the C library. |
744 | GIT_CHECK_FUNC(mkstemps, | |
745 | [NO_MKSTEMPS=], | |
746 | [NO_MKSTEMPS=YesPlease]) | |
747 | AC_SUBST(NO_MKSTEMPS) | |
748 | # | |
749 | # | |
633b4239 JN |
750 | # Define NO_MMAP if you want to avoid mmap. |
751 | # | |
633b4239 JN |
752 | # Define NO_ICONV if your libc does not properly support iconv. |
753 | ||
754 | ||
755 | ## Other checks. | |
756 | # Define USE_PIC if you need the main git objects to be built with -fPIC | |
757 | # in order to build and link perl/Git.so. x86-64 seems to need this. | |
758 | # | |
759 | # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. | |
760 | # Enable it on Windows. By default, symrefs are still used. | |
20f7a398 | 761 | # |
46059cc6 JH |
762 | # Define NO_PTHREADS if we do not have pthreads |
763 | # | |
d937c374 DS |
764 | # Define PTHREAD_LIBS to the linker flag used for Pthread support and define |
765 | # THREADED_DELTA_SEARCH if Pthreads are available. | |
1973b0d7 BW |
766 | AC_DEFUN([PTHREADTEST_SRC], [ |
767 | #include <pthread.h> | |
768 | ||
769 | int main(void) | |
770 | { | |
771 | pthread_mutex_t test_mutex; | |
772 | return (0); | |
773 | } | |
774 | ]) | |
775 | ||
776 | dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM( | |
777 | dnl [[#include <pthread.h>]], | |
778 | dnl [[pthread_mutex_t test_mutex;]] | |
779 | dnl )]) | |
780 | ||
781 | NO_PTHREADS=UnfortunatelyYes | |
782 | THREADED_DELTA_SEARCH= | |
783 | PTHREAD_LIBS= | |
784 | ||
785 | if test -n "$USER_NOPTHREAD"; then | |
786 | AC_MSG_NOTICE([Skipping POSIX Threads at user request.]) | |
787 | # handle these separately since PTHREAD_CFLAGS could be '-lpthreads | |
788 | # -D_REENTRANT' or some such. | |
789 | elif test -z "$PTHREAD_CFLAGS"; then | |
790 | for opt in -pthread -lpthread; do | |
791 | old_CFLAGS="$CFLAGS" | |
792 | CFLAGS="$opt $CFLAGS" | |
793 | AC_MSG_CHECKING([Checking for POSIX Threads with '$opt']) | |
794 | AC_LINK_IFELSE(PTHREADTEST_SRC, | |
795 | [AC_MSG_RESULT([yes]) | |
796 | NO_PTHREADS= | |
797 | PTHREAD_LIBS="$opt" | |
798 | THREADED_DELTA_SEARCH=YesPlease | |
799 | break | |
800 | ], | |
801 | [AC_MSG_RESULT([no])]) | |
802 | CFLAGS="$old_CFLAGS" | |
803 | done | |
20f7a398 | 804 | else |
1973b0d7 BW |
805 | old_CFLAGS="$CFLAGS" |
806 | CFLAGS="$PTHREAD_CFLAGS $CFLAGS" | |
807 | AC_MSG_CHECKING([Checking for POSIX Threads with '$PTHREAD_CFLAGS']) | |
808 | AC_LINK_IFELSE(PTHREADTEST_SRC, | |
809 | [AC_MSG_RESULT([yes]) | |
810 | NO_PTHREADS= | |
811 | PTHREAD_LIBS="$PTHREAD_CFLAGS" | |
812 | THREADED_DELTA_SEARCH=YesPlease | |
813 | ], | |
814 | [AC_MSG_RESULT([no])]) | |
815 | ||
816 | CFLAGS="$old_CFLAGS" | |
20f7a398 | 817 | fi |
1973b0d7 BW |
818 | |
819 | CFLAGS="$old_CFLAGS" | |
820 | ||
20f7a398 | 821 | AC_SUBST(PTHREAD_LIBS) |
46059cc6 | 822 | AC_SUBST(NO_PTHREADS) |
d937c374 | 823 | AC_SUBST(THREADED_DELTA_SEARCH) |
633b4239 | 824 | |
633b4239 | 825 | ## Output files |
d3a6db98 | 826 | AC_CONFIG_FILES(["${config_file}":"${config_in}":"${config_append}"]) |
55667714 | 827 | AC_OUTPUT |
d3a6db98 | 828 | |
f6719572 | 829 | |
d3a6db98 JN |
830 | ## Cleanup |
831 | rm -f "${config_append}" |