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