configure.ac 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328
  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 specified 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. AC_DEFINE(HAVE_OLD_ICONV, 1)
  746. OLD_ICONV=UnfortunatelyYes])
  747. GIT_UNSTASH_FLAGS($ICONVDIR)
  748. GIT_CONF_SUBST([OLD_ICONV])
  749. #
  750. # Define ICONV_OMITS_BOM if you are on a system which
  751. # iconv omits bom for utf-{16,32}
  752. if test -z "$NO_ICONV"; then
  753. AC_CACHE_CHECK([whether iconv omits bom for utf-16 and utf-32],
  754. [ac_cv_iconv_omits_bom],
  755. [
  756. old_LIBS="$LIBS"
  757. if test -n "$NEEDS_LIBICONV"; then
  758. LIBS="$LIBS -liconv"
  759. fi
  760. AC_RUN_IFELSE(
  761. [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
  762. #include <iconv.h>
  763. #ifdef HAVE_OLD_ICONV
  764. typedef const char *iconv_ibp;
  765. #else
  766. typedef char *iconv_ibp;
  767. #endif
  768. ],
  769. [[
  770. int v;
  771. iconv_t conv;
  772. char in[] = "a"; iconv_ibp pin = in;
  773. char out[20] = ""; char *pout = out;
  774. size_t isz = sizeof in;
  775. size_t osz = sizeof out;
  776. conv = iconv_open("UTF-16", "UTF-8");
  777. iconv(conv, &pin, &isz, &pout, &osz);
  778. iconv_close(conv);
  779. v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
  780. return v != 0xfe + 0xff;
  781. ]])],
  782. [ac_cv_iconv_omits_bom=no],
  783. [ac_cv_iconv_omits_bom=yes])
  784. LIBS="$old_LIBS"
  785. ])
  786. if test "x$ac_cv_iconv_omits_bom" = xyes; then
  787. ICONV_OMITS_BOM=Yes
  788. else
  789. ICONV_OMITS_BOM=
  790. fi
  791. GIT_CONF_SUBST([ICONV_OMITS_BOM])
  792. fi
  793. ## Checks for typedefs, structures, and compiler characteristics.
  794. AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
  795. #
  796. TYPE_SOCKLEN_T
  797. case $ac_cv_type_socklen_t in
  798. yes) SOCKLEN_T='';;
  799. *) SOCKLEN_T=$git_cv_socklen_t_equiv;;
  800. esac
  801. GIT_CONF_SUBST([SOCKLEN_T])
  802. #
  803. # Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval.
  804. AC_CHECK_TYPES([struct itimerval],
  805. [NO_STRUCT_ITIMERVAL=],
  806. [NO_STRUCT_ITIMERVAL=UnfortunatelyYes],
  807. [#include <sys/time.h>])
  808. GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL])
  809. #
  810. # Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exists.
  811. # Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor
  812. # stat.st_mtimespec.tv_nsec exists.
  813. AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec])
  814. AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec])
  815. if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes; then
  816. USE_ST_TIMESPEC=YesPlease
  817. GIT_CONF_SUBST([USE_ST_TIMESPEC])
  818. elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes; then
  819. NO_NSEC=YesPlease
  820. GIT_CONF_SUBST([NO_NSEC])
  821. fi
  822. #
  823. # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
  824. # d_type in struct dirent (latest Cygwin -- will be fixed soonish).
  825. AC_CHECK_MEMBER(struct dirent.d_type,
  826. [NO_D_TYPE_IN_DIRENT=],
  827. [NO_D_TYPE_IN_DIRENT=YesPlease],
  828. [#include <dirent.h>])
  829. GIT_CONF_SUBST([NO_D_TYPE_IN_DIRENT])
  830. #
  831. # Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
  832. # in the C library.
  833. AC_CHECK_MEMBER(struct passwd.pw_gecos,
  834. [NO_GECOS_IN_PWENT=],
  835. [NO_GECOS_IN_PWENT=YesPlease],
  836. [#include <pwd.h>])
  837. GIT_CONF_SUBST([NO_GECOS_IN_PWENT])
  838. #
  839. # Define NO_SOCKADDR_STORAGE if your platform does not have struct
  840. # sockaddr_storage.
  841. AC_CHECK_TYPE(struct sockaddr_storage,
  842. [NO_SOCKADDR_STORAGE=],
  843. [NO_SOCKADDR_STORAGE=YesPlease],[
  844. #include <sys/types.h>
  845. #include <sys/socket.h>
  846. ])
  847. GIT_CONF_SUBST([NO_SOCKADDR_STORAGE])
  848. #
  849. # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
  850. AC_CHECK_TYPE([struct addrinfo],[
  851. GIT_CHECK_FUNC([getaddrinfo],
  852. [NO_IPV6=],
  853. [NO_IPV6=YesPlease])
  854. ],[NO_IPV6=YesPlease],[
  855. #include <sys/types.h>
  856. #include <sys/socket.h>
  857. #include <netdb.h>
  858. ])
  859. GIT_CONF_SUBST([NO_IPV6])
  860. #
  861. # Define NO_REGEX if your C library lacks regex support with REG_STARTEND
  862. # feature.
  863. AC_CACHE_CHECK([whether the platform regex supports REG_STARTEND],
  864. [ac_cv_c_regex_with_reg_startend], [
  865. AC_EGREP_CPP(yippeeyeswehaveit,
  866. AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
  867. #include <regex.h>
  868. ],
  869. [#ifdef REG_STARTEND
  870. yippeeyeswehaveit
  871. #endif
  872. ]),
  873. [ac_cv_c_regex_with_reg_startend=yes],
  874. [ac_cv_c_regex_with_reg_startend=no])
  875. ])
  876. if test $ac_cv_c_regex_with_reg_startend = yes; then
  877. NO_REGEX=
  878. else
  879. NO_REGEX=YesPlease
  880. fi
  881. GIT_CONF_SUBST([NO_REGEX])
  882. #
  883. # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds
  884. # when attempting to read from an fopen'ed directory.
  885. AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],
  886. [ac_cv_fread_reads_directories],
  887. [
  888. AC_RUN_IFELSE(
  889. [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  890. [[
  891. FILE *f = fopen(".", "r");
  892. return f != NULL;]])],
  893. [ac_cv_fread_reads_directories=no],
  894. [ac_cv_fread_reads_directories=yes])
  895. ])
  896. if test $ac_cv_fread_reads_directories = yes; then
  897. FREAD_READS_DIRECTORIES=UnfortunatelyYes
  898. else
  899. FREAD_READS_DIRECTORIES=
  900. fi
  901. GIT_CONF_SUBST([FREAD_READS_DIRECTORIES])
  902. #
  903. # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
  904. # or vsnprintf() return -1 instead of number of characters which would
  905. # have been written to the final string if enough space had been available.
  906. AC_CACHE_CHECK([whether snprintf() and/or vsnprintf() return bogus value],
  907. [ac_cv_snprintf_returns_bogus],
  908. [
  909. AC_RUN_IFELSE(
  910. [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
  911. #include "stdarg.h"
  912. int test_vsnprintf(char *str, size_t maxsize, const char *format, ...)
  913. {
  914. int ret;
  915. va_list ap;
  916. va_start(ap, format);
  917. ret = vsnprintf(str, maxsize, format, ap);
  918. va_end(ap);
  919. return ret;
  920. }],
  921. [[char buf[6];
  922. if (test_vsnprintf(buf, 3, "%s", "12345") != 5
  923. || strcmp(buf, "12")) return 1;
  924. if (snprintf(buf, 3, "%s", "12345") != 5
  925. || strcmp(buf, "12")) return 1]])],
  926. [ac_cv_snprintf_returns_bogus=no],
  927. [ac_cv_snprintf_returns_bogus=yes])
  928. ])
  929. if test $ac_cv_snprintf_returns_bogus = yes; then
  930. SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes
  931. else
  932. SNPRINTF_RETURNS_BOGUS=
  933. fi
  934. GIT_CONF_SUBST([SNPRINTF_RETURNS_BOGUS])
  935. #
  936. # Define NEEDS_MODE_TRANSLATION if your OS strays from the typical file type
  937. # bits in mode values.
  938. AC_CACHE_CHECK([whether the platform uses typical file type bits],
  939. [ac_cv_sane_mode_bits], [
  940. AC_EGREP_CPP(yippeeyeswehaveit,
  941. AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
  942. [#if S_IFMT == 0170000 && \
  943. S_IFREG == 0100000 && S_IFDIR == 0040000 && S_IFLNK == 0120000 && \
  944. S_IFBLK == 0060000 && S_IFCHR == 0020000 && \
  945. S_IFIFO == 0010000 && S_IFSOCK == 0140000
  946. yippeeyeswehaveit
  947. #endif
  948. ]),
  949. [ac_cv_sane_mode_bits=yes],
  950. [ac_cv_sane_mode_bits=no])
  951. ])
  952. if test $ac_cv_sane_mode_bits = yes; then
  953. NEEDS_MODE_TRANSLATION=
  954. else
  955. NEEDS_MODE_TRANSLATION=UnfortunatelyYes
  956. fi
  957. GIT_CONF_SUBST([NEEDS_MODE_TRANSLATION])
  958. ## Checks for library functions.
  959. ## (in default C library and libraries checked by AC_CHECK_LIB)
  960. AC_MSG_NOTICE([CHECKS for library functions])
  961. #
  962. # Define NO_LIBGEN_H if you don't have libgen.h.
  963. AC_CHECK_HEADER([libgen.h],
  964. [NO_LIBGEN_H=],
  965. [NO_LIBGEN_H=YesPlease])
  966. GIT_CONF_SUBST([NO_LIBGEN_H])
  967. #
  968. # Define HAVE_PATHS_H if you have paths.h.
  969. AC_CHECK_HEADER([paths.h],
  970. [HAVE_PATHS_H=YesPlease],
  971. [HAVE_PATHS_H=])
  972. GIT_CONF_SUBST([HAVE_PATHS_H])
  973. #
  974. # Define HAVE_LIBCHARSET_H if have libcharset.h
  975. AC_CHECK_HEADER([libcharset.h],
  976. [HAVE_LIBCHARSET_H=YesPlease],
  977. [HAVE_LIBCHARSET_H=])
  978. GIT_CONF_SUBST([HAVE_LIBCHARSET_H])
  979. #
  980. # Define HAVE_STRINGS_H if you have strings.h
  981. AC_CHECK_HEADER([strings.h],
  982. [HAVE_STRINGS_H=YesPlease],
  983. [HAVE_STRINGS_H=])
  984. GIT_CONF_SUBST([HAVE_STRINGS_H])
  985. # Define CHARSET_LIB if libiconv does not export the locale_charset symbol
  986. # and libcharset does
  987. CHARSET_LIB=
  988. AC_CHECK_LIB([iconv], [locale_charset],
  989. [CHARSET_LIB=-liconv],
  990. [AC_CHECK_LIB([charset], [locale_charset],
  991. [CHARSET_LIB=-lcharset])])
  992. GIT_CONF_SUBST([CHARSET_LIB])
  993. #
  994. # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
  995. GIT_CHECK_FUNC(clock_gettime,
  996. [HAVE_CLOCK_GETTIME=YesPlease],
  997. [HAVE_CLOCK_GETTIME=])
  998. GIT_CONF_SUBST([HAVE_CLOCK_GETTIME])
  999. AC_DEFUN([CLOCK_MONOTONIC_SRC], [
  1000. AC_LANG_PROGRAM([[
  1001. #include <time.h>
  1002. clockid_t id = CLOCK_MONOTONIC;
  1003. ]])])
  1004. #
  1005. # Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available.
  1006. AC_MSG_CHECKING([for CLOCK_MONOTONIC])
  1007. AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC],
  1008. [AC_MSG_RESULT([yes])
  1009. HAVE_CLOCK_MONOTONIC=YesPlease],
  1010. [AC_MSG_RESULT([no])
  1011. HAVE_CLOCK_MONOTONIC=])
  1012. GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC])
  1013. #
  1014. # Define NO_SETITIMER if you don't have setitimer.
  1015. GIT_CHECK_FUNC(setitimer,
  1016. [NO_SETITIMER=],
  1017. [NO_SETITIMER=YesPlease])
  1018. GIT_CONF_SUBST([NO_SETITIMER])
  1019. #
  1020. # Define NO_STRCASESTR if you don't have strcasestr.
  1021. GIT_CHECK_FUNC(strcasestr,
  1022. [NO_STRCASESTR=],
  1023. [NO_STRCASESTR=YesPlease])
  1024. GIT_CONF_SUBST([NO_STRCASESTR])
  1025. #
  1026. # Define NO_MEMMEM if you don't have memmem.
  1027. GIT_CHECK_FUNC(memmem,
  1028. [NO_MEMMEM=],
  1029. [NO_MEMMEM=YesPlease])
  1030. GIT_CONF_SUBST([NO_MEMMEM])
  1031. #
  1032. # Define NO_STRLCPY if you don't have strlcpy.
  1033. GIT_CHECK_FUNC(strlcpy,
  1034. [NO_STRLCPY=],
  1035. [NO_STRLCPY=YesPlease])
  1036. GIT_CONF_SUBST([NO_STRLCPY])
  1037. #
  1038. # Define NO_UINTMAX_T if your platform does not have uintmax_t
  1039. AC_CHECK_TYPE(uintmax_t,
  1040. [NO_UINTMAX_T=],
  1041. [NO_UINTMAX_T=YesPlease],[
  1042. #include <inttypes.h>
  1043. ])
  1044. GIT_CONF_SUBST([NO_UINTMAX_T])
  1045. #
  1046. # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
  1047. GIT_CHECK_FUNC(strtoumax,
  1048. [NO_STRTOUMAX=],
  1049. [NO_STRTOUMAX=YesPlease])
  1050. GIT_CONF_SUBST([NO_STRTOUMAX])
  1051. #
  1052. # Define NO_SETENV if you don't have setenv in the C library.
  1053. GIT_CHECK_FUNC(setenv,
  1054. [NO_SETENV=],
  1055. [NO_SETENV=YesPlease])
  1056. GIT_CONF_SUBST([NO_SETENV])
  1057. #
  1058. # Define NO_UNSETENV if you don't have unsetenv in the C library.
  1059. GIT_CHECK_FUNC(unsetenv,
  1060. [NO_UNSETENV=],
  1061. [NO_UNSETENV=YesPlease])
  1062. GIT_CONF_SUBST([NO_UNSETENV])
  1063. #
  1064. # Define NO_MKDTEMP if you don't have mkdtemp in the C library.
  1065. GIT_CHECK_FUNC(mkdtemp,
  1066. [NO_MKDTEMP=],
  1067. [NO_MKDTEMP=YesPlease])
  1068. GIT_CONF_SUBST([NO_MKDTEMP])
  1069. #
  1070. # Define NO_INITGROUPS if you don't have initgroups in the C library.
  1071. GIT_CHECK_FUNC(initgroups,
  1072. [NO_INITGROUPS=],
  1073. [NO_INITGROUPS=YesPlease])
  1074. GIT_CONF_SUBST([NO_INITGROUPS])
  1075. #
  1076. # Define HAVE_GETDELIM if you have getdelim in the C library.
  1077. GIT_CHECK_FUNC(getdelim,
  1078. [HAVE_GETDELIM=YesPlease],
  1079. [HAVE_GETDELIM=])
  1080. GIT_CONF_SUBST([HAVE_GETDELIM])
  1081. #
  1082. #
  1083. # Define NO_MMAP if you want to avoid mmap.
  1084. #
  1085. # Define NO_ICONV if your libc does not properly support iconv.
  1086. AC_DEFUN([BSD_SYSCTL_SRC], [
  1087. AC_LANG_PROGRAM([[
  1088. #include <stddef.h>
  1089. #include <sys/types.h>
  1090. #include <sys/sysctl.h>
  1091. ]],[[
  1092. int val, mib[2];
  1093. size_t len;
  1094. mib[0] = CTL_HW;
  1095. mib[1] = 1;
  1096. len = sizeof(val);
  1097. return sysctl(mib, 2, &val, &len, NULL, 0) ? 1 : 0;
  1098. ]])])
  1099. #
  1100. # Define HAVE_BSD_SYSCTL=YesPlease if a BSD-compatible sysctl function is available.
  1101. AC_MSG_CHECKING([for BSD sysctl])
  1102. AC_COMPILE_IFELSE([BSD_SYSCTL_SRC],
  1103. [AC_MSG_RESULT([yes])
  1104. HAVE_BSD_SYSCTL=YesPlease],
  1105. [AC_MSG_RESULT([no])
  1106. HAVE_BSD_SYSCTL=])
  1107. GIT_CONF_SUBST([HAVE_BSD_SYSCTL])
  1108. ## Other checks.
  1109. # Define USE_PIC if you need the main git objects to be built with -fPIC
  1110. # in order to build and link perl/Git.so. x86-64 seems to need this.
  1111. #
  1112. # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
  1113. # Enable it on Windows. By default, symrefs are still used.
  1114. #
  1115. # Define NO_PTHREADS if we do not have pthreads.
  1116. #
  1117. # Define PTHREAD_LIBS to the linker flag used for Pthread support.
  1118. AC_DEFUN([PTHREADTEST_SRC], [
  1119. AC_LANG_PROGRAM([[
  1120. #include <pthread.h>
  1121. static void *noop(void *ignore) { return ignore; }
  1122. ]], [[
  1123. pthread_mutex_t test_mutex;
  1124. pthread_key_t test_key;
  1125. pthread_t th;
  1126. int retcode = 0;
  1127. void *ret = (void *)0;
  1128. retcode |= pthread_key_create(&test_key, (void *)0);
  1129. retcode |= pthread_mutex_init(&test_mutex,(void *)0);
  1130. retcode |= pthread_mutex_lock(&test_mutex);
  1131. retcode |= pthread_mutex_unlock(&test_mutex);
  1132. retcode |= pthread_create(&th, ret, noop, ret);
  1133. retcode |= pthread_join(th, &ret);
  1134. return retcode;
  1135. ]])])
  1136. dnl AC_LANG_CONFTEST([AC_LANG_PROGRAM(
  1137. dnl [[#include <pthread.h>]],
  1138. dnl [[pthread_mutex_t test_mutex;]]
  1139. dnl )])
  1140. NO_PTHREADS=UnfortunatelyYes
  1141. PTHREAD_LIBS=
  1142. if test -n "$USER_NOPTHREAD"; then
  1143. AC_MSG_NOTICE([Skipping POSIX Threads at user request.])
  1144. # handle these separately since PTHREAD_CFLAGS could be '-lpthreads
  1145. # -D_REENTRANT' or some such.
  1146. elif test -z "$PTHREAD_CFLAGS"; then
  1147. threads_found=no
  1148. # Attempt to compile and link some code using pthreads to determine
  1149. # required linker flags. The order is somewhat important here: We
  1150. # first try it without any extra flags, to catch systems where
  1151. # pthreads are part of the C library, then go on testing various other
  1152. # flags. We do so to avoid false positives. For example, on Mac OS X
  1153. # pthreads are part of the C library; moreover, the compiler allows us
  1154. # to add "-mt" to the CFLAGS (although it will do nothing except
  1155. # trigger a warning about an unused flag). Hence if we checked for
  1156. # "-mt" before "" we would end up picking it. But unfortunately this
  1157. # would then trigger compiler warnings on every single file we compile.
  1158. for opt in "" -mt -pthread -lpthread; do
  1159. old_CFLAGS="$CFLAGS"
  1160. old_LIBS="$LIBS"
  1161. case "$opt" in
  1162. -l*) LIBS="$opt $LIBS" ;;
  1163. *) CFLAGS="$opt $CFLAGS" ;;
  1164. esac
  1165. AC_MSG_CHECKING([for POSIX Threads with '$opt'])
  1166. AC_LINK_IFELSE([PTHREADTEST_SRC],
  1167. [AC_MSG_RESULT([yes])
  1168. NO_PTHREADS=
  1169. PTHREAD_LIBS="$opt"
  1170. PTHREAD_CFLAGS="$opt"
  1171. threads_found=yes
  1172. break
  1173. ],
  1174. [AC_MSG_RESULT([no])])
  1175. CFLAGS="$old_CFLAGS"
  1176. LIBS="$old_LIBS"
  1177. done
  1178. if test $threads_found != yes; then
  1179. AC_CHECK_LIB([pthread], [pthread_create],
  1180. [PTHREAD_LIBS="-lpthread"],
  1181. [NO_PTHREADS=UnfortunatelyYes])
  1182. fi
  1183. else
  1184. old_CFLAGS="$CFLAGS"
  1185. CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
  1186. AC_MSG_CHECKING([for POSIX Threads with '$PTHREAD_CFLAGS'])
  1187. AC_LINK_IFELSE([PTHREADTEST_SRC],
  1188. [AC_MSG_RESULT([yes])
  1189. NO_PTHREADS=
  1190. PTHREAD_LIBS="$PTHREAD_CFLAGS"
  1191. ],
  1192. [AC_MSG_RESULT([no])])
  1193. CFLAGS="$old_CFLAGS"
  1194. fi
  1195. CFLAGS="$old_CFLAGS"
  1196. GIT_CONF_SUBST([PTHREAD_CFLAGS])
  1197. GIT_CONF_SUBST([PTHREAD_LIBS])
  1198. GIT_CONF_SUBST([NO_PTHREADS])
  1199. ## Output files
  1200. AC_CONFIG_FILES(["${config_file}":"${config_in}"])
  1201. AC_OUTPUT