configure.ac 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. # $Id$
  22. ###########################################################################
  23. dnl Process this file with autoconf to produce a configure script.
  24. AC_PREREQ(2.57)
  25. dnl We don't know the version number "staticly" so we use a dash here
  26. AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
  27. dnl configure script copyright
  28. AC_COPYRIGHT([Copyright (c) 1998 - 2006 Daniel Stenberg, <daniel@haxx.se>
  29. This configure script may be copied, distributed and modified under the
  30. terms of the curl license; see COPYING for more details])
  31. AC_CONFIG_SRCDIR([lib/urldata.h])
  32. AM_CONFIG_HEADER(lib/config.h src/config.h)
  33. AM_MAINTAINER_MODE
  34. dnl SED is needed by some of the tools
  35. AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
  36. $PATH:/usr/bin:/usr/local/bin)
  37. AC_SUBST(SED)
  38. if test "x$SED" = "xsed-was-not-found-by-configure"; then
  39. AC_MSG_WARN([sed was not found, this may ruin your chances to build fine])
  40. fi
  41. dnl AR is used by libtool, and try the odd Solaris path too
  42. dnl we use AC_CHECK_TOOL since this should make a library for the target
  43. dnl platform
  44. AC_CHECK_TOOL(AR, ar,
  45. ar-was-not-found-by-configure,
  46. $PATH:/usr/bin:/usr/local/bin:/usr/ccs/bin)
  47. AC_SUBST(AR)
  48. if test "x$AR" = "xar-was-not-found-by-configure"; then
  49. AC_MSG_WARN([ar was not found, this may ruin your chances to build fine])
  50. fi
  51. dnl figure out the libcurl version
  52. VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
  53. AM_INIT_AUTOMAKE(curl,$VERSION)
  54. AC_MSG_CHECKING([curl version])
  55. AC_MSG_RESULT($VERSION)
  56. dnl
  57. dnl we extract the numerical version for curl-config only
  58. VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
  59. AC_SUBST(VERSIONNUM)
  60. dnl Solaris pkgadd support definitions
  61. PKGADD_PKG="HAXXcurl"
  62. PKGADD_NAME="cURL - a client that groks URLs"
  63. PKGADD_VENDOR="curl.haxx.se"
  64. AC_SUBST(PKGADD_PKG)
  65. AC_SUBST(PKGADD_NAME)
  66. AC_SUBST(PKGADD_VENDOR)
  67. dnl
  68. dnl initialize all the info variables
  69. curl_ssl_msg="no (--with-ssl / --with-gnutls)"
  70. curl_ssh_msg="no (--with-libssh2)"
  71. curl_zlib_msg="no (--with-zlib)"
  72. curl_krb4_msg="no (--with-krb4*)"
  73. curl_gss_msg="no (--with-gssapi)"
  74. curl_spnego_msg="no (--with-spnego)"
  75. curl_ares_msg="no (--enable-ares)"
  76. curl_ipv6_msg="no (--enable-ipv6)"
  77. curl_idn_msg="no (--with-libidn)"
  78. curl_manual_msg="no (--enable-manual)"
  79. curl_verbose_msg="enabled (--disable-verbose)"
  80. curl_sspi_msg="no (--enable-sspi)"
  81. dnl
  82. dnl Detect the canonical host and target build environment
  83. dnl
  84. AC_CANONICAL_HOST
  85. dnl Get system canonical name
  86. AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
  87. dnl Check for AIX weirdos
  88. AC_AIX
  89. dnl Checks for programs.
  90. AC_PROG_CC
  91. dnl check for how to do large files
  92. AC_SYS_LARGEFILE
  93. dnl check for cygwin stuff
  94. AC_LIBTOOL_WIN32_DLL
  95. dnl libtool setup
  96. AC_PROG_LIBTOOL
  97. AC_MSG_CHECKING([if we need -no-undefined])
  98. case $host in
  99. *-*-cygwin | *-*-mingw* | *-*-pw32*)
  100. need_no_undefined=yes
  101. ;;
  102. *)
  103. need_no_undefined=no
  104. ;;
  105. esac
  106. AC_MSG_RESULT($need_no_undefined)
  107. AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
  108. AC_MSG_CHECKING([if we need -mimpure-text])
  109. mimpure=no
  110. case $host in
  111. *-*-solaris2*)
  112. if test "$GCC" = "yes"; then
  113. mimpure="yes"
  114. fi
  115. ;;
  116. *)
  117. ;;
  118. esac
  119. AC_MSG_RESULT($mimpure)
  120. AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
  121. AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
  122. case $host in
  123. *-*-mingw*)
  124. AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
  125. AC_MSG_RESULT(yes)
  126. AC_MSG_CHECKING([if we need CURL_STATICLIB])
  127. if test "X$enable_shared" = "Xno"
  128. then
  129. AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
  130. AC_MSG_RESULT(yes)
  131. else
  132. AC_MSG_RESULT(no)
  133. fi
  134. ;;
  135. *)
  136. AC_MSG_RESULT(no)
  137. ;;
  138. esac
  139. dnl The install stuff has already been taken care of by the automake stuff
  140. dnl AC_PROG_INSTALL
  141. AC_PROG_MAKE_SET
  142. dnl **********************************************************************
  143. dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
  144. dnl and ws2tcpip.h take precedence over any other further checks which
  145. dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
  146. dnl this specific header files. And do them before its results are used.
  147. dnl **********************************************************************
  148. CURL_CHECK_HEADER_WINDOWS
  149. CURL_CHECK_HEADER_WINSOCK
  150. CURL_CHECK_HEADER_WINSOCK2
  151. CURL_CHECK_HEADER_WS2TCPIP
  152. dnl ************************************************************
  153. dnl switch off particular protocols
  154. dnl
  155. AC_MSG_CHECKING([whether to support http])
  156. AC_ARG_ENABLE(http,
  157. AC_HELP_STRING([--enable-http],[Enable HTTP support])
  158. AC_HELP_STRING([--disable-http],[Disable HTTP support]),
  159. [ case "$enableval" in
  160. no)
  161. AC_MSG_RESULT(no)
  162. AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
  163. AC_MSG_WARN([disable HTTP disables FTP over proxy])
  164. AC_SUBST(CURL_DISABLE_HTTP, [1])
  165. ;;
  166. *) AC_MSG_RESULT(yes)
  167. ;;
  168. esac ],
  169. AC_MSG_RESULT(yes)
  170. )
  171. AC_MSG_CHECKING([whether to support ftp])
  172. AC_ARG_ENABLE(ftp,
  173. AC_HELP_STRING([--enable-ftp],[Enable FTP support])
  174. AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
  175. [ case "$enableval" in
  176. no)
  177. AC_MSG_RESULT(no)
  178. AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
  179. AC_SUBST(CURL_DISABLE_FTP, [1])
  180. ;;
  181. *) AC_MSG_RESULT(yes)
  182. ;;
  183. esac ],
  184. AC_MSG_RESULT(yes)
  185. )
  186. AC_MSG_CHECKING([whether to support file])
  187. AC_ARG_ENABLE(file,
  188. AC_HELP_STRING([--enable-file],[Enable FILE support])
  189. AC_HELP_STRING([--disable-file],[Disable FILE support]),
  190. [ case "$enableval" in
  191. no)
  192. AC_MSG_RESULT(no)
  193. AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
  194. AC_SUBST(CURL_DISABLE_FILE, [1])
  195. ;;
  196. *) AC_MSG_RESULT(yes)
  197. ;;
  198. esac ],
  199. AC_MSG_RESULT(yes)
  200. )
  201. AC_MSG_CHECKING([whether to support ldap])
  202. AC_ARG_ENABLE(ldap,
  203. AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
  204. AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
  205. [ case "$enableval" in
  206. no)
  207. AC_MSG_RESULT(no)
  208. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  209. AC_SUBST(CURL_DISABLE_LDAP, [1])
  210. ;;
  211. *) AC_MSG_RESULT(yes)
  212. ;;
  213. esac ],
  214. AC_MSG_RESULT(yes)
  215. )
  216. AC_MSG_CHECKING([whether to support dict])
  217. AC_ARG_ENABLE(dict,
  218. AC_HELP_STRING([--enable-dict],[Enable DICT support])
  219. AC_HELP_STRING([--disable-dict],[Disable DICT support]),
  220. [ case "$enableval" in
  221. no)
  222. AC_MSG_RESULT(no)
  223. AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
  224. AC_SUBST(CURL_DISABLE_DICT, [1])
  225. ;;
  226. *) AC_MSG_RESULT(yes)
  227. ;;
  228. esac ],
  229. AC_MSG_RESULT(yes)
  230. )
  231. AC_MSG_CHECKING([whether to support telnet])
  232. AC_ARG_ENABLE(telnet,
  233. AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
  234. AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
  235. [ case "$enableval" in
  236. no)
  237. AC_MSG_RESULT(no)
  238. AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
  239. AC_SUBST(CURL_DISABLE_TELNET, [1])
  240. ;;
  241. *) AC_MSG_RESULT(yes)
  242. ;;
  243. esac ],
  244. AC_MSG_RESULT(yes)
  245. )
  246. AC_MSG_CHECKING([whether to support tftp])
  247. AC_ARG_ENABLE(tftp,
  248. AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
  249. AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
  250. [ case "$enableval" in
  251. no)
  252. AC_MSG_RESULT(no)
  253. AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
  254. AC_SUBST(CURL_DISABLE_TFTP, [1])
  255. ;;
  256. *) AC_MSG_RESULT(yes)
  257. ;;
  258. esac ],
  259. AC_MSG_RESULT(yes)
  260. )
  261. dnl **********************************************************************
  262. dnl Check for built-in manual
  263. dnl **********************************************************************
  264. AC_MSG_CHECKING([whether to provide built-in manual])
  265. AC_ARG_ENABLE(manual,
  266. AC_HELP_STRING([--enable-manual],[Enable built-in manual])
  267. AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
  268. [ case "$enableval" in
  269. no)
  270. AC_MSG_RESULT(no)
  271. ;;
  272. *) AC_MSG_RESULT(yes)
  273. USE_MANUAL="1"
  274. ;;
  275. esac ],
  276. AC_MSG_RESULT(yes)
  277. USE_MANUAL="1"
  278. )
  279. dnl The actual use of the USE_MANUAL variable is done much later in this
  280. dnl script to allow other actions to disable it as well.
  281. dnl **********************************************************************
  282. dnl check if this is the Intel ICC compiler, and if so make it stricter
  283. dnl (convert warning 147 into an error) so that it properly can detect the
  284. dnl gethostbyname_r() version
  285. dnl **********************************************************************
  286. CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
  287. dnl **********************************************************************
  288. dnl Checks for libraries.
  289. dnl **********************************************************************
  290. dnl gethostbyname without lib or in the nsl lib?
  291. AC_CHECK_FUNC(gethostbyname,
  292. [HAVE_GETHOSTBYNAME="1"
  293. ],
  294. [ AC_CHECK_LIB(nsl, gethostbyname,
  295. [HAVE_GETHOSTBYNAME="1"
  296. LIBS="$LIBS -lnsl"
  297. ])
  298. ])
  299. if test "$HAVE_GETHOSTBYNAME" != "1"
  300. then
  301. dnl gethostbyname in the socket lib?
  302. AC_CHECK_LIB(socket, gethostbyname,
  303. [HAVE_GETHOSTBYNAME="1"
  304. LIBS="$LIBS -lsocket"
  305. ])
  306. fi
  307. dnl At least one system has been identified to require BOTH nsl and socket
  308. dnl libs at the same time to link properly.
  309. if test "$HAVE_GETHOSTBYNAME" != "1"
  310. then
  311. AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
  312. my_ac_save_LIBS=$LIBS
  313. LIBS="-lnsl -lsocket $LIBS"
  314. AC_TRY_LINK( ,
  315. [gethostbyname();],
  316. [ dnl found it!
  317. HAVE_GETHOSTBYNAME="1"
  318. AC_MSG_RESULT([yes])],
  319. [ dnl failed!
  320. AC_MSG_RESULT([no])
  321. dnl restore LIBS
  322. LIBS=$my_ac_save_LIBS]
  323. )
  324. fi
  325. if test "$HAVE_GETHOSTBYNAME" != "1"
  326. then
  327. dnl This is for Msys/Mingw
  328. AC_MSG_CHECKING([for gethostbyname in ws2_32])
  329. my_ac_save_LIBS=$LIBS
  330. LIBS="-lws2_32 $LIBS"
  331. AC_TRY_LINK([#include <winsock2.h>],
  332. [gethostbyname("www.dummysite.com");],
  333. [ dnl worked!
  334. ws2="yes"
  335. AC_MSG_RESULT([yes])
  336. HAVE_GETHOSTBYNAME="1"],
  337. [ dnl failed, restore LIBS
  338. LIBS=$my_ac_save_LIBS
  339. AC_MSG_RESULT(no)]
  340. )
  341. fi
  342. if test "$HAVE_GETHOSTBYNAME" != "1"
  343. then
  344. dnl This is for eCos with a stubbed DNS implementation
  345. AC_MSG_CHECKING([for gethostbyname for eCos])
  346. AC_TRY_LINK([
  347. #include <stdio.h>
  348. #include <netdb.h>],
  349. [gethostbyname("www.dummysite.com");],
  350. [ dnl worked!
  351. AC_MSG_RESULT([yes])
  352. HAVE_GETHOSTBYNAME="1"],
  353. AC_MSG_RESULT(no)
  354. )
  355. fi
  356. if test "$HAVE_GETHOSTBYNAME" != "1"
  357. then
  358. dnl gethostbyname in the net lib - for BeOS
  359. AC_CHECK_LIB(net, gethostbyname,
  360. [HAVE_GETHOSTBYNAME="1"
  361. LIBS="$LIBS -lnet"
  362. ])
  363. fi
  364. if test "$HAVE_GETHOSTBYNAME" = "1"; then
  365. AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
  366. else
  367. AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
  368. fi
  369. dnl resolve lib?
  370. AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
  371. if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
  372. AC_CHECK_LIB(resolve, strcasecmp,
  373. [LIBS="-lresolve $LIBS"],
  374. ,
  375. -lnsl)
  376. fi
  377. dnl socket lib?
  378. AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
  379. dnl dl lib?
  380. AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
  381. AC_MSG_CHECKING([whether to use libgcc])
  382. AC_ARG_ENABLE(libgcc,
  383. AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
  384. [ case "$enableval" in
  385. yes)
  386. LIBS="$LIBS -lgcc"
  387. AC_MSG_RESULT(yes)
  388. ;;
  389. *) AC_MSG_RESULT(no)
  390. ;;
  391. esac ],
  392. AC_MSG_RESULT(no)
  393. )
  394. dnl **********************************************************************
  395. dnl Check for the name of dynamic OpenLDAP libraries
  396. dnl **********************************************************************
  397. LDAPLIBNAME=""
  398. AC_ARG_WITH(ldap-lib,
  399. AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of dynamic ldap lib file]),
  400. [LDAPLIBNAME="$withval"])
  401. LBERLIBNAME=""
  402. AC_ARG_WITH(lber-lib,
  403. AC_HELP_STRING([--with-lber-lib=libname],[Specify name of dynamic lber lib file]),
  404. [LBERLIBNAME="$withval"])
  405. if test x$CURL_DISABLE_LDAP != x1 ; then
  406. if test -z "$LDAPLIBNAME" ; then
  407. case $host in
  408. *-*-cygwin | *-*-mingw* | *-*-pw32*)
  409. dnl Windows uses a single and unique OpenLDAP DLL name
  410. LDAPLIBNAME="wldap32.dll"
  411. LBERLIBNAME="no"
  412. ;;
  413. esac
  414. fi
  415. if test "$LDAPLIBNAME" ; then
  416. AC_DEFINE_UNQUOTED(DL_LDAP_FILE, "$LDAPLIBNAME")
  417. AC_MSG_CHECKING([name of dynamic library ldap])
  418. AC_MSG_RESULT($LDAPLIBNAME)
  419. else
  420. dnl Try to find the right ldap library name for this system
  421. CURL_DLLIB_NAME(DL_LDAP_FILE, ldap)
  422. fi
  423. if test "$LBERLIBNAME" ; then
  424. dnl If name is "no" then don't define this variable at all
  425. dnl (it's only needed if libldap.so's dependencies are broken).
  426. if test "$LBERLIBNAME" != "no" ; then
  427. AC_DEFINE_UNQUOTED(DL_LBER_FILE, "$LBERLIBNAME")
  428. fi
  429. AC_MSG_CHECKING([name of dynamic library lber])
  430. AC_MSG_RESULT($LBERLIBNAME)
  431. else
  432. dnl Try to find the right lber library name for this system
  433. CURL_DLLIB_NAME(DL_LBER_FILE, lber)
  434. fi
  435. fi
  436. dnl **********************************************************************
  437. dnl Check for the presence of the winmm library.
  438. dnl **********************************************************************
  439. case $host in
  440. *-*-cygwin*)
  441. dnl Under Cygwin, winmm exists but is not needed as WIN32 is not #defined
  442. dnl and gettimeofday() will be used regardless of the outcome of this test.
  443. dnl Skip this test, otherwise -lwinmm will be needlessly added to LIBS
  444. dnl (and recorded as such in the .la file, potentially affecting downstream
  445. dnl clients of the library.)
  446. ;;
  447. *)
  448. AC_MSG_CHECKING([for timeGetTime in winmm])
  449. my_ac_save_LIBS=$LIBS
  450. LIBS="-lwinmm $LIBS"
  451. AC_TRY_LINK([#include <windef.h>
  452. #include <mmsystem.h>
  453. ],
  454. [timeGetTime();],
  455. [ dnl worked!
  456. AC_MSG_RESULT([yes])
  457. ],
  458. [ dnl failed, restore LIBS
  459. LIBS=$my_ac_save_LIBS
  460. AC_MSG_RESULT(no)]
  461. )
  462. ;;
  463. esac
  464. dnl **********************************************************************
  465. dnl Checks for IPv6
  466. dnl **********************************************************************
  467. AC_MSG_CHECKING([whether to enable ipv6])
  468. AC_ARG_ENABLE(ipv6,
  469. AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
  470. AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
  471. [ case "$enableval" in
  472. no)
  473. AC_MSG_RESULT(no)
  474. ipv6=no
  475. ;;
  476. *) AC_MSG_RESULT(yes)
  477. ipv6=yes
  478. ;;
  479. esac ],
  480. AC_TRY_RUN([ /* is AF_INET6 available? */
  481. #include <sys/types.h>
  482. #include <sys/socket.h>
  483. main()
  484. {
  485. if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
  486. exit(1);
  487. else
  488. exit(0);
  489. }
  490. ],
  491. AC_MSG_RESULT(yes)
  492. ipv6=yes,
  493. AC_MSG_RESULT(no)
  494. ipv6=no,
  495. AC_MSG_RESULT(no)
  496. ipv6=no
  497. ))
  498. if test "$ipv6" = "yes"; then
  499. curl_ipv6_msg="enabled"
  500. fi
  501. dnl **********************************************************************
  502. dnl Check how non-blocking sockets are set
  503. dnl **********************************************************************
  504. AC_ARG_ENABLE(nonblocking,
  505. AC_HELP_STRING([--enable-nonblocking],[Enable detecting how to do it])
  506. AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
  507. [
  508. if test "$enableval" = "no" ; then
  509. AC_MSG_WARN([non-blocking sockets disabled])
  510. AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
  511. [to disable NON-BLOCKING connections])
  512. else
  513. CURL_CHECK_NONBLOCKING_SOCKET
  514. fi
  515. ],
  516. [
  517. CURL_CHECK_NONBLOCKING_SOCKET
  518. ])
  519. dnl **********************************************************************
  520. dnl Check if the operating system allows programs to write to their own argv[]
  521. dnl **********************************************************************
  522. AC_MSG_CHECKING([if argv can be written to])
  523. AC_CACHE_VAL(curl_cv_writable_argv, [
  524. AC_RUN_IFELSE([[
  525. int main(int argc, char ** argv) {
  526. argv[0][0] = ' ';
  527. return (argv[0][0] == ' ')?0:1;
  528. }
  529. ]],
  530. curl_cv_writable_argv=yes,
  531. curl_cv_writable_argv=no,
  532. curl_cv_writable_argv=cross)
  533. ])
  534. case $curl_cv_writable_argv in
  535. yes)
  536. AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
  537. AC_MSG_RESULT(yes)
  538. ;;
  539. no)
  540. AC_MSG_RESULT(no)
  541. ;;
  542. *)
  543. AC_MSG_RESULT(no)
  544. AC_MSG_WARN([the previous check could not be made default was used])
  545. ;;
  546. esac
  547. dnl **********************************************************************
  548. dnl Check for the presence of Kerberos4 libraries and headers
  549. dnl **********************************************************************
  550. AC_ARG_WITH(krb4-includes,
  551. AC_HELP_STRING([--with-krb4-includes=DIR],
  552. [Specify location of kerberos4 headers]),[
  553. CPPFLAGS="$CPPFLAGS -I$withval"
  554. KRB4INC="$withval"
  555. want_krb4=yes
  556. ])
  557. AC_ARG_WITH(krb4-libs,
  558. AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
  559. LDFLAGS="$LDFLAGS -L$withval"
  560. KRB4LIB="$withval"
  561. want_krb4=yes
  562. ])
  563. OPT_KRB4=off
  564. AC_ARG_WITH(krb4,dnl
  565. AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
  566. OPT_KRB4="$withval"
  567. if test X"$OPT_KRB4" != Xno; then
  568. want_krb4="yes"
  569. if test X"$OPT_KRB4" != Xyes; then
  570. LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
  571. KRB4LIB="$OPT_KRB4/lib$libsuff"
  572. CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
  573. KRB4INC="$OPT_KRB4/include"
  574. fi
  575. fi
  576. ])
  577. AC_MSG_CHECKING([if Kerberos4 support is requested])
  578. if test "$want_krb4" = yes
  579. then
  580. if test "$ipv6" = "yes"; then
  581. echo krb4 is not compatible with IPv6
  582. exit 1
  583. fi
  584. AC_MSG_RESULT(yes)
  585. dnl Check for & handle argument to --with-krb4
  586. AC_MSG_CHECKING(where to look for Kerberos4)
  587. if test X"$OPT_KRB4" = Xyes
  588. then
  589. AC_MSG_RESULT([defaults])
  590. else
  591. AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
  592. fi
  593. dnl Check for DES library
  594. AC_CHECK_LIB(des, des_pcbc_encrypt,
  595. [
  596. AC_CHECK_HEADERS(des.h)
  597. dnl resolv lib?
  598. AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
  599. dnl Check for the Kerberos4 library
  600. AC_CHECK_LIB(krb, krb_net_read,
  601. [
  602. dnl Check for header files
  603. AC_CHECK_HEADERS(krb.h)
  604. dnl we found the required libraries, add to LIBS
  605. LIBS="-lkrb -lcom_err -ldes $LIBS"
  606. dnl Check for function krb_get_our_ip_for_realm
  607. dnl this is needed for NAT networks
  608. AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
  609. dnl add define KRB4
  610. AC_DEFINE(HAVE_KRB4, 1,
  611. [if you have the Kerberos4 libraries (including -ldes)])
  612. dnl substitute it too!
  613. KRB4_ENABLED=1
  614. AC_SUBST(KRB4_ENABLED)
  615. curl_krb4_msg="enabled"
  616. dnl the krb4 stuff needs a strlcpy()
  617. AC_CHECK_FUNCS(strlcpy)
  618. ])
  619. ])
  620. else
  621. AC_MSG_RESULT(no)
  622. fi
  623. dnl **********************************************************************
  624. dnl Check for FBopenssl(SPNEGO) libraries
  625. dnl **********************************************************************
  626. AC_ARG_WITH(spnego,
  627. AC_HELP_STRING([--with-spnego=DIR],
  628. [Specify location of SPNEGO library fbopenssl]), [
  629. SPNEGO_ROOT="$withval"
  630. if test x"$SPNEGO_ROOT" != xno; then
  631. want_spnego="yes"
  632. fi
  633. ])
  634. AC_MSG_CHECKING([if SPNEGO support is requested])
  635. if test x"$want_spnego" = xyes; then
  636. if test X"$SPNEGO_ROOT" = Xyes; then
  637. AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
  638. AC_MSG_RESULT(no)
  639. else
  640. if test -z "$SPNEGO_LIB_DIR"; then
  641. LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
  642. else
  643. LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
  644. fi
  645. AC_MSG_RESULT(yes)
  646. AC_DEFINE(HAVE_SPNEGO, 1,
  647. [Define this if you have the SPNEGO library fbopenssl])
  648. curl_spnego_msg="enabled"
  649. fi
  650. else
  651. AC_MSG_RESULT(no)
  652. fi
  653. dnl **********************************************************************
  654. dnl Check for GSS-API libraries
  655. dnl **********************************************************************
  656. AC_ARG_WITH(gssapi-includes,
  657. AC_HELP_STRING([--with-gssapi-includes=DIR],
  658. [Specify location of GSSAPI header]),
  659. [ GSSAPI_INCS="-I$withval"
  660. want_gss="yes" ]
  661. )
  662. AC_ARG_WITH(gssapi-libs,
  663. AC_HELP_STRING([--with-gssapi-libs=DIR],
  664. [Specify location of GSSAPI libs]),
  665. [ GSSAPI_LIB_DIR="-L$withval"
  666. want_gss="yes" ]
  667. )
  668. AC_ARG_WITH(gssapi,
  669. AC_HELP_STRING([--with-gssapi=DIR],
  670. [Where to look for GSSAPI]), [
  671. GSSAPI_ROOT="$withval"
  672. if test x"$GSSAPI_ROOT" != xno; then
  673. want_gss="yes"
  674. fi
  675. ])
  676. save_CPPFLAGS="$CPPFLAGS"
  677. AC_MSG_CHECKING([if GSSAPI support is requested])
  678. if test x"$want_gss" = xyes; then
  679. AC_MSG_RESULT(yes)
  680. if test -z "$GSSAPI_INCS"; then
  681. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  682. GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
  683. elif test "$GSSAPI_ROOT" != "yes"; then
  684. GSSAPI_INCS="-I$GSSAPI_ROOT/include"
  685. fi
  686. fi
  687. CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
  688. AC_CHECK_HEADER(gss.h,
  689. [
  690. dnl found in the given dirs
  691. AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
  692. gnu_gss=yes
  693. ],
  694. [
  695. dnl not found, check Heimdal
  696. AC_CHECK_HEADER(gssapi.h,
  697. [
  698. dnl found in the given dirs
  699. AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
  700. ],
  701. [
  702. dnl not found, check in gssapi/ subdir
  703. AC_CHECK_HEADER(gssapi/gssapi.h,
  704. [
  705. dnl found
  706. AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
  707. ],
  708. [
  709. dnl no header found, disabling GSS
  710. want_gss=no
  711. AC_MSG_WARN(disabling GSSAPI since no header files was found)
  712. ]
  713. )
  714. ]
  715. )
  716. ]
  717. )
  718. else
  719. AC_MSG_RESULT(no)
  720. fi
  721. if test x"$want_gss" = xyes; then
  722. AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
  723. curl_gss_msg="enabled (MIT/Heimdal)"
  724. if test -n "$gnu_gss"; then
  725. curl_gss_msg="enabled (GNU GSS)"
  726. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgss"
  727. elif test -z "$GSSAPI_LIB_DIR"; then
  728. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  729. gss_ldflags=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  730. LDFLAGS="$LDFLAGS $gss_ldflags"
  731. elif test "$GSSAPI_ROOT" != "yes"; then
  732. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff -lgssapi"
  733. else
  734. LDFLAGS="$LDFLAGS -lgssapi"
  735. fi
  736. else
  737. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR -lgssapi"
  738. fi
  739. else
  740. CPPFLAGS="$save_CPPFLAGS"
  741. fi
  742. dnl **********************************************************************
  743. dnl Check for the presence of SSL libraries and headers
  744. dnl **********************************************************************
  745. dnl Default to compiler & linker defaults for SSL files & libraries.
  746. OPT_SSL=off
  747. dnl Default to no CA bundle
  748. ca="no"
  749. AC_ARG_WITH(ssl,dnl
  750. AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  751. AC_HELP_STRING([--without-ssl], [disable SSL]),
  752. OPT_SSL=$withval)
  753. if test X"$OPT_SSL" != Xno; then
  754. dnl backup the pre-ssl variables
  755. CLEANLDFLAGS="$LDFLAGS"
  756. CLEANCPPFLAGS="$CPPFLAGS"
  757. CLEANLIBS="$LIBS"
  758. case "$OPT_SSL" in
  759. yes)
  760. dnl --with-ssl (without path) used
  761. if test x$cross_compiling != xyes; then
  762. dnl only do pkg-config magic when not cross-compiling
  763. PKGTEST="yes"
  764. fi
  765. PREFIX_OPENSSL=/usr/local/ssl
  766. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  767. ;;
  768. off)
  769. dnl no --with-ssl option given, just check default places
  770. if test x$cross_compiling != xyes; then
  771. dnl only do pkg-config magic when not cross-compiling
  772. PKGTEST="yes"
  773. fi
  774. PREFIX_OPENSSL=
  775. ;;
  776. *)
  777. dnl check the given --with-ssl spot
  778. PKGTEST="no"
  779. PREFIX_OPENSSL=$OPT_SSL
  780. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  781. LDFLAGS="$LDFLAGS -L$LIB_OPENSSL"
  782. CPPFLAGS="$CPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  783. ;;
  784. esac
  785. if test "$PKGTEST" = "yes"; then
  786. dnl Detect the pkg-config tool, as it may have extra info about the
  787. dnl openssl installation we can use. I *believe* this is what we are
  788. dnl expected to do on really recent Redhat Linux hosts.
  789. AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
  790. if test "$PKGCONFIG" != "no" ; then
  791. AC_MSG_CHECKING([OpenSSL options with pkg-config])
  792. $PKGCONFIG --exists openssl
  793. SSL_EXISTS=$?
  794. if test "$SSL_EXISTS" -eq "0"; then
  795. SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
  796. SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
  797. SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
  798. LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
  799. dnl use the values pkg-config reported
  800. LIBS="$LIBS $SSL_LIBS"
  801. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  802. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  803. AC_MSG_RESULT([found])
  804. else
  805. AC_MSG_RESULT([no])
  806. fi
  807. fi
  808. fi
  809. dnl This is for Msys/Mingw
  810. case $host in
  811. *-*-cygwin*)
  812. dnl Under Cygwin this is extraneous and causes an unnecessary -lgdi32
  813. dnl to be added to LIBS and recorded in the .la file.
  814. ;;
  815. *)
  816. AC_MSG_CHECKING([for gdi32])
  817. my_ac_save_LIBS=$LIBS
  818. LIBS="-lgdi32 $LIBS"
  819. AC_TRY_LINK([#include <windef.h>
  820. #include <wingdi.h>],
  821. [GdiFlush();],
  822. [ dnl worked!
  823. AC_MSG_RESULT([yes])],
  824. [ dnl failed, restore LIBS
  825. LIBS=$my_ac_save_LIBS
  826. AC_MSG_RESULT(no)]
  827. )
  828. ;;
  829. esac
  830. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  831. HAVECRYPTO="yes"
  832. LIBS="-lcrypto $LIBS"
  833. ],[
  834. LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
  835. CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  836. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  837. HAVECRYPTO="yes"
  838. LIBS="-lcrypto $LIBS"], [
  839. LDFLAGS="$CLEANLDFLAGS"
  840. CPPFLAGS="$CLEANCPPFLAGS"
  841. LIBS="$CLEANLIBS"
  842. ])
  843. ])
  844. if test X"$HAVECRYPTO" = X"yes"; then
  845. dnl This is only reasonable to do if crypto actually is there: check for
  846. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  847. AC_CHECK_LIB(ssl, SSL_connect)
  848. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  849. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  850. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  851. OLIBS=$LIBS
  852. LIBS="$LIBS -lRSAglue -lrsaref"
  853. AC_CHECK_LIB(ssl, SSL_connect)
  854. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  855. dnl still no SSL_connect
  856. AC_MSG_RESULT(no)
  857. LIBS=$OLIBS
  858. else
  859. AC_MSG_RESULT(yes)
  860. fi
  861. else
  862. dnl Have the libraries--check for SSLeay/OpenSSL headers
  863. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  864. openssl/pem.h openssl/ssl.h openssl/err.h,
  865. curl_ssl_msg="enabled (OpenSSL)"
  866. OPENSSL_ENABLED=1
  867. AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
  868. if test $ac_cv_header_openssl_x509_h = no; then
  869. dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
  870. dnl since 'err.h' might in fact find a krb4 header with the same
  871. dnl name
  872. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
  873. if test $ac_cv_header_x509_h = yes &&
  874. test $ac_cv_header_crypto_h = yes &&
  875. test $ac_cv_header_ssl_h = yes; then
  876. dnl three matches
  877. curl_ssl_msg="enabled (OpenSSL)"
  878. OPENSSL_ENABLED=1
  879. fi
  880. fi
  881. fi
  882. if test X"$OPENSSL_ENABLED" = X"1"; then
  883. AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
  884. dnl is there a pkcs12.h header present?
  885. AC_CHECK_HEADERS(openssl/pkcs12.h)
  886. else
  887. LIBS="$CLEANLIBS"
  888. fi
  889. dnl USE_SSLEAY is the historical name for what configure calls
  890. dnl OPENSSL_ENABLED; the names should really be unified
  891. USE_SSLEAY="$OPENSSL_ENABLED"
  892. AC_SUBST(USE_SSLEAY)
  893. if test X"$OPT_SSL" != Xoff &&
  894. test "$OPENSSL_ENABLED" != "1"; then
  895. AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
  896. fi
  897. fi
  898. if test X"$OPENSSL_ENABLED" = X"1"; then
  899. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  900. dnl stuff, it is kind of "separated" from the main SSL check
  901. AC_CHECK_FUNC(ENGINE_init,
  902. [
  903. AC_CHECK_HEADERS(openssl/engine.h)
  904. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  905. ])
  906. dnl these can only exist if openssl exists
  907. AC_CHECK_FUNCS( RAND_status \
  908. RAND_screen \
  909. RAND_egd \
  910. CRYPTO_cleanup_all_ex_data )
  911. fi
  912. if test "$OPENSSL_ENABLED" = "1"; then
  913. if test -n "$LIB_OPENSSL"; then
  914. dnl when the ssl shared libs were found in a path that the run-time
  915. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  916. dnl to prevent further configure tests to fail due to this
  917. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
  918. export LD_LIBRARY_PATH
  919. AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  920. fi
  921. fi
  922. fi
  923. dnl **********************************************************************
  924. dnl Check for the presence of LIBSSH2 libraries and headers
  925. dnl **********************************************************************
  926. dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
  927. OPT_LIBSSH2=off
  928. AC_ARG_WITH(libssh2,dnl
  929. AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation (default: /usr/local/lib); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  930. AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
  931. OPT_LIBSSH2=$withval)
  932. if test X"$OPT_LIBSSH2" != Xno; then
  933. dnl backup the pre-libssh2 variables
  934. CLEANLDFLAGS="$LDFLAGS"
  935. CLEANCPPFLAGS="$CPPFLAGS"
  936. CLEANLIBS="$LIBS"
  937. case "$OPT_LIBSSH2" in
  938. yes)
  939. dnl --with-libssh2 (without path) used
  940. PREFIX_LIBSSH2=/usr/local/lib
  941. LIB_LIBSSH2="$PREFIX_LIBSSH2/lib$libsuff"
  942. ;;
  943. off)
  944. dnl no --with-libssh2 option given, just check default places
  945. PREFIX_LIBSSH2=
  946. ;;
  947. *)
  948. dnl use the given --with-libssh2 spot
  949. PREFIX_LIBSSH2=$OPT_LIBSSH2
  950. LIB_LIBSSH2="$PREFIX_LIBSSH2/lib$libsuff"
  951. LDFLAGS="$LDFLAGS -L$LIB_LIBSSH2"
  952. CPPFLAGS="$CPPFLAGS -I$PREFIX_LIBSSH2/include"
  953. ;;
  954. esac
  955. if test X"$HAVECRYPTO" = X"yes"; then
  956. dnl This is only reasonable to do if crypto actually is there: check for
  957. dnl LIBSSH2 libs NOTE: it is important to do this AFTER the crypto lib
  958. AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
  959. AC_CHECK_HEADERS(libssh2.h,
  960. curl_ssh_msg="enabled (libSSH2)"
  961. LIBSSH2_ENABLED=1
  962. AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use]))
  963. if test X"$OPT_LIBSSH2" != Xoff &&
  964. test "$LIBSSH2_ENABLED" != "1"; then
  965. AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
  966. fi
  967. else
  968. AC_MSG_WARN([without the use of OpenSSL libs, libssh2 cannot work])
  969. fi
  970. if test "$LIBSSH2_ENABLED" = "1"; then
  971. if test -n "$LIB_LIBSSH2"; then
  972. dnl when the libssh2 shared libs were found in a path that the run-time
  973. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  974. dnl to prevent further configure tests to fail due to this
  975. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_LIBSSH2"
  976. export LD_LIBRARY_PATH
  977. AC_MSG_NOTICE([Added $LIB_LIBSSH2 to LD_LIBRARY_PATH])
  978. fi
  979. fi
  980. fi
  981. dnl **********************************************************************
  982. dnl Check for the random seed preferences
  983. dnl **********************************************************************
  984. if test X"$OPENSSL_ENABLED" = X"1"; then
  985. AC_ARG_WITH(egd-socket,
  986. AC_HELP_STRING([--with-egd-socket=FILE],
  987. [Entropy Gathering Daemon socket pathname]),
  988. [ EGD_SOCKET="$withval" ]
  989. )
  990. if test -n "$EGD_SOCKET" ; then
  991. AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
  992. [your Entropy Gathering Daemon socket pathname] )
  993. fi
  994. dnl Check for user-specified random device
  995. AC_ARG_WITH(random,
  996. AC_HELP_STRING([--with-random=FILE],
  997. [read randomness from FILE (default=/dev/urandom)]),
  998. [ RANDOM_FILE="$withval" ],
  999. [
  1000. dnl Check for random device
  1001. AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
  1002. ]
  1003. )
  1004. if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
  1005. AC_SUBST(RANDOM_FILE)
  1006. AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
  1007. [a suitable file to read random data from])
  1008. fi
  1009. fi
  1010. dnl ----------------------------------------------------
  1011. dnl FIX: only check for GnuTLS if OpenSSL is not enabled
  1012. dnl ----------------------------------------------------
  1013. dnl Default to compiler & linker defaults for GnuTLS files & libraries.
  1014. OPT_GNUTLS=no
  1015. AC_ARG_WITH(gnutls,dnl
  1016. AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)])
  1017. AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
  1018. OPT_GNUTLS=$withval)
  1019. if test "$OPENSSL_ENABLED" != "1"; then
  1020. if test X"$OPT_GNUTLS" != Xno; then
  1021. if test "x$OPT_GNUTLS" = "xyes"; then
  1022. check=`libgnutls-config --version 2>/dev/null`
  1023. if test -n "$check"; then
  1024. addlib=`libgnutls-config --libs`
  1025. addcflags=`libgnutls-config --cflags`
  1026. version=`libgnutls-config --version`
  1027. gtlsprefix=`libgnutls-config --prefix`
  1028. fi
  1029. else
  1030. addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs`
  1031. addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags`
  1032. version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null`
  1033. gtlsprefix=$OPT_GNUTLS
  1034. if test -z "$version"; then
  1035. version="unknown"
  1036. fi
  1037. fi
  1038. if test -n "$addlib"; then
  1039. CLEANLIBS="$LIBS"
  1040. CLEANCPPFLAGS="$CPPFLAGS"
  1041. LIBS="$LIBS $addlib"
  1042. if test "$addcflags" != "-I/usr/include"; then
  1043. CPPFLAGS="$CPPFLAGS $addcflags"
  1044. fi
  1045. AC_CHECK_LIB(gnutls, gnutls_check_version,
  1046. [
  1047. AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
  1048. AC_SUBST(USE_GNUTLS, [1])
  1049. USE_GNUTLS="yes"
  1050. curl_ssl_msg="enabled (GnuTLS)"
  1051. ],
  1052. [
  1053. LIBS="$CLEANLIBS"
  1054. CPPFLAGS="$CLEANCPPFLAGS"
  1055. ])
  1056. if test "x$USE_GNUTLS" = "xyes"; then
  1057. AC_MSG_NOTICE([detected GnuTLS version $version])
  1058. dnl when shared libs were found in a path that the run-time
  1059. dnl linker doesn't search through, we need to add it to
  1060. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1061. dnl due to this
  1062. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
  1063. export LD_LIBRARY_PATH
  1064. AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH])
  1065. fi
  1066. fi
  1067. fi dnl GNUTLS not disabled
  1068. if test X"$USE_GNUTLS" != "Xyes"; then
  1069. AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
  1070. AC_MSG_WARN([Use --with-ssl or --with-gnutls to address this.])
  1071. fi
  1072. fi dnl OPENSSL != 1
  1073. dnl **********************************************************************
  1074. dnl Check for the CA bundle
  1075. dnl **********************************************************************
  1076. if test X"$USE_GNUTLS$OPENSSL_ENABLED" != "X"; then
  1077. AC_MSG_CHECKING([CA cert bundle install path])
  1078. AC_ARG_WITH(ca-bundle,
  1079. AC_HELP_STRING([--with-ca-bundle=FILE], [File name to install the CA bundle as])
  1080. AC_HELP_STRING([--without-ca-bundle], [Don't install the CA bundle]),
  1081. [ ca="$withval" ],
  1082. [
  1083. if test "x$prefix" != xNONE; then
  1084. ca="\${prefix}/share/curl/curl-ca-bundle.crt"
  1085. else
  1086. ca="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
  1087. fi
  1088. ] )
  1089. if test "x$ca" != "xno"; then
  1090. CURL_CA_BUNDLE='"'$ca'"'
  1091. AC_SUBST(CURL_CA_BUNDLE)
  1092. fi
  1093. AC_MSG_RESULT([$ca])
  1094. fi dnl only done if some kind of SSL was enabled
  1095. AM_CONDITIONAL(CABUNDLE, test x$ca != xno)
  1096. dnl **********************************************************************
  1097. dnl Check for the presence of ZLIB libraries and headers
  1098. dnl **********************************************************************
  1099. dnl Check for & handle argument to --with-zlib.
  1100. _cppflags=$CPPFLAGS
  1101. _ldflags=$LDFLAGS
  1102. AC_ARG_WITH(zlib,
  1103. AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
  1104. AC_HELP_STRING([--without-zlib],[disable use of zlib]),
  1105. [OPT_ZLIB="$withval"])
  1106. if test "$OPT_ZLIB" = "no" ; then
  1107. AC_MSG_WARN([zlib disabled])
  1108. else
  1109. if test "$OPT_ZLIB" = "yes" ; then
  1110. OPT_ZLIB=""
  1111. fi
  1112. if test -z "$OPT_ZLIB" ; then
  1113. dnl check for the lib first without setting any new path, since many
  1114. dnl people have it in the default path
  1115. AC_CHECK_LIB(z, inflateEnd,
  1116. dnl libz found, set the variable
  1117. [HAVE_LIBZ="1"],
  1118. dnl if no lib found, try /usr/local
  1119. [OPT_ZLIB="/usr/local"])
  1120. fi
  1121. dnl Add a nonempty path to the compiler flags
  1122. if test -n "$OPT_ZLIB"; then
  1123. CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
  1124. LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
  1125. fi
  1126. AC_CHECK_HEADER(zlib.h,
  1127. [
  1128. dnl zlib.h was found
  1129. HAVE_ZLIB_H="1"
  1130. dnl if the lib wasn't found already, try again with the new paths
  1131. if test "$HAVE_LIBZ" != "1"; then
  1132. AC_CHECK_LIB(z, gzread,
  1133. [
  1134. dnl the lib was found!
  1135. HAVE_LIBZ="1"
  1136. ],
  1137. [ CPPFLAGS=$_cppflags
  1138. LDFLAGS=$_ldflags])
  1139. fi
  1140. ],
  1141. [
  1142. dnl zlib.h was not found, restore the flags
  1143. CPPFLAGS=$_cppflags
  1144. LDFLAGS=$_ldflags]
  1145. )
  1146. if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
  1147. then
  1148. AC_MSG_WARN([configure found only the libz lib, not the header file!])
  1149. elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
  1150. then
  1151. AC_MSG_WARN([configure found only the libz header file, not the lib!])
  1152. elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
  1153. then
  1154. dnl both header and lib were found!
  1155. AC_SUBST(HAVE_LIBZ)
  1156. AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
  1157. AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
  1158. LIBS="$LIBS -lz"
  1159. dnl replace 'HAVE_LIBZ' in the automake makefile.ams
  1160. AMFIXLIB="1"
  1161. AC_MSG_NOTICE([found both libz and libz.h header])
  1162. curl_zlib_msg="enabled"
  1163. fi
  1164. fi
  1165. dnl set variable for use in automakefile(s)
  1166. AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
  1167. AC_MSG_CHECKING([whether to build with libidn])
  1168. AC_ARG_WITH(libidn,
  1169. AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
  1170. AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
  1171. [LIBIDN="$withval"])
  1172. case "$LIBIDN" in
  1173. no)
  1174. AC_MSG_RESULT(no)
  1175. ;;
  1176. *) AC_MSG_RESULT(yes)
  1177. idn=""
  1178. dnl if there is a given path, check that FIRST
  1179. if test -n "$LIBIDN"; then
  1180. if test "x$LIBIDN" != "xyes"; then
  1181. oldLDFLAGS=$LDFLAGS
  1182. oldCPPFLAGS=$CPPFLAGS
  1183. LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
  1184. CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
  1185. idn="yes"
  1186. AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
  1187. idn=""
  1188. LDFLAGS=$oldLDFLAGS
  1189. CPPFLAGS=$oldCPPFLAGS)
  1190. fi
  1191. fi
  1192. if test "x$idn" != "xyes"; then
  1193. dnl check with default paths
  1194. idn="yes"
  1195. AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
  1196. idn="")
  1197. fi
  1198. if test "x$idn" = "xyes"; then
  1199. curl_idn_msg="enabled"
  1200. AC_SUBST(IDN_ENABLED, [1])
  1201. dnl different versions of libidn have different setups of these:
  1202. AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
  1203. AC_CHECK_HEADERS( idn-free.h tld.h )
  1204. fi
  1205. ;;
  1206. esac
  1207. dnl Default is to try the thread-safe versions of a few functions
  1208. OPT_THREAD=on
  1209. dnl detect AIX 4.3 or later
  1210. dnl see full docs on this reasoning in the lib/hostip.c source file
  1211. AC_MSG_CHECKING([AIX 4.3 or later])
  1212. AC_PREPROC_IFELSE([
  1213. #if defined(_AIX) && defined(_AIX43)
  1214. printf("just fine");
  1215. #else
  1216. #error "this is not AIX 4.3 or later"
  1217. #endif
  1218. ],
  1219. [ AC_MSG_RESULT([yes])
  1220. RECENTAIX=yes
  1221. OPT_THREAD=off ],
  1222. [ AC_MSG_RESULT([no]) ]
  1223. )
  1224. AC_ARG_ENABLE(thread,dnl
  1225. AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
  1226. AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
  1227. [ case "$enableval" in
  1228. no)
  1229. OPT_THREAD=off
  1230. AC_MSG_WARN(libcurl will not get built using thread-safe functions)
  1231. ;;
  1232. *)
  1233. ;;
  1234. esac
  1235. ]
  1236. )
  1237. if test X"$OPT_THREAD" = Xoff
  1238. then
  1239. AC_DEFINE(DISABLED_THREADSAFE, 1,
  1240. [Set to explicitly specify we don't want to use thread-safe functions])
  1241. else
  1242. if test "$ipv6" != "yes"; then
  1243. dnl dig around for gethostbyname_r()
  1244. CURL_CHECK_GETHOSTBYNAME_R()
  1245. dnl dig around for gethostbyaddr_r()
  1246. dnl CURL_CHECK_GETHOSTBYADDR_R()
  1247. fi
  1248. dnl poke around for inet_ntoa_r()
  1249. CURL_CHECK_INET_NTOA_R()
  1250. dnl is there a localtime_r()
  1251. CURL_CHECK_LOCALTIME_R()
  1252. dnl is there a strerror_r()
  1253. CURL_CHECK_STRERROR_R()
  1254. checkfor_gmtime_r="yes"
  1255. fi
  1256. dnl for recent AIX versions, we skip all the thread-safe checks above since
  1257. dnl they claim a thread-safe libc using the standard API. But there are
  1258. dnl some functions still not thread-safe. Check for these!
  1259. dnl Let's hope this split URL remains working:
  1260. dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
  1261. dnl genprogc/thread_quick_ref.htm
  1262. if test "x$RECENTAIX" = "xyes"; then
  1263. AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
  1264. dnl check if this is the IMB xlc compiler
  1265. dnl Details thanks to => http://predef.sourceforge.net/
  1266. AC_MSG_CHECKING([if this is the xlc compiler])
  1267. AC_EGREP_CPP([^__xlC__], [__xlC__],
  1268. dnl action if the text is found, this it has not been replaced by the
  1269. dnl cpp
  1270. XLC="no"
  1271. AC_MSG_RESULT([no]),
  1272. dnl the text was not found, it was replaced by the cpp
  1273. XLC="yes"
  1274. AC_MSG_RESULT([yes])
  1275. CFLAGS="$CFLAGS -qthreaded"
  1276. )
  1277. dnl is there a localtime_r()
  1278. CURL_CHECK_LOCALTIME_R()
  1279. dnl is there a strerror_r()
  1280. CURL_CHECK_STRERROR_R()
  1281. checkfor_gmtime_r="yes"
  1282. fi
  1283. if test x$cross_compiling != xyes; then
  1284. if test x$checkfor_gmtime_r = xyes; then
  1285. dnl if gmtime_r was found, verify that it actuall works, as (at least) HPUX
  1286. dnl 10.20 is known to have a buggy one. If it doesn't work, disable use of
  1287. dnl it.
  1288. AC_MSG_CHECKING([if gmtime_r exists and works])
  1289. AC_RUN_IFELSE([[
  1290. #include <time.h>
  1291. int main(void)
  1292. {
  1293. time_t local = 1170352587;
  1294. struct tm *gmt;
  1295. struct tm keeper;
  1296. putenv("TZ=CST6CDT");
  1297. tzset();
  1298. gmt = gmtime_r(&local, &keeper);
  1299. if(gmt) {
  1300. return 0;
  1301. }
  1302. return 1; /* failure */
  1303. }
  1304. ]],
  1305. dnl success, do nothing
  1306. AC_MSG_RESULT(yes)
  1307. AC_DEFINE(HAVE_GMTIME_R, 1, [if you have (a working) gmtime_r])
  1308. ,
  1309. dnl failure, now disable the function
  1310. AC_MSG_RESULT(no)
  1311. ,
  1312. dnl not invoked when crosscompiling)
  1313. echo "hej"
  1314. )
  1315. fi
  1316. else
  1317. dnl and for crosscompilings
  1318. AC_CHECK_FUNCS(gmtime_r)
  1319. fi
  1320. dnl **********************************************************************
  1321. dnl Back to "normal" configuring
  1322. dnl **********************************************************************
  1323. dnl Checks for header files.
  1324. AC_HEADER_STDC
  1325. CURL_CHECK_HEADER_MALLOC
  1326. dnl Now check for the very most basic headers. Then we can use these
  1327. dnl ones as default-headers when checking for the rest!
  1328. AC_CHECK_HEADERS(
  1329. sys/types.h \
  1330. sys/time.h \
  1331. sys/select.h \
  1332. sys/socket.h \
  1333. sys/ioctl.h \
  1334. assert.h \
  1335. unistd.h \
  1336. stdlib.h \
  1337. limits.h \
  1338. arpa/inet.h \
  1339. net/if.h \
  1340. netinet/in.h \
  1341. netinet/tcp.h \
  1342. netdb.h \
  1343. sys/sockio.h \
  1344. sys/stat.h \
  1345. sys/param.h \
  1346. termios.h \
  1347. termio.h \
  1348. sgtty.h \
  1349. fcntl.h \
  1350. dlfcn.h \
  1351. alloca.h \
  1352. time.h \
  1353. io.h \
  1354. pwd.h \
  1355. utime.h \
  1356. sys/utime.h \
  1357. sys/poll.h \
  1358. sys/resource.h \
  1359. libgen.h \
  1360. locale.h \
  1361. errno.h \
  1362. arpa/tftp.h \
  1363. sys/filio.h \
  1364. setjmp.h,
  1365. dnl to do if not found
  1366. [],
  1367. dnl to do if found
  1368. [],
  1369. dnl default includes
  1370. [
  1371. #ifdef HAVE_SYS_TYPES_H
  1372. #include <sys/types.h>
  1373. #endif
  1374. #ifdef HAVE_SYS_TIME_H
  1375. #include <sys/time.h>
  1376. #endif
  1377. #ifdef HAVE_SYS_SELECT_H
  1378. #include <sys/select.h>
  1379. #endif
  1380. #ifdef HAVE_SYS_SOCKET_H
  1381. #include <sys/socket.h>
  1382. #endif
  1383. #ifdef HAVE_NETINET_IN_H
  1384. #include <netinet/in.h>
  1385. #endif
  1386. ]
  1387. )
  1388. dnl Checks for typedefs, structures, and compiler characteristics.
  1389. AC_C_CONST
  1390. AC_TYPE_SIZE_T
  1391. AC_HEADER_TIME
  1392. CURL_CHECK_STRUCT_TIMEVAL
  1393. CURL_VERIFY_RUNTIMELIBS
  1394. AC_CHECK_SIZEOF(curl_off_t, ,[
  1395. #include <stdio.h>
  1396. #include "$srcdir/include/curl/curl.h"
  1397. ])
  1398. AC_CHECK_SIZEOF(size_t)
  1399. AC_CHECK_SIZEOF(long)
  1400. AC_CHECK_SIZEOF(time_t)
  1401. AC_CHECK_TYPE(long long,
  1402. [AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
  1403. longlong="yes"
  1404. )
  1405. if test "xyes" = "x$longlong"; then
  1406. AC_MSG_CHECKING([if numberLL works])
  1407. AC_COMPILE_IFELSE([long long val = 1000LL;],
  1408. [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
  1409. AC_MSG_RESULT(yes),
  1410. AC_MSG_RESULT(no)
  1411. )
  1412. fi
  1413. # check for ssize_t
  1414. AC_CHECK_TYPE(ssize_t, ,
  1415. AC_DEFINE(ssize_t, int, [the signed version of size_t]))
  1416. # Check for socklen_t or equivalent
  1417. CURL_CHECK_TYPE_SOCKLEN_T
  1418. TYPE_IN_ADDR_T
  1419. TYPE_SOCKADDR_STORAGE
  1420. TYPE_SIG_ATOMIC_T
  1421. AC_TYPE_SIGNAL
  1422. AC_FUNC_SELECT_ARGTYPES
  1423. CURL_CHECK_FUNC_RECV
  1424. CURL_CHECK_FUNC_SEND
  1425. CURL_CHECK_MSG_NOSIGNAL
  1426. dnl Checks for library functions.
  1427. dnl AC_PROG_GCC_TRADITIONAL
  1428. dnl AC_FUNC_VPRINTF
  1429. case $host in
  1430. *msdosdjgpp)
  1431. ac_cv_func_pipe=no
  1432. skipcheck_pipe=yes
  1433. AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
  1434. ;;
  1435. esac
  1436. AC_CHECK_FUNCS( strtoll \
  1437. socket \
  1438. select \
  1439. strdup \
  1440. strstr \
  1441. strtok_r \
  1442. uname \
  1443. strcasecmp \
  1444. stricmp \
  1445. strcmpi \
  1446. gethostbyaddr \
  1447. gettimeofday \
  1448. inet_addr \
  1449. inet_ntoa \
  1450. inet_pton \
  1451. perror \
  1452. closesocket \
  1453. siginterrupt \
  1454. sigaction \
  1455. signal \
  1456. getpass_r \
  1457. strlcat \
  1458. getpwuid \
  1459. geteuid \
  1460. dlopen \
  1461. utime \
  1462. sigsetjmp \
  1463. basename \
  1464. setlocale \
  1465. ftruncate \
  1466. pipe \
  1467. poll \
  1468. getprotobyname \
  1469. getrlimit \
  1470. setrlimit \
  1471. fork,
  1472. dnl if found
  1473. [],
  1474. dnl if not found, $ac_func is the name we check for
  1475. func="$ac_func"
  1476. eval skipcheck=\$skipcheck_$func
  1477. if test "x$skipcheck" != "xyes"; then
  1478. AC_MSG_CHECKING([deeper for $func])
  1479. AC_TRY_LINK( [],
  1480. [ $func ();],
  1481. AC_MSG_RESULT(yes!)
  1482. eval "ac_cv_func_$func=yes"
  1483. def=`echo "HAVE_$func" | tr 'a-z' 'A-Z'`
  1484. AC_DEFINE_UNQUOTED($def, 1, [If you have $func]),
  1485. AC_MSG_RESULT(but still no)
  1486. )
  1487. fi
  1488. )
  1489. dnl For some reason, the check above doesn't properly detect select() with
  1490. dnl Msys/Mingw
  1491. if test "$ac_cv_func_select" = "no"; then
  1492. AC_MSG_CHECKING([for select in ws2_32])
  1493. AC_TRY_LINK([
  1494. #undef inline
  1495. #ifdef HAVE_WINDOWS_H
  1496. #ifndef WIN32_LEAN_AND_MEAN
  1497. #define WIN32_LEAN_AND_MEAN
  1498. #endif
  1499. #include <windows.h>
  1500. #ifdef HAVE_WINSOCK2_H
  1501. #include <winsock2.h>
  1502. #else
  1503. #ifdef HAVE_WINSOCK_H
  1504. #include <winsock.h>
  1505. #endif
  1506. #endif
  1507. #endif
  1508. ],[
  1509. select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
  1510. ],[
  1511. AC_MSG_RESULT([yes])
  1512. HAVE_SELECT="1"
  1513. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  1514. [Define to 1 if you have the select function.])
  1515. ],[
  1516. AC_MSG_ERROR([You can't compile without a select])
  1517. ])
  1518. fi
  1519. dnl sigsetjmp() might be a macro and no function so if it isn't found already
  1520. dnl we make an extra check here!
  1521. if test "$ac_cv_func_sigsetjmp" != "yes"; then
  1522. AC_MSG_CHECKING([for sigsetjmp defined as macro])
  1523. AC_TRY_LINK( [#include <setjmp.h>],
  1524. [sigjmp_buf jmpenv;
  1525. sigsetjmp(jmpenv, 1);],
  1526. AC_MSG_RESULT(yes)
  1527. AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp]),
  1528. AC_MSG_RESULT(no)
  1529. )
  1530. fi
  1531. AC_CHECK_DECL(basename, ,
  1532. AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
  1533. #ifdef HAVE_STRING_H
  1534. #include <string.h>
  1535. #endif
  1536. #ifdef HAVE_LIBGEN_H
  1537. #include <libgen.h>
  1538. #endif
  1539. #ifdef HAVE_UNISTD_H
  1540. #include <unistd.h>
  1541. #endif
  1542. )
  1543. AC_CHECK_DECL(inet_pton, ,
  1544. AC_DEFINE(HAVE_NO_INET_PTON_PROTO, 1,
  1545. [Defined if no inet_pton() prototype available]),
  1546. [
  1547. #ifdef HAVE_ARPA_INET_H
  1548. #include <arpa/inet.h>
  1549. #endif
  1550. ]
  1551. )
  1552. dnl Check if the getnameinfo function is available
  1553. dnl and get the types of five of its arguments.
  1554. CURL_CHECK_FUNC_GETNAMEINFO
  1555. if test "$ipv6" = "yes"; then
  1556. CURL_CHECK_WORKING_GETADDRINFO
  1557. CURL_CHECK_NI_WITHSCOPEID
  1558. fi
  1559. AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
  1560. disable_poll=no
  1561. case $host in
  1562. *-*-darwin*)
  1563. disable_poll="yes";
  1564. ;;
  1565. *)
  1566. ;;
  1567. esac
  1568. AC_MSG_RESULT($disable_poll)
  1569. if test "$disable_poll" = "no"; then
  1570. dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
  1571. dnl to find out we make an extra check here!
  1572. if test "$ac_cv_func_poll" = "yes"; then
  1573. AC_MSG_CHECKING([if poll works with NULL inputs])
  1574. AC_RUN_IFELSE([
  1575. #ifdef HAVE_SYS_POLL_H
  1576. #include <sys/poll.h>
  1577. #endif
  1578. int main(void)
  1579. {
  1580. /* make this return 0 == timeout since there's nothing to read from */
  1581. return poll((void *)0, 0, 10 /*ms*/);
  1582. }
  1583. ],
  1584. AC_MSG_RESULT(yes)
  1585. AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
  1586. AC_MSG_RESULT(no),
  1587. AC_MSG_RESULT(cross-compiling assumes yes)
  1588. AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
  1589. ) dnl end of AC_RUN_IFELSE
  1590. fi dnl poll() was found
  1591. fi dnl poll()-check is not disabled
  1592. AC_PATH_PROG( PERL, perl, ,
  1593. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  1594. AC_SUBST(PERL)
  1595. AC_PATH_PROGS( NROFF, gnroff nroff, ,
  1596. $PATH:/usr/bin/:/usr/local/bin )
  1597. AC_SUBST(NROFF)
  1598. if test -n "$NROFF"; then
  1599. dnl only check for nroff options if an nroff command was found
  1600. AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  1601. MANOPT="-man"
  1602. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  1603. if test -z "$mancheck"; then
  1604. MANOPT="-mandoc"
  1605. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  1606. if test -z "$mancheck"; then
  1607. MANOPT=""
  1608. AC_MSG_RESULT([failed])
  1609. AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
  1610. else
  1611. AC_MSG_RESULT([$MANOPT])
  1612. fi
  1613. else
  1614. AC_MSG_RESULT([$MANOPT])
  1615. fi
  1616. AC_SUBST(MANOPT)
  1617. fi
  1618. if test -z "$MANOPT"
  1619. then
  1620. dnl if no nroff tool was found, or no option that could convert man pages
  1621. dnl was found, then disable the built-in manual stuff
  1622. AC_MSG_WARN([disabling built-in manual])
  1623. USE_MANUAL="no";
  1624. fi
  1625. dnl *************************************************************************
  1626. dnl If the manual variable still is set, then we go with providing a built-in
  1627. dnl manual
  1628. if test "$USE_MANUAL" = "1"; then
  1629. AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
  1630. curl_manual_msg="enabled"
  1631. fi
  1632. dnl set variable for use in automakefile(s)
  1633. AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
  1634. AC_MSG_CHECKING([whether to enable ares])
  1635. AC_ARG_ENABLE(ares,
  1636. AC_HELP_STRING([--enable-ares=PATH],[Enable ares for name lookups])
  1637. AC_HELP_STRING([--disable-ares],[Disable ares for name lookups]),
  1638. [ case "$enableval" in
  1639. no)
  1640. AC_MSG_RESULT(no)
  1641. ;;
  1642. *) AC_MSG_RESULT(yes)
  1643. if test "x$IPV6_ENABLED" = "x1"; then
  1644. AC_MSG_NOTICE([ares may not work properly with ipv6])
  1645. fi
  1646. AC_DEFINE(USE_ARES, 1, [Define if you want to enable ares support])
  1647. dnl substitute HAVE_ARES for curl-config and similar
  1648. HAVE_ARES="1"
  1649. AC_SUBST(HAVE_ARES)
  1650. curl_ares_msg="enabled"
  1651. LIBS="-lcares $LIBS"
  1652. dnl For backwards compatibility default to includes/lib in srcdir/ares
  1653. dnl If a value is specified it is assumed that the libs are in $val/lib
  1654. dnl and the includes are in $val/include. This is the default setup for
  1655. dnl ares so it should not be a problem.
  1656. if test "x$enableval" = "xyes" ; then
  1657. if test -d "$srcdir/ares"; then
  1658. aresembedded="yes"
  1659. AC_CONFIG_SUBDIRS(ares)
  1660. aresinc=`cd $srcdir/ares && pwd`
  1661. CPPFLAGS="$CPPFLAGS -I$aresinc"
  1662. dnl the pwd= below cannot 'cd' into the ares dir to get the full
  1663. dnl path to it, since it may not exist yet if we build outside of
  1664. dnl the source tree
  1665. pwd=`pwd`
  1666. LDFLAGS="$LDFLAGS -L$pwd/ares"
  1667. fi
  1668. else
  1669. CPPFLAGS="$CPPFLAGS -I$enableval/include"
  1670. LDFLAGS="$LDFLAGS -L$enableval/lib"
  1671. fi
  1672. if test -z "$aresembedded"; then
  1673. dnl verify that a sufficient c-ares is here if we have pointed one
  1674. dnl out and don't use the "embedded" ares dir (in which case we don't
  1675. dnl check it because it might not have been built yet)
  1676. AC_MSG_CHECKING([that c-ares is good and recent enough])
  1677. AC_LINK_IFELSE( [
  1678. #include <ares.h>
  1679. /* provide a set of dummy functions in case c-ares was built with debug */
  1680. void curl_dofree() { }
  1681. void curl_sclose() { }
  1682. void curl_domalloc() { }
  1683. int main(void)
  1684. {
  1685. ares_channel channel;
  1686. ares_cancel(channel);
  1687. return 0;
  1688. }
  1689. ],
  1690. AC_MSG_RESULT(yes),
  1691. AC_MSG_RESULT(no)
  1692. AC_MSG_ERROR([c-ares library defective or too old])
  1693. )
  1694. fi
  1695. ;;
  1696. esac ],
  1697. AC_MSG_RESULT(no)
  1698. )
  1699. dnl ************************************************************
  1700. dnl disable verbose text strings
  1701. dnl
  1702. AC_MSG_CHECKING([whether to enable verbose strings])
  1703. AC_ARG_ENABLE(verbose,
  1704. AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
  1705. AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
  1706. [ case "$enableval" in
  1707. no)
  1708. AC_MSG_RESULT(no)
  1709. AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
  1710. AC_SUBST(CURL_DISABLE_VERBOSE_STRINGS)
  1711. curl_verbose_msg="no"
  1712. ;;
  1713. *) AC_MSG_RESULT(yes)
  1714. ;;
  1715. esac ],
  1716. AC_MSG_RESULT(yes)
  1717. )
  1718. dnl ************************************************************
  1719. dnl enable SSPI support
  1720. dnl
  1721. AC_MSG_CHECKING([whether to enable SSPI support (win32 builds only)])
  1722. AC_ARG_ENABLE(sspi,
  1723. AC_HELP_STRING([--enable-sspi],[Enable SSPI])
  1724. AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
  1725. [ case "$enableval" in
  1726. yes)
  1727. AC_MSG_RESULT(yes)
  1728. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  1729. AC_SUBST(USE_WINDOWS_SSPI)
  1730. curl_sspi_msg="yes"
  1731. ;;
  1732. *)
  1733. AC_MSG_RESULT(no)
  1734. ;;
  1735. esac ],
  1736. AC_MSG_RESULT(no)
  1737. )
  1738. dnl ************************************************************
  1739. dnl lame option to switch on debug options
  1740. dnl
  1741. AC_MSG_CHECKING([whether to enable debug options])
  1742. AC_ARG_ENABLE(debug,
  1743. AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
  1744. AC_HELP_STRING([--disable-debug],[Disable debug options]),
  1745. [ case "$enableval" in
  1746. no)
  1747. AC_MSG_RESULT(no)
  1748. ;;
  1749. *) AC_MSG_RESULT(yes)
  1750. CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
  1751. CFLAGS="$CFLAGS -g"
  1752. dnl set compiler "debug" options to become more picky, and remove
  1753. dnl optimize options from CFLAGS
  1754. CURL_CC_DEBUG_OPTS
  1755. ;;
  1756. esac
  1757. ],
  1758. AC_MSG_RESULT(no)
  1759. )
  1760. dnl ************************************************************
  1761. dnl disable cryptographic authentication
  1762. dnl
  1763. AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
  1764. AC_ARG_ENABLE(crypto-auth,
  1765. AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
  1766. AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
  1767. [ case "$enableval" in
  1768. no)
  1769. AC_MSG_RESULT(no)
  1770. AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
  1771. AC_SUBST(CURL_DISABLE_CRYPTO_AUTH)
  1772. ;;
  1773. *) AC_MSG_RESULT(yes)
  1774. ;;
  1775. esac ],
  1776. AC_MSG_RESULT(yes)
  1777. )
  1778. dnl ************************************************************
  1779. dnl disable cookies support
  1780. dnl
  1781. AC_MSG_CHECKING([whether to enable support for cookies])
  1782. AC_ARG_ENABLE(cookies,
  1783. AC_HELP_STRING([--enable-cookies],[Enable cookies support])
  1784. AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
  1785. [ case "$enableval" in
  1786. no)
  1787. AC_MSG_RESULT(no)
  1788. AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
  1789. AC_SUBST(CURL_DISABLE_COOKIES)
  1790. ;;
  1791. *) AC_MSG_RESULT(yes)
  1792. ;;
  1793. esac ],
  1794. AC_MSG_RESULT(yes)
  1795. )
  1796. dnl ************************************************************
  1797. dnl Enable hiding of internal symbols in library to reduce its size and
  1798. dnl speed dynamic linking of applications. This currently is only supported
  1799. dnl on gcc >= 4.0 and SunPro C.
  1800. dnl
  1801. AC_MSG_CHECKING([whether to enable hidden symbols in the library])
  1802. AC_ARG_ENABLE(hidden-symbols,
  1803. AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
  1804. AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
  1805. [ case "$enableval" in
  1806. no)
  1807. AC_MSG_RESULT(no)
  1808. ;;
  1809. *)
  1810. AC_MSG_CHECKING([whether $CC supports it])
  1811. if test "$GCC" = yes ; then
  1812. if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
  1813. AC_MSG_RESULT(yes)
  1814. AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
  1815. AC_SUBST(CURL_HIDDEN_SYMBOLS)
  1816. AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
  1817. AC_SUBST(CURL_EXTERN_SYMBOL)
  1818. CFLAGS="$CFLAGS -fvisibility=hidden"
  1819. else
  1820. AC_MSG_RESULT(no)
  1821. fi
  1822. else
  1823. dnl Test for SunPro cc
  1824. if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
  1825. AC_MSG_RESULT(yes)
  1826. AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
  1827. AC_SUBST(CURL_HIDDEN_SYMBOLS)
  1828. AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
  1829. AC_SUBST(CURL_EXTERN_SYMBOL)
  1830. CFLAGS="$CFLAGS -xldscope=hidden"
  1831. else
  1832. AC_MSG_RESULT(no)
  1833. fi
  1834. fi
  1835. ;;
  1836. esac ],
  1837. AC_MSG_RESULT(no)
  1838. )
  1839. dnl ************************************************************
  1840. if test "x$ws2" = "xyes"; then
  1841. dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
  1842. dnl things work when built with c-ares). But we can't just move it last
  1843. dnl since then other stuff (SSL) won't build. So we simply append it to the
  1844. dnl end.
  1845. LIBS="$LIBS -lws2_32"
  1846. fi
  1847. AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
  1848. AC_CONFIG_FILES([Makefile \
  1849. docs/Makefile \
  1850. docs/examples/Makefile \
  1851. docs/libcurl/Makefile \
  1852. include/Makefile \
  1853. include/curl/Makefile \
  1854. src/Makefile \
  1855. lib/Makefile \
  1856. tests/Makefile \
  1857. tests/data/Makefile \
  1858. tests/server/Makefile \
  1859. tests/libtest/Makefile \
  1860. packages/Makefile \
  1861. packages/Win32/Makefile \
  1862. packages/Win32/cygwin/Makefile \
  1863. packages/Linux/Makefile \
  1864. packages/Linux/RPM/Makefile \
  1865. packages/Linux/RPM/curl.spec \
  1866. packages/Linux/RPM/curl-ssl.spec \
  1867. packages/Solaris/Makefile \
  1868. packages/DOS/Makefile \
  1869. packages/EPM/curl.list \
  1870. packages/EPM/Makefile \
  1871. packages/vms/Makefile \
  1872. packages/AIX/Makefile \
  1873. packages/AIX/RPM/Makefile \
  1874. packages/AIX/RPM/curl.spec \
  1875. curl-config \
  1876. libcurl.pc
  1877. ])
  1878. AC_OUTPUT
  1879. AC_MSG_NOTICE([Configured to build curl/libcurl:
  1880. curl version: ${VERSION}
  1881. Host setup: ${host}
  1882. Install prefix: ${prefix}
  1883. Compiler: ${CC}
  1884. SSL support: ${curl_ssl_msg}
  1885. SSH support: ${curl_ssh_msg}
  1886. zlib support: ${curl_zlib_msg}
  1887. krb4 support: ${curl_krb4_msg}
  1888. GSSAPI support: ${curl_gss_msg}
  1889. SPNEGO support: ${curl_spnego_msg}
  1890. c-ares support: ${curl_ares_msg}
  1891. ipv6 support: ${curl_ipv6_msg}
  1892. IDN support: ${curl_idn_msg}
  1893. Build libcurl: Shared=${enable_shared}, Static=${enable_static}
  1894. Built-in manual: ${curl_manual_msg}
  1895. Verbose errors: ${curl_verbose_msg}
  1896. SSPI support: ${curl_sspi_msg}
  1897. ca cert path: ${ca}
  1898. ])