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