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