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