THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1279 lines
37KB

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