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