configure.ac 74 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, 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 "statically" 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 - 2008 Daniel Stenberg, <[email protected]>
  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 include/curl/curlbuild.h)
  33. AM_MAINTAINER_MODE
  34. dnl SED is mandatory for configure process and libtool.
  35. dnl Set it now, allowing it to be changed later.
  36. AC_PATH_PROG([SED], [sed], [not_found],
  37. [$PATH:/usr/bin:/usr/local/bin])
  38. if test -z "$SED" || test "$SED" = "not_found"; then
  39. AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
  40. fi
  41. AC_SUBST([SED])
  42. dnl GREP is mandatory for configure process and libtool.
  43. dnl Set it now, allowing it to be changed later.
  44. AC_PATH_PROG([GREP], [grep], [not_found],
  45. [$PATH:/usr/bin:/usr/local/bin])
  46. if test -z "$GREP" || test "$GREP" = "not_found"; then
  47. AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
  48. fi
  49. AC_SUBST([GREP])
  50. dnl EGREP is mandatory for configure process and libtool.
  51. dnl Set it now, allowing it to be changed later.
  52. if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
  53. AC_MSG_CHECKING([for egrep])
  54. EGREP="$GREP -E"
  55. AC_MSG_RESULT([$EGREP])
  56. else
  57. AC_PATH_PROG([EGREP], [egrep], [not_found],
  58. [$PATH:/usr/bin:/usr/local/bin])
  59. fi
  60. if test -z "$EGREP" || test "$EGREP" = "not_found"; then
  61. AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
  62. fi
  63. AC_SUBST([EGREP])
  64. dnl AR is mandatory for configure process and libtool.
  65. dnl This is target dependant, so check it as a tool.
  66. AC_PATH_TOOL([AR], [ar], [not_found],
  67. [$PATH:/usr/bin:/usr/local/bin])
  68. if test -z "$AR" || test "$AR" = "not_found"; then
  69. AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
  70. fi
  71. AC_SUBST([AR])
  72. AC_SUBST(libext)
  73. dnl figure out the libcurl version
  74. VERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
  75. AM_INIT_AUTOMAKE(curl,$VERSION)
  76. AC_MSG_CHECKING([curl version])
  77. AC_MSG_RESULT($VERSION)
  78. dnl
  79. dnl we extract the numerical version for curl-config only
  80. VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
  81. AC_SUBST(VERSIONNUM)
  82. dnl Solaris pkgadd support definitions
  83. PKGADD_PKG="HAXXcurl"
  84. PKGADD_NAME="cURL - a client that groks URLs"
  85. PKGADD_VENDOR="curl.haxx.se"
  86. AC_SUBST(PKGADD_PKG)
  87. AC_SUBST(PKGADD_NAME)
  88. AC_SUBST(PKGADD_VENDOR)
  89. dnl
  90. dnl initialize all the info variables
  91. curl_ssl_msg="no (--with-ssl / --with-gnutls)"
  92. curl_ssh_msg="no (--with-libssh2)"
  93. curl_zlib_msg="no (--with-zlib)"
  94. curl_krb4_msg="no (--with-krb4*)"
  95. curl_gss_msg="no (--with-gssapi)"
  96. curl_spnego_msg="no (--with-spnego)"
  97. curl_ares_msg="no (--enable-ares)"
  98. curl_ipv6_msg="no (--enable-ipv6)"
  99. curl_idn_msg="no (--with-libidn)"
  100. curl_manual_msg="no (--enable-manual)"
  101. curl_verbose_msg="enabled (--disable-verbose)"
  102. curl_sspi_msg="no (--enable-sspi)"
  103. curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
  104. curl_ldaps_msg="no (--enable-ldaps)"
  105. dnl
  106. dnl Save anything in $LIBS for later
  107. dnl
  108. ALL_LIBS=$LIBS
  109. dnl
  110. dnl Detect the canonical host and target build environment
  111. dnl
  112. AC_CANONICAL_HOST
  113. dnl Get system canonical name
  114. AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
  115. dnl Checks for programs.
  116. AC_PROG_CC
  117. dnl Our curl_off_t internal and external configure settings
  118. CURL_CONFIGURE_CURL_OFF_T
  119. dnl This defines _ALL_SOURCE for AIX
  120. CURL_CHECK_AIX_ALL_SOURCE
  121. dnl Our configure and build reentrant settings
  122. CURL_CONFIGURE_REENTRANT
  123. dnl check for how to do large files
  124. AC_SYS_LARGEFILE
  125. dnl support building of Windows DLLs
  126. AC_LIBTOOL_WIN32_DLL
  127. dnl skip libtool C++ and Fortran compiler checks
  128. m4_ifdef([AC_PROG_CXX], [m4_undefine([AC_PROG_CXX])])
  129. m4_defun([AC_PROG_CXX],[])
  130. m4_ifdef([AC_PROG_CXXCPP], [m4_undefine([AC_PROG_CXXCPP])])
  131. m4_defun([AC_PROG_CXXCPP],[true])
  132. m4_ifdef([AC_PROG_F77], [m4_undefine([AC_PROG_F77])])
  133. m4_defun([AC_PROG_F77],[])
  134. dnl skip libtool C++ and Fortran linker checks
  135. m4_ifdef([AC_LIBTOOL_CXX], [m4_undefine([AC_LIBTOOL_CXX])])
  136. m4_defun([AC_LIBTOOL_CXX],[])
  137. m4_ifdef([AC_LIBTOOL_CXXCPP], [m4_undefine([AC_LIBTOOL_CXXCPP])])
  138. m4_defun([AC_LIBTOOL_CXXCPP],[true])
  139. m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])])
  140. m4_defun([AC_LIBTOOL_F77],[])
  141. dnl force libtool to build static libraries with PIC on AMD64-linux
  142. AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)])
  143. case $host in
  144. x86_64*linux*)
  145. AC_MSG_RESULT([yes])
  146. with_pic=yes
  147. ;;
  148. *)
  149. AC_MSG_RESULT([no])
  150. ;;
  151. esac
  152. dnl libtool setup
  153. AC_PROG_LIBTOOL
  154. AC_MSG_CHECKING([if we need -no-undefined])
  155. case $host in
  156. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
  157. need_no_undefined=yes
  158. ;;
  159. *)
  160. need_no_undefined=no
  161. ;;
  162. esac
  163. AC_MSG_RESULT($need_no_undefined)
  164. AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
  165. AC_MSG_CHECKING([if we need -mimpure-text])
  166. mimpure=no
  167. case $host in
  168. *-*-solaris2*)
  169. if test "$GCC" = "yes"; then
  170. mimpure="yes"
  171. fi
  172. ;;
  173. *)
  174. ;;
  175. esac
  176. AC_MSG_RESULT($mimpure)
  177. AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
  178. AM_CONDITIONAL(STATICLIB, false)
  179. AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
  180. case $host in
  181. *-*-mingw*)
  182. AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
  183. AC_MSG_RESULT(yes)
  184. AC_MSG_CHECKING([if we need CURL_STATICLIB])
  185. if test "X$enable_shared" = "Xno"
  186. then
  187. AC_DEFINE(CURL_STATICLIB, 1, [when not building a shared library])
  188. AC_MSG_RESULT(yes)
  189. AM_CONDITIONAL(STATICLIB, true)
  190. else
  191. AC_MSG_RESULT(no)
  192. fi
  193. ;;
  194. *)
  195. AC_MSG_RESULT(no)
  196. ;;
  197. esac
  198. # Determine whether all dependent libraries must be specified when linking
  199. if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
  200. then
  201. REQUIRE_LIB_DEPS=no
  202. else
  203. REQUIRE_LIB_DEPS=yes
  204. fi
  205. AC_SUBST(REQUIRE_LIB_DEPS)
  206. dnl The install stuff has already been taken care of by the automake stuff
  207. dnl AC_PROG_INSTALL
  208. AC_PROG_MAKE_SET
  209. dnl check if there's a way to force code inline
  210. AC_C_INLINE
  211. dnl **********************************************************************
  212. dnl platform/compiler/architecture specific checks/flags
  213. dnl **********************************************************************
  214. case $host in
  215. #
  216. x86_64*linux*)
  217. #
  218. dnl find out if icc is being used
  219. if test "z$ICC" = "z"; then
  220. CURL_DETECT_ICC
  221. fi
  222. #
  223. if test "$ICC" = "yes"; then
  224. dnl figure out icc version
  225. AC_MSG_CHECKING([icc version])
  226. iccver=`$CC -dumpversion`
  227. iccnhi=`echo $iccver | cut -d . -f1`
  228. iccnlo=`echo $iccver | cut -d . -f2`
  229. iccnum=`(expr $iccnhi "*" 100 + $iccnlo) 2>/dev/null`
  230. AC_MSG_RESULT($iccver)
  231. #
  232. if test "$iccnum" -ge "900" && test "$iccnum" -lt "1000"; then
  233. dnl icc 9.X specific
  234. CFLAGS="$CFLAGS -i-dynamic"
  235. fi
  236. #
  237. if test "$iccnum" -ge "1000"; then
  238. dnl icc 10.X or later
  239. CFLAGS="$CFLAGS -shared-intel"
  240. fi
  241. #
  242. fi
  243. ;;
  244. #
  245. esac
  246. AC_MSG_CHECKING([whether we are using the IBM C compiler])
  247. CURL_CHECK_DEF([__IBMC__], [], [silent])
  248. if test "$curl_cv_have_def___IBMC__" = "yes"; then
  249. AC_MSG_RESULT([yes])
  250. dnl Ensure that compiler optimizations are always thread-safe.
  251. CFLAGS="$CFLAGS -qthreaded"
  252. dnl Disable type based strict aliasing optimizations, using worst
  253. dnl case aliasing assumptions when compiling. Type based aliasing
  254. dnl would restrict the lvalues that could be safely used to access
  255. dnl a data object.
  256. CFLAGS="$CFLAGS -qnoansialias"
  257. dnl Force compiler to stop after the compilation phase, without
  258. dnl generating an object code file when compilation has errors.
  259. CFLAGS="$CFLAGS -qhalt=e"
  260. else
  261. AC_MSG_RESULT([no])
  262. fi
  263. AC_MSG_CHECKING([whether we are using the DEC/Compaq C compiler])
  264. CURL_CHECK_DEF([__DECC], [], [silent])
  265. CURL_CHECK_DEF([__DECC_VER], [], [silent])
  266. if test "$curl_cv_have_def___DECC" = "yes" &&
  267. test "$curl_cv_have_def___DECC_VER" = "yes"; then
  268. AC_MSG_RESULT([yes])
  269. dnl Select strict ANSI C compiler mode
  270. CFLAGS="$CFLAGS -std1"
  271. dnl Turn off optimizer ANSI C aliasing rules
  272. CFLAGS="$CFLAGS -noansi_alias"
  273. dnl Select a higher warning level than default level2
  274. CFLAGS="$CFLAGS -msg_enable level3"
  275. dnl Generate warnings for missing function prototypes
  276. CFLAGS="$CFLAGS -warnprotos"
  277. dnl Change some warnings into fatal errors
  278. CFLAGS="$CFLAGS -msg_fatal toofewargs,toomanyargs"
  279. else
  280. AC_MSG_RESULT([no])
  281. fi
  282. CURL_CHECK_COMPILER_HALT_ON_ERROR
  283. CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
  284. dnl **********************************************************************
  285. dnl Compilation based checks should not be done before this point.
  286. dnl **********************************************************************
  287. dnl **********************************************************************
  288. dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
  289. dnl and ws2tcpip.h take precedence over any other further checks which
  290. dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
  291. dnl this specific header files. And do them before its results are used.
  292. dnl **********************************************************************
  293. CURL_CHECK_HEADER_WINDOWS
  294. CURL_CHECK_NATIVE_WINDOWS
  295. case X-"$ac_cv_native_windows" in
  296. X-yes)
  297. CURL_CHECK_HEADER_WINSOCK
  298. CURL_CHECK_HEADER_WINSOCK2
  299. CURL_CHECK_HEADER_WS2TCPIP
  300. CURL_CHECK_HEADER_WINLDAP
  301. CURL_CHECK_HEADER_WINBER
  302. ;;
  303. *)
  304. ac_cv_header_winsock_h="no"
  305. ac_cv_header_winsock2_h="no"
  306. ac_cv_header_ws2tcpip_h="no"
  307. ac_cv_header_winldap_h="no"
  308. ac_cv_header_winber_h="no"
  309. ;;
  310. esac
  311. CURL_CHECK_WIN32_LARGEFILE
  312. dnl ************************************************************
  313. dnl switch off particular protocols
  314. dnl
  315. AC_MSG_CHECKING([whether to support http])
  316. AC_ARG_ENABLE(http,
  317. AC_HELP_STRING([--enable-http],[Enable HTTP support])
  318. AC_HELP_STRING([--disable-http],[Disable HTTP support]),
  319. [ case "$enableval" in
  320. no)
  321. AC_MSG_RESULT(no)
  322. AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
  323. AC_MSG_WARN([disable HTTP disables FTP over proxy])
  324. AC_SUBST(CURL_DISABLE_HTTP, [1])
  325. ;;
  326. *) AC_MSG_RESULT(yes)
  327. ;;
  328. esac ],
  329. AC_MSG_RESULT(yes)
  330. )
  331. AC_MSG_CHECKING([whether to support ftp])
  332. AC_ARG_ENABLE(ftp,
  333. AC_HELP_STRING([--enable-ftp],[Enable FTP support])
  334. AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
  335. [ case "$enableval" in
  336. no)
  337. AC_MSG_RESULT(no)
  338. AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
  339. AC_SUBST(CURL_DISABLE_FTP, [1])
  340. ;;
  341. *) AC_MSG_RESULT(yes)
  342. ;;
  343. esac ],
  344. AC_MSG_RESULT(yes)
  345. )
  346. AC_MSG_CHECKING([whether to support file])
  347. AC_ARG_ENABLE(file,
  348. AC_HELP_STRING([--enable-file],[Enable FILE support])
  349. AC_HELP_STRING([--disable-file],[Disable FILE support]),
  350. [ case "$enableval" in
  351. no)
  352. AC_MSG_RESULT(no)
  353. AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
  354. AC_SUBST(CURL_DISABLE_FILE, [1])
  355. ;;
  356. *) AC_MSG_RESULT(yes)
  357. ;;
  358. esac ],
  359. AC_MSG_RESULT(yes)
  360. )
  361. AC_MSG_CHECKING([whether to support ldap])
  362. AC_ARG_ENABLE(ldap,
  363. AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
  364. AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
  365. [ case "$enableval" in
  366. no)
  367. AC_MSG_RESULT(no)
  368. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  369. AC_SUBST(CURL_DISABLE_LDAP, [1])
  370. ;;
  371. *)
  372. case $host in
  373. *-*-cygwin*)
  374. # Force no ldap. config/build process is broken for cygwin
  375. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  376. AC_SUBST(CURL_DISABLE_LDAP, [1])
  377. AC_MSG_RESULT(no)
  378. ;;
  379. *)
  380. AC_MSG_RESULT(yes)
  381. esac
  382. ;;
  383. esac ],[
  384. case $host in
  385. *-*-cygwin*)
  386. # Force no ldap. config/build process is broken for cygwin
  387. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  388. AC_SUBST(CURL_DISABLE_LDAP, [1])
  389. AC_MSG_RESULT(no)
  390. ;;
  391. *)
  392. AC_MSG_RESULT(yes)
  393. esac ]
  394. )
  395. AC_MSG_CHECKING([whether to support ldaps])
  396. AC_ARG_ENABLE(ldaps,
  397. AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
  398. AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
  399. [ case "$enableval" in
  400. no)
  401. AC_MSG_RESULT(no)
  402. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  403. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  404. ;;
  405. *) if test x$CURL_DISABLE_LDAP = x1 ; then
  406. AC_MSG_RESULT(LDAP support needs to be enabled in order to enable LDAPS support!)
  407. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  408. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  409. else
  410. AC_MSG_RESULT(yes)
  411. AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
  412. curl_ldaps_msg="enabled"
  413. fi
  414. ;;
  415. esac ],
  416. AC_MSG_RESULT(no)
  417. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  418. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  419. )
  420. AC_MSG_CHECKING([whether to support dict])
  421. AC_ARG_ENABLE(dict,
  422. AC_HELP_STRING([--enable-dict],[Enable DICT support])
  423. AC_HELP_STRING([--disable-dict],[Disable DICT support]),
  424. [ case "$enableval" in
  425. no)
  426. AC_MSG_RESULT(no)
  427. AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
  428. AC_SUBST(CURL_DISABLE_DICT, [1])
  429. ;;
  430. *) AC_MSG_RESULT(yes)
  431. ;;
  432. esac ],
  433. AC_MSG_RESULT(yes)
  434. )
  435. AC_MSG_CHECKING([whether to support telnet])
  436. AC_ARG_ENABLE(telnet,
  437. AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
  438. AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
  439. [ case "$enableval" in
  440. no)
  441. AC_MSG_RESULT(no)
  442. AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
  443. AC_SUBST(CURL_DISABLE_TELNET, [1])
  444. ;;
  445. *) AC_MSG_RESULT(yes)
  446. ;;
  447. esac ],
  448. AC_MSG_RESULT(yes)
  449. )
  450. AC_MSG_CHECKING([whether to support tftp])
  451. AC_ARG_ENABLE(tftp,
  452. AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
  453. AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
  454. [ case "$enableval" in
  455. no)
  456. AC_MSG_RESULT(no)
  457. AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
  458. AC_SUBST(CURL_DISABLE_TFTP, [1])
  459. ;;
  460. *) AC_MSG_RESULT(yes)
  461. ;;
  462. esac ],
  463. AC_MSG_RESULT(yes)
  464. )
  465. dnl **********************************************************************
  466. dnl Check for built-in manual
  467. dnl **********************************************************************
  468. AC_MSG_CHECKING([whether to provide built-in manual])
  469. AC_ARG_ENABLE(manual,
  470. AC_HELP_STRING([--enable-manual],[Enable built-in manual])
  471. AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
  472. [ case "$enableval" in
  473. no)
  474. AC_MSG_RESULT(no)
  475. ;;
  476. *) AC_MSG_RESULT(yes)
  477. USE_MANUAL="1"
  478. ;;
  479. esac ],
  480. AC_MSG_RESULT(yes)
  481. USE_MANUAL="1"
  482. )
  483. dnl The actual use of the USE_MANUAL variable is done much later in this
  484. dnl script to allow other actions to disable it as well.
  485. dnl **********************************************************************
  486. dnl check if this is the Intel ICC compiler, and if so make it stricter
  487. dnl (convert warning 147 into an error) so that it properly can detect the
  488. dnl gethostbyname_r() version
  489. dnl **********************************************************************
  490. CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
  491. dnl **********************************************************************
  492. dnl Checks for libraries.
  493. dnl **********************************************************************
  494. dnl gethostbyname without lib or in the nsl lib?
  495. AC_CHECK_FUNC(gethostbyname,
  496. [HAVE_GETHOSTBYNAME="1"
  497. ],
  498. [ AC_CHECK_LIB(nsl, gethostbyname,
  499. [HAVE_GETHOSTBYNAME="1"
  500. LIBS="$LIBS -lnsl"
  501. ])
  502. ])
  503. if test "$HAVE_GETHOSTBYNAME" != "1"
  504. then
  505. dnl gethostbyname in the socket lib?
  506. AC_CHECK_LIB(socket, gethostbyname,
  507. [HAVE_GETHOSTBYNAME="1"
  508. LIBS="$LIBS -lsocket"
  509. ])
  510. fi
  511. dnl At least one system has been identified to require BOTH nsl and socket
  512. dnl libs at the same time to link properly.
  513. if test "$HAVE_GETHOSTBYNAME" != "1"
  514. then
  515. AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
  516. my_ac_save_LIBS=$LIBS
  517. LIBS="-lnsl -lsocket $LIBS"
  518. AC_LINK_IFELSE([
  519. AC_LANG_PROGRAM([[
  520. ]],[[
  521. gethostbyname();
  522. ]])
  523. ],[
  524. AC_MSG_RESULT([yes])
  525. HAVE_GETHOSTBYNAME="1"
  526. ],[
  527. AC_MSG_RESULT([no])
  528. LIBS=$my_ac_save_LIBS
  529. ])
  530. fi
  531. if test "$HAVE_GETHOSTBYNAME" != "1"
  532. then
  533. dnl This is for winsock systems
  534. if test "$ac_cv_header_windows_h" = "yes"; then
  535. if test "$ac_cv_header_winsock_h" = "yes"; then
  536. case $host in
  537. *-*-mingw32ce*)
  538. winsock_LIB="-lwinsock"
  539. ;;
  540. *)
  541. winsock_LIB="-lwsock32"
  542. ;;
  543. esac
  544. fi
  545. if test "$ac_cv_header_winsock2_h" = "yes"; then
  546. winsock_LIB="-lws2_32"
  547. fi
  548. if test ! -z "$winsock_LIB"; then
  549. my_ac_save_LIBS=$LIBS
  550. LIBS="$winsock_LIB $LIBS"
  551. AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
  552. AC_LINK_IFELSE([
  553. AC_LANG_PROGRAM([[
  554. #ifdef HAVE_WINDOWS_H
  555. #ifndef WIN32_LEAN_AND_MEAN
  556. #define WIN32_LEAN_AND_MEAN
  557. #endif
  558. #include <windows.h>
  559. #ifdef HAVE_WINSOCK2_H
  560. #include <winsock2.h>
  561. #else
  562. #ifdef HAVE_WINSOCK_H
  563. #include <winsock.h>
  564. #endif
  565. #endif
  566. #endif
  567. ]],[[
  568. gethostbyname("www.dummysite.com");
  569. ]])
  570. ],[
  571. AC_MSG_RESULT([yes])
  572. HAVE_GETHOSTBYNAME="1"
  573. ],[
  574. AC_MSG_RESULT([no])
  575. winsock_LIB=""
  576. LIBS=$my_ac_save_LIBS
  577. ])
  578. fi
  579. fi
  580. fi
  581. if test "$HAVE_GETHOSTBYNAME" != "1"
  582. then
  583. dnl This is for Minix 3.1
  584. AC_MSG_CHECKING([for gethostbyname for Minix 3])
  585. AC_LINK_IFELSE([
  586. AC_LANG_PROGRAM([[
  587. /* Older Minix versions may need <net/gen/netdb.h> here instead */
  588. #include <netdb.h>
  589. ]],[[
  590. gethostbyname("www.dummysite.com");
  591. ]])
  592. ],[
  593. AC_MSG_RESULT([yes])
  594. HAVE_GETHOSTBYNAME="1"
  595. ],[
  596. AC_MSG_RESULT([no])
  597. ])
  598. fi
  599. if test "$HAVE_GETHOSTBYNAME" != "1"
  600. then
  601. dnl This is for eCos with a stubbed DNS implementation
  602. AC_MSG_CHECKING([for gethostbyname for eCos])
  603. AC_LINK_IFELSE([
  604. AC_LANG_PROGRAM([[
  605. #include <stdio.h>
  606. #include <netdb.h>
  607. ]],[[
  608. gethostbyname("www.dummysite.com");
  609. ]])
  610. ],[
  611. AC_MSG_RESULT([yes])
  612. HAVE_GETHOSTBYNAME="1"
  613. ],[
  614. AC_MSG_RESULT([no])
  615. ])
  616. fi
  617. if test "$HAVE_GETHOSTBYNAME" != "1"
  618. then
  619. dnl gethostbyname in the network lib - for Haiku OS
  620. AC_CHECK_LIB(network, gethostbyname,
  621. [HAVE_GETHOSTBYNAME="1"
  622. LIBS="$LIBS -lnetwork"
  623. ])
  624. fi
  625. if test "$HAVE_GETHOSTBYNAME" != "1"
  626. then
  627. dnl gethostbyname in the net lib - for BeOS
  628. AC_CHECK_LIB(net, gethostbyname,
  629. [HAVE_GETHOSTBYNAME="1"
  630. LIBS="$LIBS -lnet"
  631. ])
  632. fi
  633. if test "$HAVE_GETHOSTBYNAME" = "1"; then
  634. AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [If you have gethostbyname])
  635. else
  636. AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
  637. fi
  638. dnl resolve lib?
  639. AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
  640. if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
  641. AC_CHECK_LIB(resolve, strcasecmp,
  642. [LIBS="-lresolve $LIBS"],
  643. ,
  644. -lnsl)
  645. fi
  646. dnl socket lib?
  647. AC_CHECK_FUNC(connect, , [ AC_CHECK_LIB(socket, connect) ])
  648. dnl **********************************************************************
  649. dnl In case that function clock_gettime with monotonic timer is available,
  650. dnl check for additional required libraries.
  651. dnl **********************************************************************
  652. CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  653. dnl **********************************************************************
  654. dnl The preceding library checks are all potentially useful for test
  655. dnl servers (for providing networking support). Save the list of required
  656. dnl libraries at this point for use while linking those test servers.
  657. dnl **********************************************************************
  658. TEST_SERVER_LIBS=$LIBS
  659. dnl **********************************************************************
  660. AC_MSG_CHECKING([whether to use libgcc])
  661. AC_ARG_ENABLE(libgcc,
  662. AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
  663. [ case "$enableval" in
  664. yes)
  665. ALL_LIBS="$ALL_LIBS -lgcc"
  666. AC_MSG_RESULT(yes)
  667. ;;
  668. *) AC_MSG_RESULT(no)
  669. ;;
  670. esac ],
  671. AC_MSG_RESULT(no)
  672. )
  673. dnl **********************************************************************
  674. dnl Check for LDAP
  675. dnl **********************************************************************
  676. LDAPLIBNAME=""
  677. AC_ARG_WITH(ldap-lib,
  678. AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
  679. [LDAPLIBNAME="$withval"])
  680. LBERLIBNAME=""
  681. AC_ARG_WITH(lber-lib,
  682. AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
  683. [LBERLIBNAME="$withval"])
  684. if test x$CURL_DISABLE_LDAP != x1 ; then
  685. CURL_CHECK_HEADER_LBER
  686. CURL_CHECK_HEADER_LDAP
  687. CURL_CHECK_HEADER_LDAPSSL
  688. CURL_CHECK_HEADER_LDAP_SSL
  689. if test -z "$LDAPLIBNAME" ; then
  690. case $host in
  691. *-*-cygwin* | *-*-mingw* | *-*-pw32*)
  692. dnl Windows uses a single and unique OpenLDAP DLL name
  693. LDAPLIBNAME="wldap32"
  694. LBERLIBNAME="no"
  695. ;;
  696. esac
  697. fi
  698. if test "$LDAPLIBNAME" ; then
  699. AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
  700. AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
  701. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  702. AC_SUBST(CURL_DISABLE_LDAP, [1])])
  703. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  704. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  705. else
  706. dnl Try to find the right ldap libraries for this system
  707. CURL_CHECK_LIBS_LDAP
  708. case X-"$curl_cv_ldap_LIBS" in
  709. X-unknown)
  710. AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
  711. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  712. AC_SUBST(CURL_DISABLE_LDAP, [1])
  713. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  714. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  715. ;;
  716. esac
  717. fi
  718. fi
  719. if test x$CURL_DISABLE_LDAP != x1 ; then
  720. if test "$LBERLIBNAME" ; then
  721. dnl If name is "no" then don't define this library at all
  722. dnl (it's only needed if libldap.so's dependencies are broken).
  723. if test "$LBERLIBNAME" != "no" ; then
  724. AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
  725. AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
  726. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  727. AC_SUBST(CURL_DISABLE_LDAP, [1])])
  728. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  729. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  730. fi
  731. fi
  732. fi
  733. if test x$CURL_DISABLE_LDAP != x1 ; then
  734. AC_CHECK_FUNCS([ldap_url_parse])
  735. if test "$LDAPLIBNAME" = "wldap32"; then
  736. curl_ldap_msg="enabled (winldap)"
  737. AC_DEFINE(CURL_LDAP_WIN, 1, [Use W$ LDAP implementation])
  738. case $host in
  739. *-*-cygwin* | *-*-pw32*)
  740. AC_DEFINE(CURL_LDAP_HYBRID, 1, [W$ LDAP with non-W$ compiler])
  741. ;;
  742. esac
  743. else
  744. curl_ldap_msg="enabled (OpenLDAP)"
  745. fi
  746. fi
  747. dnl **********************************************************************
  748. dnl Checks for IPv6
  749. dnl **********************************************************************
  750. AC_MSG_CHECKING([whether to enable ipv6])
  751. AC_ARG_ENABLE(ipv6,
  752. AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
  753. AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
  754. [ case "$enableval" in
  755. no)
  756. AC_MSG_RESULT(no)
  757. ipv6=no
  758. ;;
  759. *) AC_MSG_RESULT(yes)
  760. ipv6=yes
  761. ;;
  762. esac ],
  763. AC_TRY_RUN([ /* is AF_INET6 available? */
  764. #include <sys/types.h>
  765. #include <sys/socket.h>
  766. main()
  767. {
  768. if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
  769. exit(1);
  770. else
  771. exit(0);
  772. }
  773. ],
  774. AC_MSG_RESULT(yes)
  775. ipv6=yes,
  776. AC_MSG_RESULT(no)
  777. ipv6=no,
  778. AC_MSG_RESULT(no)
  779. ipv6=no
  780. ))
  781. if test "$ipv6" = "yes"; then
  782. curl_ipv6_msg="enabled"
  783. fi
  784. dnl **********************************************************************
  785. dnl Check how non-blocking sockets are set
  786. dnl **********************************************************************
  787. AC_ARG_ENABLE(nonblocking,
  788. AC_HELP_STRING([--enable-nonblocking],[Enable detecting how to do it])
  789. AC_HELP_STRING([--disable-nonblocking],[Disable non-blocking socket detection]),
  790. [
  791. if test "$enableval" = "no" ; then
  792. AC_MSG_WARN([non-blocking sockets disabled])
  793. AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
  794. [to disable NON-BLOCKING connections])
  795. else
  796. CURL_CHECK_NONBLOCKING_SOCKET
  797. fi
  798. ],
  799. [
  800. CURL_CHECK_NONBLOCKING_SOCKET
  801. ])
  802. dnl **********************************************************************
  803. dnl Check if the operating system allows programs to write to their own argv[]
  804. dnl **********************************************************************
  805. AC_MSG_CHECKING([if argv can be written to])
  806. AC_CACHE_VAL(curl_cv_writable_argv, [
  807. AC_RUN_IFELSE([[
  808. int main(int argc, char ** argv) {
  809. argv[0][0] = ' ';
  810. return (argv[0][0] == ' ')?0:1;
  811. }
  812. ]],
  813. curl_cv_writable_argv=yes,
  814. curl_cv_writable_argv=no,
  815. curl_cv_writable_argv=cross)
  816. ])
  817. case $curl_cv_writable_argv in
  818. yes)
  819. AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
  820. AC_MSG_RESULT(yes)
  821. ;;
  822. no)
  823. AC_MSG_RESULT(no)
  824. ;;
  825. *)
  826. AC_MSG_RESULT(no)
  827. AC_MSG_WARN([the previous check could not be made default was used])
  828. ;;
  829. esac
  830. dnl **********************************************************************
  831. dnl Check for the presence of Kerberos4 libraries and headers
  832. dnl **********************************************************************
  833. AC_ARG_WITH(krb4-includes,
  834. AC_HELP_STRING([--with-krb4-includes=DIR],
  835. [Specify location of kerberos4 headers]),[
  836. CPPFLAGS="$CPPFLAGS -I$withval"
  837. KRB4INC="$withval"
  838. want_krb4=yes
  839. ])
  840. AC_ARG_WITH(krb4-libs,
  841. AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
  842. LDFLAGS="$LDFLAGS -L$withval"
  843. KRB4LIB="$withval"
  844. want_krb4=yes
  845. ])
  846. OPT_KRB4=off
  847. AC_ARG_WITH(krb4,dnl
  848. AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
  849. OPT_KRB4="$withval"
  850. if test X"$OPT_KRB4" != Xno; then
  851. want_krb4="yes"
  852. if test X"$OPT_KRB4" != Xyes; then
  853. LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
  854. KRB4LIB="$OPT_KRB4/lib$libsuff"
  855. CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
  856. KRB4INC="$OPT_KRB4/include"
  857. fi
  858. fi
  859. ])
  860. AC_MSG_CHECKING([if Kerberos4 support is requested])
  861. if test "$want_krb4" = yes
  862. then
  863. if test "$ipv6" = "yes"; then
  864. echo krb4 is not compatible with IPv6
  865. exit 1
  866. fi
  867. AC_MSG_RESULT(yes)
  868. dnl Check for & handle argument to --with-krb4
  869. AC_MSG_CHECKING(where to look for Kerberos4)
  870. if test X"$OPT_KRB4" = Xyes
  871. then
  872. AC_MSG_RESULT([defaults])
  873. else
  874. AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
  875. fi
  876. dnl Check for DES library
  877. AC_CHECK_LIB(des, des_pcbc_encrypt,
  878. [
  879. AC_CHECK_HEADERS(des.h)
  880. dnl resolv lib?
  881. AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
  882. dnl Check for the Kerberos4 library
  883. AC_CHECK_LIB(krb, krb_net_read,
  884. [
  885. dnl Check for header files
  886. AC_CHECK_HEADERS(krb.h)
  887. dnl we found the required libraries, add to LIBS
  888. LIBS="-lkrb -lcom_err -ldes $LIBS"
  889. dnl Check for function krb_get_our_ip_for_realm
  890. dnl this is needed for NAT networks
  891. AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
  892. dnl add define KRB4
  893. AC_DEFINE(HAVE_KRB4, 1,
  894. [if you have the Kerberos4 libraries (including -ldes)])
  895. dnl substitute it too!
  896. KRB4_ENABLED=1
  897. AC_SUBST(KRB4_ENABLED)
  898. curl_krb4_msg="enabled"
  899. dnl the krb4 stuff needs a strlcpy()
  900. AC_CHECK_FUNCS(strlcpy)
  901. ])
  902. ])
  903. else
  904. AC_MSG_RESULT(no)
  905. fi
  906. dnl **********************************************************************
  907. dnl Check for FBopenssl(SPNEGO) libraries
  908. dnl **********************************************************************
  909. AC_ARG_WITH(spnego,
  910. AC_HELP_STRING([--with-spnego=DIR],
  911. [Specify location of SPNEGO library fbopenssl]), [
  912. SPNEGO_ROOT="$withval"
  913. if test x"$SPNEGO_ROOT" != xno; then
  914. want_spnego="yes"
  915. fi
  916. ])
  917. AC_MSG_CHECKING([if SPNEGO support is requested])
  918. if test x"$want_spnego" = xyes; then
  919. if test X"$SPNEGO_ROOT" = Xyes; then
  920. AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
  921. AC_MSG_RESULT(no)
  922. else
  923. if test -z "$SPNEGO_LIB_DIR"; then
  924. LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
  925. else
  926. LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
  927. fi
  928. AC_MSG_RESULT(yes)
  929. AC_DEFINE(HAVE_SPNEGO, 1,
  930. [Define this if you have the SPNEGO library fbopenssl])
  931. curl_spnego_msg="enabled"
  932. fi
  933. else
  934. AC_MSG_RESULT(no)
  935. fi
  936. dnl **********************************************************************
  937. dnl Check for GSS-API libraries
  938. dnl **********************************************************************
  939. dnl check for gss stuff in the /usr as default
  940. GSSAPI_ROOT="/usr"
  941. AC_ARG_WITH(gssapi-includes,
  942. AC_HELP_STRING([--with-gssapi-includes=DIR],
  943. [Specify location of GSSAPI header]),
  944. [ GSSAPI_INCS="-I$withval"
  945. want_gss="yes" ]
  946. )
  947. AC_ARG_WITH(gssapi-libs,
  948. AC_HELP_STRING([--with-gssapi-libs=DIR],
  949. [Specify location of GSSAPI libs]),
  950. [ GSSAPI_LIB_DIR="-L$withval"
  951. want_gss="yes" ]
  952. )
  953. AC_ARG_WITH(gssapi,
  954. AC_HELP_STRING([--with-gssapi=DIR],
  955. [Where to look for GSSAPI]), [
  956. GSSAPI_ROOT="$withval"
  957. if test x"$GSSAPI_ROOT" != xno; then
  958. want_gss="yes"
  959. if test x"$GSSAPI_ROOT" = xyes; then
  960. dnl if yes, then use default root
  961. GSSAPI_ROOT="/usr"
  962. fi
  963. fi
  964. ])
  965. save_CPPFLAGS="$CPPFLAGS"
  966. AC_MSG_CHECKING([if GSSAPI support is requested])
  967. if test x"$want_gss" = xyes; then
  968. AC_MSG_RESULT(yes)
  969. if test -z "$GSSAPI_INCS"; then
  970. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  971. GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
  972. GSSAPI_LIBS=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  973. elif test "$GSSAPI_ROOT" != "yes"; then
  974. GSSAPI_INCS="-I$GSSAPI_ROOT/include"
  975. GSSAPI_LIBS="-lgssapi"
  976. fi
  977. fi
  978. CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
  979. LIBS="$LIBS $GSSAPI_LIBS"
  980. AC_CHECK_HEADER(gss.h,
  981. [
  982. dnl found in the given dirs
  983. AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
  984. gnu_gss=yes
  985. ],
  986. [
  987. dnl not found, check Heimdal or MIT
  988. AC_CHECK_HEADERS(
  989. [gssapi/gssapi.h gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
  990. [],
  991. [not_mit=1])
  992. if test "x$not_mit" = "x1"; then
  993. dnl MIT not found, check for Heimdal
  994. AC_CHECK_HEADER(gssapi.h,
  995. [
  996. dnl found
  997. AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
  998. ],
  999. [
  1000. dnl no header found, disabling GSS
  1001. want_gss=no
  1002. AC_MSG_WARN(disabling GSSAPI since no header files was found)
  1003. ]
  1004. )
  1005. else
  1006. dnl MIT found
  1007. AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
  1008. dnl check if we have a really old MIT kerberos (<= 1.2)
  1009. AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
  1010. AC_COMPILE_IFELSE([
  1011. AC_LANG_PROGRAM([[
  1012. #include <gssapi/gssapi.h>
  1013. #include <gssapi/gssapi_generic.h>
  1014. #include <gssapi/gssapi_krb5.h>
  1015. ]],[[
  1016. gss_import_name(
  1017. (OM_uint32 *)0,
  1018. (gss_buffer_t)0,
  1019. GSS_C_NT_HOSTBASED_SERVICE,
  1020. (gss_name_t *)0);
  1021. ]])
  1022. ],[
  1023. AC_MSG_RESULT([yes])
  1024. ],[
  1025. AC_MSG_RESULT([no])
  1026. AC_DEFINE(HAVE_OLD_GSSMIT, 1,
  1027. [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
  1028. ])
  1029. fi
  1030. ]
  1031. )
  1032. else
  1033. AC_MSG_RESULT(no)
  1034. fi
  1035. if test x"$want_gss" = xyes; then
  1036. AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
  1037. curl_gss_msg="enabled (MIT/Heimdal)"
  1038. if test -n "$gnu_gss"; then
  1039. curl_gss_msg="enabled (GNU GSS)"
  1040. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1041. LIBS="$LIBS -lgss"
  1042. elif test -z "$GSSAPI_LIB_DIR"; then
  1043. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1044. dnl krb5-config doesn't have --libs-only-L or similar, put everything
  1045. dnl into LIBS
  1046. gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  1047. LIBS="$LIBS $gss_libs"
  1048. elif test "$GSSAPI_ROOT" != "yes"; then
  1049. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
  1050. LIBS="$LIBS -lgssapi"
  1051. else
  1052. LIBS="$LIBS -lgssapi"
  1053. fi
  1054. else
  1055. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1056. LIBS="$LIBS -lgssapi"
  1057. fi
  1058. else
  1059. CPPFLAGS="$save_CPPFLAGS"
  1060. fi
  1061. dnl **********************************************************************
  1062. dnl Check for the presence of SSL libraries and headers
  1063. dnl **********************************************************************
  1064. dnl Default to compiler & linker defaults for SSL files & libraries.
  1065. OPT_SSL=off
  1066. dnl Default to no CA bundle
  1067. ca="no"
  1068. AC_ARG_WITH(ssl,dnl
  1069. 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])
  1070. AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
  1071. OPT_SSL=$withval)
  1072. if test X"$OPT_SSL" != Xno; then
  1073. dnl backup the pre-ssl variables
  1074. CLEANLDFLAGS="$LDFLAGS"
  1075. CLEANCPPFLAGS="$CPPFLAGS"
  1076. CLEANLIBS="$LIBS"
  1077. case "$OPT_SSL" in
  1078. yes)
  1079. dnl --with-ssl (without path) used
  1080. if test x$cross_compiling != xyes; then
  1081. dnl only do pkg-config magic when not cross-compiling
  1082. PKGTEST="yes"
  1083. fi
  1084. PREFIX_OPENSSL=/usr/local/ssl
  1085. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1086. ;;
  1087. off)
  1088. dnl no --with-ssl option given, just check default places
  1089. if test x$cross_compiling != xyes; then
  1090. dnl only do pkg-config magic when not cross-compiling
  1091. PKGTEST="yes"
  1092. fi
  1093. PREFIX_OPENSSL=
  1094. ;;
  1095. *)
  1096. dnl check the given --with-ssl spot
  1097. PKGTEST="no"
  1098. PREFIX_OPENSSL=$OPT_SSL
  1099. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1100. LDFLAGS="$LDFLAGS -L$LIB_OPENSSL"
  1101. CPPFLAGS="$CPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  1102. ;;
  1103. esac
  1104. if test "$PKGTEST" = "yes"; then
  1105. dnl Detect the pkg-config tool, as it may have extra info about the
  1106. dnl openssl installation we can use. I *believe* this is what we are
  1107. dnl expected to do on really recent Redhat Linux hosts.
  1108. AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
  1109. if test "$PKGCONFIG" != "no" ; then
  1110. AC_MSG_CHECKING([OpenSSL options with pkg-config])
  1111. $PKGCONFIG --exists openssl
  1112. SSL_EXISTS=$?
  1113. if test "$SSL_EXISTS" -eq "0"; then
  1114. SSL_LIBS=`$PKGCONFIG --libs-only-l openssl 2>/dev/null`
  1115. SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl 2>/dev/null`
  1116. SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl 2>/dev/null`
  1117. LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
  1118. dnl use the values pkg-config reported
  1119. LIBS="$LIBS $SSL_LIBS"
  1120. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  1121. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  1122. AC_MSG_RESULT([found])
  1123. else
  1124. AC_MSG_RESULT([no])
  1125. fi
  1126. fi
  1127. fi
  1128. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  1129. HAVECRYPTO="yes"
  1130. LIBS="-lcrypto $LIBS"
  1131. ],[
  1132. LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
  1133. CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  1134. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  1135. HAVECRYPTO="yes"
  1136. LIBS="-lcrypto $LIBS"], [
  1137. LDFLAGS="$CLEANLDFLAGS"
  1138. CPPFLAGS="$CLEANCPPFLAGS"
  1139. LIBS="$CLEANLIBS"
  1140. ])
  1141. ])
  1142. if test X"$HAVECRYPTO" = X"yes"; then
  1143. dnl This is only reasonable to do if crypto actually is there: check for
  1144. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  1145. AC_CHECK_LIB(ssl, SSL_connect)
  1146. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1147. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  1148. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  1149. OLIBS=$LIBS
  1150. LIBS="$LIBS -lRSAglue -lrsaref"
  1151. AC_CHECK_LIB(ssl, SSL_connect)
  1152. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1153. dnl still no SSL_connect
  1154. AC_MSG_RESULT(no)
  1155. LIBS=$OLIBS
  1156. else
  1157. AC_MSG_RESULT(yes)
  1158. fi
  1159. else
  1160. dnl Have the libraries--check for SSLeay/OpenSSL headers
  1161. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  1162. openssl/pem.h openssl/ssl.h openssl/err.h,
  1163. curl_ssl_msg="enabled (OpenSSL)"
  1164. OPENSSL_ENABLED=1
  1165. AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
  1166. if test $ac_cv_header_openssl_x509_h = no; then
  1167. dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
  1168. dnl since 'err.h' might in fact find a krb4 header with the same
  1169. dnl name
  1170. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
  1171. if test $ac_cv_header_x509_h = yes &&
  1172. test $ac_cv_header_crypto_h = yes &&
  1173. test $ac_cv_header_ssl_h = yes; then
  1174. dnl three matches
  1175. curl_ssl_msg="enabled (OpenSSL)"
  1176. OPENSSL_ENABLED=1
  1177. fi
  1178. fi
  1179. fi
  1180. if test X"$OPENSSL_ENABLED" = X"1"; then
  1181. AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
  1182. dnl is there a pkcs12.h header present?
  1183. AC_CHECK_HEADERS(openssl/pkcs12.h)
  1184. else
  1185. LIBS="$CLEANLIBS"
  1186. fi
  1187. dnl USE_SSLEAY is the historical name for what configure calls
  1188. dnl OPENSSL_ENABLED; the names should really be unified
  1189. USE_SSLEAY="$OPENSSL_ENABLED"
  1190. AC_SUBST(USE_SSLEAY)
  1191. if test X"$OPT_SSL" != Xoff &&
  1192. test "$OPENSSL_ENABLED" != "1"; then
  1193. AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
  1194. fi
  1195. fi
  1196. if test X"$OPENSSL_ENABLED" = X"1"; then
  1197. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  1198. dnl stuff, it is kind of "separated" from the main SSL check
  1199. AC_CHECK_FUNC(ENGINE_init,
  1200. [
  1201. AC_CHECK_HEADERS(openssl/engine.h)
  1202. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  1203. ])
  1204. dnl these can only exist if openssl exists
  1205. dnl yassl doesn't have SSL_get_shutdown
  1206. AC_CHECK_FUNCS( RAND_status \
  1207. RAND_screen \
  1208. RAND_egd \
  1209. CRYPTO_cleanup_all_ex_data \
  1210. SSL_get_shutdown )
  1211. dnl Make an attempt to detect if this is actually yassl's headers and
  1212. dnl OpenSSL emulation layer. We still leave everything else believing
  1213. dnl and acting like OpenSSL.
  1214. AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
  1215. AC_COMPILE_IFELSE([
  1216. AC_LANG_PROGRAM([[
  1217. #include <openssl/ssl.h>
  1218. ]],[[
  1219. #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
  1220. int dummy = SSL_ERROR_NONE;
  1221. #else
  1222. Not the yaSSL OpenSSL compatibility header.
  1223. #endif
  1224. ]])
  1225. ],[
  1226. AC_MSG_RESULT([yes])
  1227. AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
  1228. [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
  1229. curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
  1230. ],[
  1231. AC_MSG_RESULT([no])
  1232. ])
  1233. fi
  1234. if test "$OPENSSL_ENABLED" = "1"; then
  1235. if test -n "$LIB_OPENSSL"; then
  1236. dnl when the ssl shared libs were found in a path that the run-time
  1237. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1238. dnl to prevent further configure tests to fail due to this
  1239. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
  1240. export LD_LIBRARY_PATH
  1241. AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  1242. fi
  1243. fi
  1244. fi
  1245. dnl **********************************************************************
  1246. dnl Check for the presence of ZLIB libraries and headers
  1247. dnl **********************************************************************
  1248. dnl Check for & handle argument to --with-zlib.
  1249. _cppflags=$CPPFLAGS
  1250. _ldflags=$LDFLAGS
  1251. AC_ARG_WITH(zlib,
  1252. AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
  1253. AC_HELP_STRING([--without-zlib],[disable use of zlib]),
  1254. [OPT_ZLIB="$withval"])
  1255. if test "$OPT_ZLIB" = "no" ; then
  1256. AC_MSG_WARN([zlib disabled])
  1257. else
  1258. if test "$OPT_ZLIB" = "yes" ; then
  1259. OPT_ZLIB=""
  1260. fi
  1261. if test -z "$OPT_ZLIB" ; then
  1262. dnl check for the lib first without setting any new path, since many
  1263. dnl people have it in the default path
  1264. AC_CHECK_LIB(z, inflateEnd,
  1265. dnl libz found, set the variable
  1266. [HAVE_LIBZ="1"],
  1267. dnl if no lib found, try /usr/local
  1268. [OPT_ZLIB="/usr/local"])
  1269. fi
  1270. dnl Add a nonempty path to the compiler flags
  1271. if test -n "$OPT_ZLIB"; then
  1272. CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
  1273. LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
  1274. fi
  1275. AC_CHECK_HEADER(zlib.h,
  1276. [
  1277. dnl zlib.h was found
  1278. HAVE_ZLIB_H="1"
  1279. dnl if the lib wasn't found already, try again with the new paths
  1280. if test "$HAVE_LIBZ" != "1"; then
  1281. AC_CHECK_LIB(z, gzread,
  1282. [
  1283. dnl the lib was found!
  1284. HAVE_LIBZ="1"
  1285. ],
  1286. [ CPPFLAGS=$_cppflags
  1287. LDFLAGS=$_ldflags])
  1288. fi
  1289. ],
  1290. [
  1291. dnl zlib.h was not found, restore the flags
  1292. CPPFLAGS=$_cppflags
  1293. LDFLAGS=$_ldflags]
  1294. )
  1295. if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
  1296. then
  1297. AC_MSG_WARN([configure found only the libz lib, not the header file!])
  1298. HAVE_LIBZ=""
  1299. elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
  1300. then
  1301. AC_MSG_WARN([configure found only the libz header file, not the lib!])
  1302. elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
  1303. then
  1304. dnl both header and lib were found!
  1305. AC_SUBST(HAVE_LIBZ)
  1306. AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
  1307. AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
  1308. CURL_LIBS="$CURL_LIBS -lz"
  1309. LIBS="$LIBS -lz"
  1310. dnl replace 'HAVE_LIBZ' in the automake makefile.ams
  1311. AMFIXLIB="1"
  1312. AC_MSG_NOTICE([found both libz and libz.h header])
  1313. curl_zlib_msg="enabled"
  1314. fi
  1315. fi
  1316. dnl set variable for use in automakefile(s)
  1317. AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
  1318. dnl **********************************************************************
  1319. dnl Check for the presence of LIBSSH2 libraries and headers
  1320. dnl **********************************************************************
  1321. dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
  1322. OPT_LIBSSH2=off
  1323. AC_ARG_WITH(libssh2,dnl
  1324. 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])
  1325. AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
  1326. OPT_LIBSSH2=$withval)
  1327. if test X"$OPT_LIBSSH2" != Xno; then
  1328. dnl backup the pre-libssh2 variables
  1329. CLEANLDFLAGS="$LDFLAGS"
  1330. CLEANCPPFLAGS="$CPPFLAGS"
  1331. CLEANLIBS="$LIBS"
  1332. case "$OPT_LIBSSH2" in
  1333. yes)
  1334. dnl --with-libssh2 (without path) used
  1335. PREFIX_LIBSSH2=/usr/local/lib
  1336. LIB_LIBSSH2="$PREFIX_LIBSSH2$libsuff"
  1337. ;;
  1338. off)
  1339. dnl no --with-libssh2 option given, just check default places
  1340. PREFIX_LIBSSH2=
  1341. ;;
  1342. *)
  1343. dnl use the given --with-libssh2 spot
  1344. PREFIX_LIBSSH2=$OPT_LIBSSH2
  1345. LIB_LIBSSH2="$PREFIX_LIBSSH2/lib$libsuff"
  1346. LDFLAGS="$LDFLAGS -L$LIB_LIBSSH2"
  1347. CPPFLAGS="$CPPFLAGS -I$PREFIX_LIBSSH2/include"
  1348. ;;
  1349. esac
  1350. AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
  1351. AC_CHECK_HEADERS(libssh2.h,
  1352. curl_ssh_msg="enabled (libSSH2)"
  1353. LIBSSH2_ENABLED=1
  1354. AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
  1355. AC_SUBST(USE_LIBSSH2, [1])
  1356. )
  1357. if test X"$OPT_LIBSSH2" != Xoff &&
  1358. test "$LIBSSH2_ENABLED" != "1"; then
  1359. AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
  1360. fi
  1361. if test "$LIBSSH2_ENABLED" = "1"; then
  1362. if test -n "$LIB_LIBSSH2"; then
  1363. dnl when the libssh2 shared libs were found in a path that the run-time
  1364. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1365. dnl to prevent further configure tests to fail due to this
  1366. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_LIBSSH2"
  1367. export LD_LIBRARY_PATH
  1368. AC_MSG_NOTICE([Added $LIB_LIBSSH2 to LD_LIBRARY_PATH])
  1369. fi
  1370. fi
  1371. fi
  1372. dnl **********************************************************************
  1373. dnl Check for the random seed preferences
  1374. dnl **********************************************************************
  1375. if test X"$OPENSSL_ENABLED" = X"1"; then
  1376. AC_ARG_WITH(egd-socket,
  1377. AC_HELP_STRING([--with-egd-socket=FILE],
  1378. [Entropy Gathering Daemon socket pathname]),
  1379. [ EGD_SOCKET="$withval" ]
  1380. )
  1381. if test -n "$EGD_SOCKET" ; then
  1382. AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
  1383. [your Entropy Gathering Daemon socket pathname] )
  1384. fi
  1385. dnl Check for user-specified random device
  1386. AC_ARG_WITH(random,
  1387. AC_HELP_STRING([--with-random=FILE],
  1388. [read randomness from FILE (default=/dev/urandom)]),
  1389. [ RANDOM_FILE="$withval" ],
  1390. [
  1391. dnl Check for random device
  1392. AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
  1393. ]
  1394. )
  1395. if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
  1396. AC_SUBST(RANDOM_FILE)
  1397. AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
  1398. [a suitable file to read random data from])
  1399. fi
  1400. fi
  1401. dnl ----------------------------------------------------
  1402. dnl FIX: only check for GnuTLS if OpenSSL is not enabled
  1403. dnl ----------------------------------------------------
  1404. dnl Default to compiler & linker defaults for GnuTLS files & libraries.
  1405. OPT_GNUTLS=no
  1406. AC_ARG_WITH(gnutls,dnl
  1407. AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root (default: /usr/local/)])
  1408. AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
  1409. OPT_GNUTLS=$withval)
  1410. if test "$OPENSSL_ENABLED" != "1"; then
  1411. if test X"$OPT_GNUTLS" != Xno; then
  1412. if test "x$OPT_GNUTLS" = "xyes"; then
  1413. check=`libgnutls-config --version 2>/dev/null`
  1414. if test -n "$check"; then
  1415. addlib=`libgnutls-config --libs`
  1416. addcflags=`libgnutls-config --cflags`
  1417. version=`libgnutls-config --version`
  1418. gtlsprefix=`libgnutls-config --prefix`
  1419. fi
  1420. else
  1421. addlib=`$OPT_GNUTLS/bin/libgnutls-config --libs`
  1422. addcflags=`$OPT_GNUTLS/bin/libgnutls-config --cflags`
  1423. version=`$OPT_GNUTLS/bin/libgnutls-config --version 2>/dev/null`
  1424. gtlsprefix=$OPT_GNUTLS
  1425. if test -z "$version"; then
  1426. version="unknown"
  1427. fi
  1428. fi
  1429. if test -n "$addlib"; then
  1430. CLEANLIBS="$LIBS"
  1431. CLEANCPPFLAGS="$CPPFLAGS"
  1432. LIBS="$LIBS $addlib"
  1433. if test "$addcflags" != "-I/usr/include"; then
  1434. CPPFLAGS="$CPPFLAGS $addcflags"
  1435. fi
  1436. AC_CHECK_LIB(gnutls, gnutls_check_version,
  1437. [
  1438. AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
  1439. AC_SUBST(USE_GNUTLS, [1])
  1440. GNUTLS_ENABLED=1
  1441. USE_GNUTLS="yes"
  1442. curl_ssl_msg="enabled (GnuTLS)"
  1443. ],
  1444. [
  1445. LIBS="$CLEANLIBS"
  1446. CPPFLAGS="$CLEANCPPFLAGS"
  1447. ])
  1448. if test "x$USE_GNUTLS" = "xyes"; then
  1449. AC_MSG_NOTICE([detected GnuTLS version $version])
  1450. dnl when shared libs were found in a path that the run-time
  1451. dnl linker doesn't search through, we need to add it to
  1452. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1453. dnl due to this
  1454. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlsprefix/lib$libsuff"
  1455. export LD_LIBRARY_PATH
  1456. AC_MSG_NOTICE([Added $gtlsprefix/lib$libsuff to LD_LIBRARY_PATH])
  1457. fi
  1458. fi
  1459. fi dnl GNUTLS not disabled
  1460. fi dnl OPENSSL != 1
  1461. dnl ----------------------------------------------------
  1462. dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
  1463. dnl ----------------------------------------------------
  1464. dnl Default to compiler & linker defaults for NSS files & libraries.
  1465. OPT_NSS=no
  1466. AC_ARG_WITH(nss,dnl
  1467. AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root (default: /usr/local/)])
  1468. AC_HELP_STRING([--without-nss], [disable NSS detection]),
  1469. OPT_NSS=$withval)
  1470. if test "$OPENSSL_ENABLED" != "1" -a "$GNUTLS_ENABLED" != "1"; then
  1471. if test X"$OPT_NSS" != Xno; then
  1472. if test "x$OPT_NSS" = "xyes"; then
  1473. check=`pkg-config --version 2>/dev/null`
  1474. if test -n "$check"; then
  1475. addlib=`pkg-config --libs nss`
  1476. addcflags=`pkg-config --cflags nss`
  1477. version=`pkg-config --modversion nss`
  1478. nssprefix=`pkg-config --variable=prefix nss`
  1479. fi
  1480. else
  1481. # Without pkg-config, we'll kludge in some defaults
  1482. addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
  1483. addcflags="-I$OPT_NSS/include"
  1484. version="unknown"
  1485. gtlsprefix=$OPT_GNUTLS
  1486. fi
  1487. dnl Check for functionPK11_CreateGenericObject
  1488. dnl this is needed for using the PEM PKCS#11 module
  1489. AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
  1490. [
  1491. AC_DEFINE(HAVE_PK11_CREATEGENERICOBJECT, 1, [if you have the function PK11_CreateGenericObject])
  1492. AC_SUBST(HAVE_PK11_CREATEGENERICOBJECT, [1])
  1493. ])
  1494. if test -n "$addlib"; then
  1495. CLEANLIBS="$LIBS"
  1496. CLEANCPPFLAGS="$CPPFLAGS"
  1497. LIBS="$LIBS $addlib"
  1498. if test "$addcflags" != "-I/usr/include"; then
  1499. CPPFLAGS="$CPPFLAGS $addcflags"
  1500. fi
  1501. AC_CHECK_LIB(nss3, NSS_Initialize,
  1502. [
  1503. AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
  1504. AC_SUBST(USE_NSS, [1])
  1505. USE_NSS="yes"
  1506. NSS_ENABLED=1
  1507. curl_ssl_msg="enabled (NSS)"
  1508. ],
  1509. [
  1510. LIBS="$CLEANLIBS"
  1511. CPPFLAGS="$CLEANCPPFLAGS"
  1512. ])
  1513. if test "x$USE_NSS" = "xyes"; then
  1514. AC_MSG_NOTICE([detected NSS version $version])
  1515. dnl when shared libs were found in a path that the run-time
  1516. dnl linker doesn't search through, we need to add it to
  1517. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1518. dnl due to this
  1519. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
  1520. export LD_LIBRARY_PATH
  1521. AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
  1522. fi
  1523. fi
  1524. fi dnl NSS not disabled
  1525. fi dnl OPENSSL != 1 -a GNUTLS_ENABLED != 1
  1526. if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED" = "x"; then
  1527. AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
  1528. AC_MSG_WARN([Use --with-ssl, --with-gnutls or --with-nss to address this.])
  1529. else
  1530. # SSL is enabled, genericly
  1531. AC_SUBST(SSL_ENABLED)
  1532. SSL_ENABLED="1"
  1533. fi
  1534. dnl **********************************************************************
  1535. dnl Check for the CA bundle
  1536. dnl **********************************************************************
  1537. CURL_CHECK_CA_BUNDLE
  1538. dnl **********************************************************************
  1539. dnl Check for the presence of IDN libraries and headers
  1540. dnl **********************************************************************
  1541. AC_MSG_CHECKING([whether to build with libidn])
  1542. AC_ARG_WITH(libidn,
  1543. AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
  1544. AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
  1545. [LIBIDN="$withval"])
  1546. case "$LIBIDN" in
  1547. no)
  1548. AC_MSG_RESULT(no)
  1549. ;;
  1550. *) AC_MSG_RESULT(yes)
  1551. idn=""
  1552. dnl if there is a given path, check that FIRST
  1553. if test -n "$LIBIDN"; then
  1554. if test "x$LIBIDN" != "xyes"; then
  1555. oldLDFLAGS=$LDFLAGS
  1556. oldCPPFLAGS=$CPPFLAGS
  1557. LDFLAGS="$LDFLAGS -L$LIBIDN/lib"
  1558. CPPFLAGS="$CPPFLAGS -I$LIBIDN/include"
  1559. idn="yes"
  1560. AC_CHECK_LIB(idn, idna_to_ascii_4i, ,
  1561. idn=""
  1562. LDFLAGS=$oldLDFLAGS
  1563. CPPFLAGS=$oldCPPFLAGS)
  1564. fi
  1565. fi
  1566. if test "x$idn" != "xyes"; then
  1567. dnl check with default paths
  1568. idn="yes"
  1569. AC_CHECK_LIB(idn, idna_to_ascii_lz, ,
  1570. idn="")
  1571. fi
  1572. if test "x$idn" = "xyes"; then
  1573. curl_idn_msg="enabled"
  1574. AC_SUBST(IDN_ENABLED, [1])
  1575. dnl different versions of libidn have different setups of these:
  1576. AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror)
  1577. AC_CHECK_HEADERS( idn-free.h tld.h )
  1578. fi
  1579. ;;
  1580. esac
  1581. dnl Default is to try the thread-safe versions of a few functions
  1582. OPT_THREAD=on
  1583. dnl detect AIX 4.3 or later
  1584. dnl see full docs on this reasoning in the lib/hostip.c source file
  1585. AC_MSG_CHECKING([AIX 4.3 or later])
  1586. AC_PREPROC_IFELSE([
  1587. #if defined(_AIX) && defined(_AIX43)
  1588. printf("just fine");
  1589. #else
  1590. #error "this is not AIX 4.3 or later"
  1591. #endif
  1592. ],
  1593. [ AC_MSG_RESULT([yes])
  1594. RECENTAIX=yes
  1595. OPT_THREAD=off ],
  1596. [ AC_MSG_RESULT([no]) ]
  1597. )
  1598. AC_ARG_ENABLE(thread,dnl
  1599. AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
  1600. AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
  1601. [ case "$enableval" in
  1602. no)
  1603. OPT_THREAD=off
  1604. AC_MSG_WARN(libcurl will not get built using thread-safe functions)
  1605. ;;
  1606. *)
  1607. ;;
  1608. esac
  1609. ]
  1610. )
  1611. if test X"$OPT_THREAD" = Xoff
  1612. then
  1613. AC_DEFINE(DISABLED_THREADSAFE, 1,
  1614. [Set to explicitly specify we don't want to use thread-safe functions])
  1615. else
  1616. if test "$ipv6" != "yes"; then
  1617. dnl dig around for gethostbyname_r()
  1618. CURL_CHECK_GETHOSTBYNAME_R()
  1619. dnl dig around for gethostbyaddr_r()
  1620. dnl CURL_CHECK_GETHOSTBYADDR_R()
  1621. fi
  1622. dnl poke around for inet_ntoa_r()
  1623. CURL_CHECK_INET_NTOA_R()
  1624. dnl is there a localtime_r()
  1625. CURL_CHECK_LOCALTIME_R()
  1626. dnl is there a strerror_r()
  1627. CURL_CHECK_STRERROR_R()
  1628. checkfor_gmtime_r="yes"
  1629. fi
  1630. dnl for recent AIX versions, we skip all the thread-safe checks above since
  1631. dnl they claim a thread-safe libc using the standard API. But there are
  1632. dnl some functions still not thread-safe. Check for these!
  1633. dnl Let's hope this split URL remains working:
  1634. dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
  1635. dnl genprogc/thread_quick_ref.htm
  1636. if test "x$RECENTAIX" = "xyes"; then
  1637. AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
  1638. dnl is there a localtime_r()
  1639. CURL_CHECK_LOCALTIME_R()
  1640. dnl is there a strerror_r()
  1641. CURL_CHECK_STRERROR_R()
  1642. checkfor_gmtime_r="yes"
  1643. fi
  1644. if test x$cross_compiling != xyes; then
  1645. if test x$checkfor_gmtime_r = xyes; then
  1646. dnl if gmtime_r was found, verify that it actually works, as (at least) HPUX
  1647. dnl 10.20 is known to have a buggy one. If it doesn't work, disable use of
  1648. dnl it.
  1649. AC_MSG_CHECKING([if gmtime_r exists and works])
  1650. AC_RUN_IFELSE([[
  1651. #include <time.h>
  1652. int main(void)
  1653. {
  1654. time_t local = 1170352587;
  1655. struct tm *gmt;
  1656. struct tm keeper;
  1657. putenv("TZ=CST6CDT");
  1658. tzset();
  1659. gmt = gmtime_r(&local, &keeper);
  1660. if(gmt) {
  1661. return 0;
  1662. }
  1663. return 1; /* failure */
  1664. }
  1665. ]],
  1666. dnl success, do nothing
  1667. AC_MSG_RESULT(yes)
  1668. AC_DEFINE(HAVE_GMTIME_R, 1, [if you have (a working) gmtime_r])
  1669. ,
  1670. dnl failure, now disable the function
  1671. AC_MSG_RESULT(no)
  1672. ,
  1673. dnl not invoked when crosscompiling)
  1674. echo "hej"
  1675. )
  1676. fi
  1677. else
  1678. dnl and for crosscompiling
  1679. AC_CHECK_FUNCS(gmtime_r)
  1680. fi
  1681. dnl **********************************************************************
  1682. dnl Back to "normal" configuring
  1683. dnl **********************************************************************
  1684. dnl Checks for header files.
  1685. AC_HEADER_STDC
  1686. CURL_CHECK_HEADER_MALLOC
  1687. dnl Now check for the very most basic headers. Then we can use these
  1688. dnl ones as default-headers when checking for the rest!
  1689. AC_CHECK_HEADERS(
  1690. sys/types.h \
  1691. sys/time.h \
  1692. sys/select.h \
  1693. sys/socket.h \
  1694. sys/ioctl.h \
  1695. assert.h \
  1696. unistd.h \
  1697. stdlib.h \
  1698. limits.h \
  1699. arpa/inet.h \
  1700. net/if.h \
  1701. netinet/in.h \
  1702. sys/un.h \
  1703. netinet/tcp.h \
  1704. netdb.h \
  1705. sys/sockio.h \
  1706. sys/stat.h \
  1707. sys/param.h \
  1708. termios.h \
  1709. termio.h \
  1710. sgtty.h \
  1711. fcntl.h \
  1712. alloca.h \
  1713. time.h \
  1714. io.h \
  1715. pwd.h \
  1716. utime.h \
  1717. sys/utime.h \
  1718. sys/poll.h \
  1719. poll.h \
  1720. sys/resource.h \
  1721. libgen.h \
  1722. locale.h \
  1723. errno.h \
  1724. stdbool.h \
  1725. arpa/tftp.h \
  1726. sys/filio.h \
  1727. setjmp.h,
  1728. dnl to do if not found
  1729. [],
  1730. dnl to do if found
  1731. [],
  1732. dnl default includes
  1733. [
  1734. #ifdef HAVE_SYS_TYPES_H
  1735. #include <sys/types.h>
  1736. #endif
  1737. #ifdef HAVE_SYS_TIME_H
  1738. #include <sys/time.h>
  1739. #endif
  1740. #ifdef HAVE_SYS_SELECT_H
  1741. #include <sys/select.h>
  1742. #endif
  1743. #ifdef HAVE_SYS_SOCKET_H
  1744. #include <sys/socket.h>
  1745. #endif
  1746. #ifdef HAVE_NETINET_IN_H
  1747. #include <netinet/in.h>
  1748. #endif
  1749. #ifdef HAVE_SYS_UN_H
  1750. #include <sys/un.h>
  1751. #endif
  1752. ]
  1753. )
  1754. dnl Checks for typedefs, structures, and compiler characteristics.
  1755. AC_C_CONST
  1756. CURL_CHECK_VARIADIC_MACROS
  1757. AC_TYPE_SIZE_T
  1758. AC_HEADER_TIME
  1759. CURL_CHECK_STRUCT_TIMEVAL
  1760. CURL_VERIFY_RUNTIMELIBS
  1761. AC_CHECK_SIZEOF(size_t)
  1762. AC_CHECK_SIZEOF(int)
  1763. AC_CHECK_SIZEOF(long)
  1764. CURL_CONFIGURE_LONG
  1765. AC_CHECK_SIZEOF(time_t)
  1766. AC_CHECK_SIZEOF(off_t)
  1767. soname_bump=no
  1768. if test x"$ac_cv_native_windows" != "xyes" &&
  1769. test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
  1770. AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
  1771. AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
  1772. soname_bump=yes
  1773. fi
  1774. AC_CHECK_TYPE(long long,
  1775. [AC_DEFINE(HAVE_LONGLONG, 1,
  1776. [Define to 1 if the compiler supports the 'long long' data type.])]
  1777. longlong="yes"
  1778. )
  1779. if test "xyes" = "x$longlong"; then
  1780. AC_MSG_CHECKING([if numberLL works])
  1781. AC_COMPILE_IFELSE([long long val = 1000LL;],
  1782. [AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
  1783. AC_MSG_RESULT(yes),
  1784. AC_MSG_RESULT(no)
  1785. )
  1786. fi
  1787. # check for ssize_t
  1788. AC_CHECK_TYPE(ssize_t, ,
  1789. AC_DEFINE(ssize_t, int, [the signed version of size_t]))
  1790. # check for bool type
  1791. AC_CHECK_TYPE([bool],[
  1792. AC_DEFINE(HAVE_BOOL_T, 1,
  1793. [Define to 1 if bool is an available type.])
  1794. ], ,[
  1795. #ifdef HAVE_SYS_TYPES_H
  1796. #include <sys/types.h>
  1797. #endif
  1798. #ifdef HAVE_STDBOOL_H
  1799. #include <stdbool.h>
  1800. #endif
  1801. ])
  1802. # Check for socklen_t or equivalent
  1803. CURL_CHECK_TYPE_SOCKLEN_T
  1804. TYPE_IN_ADDR_T
  1805. TYPE_SOCKADDR_STORAGE
  1806. TYPE_SIG_ATOMIC_T
  1807. AC_TYPE_SIGNAL
  1808. CURL_CHECK_FUNC_SELECT
  1809. CURL_CHECK_FUNC_RECV
  1810. CURL_CHECK_FUNC_RECVFROM
  1811. CURL_CHECK_FUNC_SEND
  1812. CURL_CHECK_MSG_NOSIGNAL
  1813. dnl Checks for library functions.
  1814. dnl AC_PROG_GCC_TRADITIONAL
  1815. dnl AC_FUNC_VPRINTF
  1816. case $host in
  1817. *msdosdjgpp)
  1818. ac_cv_func_pipe=no
  1819. skipcheck_pipe=yes
  1820. AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
  1821. ;;
  1822. esac
  1823. AC_CHECK_FUNCS([basename \
  1824. closesocket \
  1825. fork \
  1826. ftruncate \
  1827. geteuid \
  1828. gethostbyaddr \
  1829. getpass_r \
  1830. getppid \
  1831. getprotobyname \
  1832. getpwuid \
  1833. getrlimit \
  1834. gettimeofday \
  1835. inet_addr \
  1836. inet_ntoa \
  1837. inet_pton \
  1838. perror \
  1839. pipe \
  1840. poll \
  1841. setlocale \
  1842. setmode \
  1843. setrlimit \
  1844. sigaction \
  1845. siginterrupt \
  1846. signal \
  1847. sigsetjmp \
  1848. socket \
  1849. strcasecmp \
  1850. strcasestr \
  1851. strcmpi \
  1852. strdup \
  1853. stricmp \
  1854. strlcat \
  1855. strstr \
  1856. strtok_r \
  1857. strtoll \
  1858. uname \
  1859. utime
  1860. ],[
  1861. ],[
  1862. func="$ac_func"
  1863. eval skipcheck=\$skipcheck_$func
  1864. if test "x$skipcheck" != "xyes"; then
  1865. AC_MSG_CHECKING([deeper for $func])
  1866. AC_LINK_IFELSE([
  1867. AC_LANG_PROGRAM([[
  1868. ]],[[
  1869. $func ();
  1870. ]])
  1871. ],[
  1872. AC_MSG_RESULT([yes])
  1873. eval "ac_cv_func_$func=yes"
  1874. AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$func])], [1],
  1875. [Define to 1 if you have the $func function.])
  1876. ],[
  1877. AC_MSG_RESULT([but still no])
  1878. ])
  1879. fi
  1880. ])
  1881. dnl sigsetjmp() might be a macro and no function so if it isn't found already
  1882. dnl we make an extra check here!
  1883. if test "$ac_cv_func_sigsetjmp" != "yes"; then
  1884. AC_MSG_CHECKING([for sigsetjmp defined as macro])
  1885. AC_LINK_IFELSE([
  1886. AC_LANG_PROGRAM([[
  1887. #include <setjmp.h>
  1888. ]],[[
  1889. sigjmp_buf jmpenv;
  1890. sigsetjmp(jmpenv, 1);
  1891. ]])
  1892. ],[
  1893. AC_MSG_RESULT([yes])
  1894. AC_DEFINE(HAVE_SIGSETJMP, 1, [If you have sigsetjmp])
  1895. ],[
  1896. AC_MSG_RESULT([no])
  1897. ])
  1898. fi
  1899. AC_CHECK_DECL(basename, ,
  1900. AC_DEFINE(NEED_BASENAME_PROTO, 1, [If you lack a fine basename() prototype]),
  1901. #ifdef HAVE_STRING_H
  1902. #include <string.h>
  1903. #endif
  1904. #ifdef HAVE_LIBGEN_H
  1905. #include <libgen.h>
  1906. #endif
  1907. #ifdef HAVE_UNISTD_H
  1908. #include <unistd.h>
  1909. #endif
  1910. )
  1911. AC_CHECK_DECL(inet_pton, ,
  1912. AC_DEFINE(HAVE_NO_INET_PTON_PROTO, 1,
  1913. [Defined if no inet_pton() prototype available]),
  1914. [
  1915. #ifdef HAVE_ARPA_INET_H
  1916. #include <arpa/inet.h>
  1917. #endif
  1918. ]
  1919. )
  1920. dnl Check if the getnameinfo function is available
  1921. dnl and get the types of five of its arguments.
  1922. CURL_CHECK_FUNC_GETNAMEINFO
  1923. if test "$ipv6" = "yes"; then
  1924. CURL_CHECK_WORKING_GETADDRINFO
  1925. CURL_CHECK_NI_WITHSCOPEID
  1926. fi
  1927. AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
  1928. disable_poll=no
  1929. case $host in
  1930. *-*-darwin*)
  1931. disable_poll="yes";
  1932. ;;
  1933. *)
  1934. ;;
  1935. esac
  1936. AC_MSG_RESULT($disable_poll)
  1937. if test "$disable_poll" = "no"; then
  1938. dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
  1939. dnl to find out we make an extra check here!
  1940. if test "$ac_cv_func_poll" = "yes"; then
  1941. AC_MSG_CHECKING([if poll works with NULL inputs])
  1942. AC_RUN_IFELSE([
  1943. #ifdef HAVE_SYS_POLL_H
  1944. #include <sys/poll.h>
  1945. #elif defined(HAVE_POLL_H)
  1946. #include <poll.h>
  1947. #endif
  1948. int main(void)
  1949. {
  1950. /* make this return 0 == timeout since there's nothing to read from */
  1951. return poll((void *)0, 0, 10 /*ms*/);
  1952. }
  1953. ],
  1954. AC_MSG_RESULT(yes)
  1955. AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
  1956. AC_MSG_RESULT(no),
  1957. AC_MSG_RESULT(cross-compiling assumes yes)
  1958. AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
  1959. ) dnl end of AC_RUN_IFELSE
  1960. fi dnl poll() was found
  1961. fi dnl poll()-check is not disabled
  1962. AC_PATH_PROG( PERL, perl, ,
  1963. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  1964. AC_SUBST(PERL)
  1965. AC_PATH_PROGS( NROFF, gnroff nroff, ,
  1966. $PATH:/usr/bin/:/usr/local/bin )
  1967. AC_SUBST(NROFF)
  1968. if test -n "$NROFF"; then
  1969. dnl only check for nroff options if an nroff command was found
  1970. AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  1971. MANOPT="-man"
  1972. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  1973. if test -z "$mancheck"; then
  1974. MANOPT="-mandoc"
  1975. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  1976. if test -z "$mancheck"; then
  1977. MANOPT=""
  1978. AC_MSG_RESULT([failed])
  1979. AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
  1980. else
  1981. AC_MSG_RESULT([$MANOPT])
  1982. fi
  1983. else
  1984. AC_MSG_RESULT([$MANOPT])
  1985. fi
  1986. AC_SUBST(MANOPT)
  1987. fi
  1988. if test -z "$MANOPT"
  1989. then
  1990. dnl if no nroff tool was found, or no option that could convert man pages
  1991. dnl was found, then disable the built-in manual stuff
  1992. AC_MSG_WARN([disabling built-in manual])
  1993. USE_MANUAL="no";
  1994. fi
  1995. dnl *************************************************************************
  1996. dnl If the manual variable still is set, then we go with providing a built-in
  1997. dnl manual
  1998. if test "$USE_MANUAL" = "1"; then
  1999. AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
  2000. curl_manual_msg="enabled"
  2001. fi
  2002. dnl set variable for use in automakefile(s)
  2003. AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
  2004. AC_MSG_CHECKING([whether to enable c-ares])
  2005. AC_ARG_ENABLE(ares,
  2006. AC_HELP_STRING([--enable-ares=PATH],[Enable c-ares for name lookups])
  2007. AC_HELP_STRING([--disable-ares],[Disable c-ares for name lookups]),
  2008. [ case "$enableval" in
  2009. no)
  2010. AC_MSG_RESULT(no)
  2011. ;;
  2012. *) AC_MSG_RESULT(yes)
  2013. if test "x$IPV6_ENABLED" = "x1"; then
  2014. AC_MSG_NOTICE([c-ares may not work properly with ipv6])
  2015. fi
  2016. AC_DEFINE(USE_ARES, 1, [Define if you want to enable c-ares support])
  2017. dnl substitute HAVE_ARES for curl-config and similar
  2018. HAVE_ARES="1"
  2019. AC_SUBST(HAVE_ARES)
  2020. curl_ares_msg="enabled"
  2021. LIBS="-lcares $LIBS"
  2022. dnl For backwards compatibility default to includes/lib in srcdir/ares
  2023. dnl If a value is specified it is assumed that the libs are in $val/lib
  2024. dnl and the includes are in $val/include. This is the default setup for
  2025. dnl ares so it should not be a problem.
  2026. if test "x$enableval" = "xyes" ; then
  2027. if test -d "$srcdir/ares"; then
  2028. aresembedded="yes"
  2029. AC_CONFIG_SUBDIRS(ares)
  2030. aresinc=`cd $srcdir/ares && pwd`
  2031. CPPFLAGS="$CPPFLAGS -I$aresinc"
  2032. dnl the pwd= below cannot 'cd' into the ares dir to get the full
  2033. dnl path to it, since it may not exist yet if we build outside of
  2034. dnl the source tree
  2035. pwd=`pwd`
  2036. LDFLAGS="$LDFLAGS -L$pwd/ares"
  2037. fi
  2038. else
  2039. CPPFLAGS="$CPPFLAGS -I$enableval/include"
  2040. LDFLAGS="$LDFLAGS -L$enableval/lib"
  2041. fi
  2042. if test -z "$aresembedded"; then
  2043. dnl verify that a sufficient c-ares is here if we have pointed one
  2044. dnl out and don't use the "embedded" ares dir (in which case we don't
  2045. dnl check it because it might not have been built yet)
  2046. AC_MSG_CHECKING([that c-ares is good and recent enough])
  2047. AC_LINK_IFELSE([
  2048. AC_LANG_PROGRAM([[
  2049. #include <ares.h>
  2050. /* set of dummy functions in case c-ares was built with debug */
  2051. void curl_dofree() { }
  2052. void curl_sclose() { }
  2053. void curl_domalloc() { }
  2054. void curl_docalloc() { }
  2055. void curl_socket() { }
  2056. ]],[[
  2057. ares_channel channel;
  2058. ares_cancel(channel); /* added in 1.2.0 */
  2059. ares_process_fd(channel, 0, 0); /* added in 1.4.0 */
  2060. ]])
  2061. ],[
  2062. AC_MSG_RESULT([yes])
  2063. ],[
  2064. AC_MSG_RESULT([no])
  2065. AC_MSG_ERROR([c-ares library defective or too old])
  2066. ])
  2067. fi
  2068. ;;
  2069. esac ],
  2070. AC_MSG_RESULT(no)
  2071. )
  2072. dnl ************************************************************
  2073. dnl disable verbose text strings
  2074. dnl
  2075. AC_MSG_CHECKING([whether to enable verbose strings])
  2076. AC_ARG_ENABLE(verbose,
  2077. AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
  2078. AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
  2079. [ case "$enableval" in
  2080. no)
  2081. AC_MSG_RESULT(no)
  2082. AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
  2083. curl_verbose_msg="no"
  2084. ;;
  2085. *) AC_MSG_RESULT(yes)
  2086. ;;
  2087. esac ],
  2088. AC_MSG_RESULT(yes)
  2089. )
  2090. dnl ************************************************************
  2091. dnl enable SSPI support
  2092. dnl
  2093. AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
  2094. AC_ARG_ENABLE(sspi,
  2095. AC_HELP_STRING([--enable-sspi],[Enable SSPI])
  2096. AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
  2097. [ case "$enableval" in
  2098. yes)
  2099. if test "$ac_cv_native_windows" = "yes"; then
  2100. AC_MSG_RESULT(yes)
  2101. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  2102. AC_SUBST(USE_WINDOWS_SSPI, [1])
  2103. curl_sspi_msg="yes"
  2104. else
  2105. AC_MSG_RESULT(no)
  2106. AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
  2107. fi
  2108. ;;
  2109. *)
  2110. AC_MSG_RESULT(no)
  2111. ;;
  2112. esac ],
  2113. AC_MSG_RESULT(no)
  2114. )
  2115. dnl ************************************************************
  2116. dnl lame option to switch on debug options
  2117. dnl
  2118. AC_MSG_CHECKING([whether to enable debug options])
  2119. AC_ARG_ENABLE(debug,
  2120. AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
  2121. AC_HELP_STRING([--disable-debug],[Disable debug options]),
  2122. [ case "$enableval" in
  2123. no)
  2124. AC_MSG_RESULT(no)
  2125. ;;
  2126. *) AC_MSG_RESULT(yes)
  2127. CPPFLAGS="$CPPFLAGS -DCURLDEBUG"
  2128. CFLAGS="$CFLAGS -g"
  2129. dnl set compiler "debug" options to become more picky, and remove
  2130. dnl optimize options from CFLAGS
  2131. CURL_CC_DEBUG_OPTS
  2132. ;;
  2133. esac
  2134. ],
  2135. AC_MSG_RESULT(no)
  2136. )
  2137. dnl ************************************************************
  2138. dnl disable cryptographic authentication
  2139. dnl
  2140. AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
  2141. AC_ARG_ENABLE(crypto-auth,
  2142. AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
  2143. AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
  2144. [ case "$enableval" in
  2145. no)
  2146. AC_MSG_RESULT(no)
  2147. AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
  2148. ;;
  2149. *) AC_MSG_RESULT(yes)
  2150. ;;
  2151. esac ],
  2152. AC_MSG_RESULT(yes)
  2153. )
  2154. dnl ************************************************************
  2155. dnl disable cookies support
  2156. dnl
  2157. AC_MSG_CHECKING([whether to enable support for cookies])
  2158. AC_ARG_ENABLE(cookies,
  2159. AC_HELP_STRING([--enable-cookies],[Enable cookies support])
  2160. AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
  2161. [ case "$enableval" in
  2162. no)
  2163. AC_MSG_RESULT(no)
  2164. AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
  2165. ;;
  2166. *) AC_MSG_RESULT(yes)
  2167. ;;
  2168. esac ],
  2169. AC_MSG_RESULT(yes)
  2170. )
  2171. dnl ************************************************************
  2172. dnl Enable hiding of internal symbols in library to reduce its size and
  2173. dnl speed dynamic linking of applications. This currently is only supported
  2174. dnl on gcc >= 4.0 and SunPro C.
  2175. dnl
  2176. AC_MSG_CHECKING([whether to enable hidden symbols in the library])
  2177. AC_ARG_ENABLE(hidden-symbols,
  2178. AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
  2179. AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
  2180. [ case "$enableval" in
  2181. no)
  2182. AC_MSG_RESULT(no)
  2183. ;;
  2184. *)
  2185. AC_MSG_CHECKING([whether $CC supports it])
  2186. if test "$GCC" = yes ; then
  2187. if $CC --help --verbose 2>&1 | grep fvisibility= > /dev/null ; then
  2188. AC_MSG_RESULT(yes)
  2189. AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
  2190. AC_DEFINE(CURL_EXTERN_SYMBOL, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
  2191. CFLAGS="$CFLAGS -fvisibility=hidden"
  2192. else
  2193. AC_MSG_RESULT(no)
  2194. fi
  2195. else
  2196. dnl Test for SunPro cc
  2197. if $CC 2>&1 | grep flags >/dev/null && $CC -flags | grep xldscope= >/dev/null ; then
  2198. AC_MSG_RESULT(yes)
  2199. AC_DEFINE(CURL_HIDDEN_SYMBOLS, 1, [to enable hidden symbols])
  2200. AC_DEFINE(CURL_EXTERN_SYMBOL, [__global], [to make a symbol visible])
  2201. CFLAGS="$CFLAGS -xldscope=hidden"
  2202. else
  2203. AC_MSG_RESULT(no)
  2204. fi
  2205. fi
  2206. ;;
  2207. esac ],
  2208. AC_MSG_RESULT(no)
  2209. )
  2210. dnl ************************************************************
  2211. dnl enforce SONAME bump
  2212. dnl
  2213. AC_MSG_CHECKING([whether to enforce SONAME bump])
  2214. AC_ARG_ENABLE(soname-bump,
  2215. AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
  2216. AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
  2217. [ case "$enableval" in
  2218. yes) AC_MSG_RESULT(yes)
  2219. soname_bump=yes
  2220. ;;
  2221. *)
  2222. AC_MSG_RESULT(no)
  2223. ;;
  2224. esac ],
  2225. AC_MSG_RESULT($soname_bump)
  2226. )
  2227. AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
  2228. dnl ************************************************************
  2229. if test ! -z "$winsock_LIB"; then
  2230. dnl If ws2_32 is wanted, make sure it is the _last_ lib in LIBS (makes
  2231. dnl things work when built with c-ares). But we can't just move it last
  2232. dnl since then other stuff (SSL) won't build. So we simply append it to the
  2233. dnl end.
  2234. LIBS="$LIBS $winsock_LIB"
  2235. TEST_SERVER_LIBS="$TEST_SERVER_LIBS $winsock_LIB"
  2236. fi
  2237. dnl
  2238. dnl All the library dependencies put into $LIB apply to libcurl only.
  2239. dnl Those in $CURL_LIBS apply to the curl command-line client only.
  2240. dnl Those in $TEST_SERVER_LIBS apply to test servers only.
  2241. dnl Those in $ALL_LIBS apply to all targets, including test targets.
  2242. dnl
  2243. LIBCURL_LIBS=$LIBS
  2244. AC_SUBST(LIBCURL_LIBS)
  2245. AC_SUBST(CURL_LIBS)
  2246. AC_SUBST(TEST_SERVER_LIBS)
  2247. LIBS=$ALL_LIBS dnl LIBS is a magic variable that's used for every link
  2248. AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
  2249. AC_CONFIG_FILES([Makefile \
  2250. docs/Makefile \
  2251. docs/examples/Makefile \
  2252. docs/libcurl/Makefile \
  2253. include/Makefile \
  2254. include/curl/Makefile \
  2255. src/Makefile \
  2256. lib/Makefile \
  2257. tests/Makefile \
  2258. tests/data/Makefile \
  2259. tests/server/Makefile \
  2260. tests/libtest/Makefile \
  2261. packages/Makefile \
  2262. packages/Win32/Makefile \
  2263. packages/Win32/cygwin/Makefile \
  2264. packages/Linux/Makefile \
  2265. packages/Linux/RPM/Makefile \
  2266. packages/Linux/RPM/curl.spec \
  2267. packages/Linux/RPM/curl-ssl.spec \
  2268. packages/Solaris/Makefile \
  2269. packages/DOS/Makefile \
  2270. packages/EPM/curl.list \
  2271. packages/EPM/Makefile \
  2272. packages/vms/Makefile \
  2273. packages/AIX/Makefile \
  2274. packages/AIX/RPM/Makefile \
  2275. packages/AIX/RPM/curl.spec \
  2276. curl-config \
  2277. libcurl.pc
  2278. ])
  2279. AC_OUTPUT
  2280. AC_MSG_NOTICE([Configured to build curl/libcurl:
  2281. curl version: ${VERSION}
  2282. Host setup: ${host}
  2283. Install prefix: ${prefix}
  2284. Compiler: ${CC}
  2285. SSL support: ${curl_ssl_msg}
  2286. SSH support: ${curl_ssh_msg}
  2287. zlib support: ${curl_zlib_msg}
  2288. krb4 support: ${curl_krb4_msg}
  2289. GSSAPI support: ${curl_gss_msg}
  2290. SPNEGO support: ${curl_spnego_msg}
  2291. c-ares support: ${curl_ares_msg}
  2292. ipv6 support: ${curl_ipv6_msg}
  2293. IDN support: ${curl_idn_msg}
  2294. Build libcurl: Shared=${enable_shared}, Static=${enable_static}
  2295. Built-in manual: ${curl_manual_msg}
  2296. Verbose errors: ${curl_verbose_msg}
  2297. SSPI support: ${curl_sspi_msg}
  2298. ca cert bundle: ${ca}
  2299. ca cert path: ${capath}
  2300. LDAP support: ${curl_ldap_msg}
  2301. LDAPS support: ${curl_ldaps_msg}
  2302. ])
  2303. if test "x$soname_bump" = "xyes"; then
  2304. cat <<EOM
  2305. SONAME bump: yes - WARNING: this library will be built with the SONAME
  2306. number bumped due to (a detected) ABI breakage.
  2307. See lib/README.curl_off_t for details on this.
  2308. EOM
  2309. fi