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