configure.ac 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. #***************************************************************************
  22. dnl Process this file with autoconf to produce a configure script.
  23. AC_PREREQ(2.57)
  24. dnl We don't know the version number "statically" so we use a dash here
  25. AC_INIT([curl], [-], [a suitable curl mailing list: http://curl.haxx.se/mail/])
  26. XC_OVR_ZZ50
  27. XC_OVR_ZZ60
  28. CURL_OVERRIDE_AUTOCONF
  29. dnl configure script copyright
  30. AC_COPYRIGHT([Copyright (c) 1998 - 2013 Daniel Stenberg, <daniel@haxx.se>
  31. This configure script may be copied, distributed and modified under the
  32. terms of the curl license; see COPYING for more details])
  33. AC_CONFIG_SRCDIR([lib/urldata.h])
  34. AC_CONFIG_HEADERS(lib/curl_config.h include/curl/curlbuild.h)
  35. AC_CONFIG_MACRO_DIR([m4])
  36. AM_MAINTAINER_MODE
  37. CURL_CHECK_OPTION_DEBUG
  38. CURL_CHECK_OPTION_OPTIMIZE
  39. CURL_CHECK_OPTION_WARNINGS
  40. CURL_CHECK_OPTION_WERROR
  41. CURL_CHECK_OPTION_CURLDEBUG
  42. CURL_CHECK_OPTION_SYMBOL_HIDING
  43. CURL_CHECK_OPTION_ARES
  44. XC_CHECK_PATH_SEPARATOR
  45. #
  46. # save the configure arguments
  47. #
  48. CONFIGURE_OPTIONS="\"$ac_configure_args\""
  49. AC_SUBST(CONFIGURE_OPTIONS)
  50. CURL_CFLAG_EXTRAS=""
  51. if test X"$want_werror" = Xyes; then
  52. CURL_CFLAG_EXTRAS="-Werror"
  53. fi
  54. AC_SUBST(CURL_CFLAG_EXTRAS)
  55. dnl SED is mandatory for configure process and libtool.
  56. dnl Set it now, allowing it to be changed later.
  57. if test -z "$SED"; then
  58. dnl allow it to be overridden
  59. AC_PATH_PROG([SED], [sed], [not_found],
  60. [$PATH:/usr/bin:/usr/local/bin])
  61. if test -z "$SED" || test "$SED" = "not_found"; then
  62. AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
  63. fi
  64. fi
  65. AC_SUBST([SED])
  66. dnl GREP is mandatory for configure process and libtool.
  67. dnl Set it now, allowing it to be changed later.
  68. if test -z "$GREP"; then
  69. dnl allow it to be overridden
  70. AC_PATH_PROG([GREP], [grep], [not_found],
  71. [$PATH:/usr/bin:/usr/local/bin])
  72. if test -z "$GREP" || test "$GREP" = "not_found"; then
  73. AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
  74. fi
  75. fi
  76. AC_SUBST([GREP])
  77. dnl EGREP is mandatory for configure process and libtool.
  78. dnl Set it now, allowing it to be changed later.
  79. if test -z "$EGREP"; then
  80. dnl allow it to be overridden
  81. if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
  82. AC_MSG_CHECKING([for egrep])
  83. EGREP="$GREP -E"
  84. AC_MSG_RESULT([$EGREP])
  85. else
  86. AC_PATH_PROG([EGREP], [egrep], [not_found],
  87. [$PATH:/usr/bin:/usr/local/bin])
  88. fi
  89. fi
  90. if test -z "$EGREP" || test "$EGREP" = "not_found"; then
  91. AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
  92. fi
  93. AC_SUBST([EGREP])
  94. dnl AR is mandatory for configure process and libtool.
  95. dnl This is target dependent, so check it as a tool.
  96. if test -z "$AR"; then
  97. dnl allow it to be overridden
  98. AC_PATH_TOOL([AR], [ar], [not_found],
  99. [$PATH:/usr/bin:/usr/local/bin])
  100. if test -z "$AR" || test "$AR" = "not_found"; then
  101. AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
  102. fi
  103. fi
  104. AC_SUBST([AR])
  105. AC_SUBST(libext)
  106. dnl Remove non-configure distributed curlbuild.h
  107. if test -f ${srcdir}/include/curl/curlbuild.h; then
  108. rm -f ${srcdir}/include/curl/curlbuild.h
  109. fi
  110. dnl figure out the libcurl version
  111. CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
  112. XC_CHECK_PROG_CC
  113. AM_INIT_AUTOMAKE
  114. AC_MSG_CHECKING([curl version])
  115. AC_MSG_RESULT($CURLVERSION)
  116. AC_SUBST(CURLVERSION)
  117. dnl
  118. dnl we extract the numerical version for curl-config only
  119. VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
  120. AC_SUBST(VERSIONNUM)
  121. dnl Solaris pkgadd support definitions
  122. PKGADD_PKG="HAXXcurl"
  123. PKGADD_NAME="cURL - a client that groks URLs"
  124. PKGADD_VENDOR="curl.haxx.se"
  125. AC_SUBST(PKGADD_PKG)
  126. AC_SUBST(PKGADD_NAME)
  127. AC_SUBST(PKGADD_VENDOR)
  128. dnl
  129. dnl initialize all the info variables
  130. curl_ssl_msg="no (--with-{ssl,gnutls,nss,polarssl,cyassl,axtls,winssl,darwinssl} )"
  131. curl_ssh_msg="no (--with-libssh2)"
  132. curl_zlib_msg="no (--with-zlib)"
  133. curl_krb4_msg="no (--with-krb4*)"
  134. curl_gss_msg="no (--with-gssapi)"
  135. curl_spnego_msg="no (--with-spnego)"
  136. curl_tls_srp_msg="no (--enable-tls-srp)"
  137. curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
  138. curl_ipv6_msg="no (--enable-ipv6)"
  139. curl_idn_msg="no (--with-{libidn,winidn})"
  140. curl_manual_msg="no (--enable-manual)"
  141. curl_libcurl_msg="enabled (--disable-libcurl-option)"
  142. curl_verbose_msg="enabled (--disable-verbose)"
  143. curl_sspi_msg="no (--enable-sspi)"
  144. curl_ldap_msg="no (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
  145. curl_ldaps_msg="no (--enable-ldaps)"
  146. curl_rtsp_msg="no (--enable-rtsp)"
  147. curl_rtmp_msg="no (--with-librtmp)"
  148. curl_mtlnk_msg="no (--with-libmetalink)"
  149. init_ssl_msg=${curl_ssl_msg}
  150. dnl
  151. dnl Save some initial values the user might have provided
  152. dnl
  153. INITIAL_LDFLAGS=$LDFLAGS
  154. INITIAL_LIBS=$LIBS
  155. dnl
  156. dnl Detect the canonical host and target build environment
  157. dnl
  158. AC_CANONICAL_HOST
  159. dnl Get system canonical name
  160. AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS])
  161. dnl Checks for programs.
  162. dnl Our curl_off_t internal and external configure settings
  163. CURL_CONFIGURE_CURL_OFF_T
  164. dnl This defines _ALL_SOURCE for AIX
  165. CURL_CHECK_AIX_ALL_SOURCE
  166. dnl Our configure and build reentrant settings
  167. CURL_CONFIGURE_THREAD_SAFE
  168. CURL_CONFIGURE_REENTRANT
  169. dnl check for how to do large files
  170. AC_SYS_LARGEFILE
  171. XC_LIBTOOL
  172. #
  173. # Automake conditionals based on libtool related checks
  174. #
  175. AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
  176. [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
  177. AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
  178. [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
  179. AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
  180. [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
  181. AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
  182. use_cppflag_building_libcurl="no"
  183. use_cppflag_curl_staticlib="no"
  184. CPPFLAG_CURL_STATICLIB=""
  185. case $host in
  186. *-*-mingw*)
  187. AC_MSG_RESULT(yes)
  188. use_cppflag_building_libcurl="yes"
  189. AC_MSG_CHECKING([if we need CURL_STATICLIB])
  190. if test "X$enable_shared" = "Xno"
  191. then
  192. AC_MSG_RESULT(yes)
  193. use_cppflag_curl_staticlib="yes"
  194. CPPFLAG_CURL_STATICLIB="-DCURL_STATICLIB"
  195. else
  196. AC_MSG_RESULT(no)
  197. fi
  198. ;;
  199. *)
  200. AC_MSG_RESULT(no)
  201. ;;
  202. esac
  203. AM_CONDITIONAL(USE_CPPFLAG_BUILDING_LIBCURL, test x$use_cppflag_building_libcurl = xyes)
  204. AM_CONDITIONAL(USE_CPPFLAG_CURL_STATICLIB, test x$use_cppflag_curl_staticlib = xyes)
  205. AC_SUBST(CPPFLAG_CURL_STATICLIB)
  206. # Determine whether all dependent libraries must be specified when linking
  207. if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
  208. then
  209. REQUIRE_LIB_DEPS=no
  210. else
  211. REQUIRE_LIB_DEPS=yes
  212. fi
  213. AC_SUBST(REQUIRE_LIB_DEPS)
  214. AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
  215. dnl The install stuff has already been taken care of by the automake stuff
  216. dnl AC_PROG_INSTALL
  217. AC_PROG_MAKE_SET
  218. dnl check if there's a way to force code inline
  219. AC_C_INLINE
  220. dnl **********************************************************************
  221. dnl platform/compiler/architecture specific checks/flags
  222. dnl **********************************************************************
  223. CURL_CHECK_COMPILER
  224. CURL_SET_COMPILER_BASIC_OPTS
  225. CURL_SET_COMPILER_DEBUG_OPTS
  226. CURL_SET_COMPILER_OPTIMIZE_OPTS
  227. CURL_SET_COMPILER_WARNING_OPTS
  228. if test "$compiler_id" = "INTEL_UNIX_C"; then
  229. #
  230. if test "$compiler_num" -ge "1000"; then
  231. dnl icc 10.X or later
  232. CFLAGS="$CFLAGS -shared-intel"
  233. elif test "$compiler_num" -ge "900"; then
  234. dnl icc 9.X specific
  235. CFLAGS="$CFLAGS -i-dynamic"
  236. fi
  237. #
  238. fi
  239. CURL_CHECK_COMPILER_HALT_ON_ERROR
  240. CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
  241. CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
  242. CURL_CHECK_COMPILER_SYMBOL_HIDING
  243. CURL_CHECK_CURLDEBUG
  244. AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
  245. supports_unittests=yes
  246. # cross-compilation of unit tests static library/programs fails when
  247. # libcurl shared library is built. This might be due to a libtool or
  248. # automake issue. In this case we disable unit tests.
  249. if test "x$cross_compiling" != "xno" &&
  250. test "x$enable_shared" != "xno"; then
  251. supports_unittests=no
  252. fi
  253. # IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
  254. # a problem related with OpenSSL headers and library versions not matching.
  255. # Disable unit tests while time to further investigate this is found.
  256. case $host in
  257. mips-sgi-irix6.5)
  258. if test "$compiler_id" = "GNU_C"; then
  259. supports_unittests=no
  260. fi
  261. ;;
  262. esac
  263. # All AIX autobuilds fails unit tests linking against unittests library
  264. # due to unittests library being built with no symbols or members. Libtool ?
  265. # Disable unit tests while time to further investigate this is found.
  266. case $host_os in
  267. aix*)
  268. supports_unittests=no
  269. ;;
  270. esac
  271. dnl Build unit tests when option --enable-debug is given.
  272. if test "x$want_debug" = "xyes" &&
  273. test "x$supports_unittests" = "xyes"; then
  274. want_unittests=yes
  275. else
  276. want_unittests=no
  277. fi
  278. AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
  279. dnl **********************************************************************
  280. dnl Compilation based checks should not be done before this point.
  281. dnl **********************************************************************
  282. dnl **********************************************************************
  283. dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
  284. dnl and ws2tcpip.h take precedence over any other further checks which
  285. dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
  286. dnl this specific header files. And do them before its results are used.
  287. dnl **********************************************************************
  288. CURL_CHECK_HEADER_WINDOWS
  289. CURL_CHECK_NATIVE_WINDOWS
  290. case X-"$ac_cv_native_windows" in
  291. X-yes)
  292. CURL_CHECK_HEADER_WINSOCK
  293. CURL_CHECK_HEADER_WINSOCK2
  294. CURL_CHECK_HEADER_WS2TCPIP
  295. CURL_CHECK_HEADER_WINLDAP
  296. CURL_CHECK_HEADER_WINBER
  297. ;;
  298. *)
  299. ac_cv_header_winsock_h="no"
  300. ac_cv_header_winsock2_h="no"
  301. ac_cv_header_ws2tcpip_h="no"
  302. ac_cv_header_winldap_h="no"
  303. ac_cv_header_winber_h="no"
  304. ;;
  305. esac
  306. CURL_CHECK_WIN32_LARGEFILE
  307. dnl ************************************************************
  308. dnl switch off particular protocols
  309. dnl
  310. AC_MSG_CHECKING([whether to support http])
  311. AC_ARG_ENABLE(http,
  312. AC_HELP_STRING([--enable-http],[Enable HTTP support])
  313. AC_HELP_STRING([--disable-http],[Disable HTTP support]),
  314. [ case "$enableval" in
  315. no)
  316. AC_MSG_RESULT(no)
  317. AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
  318. AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
  319. AC_SUBST(CURL_DISABLE_HTTP, [1])
  320. AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
  321. AC_SUBST(CURL_DISABLE_RTSP, [1])
  322. ;;
  323. *) AC_MSG_RESULT(yes)
  324. ;;
  325. esac ],
  326. AC_MSG_RESULT(yes)
  327. )
  328. AC_MSG_CHECKING([whether to support ftp])
  329. AC_ARG_ENABLE(ftp,
  330. AC_HELP_STRING([--enable-ftp],[Enable FTP support])
  331. AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
  332. [ case "$enableval" in
  333. no)
  334. AC_MSG_RESULT(no)
  335. AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
  336. AC_SUBST(CURL_DISABLE_FTP, [1])
  337. ;;
  338. *) AC_MSG_RESULT(yes)
  339. ;;
  340. esac ],
  341. AC_MSG_RESULT(yes)
  342. )
  343. AC_MSG_CHECKING([whether to support file])
  344. AC_ARG_ENABLE(file,
  345. AC_HELP_STRING([--enable-file],[Enable FILE support])
  346. AC_HELP_STRING([--disable-file],[Disable FILE support]),
  347. [ case "$enableval" in
  348. no)
  349. AC_MSG_RESULT(no)
  350. AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
  351. AC_SUBST(CURL_DISABLE_FILE, [1])
  352. ;;
  353. *) AC_MSG_RESULT(yes)
  354. ;;
  355. esac ],
  356. AC_MSG_RESULT(yes)
  357. )
  358. AC_MSG_CHECKING([whether to support ldap])
  359. AC_ARG_ENABLE(ldap,
  360. AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
  361. AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
  362. [ case "$enableval" in
  363. no)
  364. AC_MSG_RESULT(no)
  365. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  366. AC_SUBST(CURL_DISABLE_LDAP, [1])
  367. ;;
  368. *)
  369. AC_MSG_RESULT(yes)
  370. ;;
  371. esac ],[
  372. AC_MSG_RESULT(yes) ]
  373. )
  374. AC_MSG_CHECKING([whether to support ldaps])
  375. AC_ARG_ENABLE(ldaps,
  376. AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
  377. AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
  378. [ case "$enableval" in
  379. no)
  380. AC_MSG_RESULT(no)
  381. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  382. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  383. ;;
  384. *) if test "x$CURL_DISABLE_LDAP" = "x1" ; then
  385. AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
  386. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  387. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  388. else
  389. AC_MSG_RESULT(yes)
  390. AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
  391. AC_SUBST(HAVE_LDAP_SSL, [1])
  392. fi
  393. ;;
  394. esac ],[
  395. if test "x$CURL_DISABLE_LDAP" = "x1" ; then
  396. AC_MSG_RESULT(no)
  397. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  398. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  399. else
  400. AC_MSG_RESULT(yes)
  401. AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
  402. AC_SUBST(HAVE_LDAP_SSL, [1])
  403. fi ]
  404. )
  405. AC_MSG_CHECKING([whether to support rtsp])
  406. AC_ARG_ENABLE(rtsp,
  407. AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
  408. AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
  409. [ case "$enableval" in
  410. no)
  411. AC_MSG_RESULT(no)
  412. AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
  413. AC_SUBST(CURL_DISABLE_RTSP, [1])
  414. ;;
  415. *) if test x$CURL_DISABLE_HTTP = x1 ; then
  416. AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
  417. else
  418. AC_MSG_RESULT(yes)
  419. curl_rtsp_msg="enabled"
  420. fi
  421. ;;
  422. esac ],
  423. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  424. AC_MSG_RESULT(yes)
  425. curl_rtsp_msg="enabled"
  426. else
  427. AC_MSG_RESULT(no)
  428. fi
  429. )
  430. AC_MSG_CHECKING([whether to support proxies])
  431. AC_ARG_ENABLE(proxy,
  432. AC_HELP_STRING([--enable-proxy],[Enable proxy support])
  433. AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
  434. [ case "$enableval" in
  435. no)
  436. AC_MSG_RESULT(no)
  437. AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
  438. AC_SUBST(CURL_DISABLE_PROXY, [1])
  439. ;;
  440. *) AC_MSG_RESULT(yes)
  441. ;;
  442. esac ],
  443. AC_MSG_RESULT(yes)
  444. )
  445. AC_MSG_CHECKING([whether to support dict])
  446. AC_ARG_ENABLE(dict,
  447. AC_HELP_STRING([--enable-dict],[Enable DICT support])
  448. AC_HELP_STRING([--disable-dict],[Disable DICT support]),
  449. [ case "$enableval" in
  450. no)
  451. AC_MSG_RESULT(no)
  452. AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
  453. AC_SUBST(CURL_DISABLE_DICT, [1])
  454. ;;
  455. *) AC_MSG_RESULT(yes)
  456. ;;
  457. esac ],
  458. AC_MSG_RESULT(yes)
  459. )
  460. AC_MSG_CHECKING([whether to support telnet])
  461. AC_ARG_ENABLE(telnet,
  462. AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
  463. AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
  464. [ case "$enableval" in
  465. no)
  466. AC_MSG_RESULT(no)
  467. AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
  468. AC_SUBST(CURL_DISABLE_TELNET, [1])
  469. ;;
  470. *) AC_MSG_RESULT(yes)
  471. ;;
  472. esac ],
  473. AC_MSG_RESULT(yes)
  474. )
  475. AC_MSG_CHECKING([whether to support tftp])
  476. AC_ARG_ENABLE(tftp,
  477. AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
  478. AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
  479. [ case "$enableval" in
  480. no)
  481. AC_MSG_RESULT(no)
  482. AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
  483. AC_SUBST(CURL_DISABLE_TFTP, [1])
  484. ;;
  485. *) AC_MSG_RESULT(yes)
  486. ;;
  487. esac ],
  488. AC_MSG_RESULT(yes)
  489. )
  490. AC_MSG_CHECKING([whether to support pop3])
  491. AC_ARG_ENABLE(pop3,
  492. AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
  493. AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
  494. [ case "$enableval" in
  495. no)
  496. AC_MSG_RESULT(no)
  497. AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
  498. AC_SUBST(CURL_DISABLE_POP3, [1])
  499. ;;
  500. *) AC_MSG_RESULT(yes)
  501. ;;
  502. esac ],
  503. AC_MSG_RESULT(yes)
  504. )
  505. AC_MSG_CHECKING([whether to support imap])
  506. AC_ARG_ENABLE(imap,
  507. AC_HELP_STRING([--enable-imap],[Enable IMAP support])
  508. AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
  509. [ case "$enableval" in
  510. no)
  511. AC_MSG_RESULT(no)
  512. AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
  513. AC_SUBST(CURL_DISABLE_IMAP, [1])
  514. ;;
  515. *) AC_MSG_RESULT(yes)
  516. ;;
  517. esac ],
  518. AC_MSG_RESULT(yes)
  519. )
  520. AC_MSG_CHECKING([whether to support smtp])
  521. AC_ARG_ENABLE(smtp,
  522. AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
  523. AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
  524. [ case "$enableval" in
  525. no)
  526. AC_MSG_RESULT(no)
  527. AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
  528. AC_SUBST(CURL_DISABLE_SMTP, [1])
  529. ;;
  530. *) AC_MSG_RESULT(yes)
  531. ;;
  532. esac ],
  533. AC_MSG_RESULT(yes)
  534. )
  535. AC_MSG_CHECKING([whether to support gopher])
  536. AC_ARG_ENABLE(gopher,
  537. AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
  538. AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
  539. [ case "$enableval" in
  540. no)
  541. AC_MSG_RESULT(no)
  542. AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
  543. AC_SUBST(CURL_DISABLE_GOPHER, [1])
  544. ;;
  545. *) AC_MSG_RESULT(yes)
  546. ;;
  547. esac ],
  548. AC_MSG_RESULT(yes)
  549. )
  550. dnl **********************************************************************
  551. dnl Check for built-in manual
  552. dnl **********************************************************************
  553. AC_MSG_CHECKING([whether to provide built-in manual])
  554. AC_ARG_ENABLE(manual,
  555. AC_HELP_STRING([--enable-manual],[Enable built-in manual])
  556. AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
  557. [ case "$enableval" in
  558. no)
  559. AC_MSG_RESULT(no)
  560. ;;
  561. *) AC_MSG_RESULT(yes)
  562. USE_MANUAL="1"
  563. ;;
  564. esac ],
  565. AC_MSG_RESULT(yes)
  566. USE_MANUAL="1"
  567. )
  568. dnl The actual use of the USE_MANUAL variable is done much later in this
  569. dnl script to allow other actions to disable it as well.
  570. dnl ************************************************************
  571. dnl disable C code generation support
  572. dnl
  573. AC_MSG_CHECKING([whether to enable generation of C code])
  574. AC_ARG_ENABLE(libcurl_option,
  575. AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
  576. AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
  577. [ case "$enableval" in
  578. no)
  579. AC_MSG_RESULT(no)
  580. AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
  581. curl_libcurl_msg="no"
  582. ;;
  583. *) AC_MSG_RESULT(yes)
  584. ;;
  585. esac ],
  586. AC_MSG_RESULT(yes)
  587. )
  588. dnl **********************************************************************
  589. dnl Checks for libraries.
  590. dnl **********************************************************************
  591. AC_MSG_CHECKING([whether to use libgcc])
  592. AC_ARG_ENABLE(libgcc,
  593. AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
  594. [ case "$enableval" in
  595. yes)
  596. LIBS="-lgcc $LIBS"
  597. AC_MSG_RESULT(yes)
  598. ;;
  599. *) AC_MSG_RESULT(no)
  600. ;;
  601. esac ],
  602. AC_MSG_RESULT(no)
  603. )
  604. CURL_CHECK_LIB_XNET
  605. dnl gethostbyname without lib or in the nsl lib?
  606. AC_CHECK_FUNC(gethostbyname,
  607. [HAVE_GETHOSTBYNAME="1"
  608. ],
  609. [ AC_CHECK_LIB(nsl, gethostbyname,
  610. [HAVE_GETHOSTBYNAME="1"
  611. LIBS="-lnsl $LIBS"
  612. ])
  613. ])
  614. if test "$HAVE_GETHOSTBYNAME" != "1"
  615. then
  616. dnl gethostbyname in the socket lib?
  617. AC_CHECK_LIB(socket, gethostbyname,
  618. [HAVE_GETHOSTBYNAME="1"
  619. LIBS="-lsocket $LIBS"
  620. ])
  621. fi
  622. if test "$HAVE_GETHOSTBYNAME" != "1"
  623. then
  624. dnl gethostbyname in the watt lib?
  625. AC_CHECK_LIB(watt, gethostbyname,
  626. [HAVE_GETHOSTBYNAME="1"
  627. CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
  628. LDFLAGS="-L/dev/env/WATT_ROOT/lib"
  629. LIBS="-lwatt $LIBS"
  630. ])
  631. fi
  632. dnl At least one system has been identified to require BOTH nsl and socket
  633. dnl libs at the same time to link properly.
  634. if test "$HAVE_GETHOSTBYNAME" != "1"
  635. then
  636. AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
  637. my_ac_save_LIBS=$LIBS
  638. LIBS="-lnsl -lsocket $LIBS"
  639. AC_LINK_IFELSE([
  640. AC_LANG_PROGRAM([[
  641. ]],[[
  642. gethostbyname();
  643. ]])
  644. ],[
  645. AC_MSG_RESULT([yes])
  646. HAVE_GETHOSTBYNAME="1"
  647. ],[
  648. AC_MSG_RESULT([no])
  649. LIBS=$my_ac_save_LIBS
  650. ])
  651. fi
  652. if test "$HAVE_GETHOSTBYNAME" != "1"
  653. then
  654. dnl This is for winsock systems
  655. if test "$ac_cv_header_windows_h" = "yes"; then
  656. if test "$ac_cv_header_winsock_h" = "yes"; then
  657. case $host in
  658. *-*-mingw32ce*)
  659. winsock_LIB="-lwinsock"
  660. ;;
  661. *)
  662. winsock_LIB="-lwsock32"
  663. ;;
  664. esac
  665. fi
  666. if test "$ac_cv_header_winsock2_h" = "yes"; then
  667. winsock_LIB="-lws2_32"
  668. fi
  669. if test ! -z "$winsock_LIB"; then
  670. my_ac_save_LIBS=$LIBS
  671. LIBS="$winsock_LIB $LIBS"
  672. AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
  673. AC_LINK_IFELSE([
  674. AC_LANG_PROGRAM([[
  675. #ifdef HAVE_WINDOWS_H
  676. #ifndef WIN32_LEAN_AND_MEAN
  677. #define WIN32_LEAN_AND_MEAN
  678. #endif
  679. #include <windows.h>
  680. #ifdef HAVE_WINSOCK2_H
  681. #include <winsock2.h>
  682. #else
  683. #ifdef HAVE_WINSOCK_H
  684. #include <winsock.h>
  685. #endif
  686. #endif
  687. #endif
  688. ]],[[
  689. gethostbyname("www.dummysite.com");
  690. ]])
  691. ],[
  692. AC_MSG_RESULT([yes])
  693. HAVE_GETHOSTBYNAME="1"
  694. ],[
  695. AC_MSG_RESULT([no])
  696. winsock_LIB=""
  697. LIBS=$my_ac_save_LIBS
  698. ])
  699. fi
  700. fi
  701. fi
  702. if test "$HAVE_GETHOSTBYNAME" != "1"
  703. then
  704. dnl This is for Minix 3.1
  705. AC_MSG_CHECKING([for gethostbyname for Minix 3])
  706. AC_LINK_IFELSE([
  707. AC_LANG_PROGRAM([[
  708. /* Older Minix versions may need <net/gen/netdb.h> here instead */
  709. #include <netdb.h>
  710. ]],[[
  711. gethostbyname("www.dummysite.com");
  712. ]])
  713. ],[
  714. AC_MSG_RESULT([yes])
  715. HAVE_GETHOSTBYNAME="1"
  716. ],[
  717. AC_MSG_RESULT([no])
  718. ])
  719. fi
  720. if test "$HAVE_GETHOSTBYNAME" != "1"
  721. then
  722. dnl This is for eCos with a stubbed DNS implementation
  723. AC_MSG_CHECKING([for gethostbyname for eCos])
  724. AC_LINK_IFELSE([
  725. AC_LANG_PROGRAM([[
  726. #include <stdio.h>
  727. #include <netdb.h>
  728. ]],[[
  729. gethostbyname("www.dummysite.com");
  730. ]])
  731. ],[
  732. AC_MSG_RESULT([yes])
  733. HAVE_GETHOSTBYNAME="1"
  734. ],[
  735. AC_MSG_RESULT([no])
  736. ])
  737. fi
  738. if test "$HAVE_GETHOSTBYNAME" != "1"
  739. then
  740. dnl gethostbyname in the network lib - for Haiku OS
  741. AC_CHECK_LIB(network, gethostbyname,
  742. [HAVE_GETHOSTBYNAME="1"
  743. LIBS="-lnetwork $LIBS"
  744. ])
  745. fi
  746. if test "$HAVE_GETHOSTBYNAME" != "1"
  747. then
  748. dnl gethostbyname in the net lib - for BeOS
  749. AC_CHECK_LIB(net, gethostbyname,
  750. [HAVE_GETHOSTBYNAME="1"
  751. LIBS="-lnet $LIBS"
  752. ])
  753. fi
  754. if test "$HAVE_GETHOSTBYNAME" != "1"; then
  755. AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
  756. fi
  757. dnl resolve lib?
  758. AC_CHECK_FUNC(strcasecmp, , [ AC_CHECK_LIB(resolve, strcasecmp) ])
  759. if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
  760. AC_CHECK_LIB(resolve, strcasecmp,
  761. [LIBS="-lresolve $LIBS"],
  762. ,
  763. -lnsl)
  764. fi
  765. ac_cv_func_strcasecmp="no"
  766. CURL_CHECK_LIBS_CONNECT
  767. CURL_NETWORK_LIBS=$LIBS
  768. dnl **********************************************************************
  769. dnl In case that function clock_gettime with monotonic timer is available,
  770. dnl check for additional required libraries.
  771. dnl **********************************************************************
  772. CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  773. dnl **********************************************************************
  774. dnl The preceding library checks are all potentially useful for test
  775. dnl servers and libtest cases which require networking and clock_gettime
  776. dnl support. Save the list of required libraries at this point for use
  777. dnl while linking those test servers and programs.
  778. dnl **********************************************************************
  779. CURL_NETWORK_AND_TIME_LIBS=$LIBS
  780. dnl **********************************************************************
  781. dnl Check for the presence of ZLIB libraries and headers
  782. dnl **********************************************************************
  783. dnl Check for & handle argument to --with-zlib.
  784. clean_CPPFLAGS=$CPPFLAGS
  785. clean_LDFLAGS=$LDFLAGS
  786. clean_LIBS=$LIBS
  787. ZLIB_LIBS=""
  788. AC_ARG_WITH(zlib,
  789. AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
  790. AC_HELP_STRING([--without-zlib],[disable use of zlib]),
  791. [OPT_ZLIB="$withval"])
  792. if test "$OPT_ZLIB" = "no" ; then
  793. AC_MSG_WARN([zlib disabled])
  794. else
  795. if test "$OPT_ZLIB" = "yes" ; then
  796. OPT_ZLIB=""
  797. fi
  798. if test -z "$OPT_ZLIB" ; then
  799. dnl check for the lib first without setting any new path, since many
  800. dnl people have it in the default path
  801. AC_CHECK_LIB(z, inflateEnd,
  802. dnl libz found, set the variable
  803. [HAVE_LIBZ="1"
  804. LIBS="-lz $LIBS"],
  805. dnl if no lib found, try /usr/local
  806. [OPT_ZLIB="/usr/local"])
  807. fi
  808. dnl Add a nonempty path to the compiler flags
  809. if test -n "$OPT_ZLIB"; then
  810. CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
  811. LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
  812. fi
  813. AC_CHECK_HEADER(zlib.h,
  814. [
  815. dnl zlib.h was found
  816. HAVE_ZLIB_H="1"
  817. dnl if the lib wasn't found already, try again with the new paths
  818. if test "$HAVE_LIBZ" != "1"; then
  819. AC_CHECK_LIB(z, gzread,
  820. [
  821. dnl the lib was found!
  822. HAVE_LIBZ="1"
  823. LIBS="-lz $LIBS"
  824. ],
  825. [ CPPFLAGS=$clean_CPPFLAGS
  826. LDFLAGS=$clean_LDFLAGS])
  827. fi
  828. ],
  829. [
  830. dnl zlib.h was not found, restore the flags
  831. CPPFLAGS=$clean_CPPFLAGS
  832. LDFLAGS=$clean_LDFLAGS]
  833. )
  834. if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
  835. then
  836. AC_MSG_WARN([configure found only the libz lib, not the header file!])
  837. HAVE_LIBZ=""
  838. CPPFLAGS=$clean_CPPFLAGS
  839. LDFLAGS=$clean_LDFLAGS
  840. LIBS=$clean_LIBS
  841. elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
  842. then
  843. AC_MSG_WARN([configure found only the libz header file, not the lib!])
  844. CPPFLAGS=$clean_CPPFLAGS
  845. LDFLAGS=$clean_LDFLAGS
  846. LIBS=$clean_LIBS
  847. elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
  848. then
  849. dnl both header and lib were found!
  850. AC_SUBST(HAVE_LIBZ)
  851. AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
  852. AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
  853. ZLIB_LIBS="-lz"
  854. LIBS="-lz $clean_LIBS"
  855. dnl replace 'HAVE_LIBZ' in the automake makefile.ams
  856. AMFIXLIB="1"
  857. AC_MSG_NOTICE([found both libz and libz.h header])
  858. curl_zlib_msg="enabled"
  859. fi
  860. fi
  861. dnl set variable for use in automakefile(s)
  862. AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
  863. AC_SUBST(ZLIB_LIBS)
  864. dnl **********************************************************************
  865. dnl Check for LDAP
  866. dnl **********************************************************************
  867. LDAPLIBNAME=""
  868. AC_ARG_WITH(ldap-lib,
  869. AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
  870. [LDAPLIBNAME="$withval"])
  871. LBERLIBNAME=""
  872. AC_ARG_WITH(lber-lib,
  873. AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
  874. [LBERLIBNAME="$withval"])
  875. if test x$CURL_DISABLE_LDAP != x1 ; then
  876. CURL_CHECK_HEADER_LBER
  877. CURL_CHECK_HEADER_LDAP
  878. CURL_CHECK_HEADER_LDAPSSL
  879. CURL_CHECK_HEADER_LDAP_SSL
  880. if test -z "$LDAPLIBNAME" ; then
  881. if test "$ac_cv_native_windows" = "yes"; then
  882. dnl Windows uses a single and unique LDAP library name
  883. LDAPLIBNAME="wldap32"
  884. LBERLIBNAME="no"
  885. fi
  886. fi
  887. if test "$LDAPLIBNAME" ; then
  888. AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
  889. AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
  890. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  891. AC_SUBST(CURL_DISABLE_LDAP, [1])
  892. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  893. AC_SUBST(CURL_DISABLE_LDAPS, [1])])
  894. else
  895. dnl Try to find the right ldap libraries for this system
  896. CURL_CHECK_LIBS_LDAP
  897. case X-"$curl_cv_ldap_LIBS" in
  898. X-unknown)
  899. AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
  900. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  901. AC_SUBST(CURL_DISABLE_LDAP, [1])
  902. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  903. AC_SUBST(CURL_DISABLE_LDAPS, [1])
  904. ;;
  905. esac
  906. fi
  907. fi
  908. if test x$CURL_DISABLE_LDAP != x1 ; then
  909. if test "$LBERLIBNAME" ; then
  910. dnl If name is "no" then don't define this library at all
  911. dnl (it's only needed if libldap.so's dependencies are broken).
  912. if test "$LBERLIBNAME" != "no" ; then
  913. AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
  914. AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
  915. AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
  916. AC_SUBST(CURL_DISABLE_LDAP, [1])
  917. AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
  918. AC_SUBST(CURL_DISABLE_LDAPS, [1])])
  919. fi
  920. fi
  921. fi
  922. if test x$CURL_DISABLE_LDAP != x1 ; then
  923. AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
  924. if test "$LDAPLIBNAME" = "wldap32"; then
  925. curl_ldap_msg="enabled (winldap)"
  926. AC_DEFINE(CURL_LDAP_WIN, 1, [Use Windows LDAP implementation])
  927. else
  928. curl_ldap_msg="enabled (OpenLDAP)"
  929. if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
  930. AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
  931. AC_SUBST(USE_OPENLDAP, [1])
  932. fi
  933. fi
  934. fi
  935. if test x$CURL_DISABLE_LDAPS != x1 ; then
  936. curl_ldaps_msg="enabled"
  937. fi
  938. dnl **********************************************************************
  939. dnl Checks for IPv6
  940. dnl **********************************************************************
  941. AC_MSG_CHECKING([whether to enable ipv6])
  942. AC_ARG_ENABLE(ipv6,
  943. AC_HELP_STRING([--enable-ipv6],[Enable ipv6 (with ipv4) support])
  944. AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
  945. [ case "$enableval" in
  946. no)
  947. AC_MSG_RESULT(no)
  948. ipv6=no
  949. ;;
  950. *) AC_MSG_RESULT(yes)
  951. ipv6=yes
  952. ;;
  953. esac ],
  954. AC_TRY_RUN([ /* is AF_INET6 available? */
  955. #include <sys/types.h>
  956. #include <sys/socket.h>
  957. main()
  958. {
  959. if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
  960. exit(1);
  961. else
  962. exit(0);
  963. }
  964. ],
  965. AC_MSG_RESULT(yes)
  966. ipv6=yes,
  967. AC_MSG_RESULT(no)
  968. ipv6=no,
  969. AC_MSG_RESULT(no)
  970. ipv6=no
  971. ))
  972. if test "$ipv6" = "yes"; then
  973. curl_ipv6_msg="enabled"
  974. fi
  975. # Check if struct sockaddr_in6 have sin6_scope_id member
  976. if test "$ipv6" = yes; then
  977. AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
  978. AC_TRY_COMPILE([
  979. #include <sys/types.h>
  980. #include <netinet/in.h>] ,
  981. struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
  982. if test "$have_sin6_scope_id" = yes; then
  983. AC_MSG_RESULT([yes])
  984. AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
  985. else
  986. AC_MSG_RESULT([no])
  987. fi
  988. fi
  989. dnl **********************************************************************
  990. dnl Check if the operating system allows programs to write to their own argv[]
  991. dnl **********************************************************************
  992. AC_MSG_CHECKING([if argv can be written to])
  993. AC_RUN_IFELSE([
  994. AC_LANG_SOURCE([[
  995. int main(int argc, char ** argv) {
  996. argv[0][0] = ' ';
  997. return (argv[0][0] == ' ')?0:1;
  998. }
  999. ]])
  1000. ],[
  1001. curl_cv_writable_argv=yes
  1002. ],[
  1003. curl_cv_writable_argv=no
  1004. ],[
  1005. curl_cv_writable_argv=cross
  1006. ])
  1007. case $curl_cv_writable_argv in
  1008. yes)
  1009. AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
  1010. AC_MSG_RESULT(yes)
  1011. ;;
  1012. no)
  1013. AC_MSG_RESULT(no)
  1014. ;;
  1015. *)
  1016. AC_MSG_RESULT(no)
  1017. AC_MSG_WARN([the previous check could not be made default was used])
  1018. ;;
  1019. esac
  1020. dnl **********************************************************************
  1021. dnl Check for the presence of Kerberos4 libraries and headers
  1022. dnl **********************************************************************
  1023. AC_ARG_WITH(krb4-includes,
  1024. AC_HELP_STRING([--with-krb4-includes=DIR],
  1025. [Specify location of kerberos4 headers]),[
  1026. CPPFLAGS="$CPPFLAGS -I$withval"
  1027. KRB4INC="$withval"
  1028. want_krb4=yes
  1029. ])
  1030. AC_ARG_WITH(krb4-libs,
  1031. AC_HELP_STRING([--with-krb4-libs=DIR],[Specify location of kerberos4 libs]),[
  1032. LDFLAGS="$LDFLAGS -L$withval"
  1033. KRB4LIB="$withval"
  1034. want_krb4=yes
  1035. ])
  1036. OPT_KRB4=off
  1037. AC_ARG_WITH(krb4,dnl
  1038. AC_HELP_STRING([--with-krb4=DIR],[where to look for Kerberos4]),[
  1039. OPT_KRB4="$withval"
  1040. if test X"$OPT_KRB4" != Xno; then
  1041. want_krb4="yes"
  1042. if test X"$OPT_KRB4" != Xyes; then
  1043. LDFLAGS="$LDFLAGS -L$OPT_KRB4/lib$libsuff"
  1044. KRB4LIB="$OPT_KRB4/lib$libsuff"
  1045. CPPFLAGS="$CPPFLAGS -I$OPT_KRB4/include"
  1046. KRB4INC="$OPT_KRB4/include"
  1047. fi
  1048. fi
  1049. ])
  1050. AC_MSG_CHECKING([if Kerberos4 support is requested])
  1051. if test "$want_krb4" = yes
  1052. then
  1053. if test "$ipv6" = "yes"; then
  1054. echo krb4 is not compatible with IPv6
  1055. exit 1
  1056. fi
  1057. AC_MSG_RESULT(yes)
  1058. dnl Check for & handle argument to --with-krb4
  1059. AC_MSG_CHECKING(where to look for Kerberos4)
  1060. if test X"$OPT_KRB4" = Xyes
  1061. then
  1062. AC_MSG_RESULT([defaults])
  1063. else
  1064. AC_MSG_RESULT([libs in $KRB4LIB, headers in $KRB4INC])
  1065. fi
  1066. dnl Check for DES library
  1067. AC_CHECK_LIB(des, des_pcbc_encrypt,
  1068. [
  1069. AC_CHECK_HEADERS(des.h)
  1070. dnl resolv lib?
  1071. AC_CHECK_FUNC(res_search, , [AC_CHECK_LIB(resolv, res_search)])
  1072. dnl Check for the Kerberos4 library
  1073. AC_CHECK_LIB(krb, krb_net_read,
  1074. [
  1075. dnl Check for header files
  1076. AC_CHECK_HEADERS(krb.h)
  1077. dnl we found the required libraries, add to LIBS
  1078. LIBS="-lkrb -lcom_err -ldes $LIBS"
  1079. dnl Check for function krb_get_our_ip_for_realm
  1080. dnl this is needed for NAT networks
  1081. AC_CHECK_FUNCS(krb_get_our_ip_for_realm)
  1082. dnl add define KRB4
  1083. AC_DEFINE(HAVE_KRB4, 1,
  1084. [if you have the Kerberos4 libraries (including -ldes)])
  1085. dnl substitute it too!
  1086. KRB4_ENABLED=1
  1087. AC_SUBST(KRB4_ENABLED)
  1088. curl_krb4_msg="enabled"
  1089. dnl the krb4 stuff needs a strlcpy()
  1090. AC_CHECK_FUNCS(strlcpy)
  1091. ])
  1092. ])
  1093. else
  1094. AC_MSG_RESULT(no)
  1095. fi
  1096. dnl **********************************************************************
  1097. dnl Check for FBopenssl(SPNEGO) libraries
  1098. dnl **********************************************************************
  1099. AC_ARG_WITH(spnego,
  1100. AC_HELP_STRING([--with-spnego=DIR],
  1101. [Specify location of SPNEGO library fbopenssl]), [
  1102. SPNEGO_ROOT="$withval"
  1103. if test x"$SPNEGO_ROOT" != xno; then
  1104. want_spnego="yes"
  1105. fi
  1106. ])
  1107. AC_MSG_CHECKING([if SPNEGO support is requested])
  1108. if test x"$want_spnego" = xyes; then
  1109. if test X"$SPNEGO_ROOT" = Xyes; then
  1110. AC_MSG_ERROR([FBOpenSSL libs and/or directories were not found where specified!])
  1111. AC_MSG_RESULT(no)
  1112. else
  1113. if test -z "$SPNEGO_LIB_DIR"; then
  1114. LDFLAGS="$LDFLAGS -L$SPNEGO_ROOT -lfbopenssl"
  1115. else
  1116. LDFLAGS="$LDFLAGS $SPNEGO_LIB_DIR"
  1117. fi
  1118. AC_MSG_RESULT(yes)
  1119. AC_DEFINE(HAVE_SPNEGO, 1,
  1120. [Define this if you have the SPNEGO library fbopenssl])
  1121. curl_spnego_msg="enabled"
  1122. fi
  1123. else
  1124. AC_MSG_RESULT(no)
  1125. fi
  1126. dnl **********************************************************************
  1127. dnl Check for GSS-API libraries
  1128. dnl **********************************************************************
  1129. dnl check for gss stuff in the /usr as default
  1130. GSSAPI_ROOT="/usr"
  1131. AC_ARG_WITH(gssapi-includes,
  1132. AC_HELP_STRING([--with-gssapi-includes=DIR],
  1133. [Specify location of GSSAPI header]),
  1134. [ GSSAPI_INCS="-I$withval"
  1135. want_gss="yes" ]
  1136. )
  1137. AC_ARG_WITH(gssapi-libs,
  1138. AC_HELP_STRING([--with-gssapi-libs=DIR],
  1139. [Specify location of GSSAPI libs]),
  1140. [ GSSAPI_LIB_DIR="-L$withval"
  1141. want_gss="yes" ]
  1142. )
  1143. AC_ARG_WITH(gssapi,
  1144. AC_HELP_STRING([--with-gssapi=DIR],
  1145. [Where to look for GSSAPI]), [
  1146. GSSAPI_ROOT="$withval"
  1147. if test x"$GSSAPI_ROOT" != xno; then
  1148. want_gss="yes"
  1149. if test x"$GSSAPI_ROOT" = xyes; then
  1150. dnl if yes, then use default root
  1151. GSSAPI_ROOT="/usr"
  1152. fi
  1153. fi
  1154. ])
  1155. save_CPPFLAGS="$CPPFLAGS"
  1156. AC_MSG_CHECKING([if GSSAPI support is requested])
  1157. if test x"$want_gss" = xyes; then
  1158. AC_MSG_RESULT(yes)
  1159. if test -z "$GSSAPI_INCS"; then
  1160. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1161. GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi`
  1162. elif test "$GSSAPI_ROOT" != "yes"; then
  1163. GSSAPI_INCS="-I$GSSAPI_ROOT/include"
  1164. fi
  1165. fi
  1166. CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
  1167. AC_CHECK_HEADER(gss.h,
  1168. [
  1169. dnl found in the given dirs
  1170. AC_DEFINE(HAVE_GSSGNU, 1, [if you have the GNU gssapi libraries])
  1171. gnu_gss=yes
  1172. ],
  1173. [
  1174. dnl not found, check Heimdal or MIT
  1175. AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
  1176. AC_CHECK_HEADERS(
  1177. [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
  1178. [],
  1179. [not_mit=1],
  1180. [
  1181. AC_INCLUDES_DEFAULT
  1182. #ifdef HAVE_GSSAPI_GSSAPI_H
  1183. #include <gssapi/gssapi.h>
  1184. #endif
  1185. ])
  1186. if test "x$not_mit" = "x1"; then
  1187. dnl MIT not found, check for Heimdal
  1188. AC_CHECK_HEADER(gssapi.h,
  1189. [
  1190. dnl found
  1191. AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have the Heimdal gssapi libraries])
  1192. ],
  1193. [
  1194. dnl no header found, disabling GSS
  1195. want_gss=no
  1196. AC_MSG_WARN(disabling GSSAPI since no header files was found)
  1197. ]
  1198. )
  1199. else
  1200. dnl MIT found
  1201. AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
  1202. dnl check if we have a really old MIT kerberos (<= 1.2)
  1203. AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE])
  1204. AC_COMPILE_IFELSE([
  1205. AC_LANG_PROGRAM([[
  1206. #include <gssapi/gssapi.h>
  1207. #include <gssapi/gssapi_generic.h>
  1208. #include <gssapi/gssapi_krb5.h>
  1209. ]],[[
  1210. gss_import_name(
  1211. (OM_uint32 *)0,
  1212. (gss_buffer_t)0,
  1213. GSS_C_NT_HOSTBASED_SERVICE,
  1214. (gss_name_t *)0);
  1215. ]])
  1216. ],[
  1217. AC_MSG_RESULT([yes])
  1218. ],[
  1219. AC_MSG_RESULT([no])
  1220. AC_DEFINE(HAVE_OLD_GSSMIT, 1,
  1221. [if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE])
  1222. ])
  1223. fi
  1224. ]
  1225. )
  1226. else
  1227. AC_MSG_RESULT(no)
  1228. fi
  1229. if test x"$want_gss" = xyes; then
  1230. AC_DEFINE(HAVE_GSSAPI, 1, [if you have the gssapi libraries])
  1231. curl_gss_msg="enabled (MIT/Heimdal)"
  1232. if test -n "$gnu_gss"; then
  1233. curl_gss_msg="enabled (GNU GSS)"
  1234. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1235. LIBS="-lgss $LIBS"
  1236. elif test -z "$GSSAPI_LIB_DIR"; then
  1237. case $host in
  1238. *-*-darwin*)
  1239. LIBS="-lgssapi_krb5 -lresolv $LIBS"
  1240. ;;
  1241. *)
  1242. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1243. dnl krb5-config doesn't have --libs-only-L or similar, put everything
  1244. dnl into LIBS
  1245. gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  1246. LIBS="$gss_libs $LIBS"
  1247. elif test "$GSSAPI_ROOT" != "yes"; then
  1248. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
  1249. LIBS="-lgssapi $LIBS"
  1250. else
  1251. LIBS="-lgssapi $LIBS"
  1252. fi
  1253. ;;
  1254. esac
  1255. else
  1256. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1257. LIBS="-lgssapi $LIBS"
  1258. fi
  1259. else
  1260. CPPFLAGS="$save_CPPFLAGS"
  1261. fi
  1262. dnl -------------------------------------------------
  1263. dnl check winssl option before other SSL libraries
  1264. dnl -------------------------------------------------
  1265. OPT_WINSSL=no
  1266. AC_ARG_WITH(winssl,dnl
  1267. AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
  1268. AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
  1269. OPT_WINSSL=$withval)
  1270. AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
  1271. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1272. if test "x$OPT_WINSSL" != "xno" &&
  1273. test "x$ac_cv_native_windows" = "xyes"; then
  1274. AC_MSG_RESULT(yes)
  1275. AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
  1276. AC_SUBST(USE_SCHANNEL, [1])
  1277. curl_ssl_msg="enabled (Windows-native)"
  1278. WINSSL_ENABLED=1
  1279. # --with-winssl implies --enable-sspi
  1280. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  1281. AC_SUBST(USE_WINDOWS_SSPI, [1])
  1282. curl_sspi_msg="enabled"
  1283. else
  1284. AC_MSG_RESULT(no)
  1285. fi
  1286. else
  1287. AC_MSG_RESULT(no)
  1288. fi
  1289. OPT_DARWINSSL=no
  1290. AC_ARG_WITH(darwinssl,dnl
  1291. AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
  1292. AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
  1293. OPT_DARWINSSL=$withval)
  1294. AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
  1295. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1296. if test "x$OPT_DARWINSSL" != "xno" &&
  1297. test -d "/System/Library/Frameworks/Security.framework"; then
  1298. AC_MSG_RESULT(yes)
  1299. AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
  1300. AC_SUBST(USE_DARWINSSL, [1])
  1301. curl_ssl_msg="enabled (iOS/Mac OS X-native)"
  1302. DARWINSSL_ENABLED=1
  1303. LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
  1304. else
  1305. AC_MSG_RESULT(no)
  1306. fi
  1307. else
  1308. AC_MSG_RESULT(no)
  1309. fi
  1310. dnl **********************************************************************
  1311. dnl Check for the presence of SSL libraries and headers
  1312. dnl **********************************************************************
  1313. dnl Default to compiler & linker defaults for SSL files & libraries.
  1314. OPT_SSL=off
  1315. dnl Default to no CA bundle
  1316. ca="no"
  1317. AC_ARG_WITH(ssl,dnl
  1318. 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])
  1319. AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
  1320. OPT_SSL=$withval)
  1321. if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
  1322. dnl backup the pre-ssl variables
  1323. CLEANLDFLAGS="$LDFLAGS"
  1324. CLEANCPPFLAGS="$CPPFLAGS"
  1325. CLEANLIBS="$LIBS"
  1326. case "$OPT_SSL" in
  1327. yes)
  1328. dnl --with-ssl (without path) used
  1329. if test x$cross_compiling != xyes; then
  1330. dnl only do pkg-config magic when not cross-compiling
  1331. PKGTEST="yes"
  1332. fi
  1333. PREFIX_OPENSSL=/usr/local/ssl
  1334. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1335. ;;
  1336. off)
  1337. dnl no --with-ssl option given, just check default places
  1338. if test x$cross_compiling != xyes; then
  1339. dnl only do pkg-config magic when not cross-compiling
  1340. PKGTEST="yes"
  1341. fi
  1342. PREFIX_OPENSSL=
  1343. ;;
  1344. *)
  1345. dnl check the given --with-ssl spot
  1346. PKGTEST="no"
  1347. PREFIX_OPENSSL=$OPT_SSL
  1348. dnl Try pkg-config even when cross-compiling. Since we
  1349. dnl specify PKG_CONFIG_LIBDIR we're only looking where
  1350. dnl the user told us to look
  1351. OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
  1352. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
  1353. if test -f "$OPENSSL_PCDIR/openssl.pc"; then
  1354. PKGTEST="yes"
  1355. fi
  1356. dnl in case pkg-config comes up empty, use what we got
  1357. dnl via --with-ssl
  1358. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1359. if test "$PREFIX_OPENSSL" != "/usr" ; then
  1360. SSL_LDFLAGS="-L$LIB_OPENSSL"
  1361. SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
  1362. fi
  1363. SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
  1364. ;;
  1365. esac
  1366. if test "$PKGTEST" = "yes"; then
  1367. CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
  1368. if test "$PKGCONFIG" != "no" ; then
  1369. SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1370. $PKGCONFIG --libs-only-l openssl 2>/dev/null`
  1371. SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1372. $PKGCONFIG --libs-only-L openssl 2>/dev/null`
  1373. SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1374. $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
  1375. AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
  1376. AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
  1377. AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
  1378. LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
  1379. dnl use the values pkg-config reported. This is here
  1380. dnl instead of below with CPPFLAGS and LDFLAGS because we only
  1381. dnl learn about this via pkg-config. If we only have
  1382. dnl the argument to --with-ssl we don't know what
  1383. dnl additional libs may be necessary. Hope that we
  1384. dnl don't need any.
  1385. LIBS="$SSL_LIBS $LIBS"
  1386. fi
  1387. fi
  1388. dnl finally, set flags to use SSL
  1389. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  1390. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  1391. dnl This is for Msys/Mingw
  1392. case $host in
  1393. *-*-msys* | *-*-mingw*)
  1394. AC_MSG_CHECKING([for gdi32])
  1395. my_ac_save_LIBS=$LIBS
  1396. LIBS="-lgdi32 $LIBS"
  1397. AC_TRY_LINK([#include <windef.h>
  1398. #include <wingdi.h>],
  1399. [GdiFlush();],
  1400. [ dnl worked!
  1401. AC_MSG_RESULT([yes])],
  1402. [ dnl failed, restore LIBS
  1403. LIBS=$my_ac_save_LIBS
  1404. AC_MSG_RESULT(no)]
  1405. )
  1406. ;;
  1407. esac
  1408. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  1409. HAVECRYPTO="yes"
  1410. LIBS="-lcrypto $LIBS"
  1411. ],[
  1412. LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
  1413. CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  1414. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  1415. HAVECRYPTO="yes"
  1416. LIBS="-lcrypto $LIBS"], [
  1417. LDFLAGS="$CLEANLDFLAGS"
  1418. CPPFLAGS="$CLEANCPPFLAGS"
  1419. LIBS="$CLEANLIBS"
  1420. ])
  1421. ])
  1422. if test X"$HAVECRYPTO" = X"yes"; then
  1423. dnl This is only reasonable to do if crypto actually is there: check for
  1424. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  1425. AC_CHECK_LIB(ssl, SSL_connect)
  1426. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1427. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  1428. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  1429. OLIBS=$LIBS
  1430. LIBS="-lRSAglue -lrsaref $LIBS"
  1431. AC_CHECK_LIB(ssl, SSL_connect)
  1432. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1433. dnl still no SSL_connect
  1434. AC_MSG_RESULT(no)
  1435. LIBS=$OLIBS
  1436. else
  1437. AC_MSG_RESULT(yes)
  1438. fi
  1439. else
  1440. dnl Have the libraries--check for SSLeay/OpenSSL headers
  1441. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  1442. openssl/pem.h openssl/ssl.h openssl/err.h,
  1443. curl_ssl_msg="enabled (OpenSSL)"
  1444. OPENSSL_ENABLED=1
  1445. AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
  1446. if test $ac_cv_header_openssl_x509_h = no; then
  1447. dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
  1448. dnl since 'err.h' might in fact find a krb4 header with the same
  1449. dnl name
  1450. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
  1451. if test $ac_cv_header_x509_h = yes &&
  1452. test $ac_cv_header_crypto_h = yes &&
  1453. test $ac_cv_header_ssl_h = yes; then
  1454. dnl three matches
  1455. curl_ssl_msg="enabled (OpenSSL)"
  1456. OPENSSL_ENABLED=1
  1457. fi
  1458. fi
  1459. fi
  1460. if test X"$OPENSSL_ENABLED" = X"1"; then
  1461. AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
  1462. dnl is there a pkcs12.h header present?
  1463. AC_CHECK_HEADERS(openssl/pkcs12.h)
  1464. else
  1465. LIBS="$CLEANLIBS"
  1466. fi
  1467. dnl USE_SSLEAY is the historical name for what configure calls
  1468. dnl OPENSSL_ENABLED; the names should really be unified
  1469. USE_SSLEAY="$OPENSSL_ENABLED"
  1470. AC_SUBST(USE_SSLEAY)
  1471. if test X"$OPT_SSL" != Xoff &&
  1472. test "$OPENSSL_ENABLED" != "1"; then
  1473. AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
  1474. fi
  1475. fi
  1476. if test X"$OPENSSL_ENABLED" = X"1"; then
  1477. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  1478. dnl stuff, it is kind of "separated" from the main SSL check
  1479. AC_CHECK_FUNC(ENGINE_init,
  1480. [
  1481. AC_CHECK_HEADERS(openssl/engine.h)
  1482. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  1483. ])
  1484. dnl these can only exist if openssl exists
  1485. dnl yassl doesn't have SSL_get_shutdown
  1486. AC_CHECK_FUNCS( RAND_status \
  1487. RAND_screen \
  1488. RAND_egd \
  1489. ENGINE_cleanup \
  1490. CRYPTO_cleanup_all_ex_data \
  1491. SSL_get_shutdown \
  1492. SSLv2_client_method )
  1493. dnl Make an attempt to detect if this is actually yassl's headers and
  1494. dnl OpenSSL emulation layer. We still leave everything else believing
  1495. dnl and acting like OpenSSL.
  1496. AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
  1497. AC_COMPILE_IFELSE([
  1498. AC_LANG_PROGRAM([[
  1499. #include <openssl/ssl.h>
  1500. ]],[[
  1501. #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
  1502. int dummy = SSL_ERROR_NONE;
  1503. #else
  1504. Not the yaSSL OpenSSL compatibility header.
  1505. #endif
  1506. ]])
  1507. ],[
  1508. AC_MSG_RESULT([yes])
  1509. AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
  1510. [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
  1511. curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
  1512. ],[
  1513. AC_MSG_RESULT([no])
  1514. ])
  1515. fi
  1516. if test "$OPENSSL_ENABLED" = "1"; then
  1517. if test -n "$LIB_OPENSSL"; then
  1518. dnl when the ssl shared libs were found in a path that the run-time
  1519. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1520. dnl to prevent further configure tests to fail due to this
  1521. if test "x$cross_compiling" != "xyes"; then
  1522. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
  1523. export LD_LIBRARY_PATH
  1524. AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  1525. fi
  1526. fi
  1527. CURL_CHECK_OPENSSL_API
  1528. fi
  1529. fi
  1530. dnl **********************************************************************
  1531. dnl Check for the random seed preferences
  1532. dnl **********************************************************************
  1533. if test X"$OPENSSL_ENABLED" = X"1"; then
  1534. AC_ARG_WITH(egd-socket,
  1535. AC_HELP_STRING([--with-egd-socket=FILE],
  1536. [Entropy Gathering Daemon socket pathname]),
  1537. [ EGD_SOCKET="$withval" ]
  1538. )
  1539. if test -n "$EGD_SOCKET" ; then
  1540. AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
  1541. [your Entropy Gathering Daemon socket pathname] )
  1542. fi
  1543. dnl Check for user-specified random device
  1544. AC_ARG_WITH(random,
  1545. AC_HELP_STRING([--with-random=FILE],
  1546. [read randomness from FILE (default=/dev/urandom)]),
  1547. [ RANDOM_FILE="$withval" ],
  1548. [
  1549. if test x$cross_compiling != xyes; then
  1550. dnl Check for random device
  1551. AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
  1552. else
  1553. AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
  1554. fi
  1555. ]
  1556. )
  1557. if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
  1558. AC_SUBST(RANDOM_FILE)
  1559. AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
  1560. [a suitable file to read random data from])
  1561. fi
  1562. fi
  1563. dnl ---
  1564. dnl We require OpenSSL with SRP support.
  1565. dnl ---
  1566. if test "$OPENSSL_ENABLED" = "1"; then
  1567. AC_CHECK_LIB(crypto, SRP_Calc_client_key,
  1568. [
  1569. AC_DEFINE(HAVE_SSLEAY_SRP, 1, [if you have the function SRP_Calc_client_key])
  1570. AC_SUBST(HAVE_SSLEAY_SRP, [1])
  1571. ])
  1572. fi
  1573. dnl ----------------------------------------------------
  1574. dnl check for GnuTLS
  1575. dnl ----------------------------------------------------
  1576. dnl Default to compiler & linker defaults for GnuTLS files & libraries.
  1577. OPT_GNUTLS=no
  1578. AC_ARG_WITH(gnutls,dnl
  1579. AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
  1580. AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
  1581. OPT_GNUTLS=$withval)
  1582. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1583. if test X"$OPT_GNUTLS" != Xno; then
  1584. addld=""
  1585. addlib=""
  1586. gtlslib=""
  1587. version=""
  1588. addcflags=""
  1589. if test "x$OPT_GNUTLS" = "xyes"; then
  1590. dnl this is with no partiular path given
  1591. CURL_CHECK_PKGCONFIG(gnutls)
  1592. if test "$PKGCONFIG" != "no" ; then
  1593. addlib=`$PKGCONFIG --libs-only-l gnutls`
  1594. addld=`$PKGCONFIG --libs-only-L gnutls`
  1595. addcflags=`$PKGCONFIG --cflags-only-I gnutls`
  1596. version=`$PKGCONFIG --modversion gnutls`
  1597. gtlslib=`echo $addld | $SED -e 's/-L//'`
  1598. else
  1599. dnl without pkg-config, we try libgnutls-config as that was how it
  1600. dnl used to be done
  1601. check=`libgnutls-config --version 2>/dev/null`
  1602. if test -n "$check"; then
  1603. addlib=`libgnutls-config --libs`
  1604. addcflags=`libgnutls-config --cflags`
  1605. version=`libgnutls-config --version`
  1606. gtlslib=`libgnutls-config --prefix`/lib$libsuff
  1607. fi
  1608. fi
  1609. else
  1610. dnl this is with a given path, first check if there's a libgnutls-config
  1611. dnl there and if not, make an educated guess
  1612. cfg=$OPT_GNUTLS/bin/libgnutls-config
  1613. check=`$cfg --version 2>/dev/null`
  1614. if test -n "$check"; then
  1615. addlib=`$cfg --libs`
  1616. addcflags=`$cfg --cflags`
  1617. version=`$cfg --version`
  1618. gtlslib=`$cfg --prefix`/lib$libsuff
  1619. else
  1620. dnl without pkg-config and libgnutls-config, we guess a lot!
  1621. addlib=-lgnutls
  1622. addld=-L$OPT_GNUTLS/lib$libsuff
  1623. addcflags=-I$OPT_GNUTLS/include
  1624. version="" # we just don't know
  1625. gtlslib=$OPT_GNUTLS/lib$libsuff
  1626. fi
  1627. fi
  1628. if test -z "$version"; then
  1629. dnl lots of efforts, still no go
  1630. version="unknown"
  1631. fi
  1632. if test -n "$addlib"; then
  1633. CLEANLIBS="$LIBS"
  1634. CLEANCPPFLAGS="$CPPFLAGS"
  1635. CLEANLDFLAGS="$LDFLAGS"
  1636. LIBS="$addlib $LIBS"
  1637. LDFLAGS="$LDFLAGS $addld"
  1638. if test "$addcflags" != "-I/usr/include"; then
  1639. CPPFLAGS="$CPPFLAGS $addcflags"
  1640. fi
  1641. AC_CHECK_LIB(gnutls, gnutls_check_version,
  1642. [
  1643. AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
  1644. AC_SUBST(USE_GNUTLS, [1])
  1645. GNUTLS_ENABLED=1
  1646. USE_GNUTLS="yes"
  1647. curl_ssl_msg="enabled (GnuTLS)"
  1648. ],
  1649. [
  1650. LIBS="$CLEANLIBS"
  1651. CPPFLAGS="$CLEANCPPFLAGS"
  1652. ])
  1653. if test "x$USE_GNUTLS" = "xyes"; then
  1654. AC_MSG_NOTICE([detected GnuTLS version $version])
  1655. if test -n "$gtlslib"; then
  1656. dnl when shared libs were found in a path that the run-time
  1657. dnl linker doesn't search through, we need to add it to
  1658. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1659. dnl due to this
  1660. if test "x$cross_compiling" != "xyes"; then
  1661. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
  1662. export LD_LIBRARY_PATH
  1663. AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
  1664. fi
  1665. fi
  1666. fi
  1667. fi
  1668. fi dnl GNUTLS not disabled
  1669. fi
  1670. dnl ---
  1671. dnl Check which crypto backend GnuTLS uses
  1672. dnl ---
  1673. if test "$GNUTLS_ENABLED" = "1"; then
  1674. USE_GNUTLS_NETTLE=
  1675. # First check if we can detect either crypto library via transitive linking
  1676. AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
  1677. if test "$USE_GNUTLS_NETTLE" = ""; then
  1678. AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
  1679. fi
  1680. # If not, try linking directly to both of them to see if they are available
  1681. if test "$USE_GNUTLS_NETTLE" = ""; then
  1682. AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
  1683. fi
  1684. if test "$USE_GNUTLS_NETTLE" = ""; then
  1685. AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
  1686. fi
  1687. if test "$USE_GNUTLS_NETTLE" = ""; then
  1688. AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
  1689. fi
  1690. if test "$USE_GNUTLS_NETTLE" = "1"; then
  1691. AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
  1692. AC_SUBST(USE_GNUTLS_NETTLE, [1])
  1693. LIBS="-lnettle $LIBS"
  1694. else
  1695. LIBS="-lgcrypt $LIBS"
  1696. fi
  1697. fi
  1698. dnl ---
  1699. dnl We require GnuTLS with SRP support.
  1700. dnl ---
  1701. if test "$GNUTLS_ENABLED" = "1"; then
  1702. AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
  1703. [
  1704. AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
  1705. AC_SUBST(HAVE_GNUTLS_SRP, [1])
  1706. ])
  1707. fi
  1708. dnl ----------------------------------------------------
  1709. dnl check for PolarSSL
  1710. dnl ----------------------------------------------------
  1711. dnl Default to compiler & linker defaults for PolarSSL files & libraries.
  1712. OPT_POLARSSL=no
  1713. _cppflags=$CPPFLAGS
  1714. _ldflags=$LDFLAGS
  1715. AC_ARG_WITH(polarssl,dnl
  1716. AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
  1717. AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
  1718. OPT_POLARSSL=$withval)
  1719. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1720. if test X"$OPT_POLARSSL" != Xno; then
  1721. if test "$OPT_POLARSSL" = "yes"; then
  1722. OPT_POLARSSL=""
  1723. fi
  1724. if test -z "$OPT_POLARSSL" ; then
  1725. dnl check for lib first without setting any new path
  1726. AC_CHECK_LIB(polarssl, havege_init,
  1727. dnl libpolarssl found, set the variable
  1728. [
  1729. AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
  1730. AC_SUBST(USE_POLARSSL, [1])
  1731. POLARSSL_ENABLED=1
  1732. USE_POLARSSL="yes"
  1733. curl_ssl_msg="enabled (PolarSSL)"
  1734. ])
  1735. fi
  1736. addld=""
  1737. addlib=""
  1738. addcflags=""
  1739. polarssllib=""
  1740. if test "x$USE_POLARSSL" != "xyes"; then
  1741. dnl add the path and test again
  1742. addld=-L$OPT_POLARSSL/lib$libsuff
  1743. addcflags=-I$OPT_POLARSSL/include
  1744. polarssllib=$OPT_POLARSSL/lib$libsuff
  1745. LDFLAGS="$LDFLAGS $addld"
  1746. if test "$addcflags" != "-I/usr/include"; then
  1747. CPPFLAGS="$CPPFLAGS $addcflags"
  1748. fi
  1749. AC_CHECK_LIB(polarssl, ssl_init,
  1750. [
  1751. AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
  1752. AC_SUBST(USE_POLARSSL, [1])
  1753. POLARSSL_ENABLED=1
  1754. USE_POLARSSL="yes"
  1755. curl_ssl_msg="enabled (PolarSSL)"
  1756. ],
  1757. [
  1758. CPPFLAGS=$_cppflags
  1759. LDFLAGS=$_ldflags
  1760. ])
  1761. fi
  1762. if test "x$USE_POLARSSL" = "xyes"; then
  1763. AC_MSG_NOTICE([detected PolarSSL])
  1764. LIBS="-lpolarssl $LIBS"
  1765. if test -n "$polarssllib"; then
  1766. dnl when shared libs were found in a path that the run-time
  1767. dnl linker doesn't search through, we need to add it to
  1768. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1769. dnl due to this
  1770. if test "x$cross_compiling" != "xyes"; then
  1771. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
  1772. export LD_LIBRARY_PATH
  1773. AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
  1774. fi
  1775. fi
  1776. fi
  1777. fi dnl PolarSSL not disabled
  1778. fi
  1779. dnl ----------------------------------------------------
  1780. dnl check for CyaSSL
  1781. dnl ----------------------------------------------------
  1782. dnl Default to compiler & linker defaults for CyaSSL files & libraries.
  1783. OPT_CYASSL=no
  1784. _cppflags=$CPPFLAGS
  1785. _ldflags=$LDFLAGS
  1786. AC_ARG_WITH(cyassl,dnl
  1787. AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
  1788. AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
  1789. OPT_CYASSL=$withval)
  1790. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1791. if test X"$OPT_CYASSL" != Xno; then
  1792. if test "$OPT_CYASSL" = "yes"; then
  1793. OPT_CYASSL=""
  1794. fi
  1795. if test -z "$OPT_CYASSL" ; then
  1796. dnl check for lib in system default first
  1797. AC_CHECK_LIB(cyassl, CyaSSL_Init,
  1798. dnl libcyassl found, set the variable
  1799. [
  1800. AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  1801. AC_SUBST(USE_CYASSL, [1])
  1802. CYASSL_ENABLED=1
  1803. USE_CYASSL="yes"
  1804. curl_ssl_msg="enabled (CyaSSL)"
  1805. ])
  1806. fi
  1807. addld=""
  1808. addlib=""
  1809. addcflags=""
  1810. cyassllib=""
  1811. if test "x$USE_CYASSL" != "xyes"; then
  1812. dnl add the path and test again
  1813. addld=-L$OPT_CYASSL/lib$libsuff
  1814. addcflags=-I$OPT_CYASSL/include
  1815. cyassllib=$OPT_CYASSL/lib$libsuff
  1816. LDFLAGS="$LDFLAGS $addld"
  1817. if test "$addcflags" != "-I/usr/include"; then
  1818. CPPFLAGS="$CPPFLAGS $addcflags"
  1819. fi
  1820. AC_CHECK_LIB(cyassl, CyaSSL_Init,
  1821. [
  1822. AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  1823. AC_SUBST(USE_CYASSL, [1])
  1824. CYASSL_ENABLED=1
  1825. USE_CYASSL="yes"
  1826. curl_ssl_msg="enabled (CyaSSL)"
  1827. ],
  1828. [
  1829. CPPFLAGS=$_cppflags
  1830. LDFLAGS=$_ldflags
  1831. ])
  1832. fi
  1833. if test "x$USE_CYASSL" = "xyes"; then
  1834. AC_MSG_NOTICE([detected CyaSSL])
  1835. LIBS="-lcyassl -lm $LIBS"
  1836. if test -n "$cyassllib"; then
  1837. dnl when shared libs were found in a path that the run-time
  1838. dnl linker doesn't search through, we need to add it to
  1839. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1840. dnl due to this
  1841. if test "x$cross_compiling" != "xyes"; then
  1842. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
  1843. export LD_LIBRARY_PATH
  1844. AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
  1845. fi
  1846. fi
  1847. fi
  1848. fi dnl CyaSSL not disabled
  1849. fi
  1850. dnl ----------------------------------------------------
  1851. dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
  1852. dnl ----------------------------------------------------
  1853. dnl Default to compiler & linker defaults for NSS files & libraries.
  1854. OPT_NSS=no
  1855. AC_ARG_WITH(nss,dnl
  1856. AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
  1857. AC_HELP_STRING([--without-nss], [disable NSS detection]),
  1858. OPT_NSS=$withval)
  1859. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1860. if test X"$OPT_NSS" != Xno; then
  1861. addld=""
  1862. addlib=""
  1863. addcflags=""
  1864. nssprefix=""
  1865. version=""
  1866. if test "x$OPT_NSS" = "xyes"; then
  1867. CURL_CHECK_PKGCONFIG(nss)
  1868. if test "$PKGCONFIG" != "no" ; then
  1869. addlib=`$PKGCONFIG --libs nss`
  1870. addcflags=`$PKGCONFIG --cflags nss`
  1871. version=`$PKGCONFIG --modversion nss`
  1872. nssprefix=`$PKGCONFIG --variable=prefix nss`
  1873. else
  1874. dnl Without pkg-config, we check for nss-config
  1875. check=`nss-config --version 2>/dev/null`
  1876. if test -n "$check"; then
  1877. addlib=`nss-config --libs`
  1878. addcflags=`nss-config --cflags`
  1879. version=`nss-config --version`
  1880. nssprefix=`nss-config --prefix`
  1881. else
  1882. addlib="-lnss3"
  1883. addcflags=""
  1884. version="unknown"
  1885. fi
  1886. fi
  1887. else
  1888. # Without pkg-config, we'll kludge in some defaults
  1889. addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
  1890. addcflags="-I$OPT_NSS/include"
  1891. version="unknown"
  1892. nssprefix=$OPT_NSS
  1893. fi
  1894. if test -n "$addlib"; then
  1895. CLEANLIBS="$LIBS"
  1896. CLEANCPPFLAGS="$CPPFLAGS"
  1897. LIBS="$addlib $LIBS"
  1898. if test "$addcflags" != "-I/usr/include"; then
  1899. CPPFLAGS="$CPPFLAGS $addcflags"
  1900. fi
  1901. dnl The function PK11_CreateGenericObject is needed to load libnsspem.so
  1902. AC_CHECK_LIB(nss3, PK11_CreateGenericObject,
  1903. [
  1904. AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
  1905. AC_SUBST(USE_NSS, [1])
  1906. USE_NSS="yes"
  1907. NSS_ENABLED=1
  1908. curl_ssl_msg="enabled (NSS)"
  1909. ],
  1910. [
  1911. LIBS="$CLEANLIBS"
  1912. CPPFLAGS="$CLEANCPPFLAGS"
  1913. ])
  1914. if test "x$USE_NSS" = "xyes"; then
  1915. AC_MSG_NOTICE([detected NSS version $version])
  1916. dnl NSS_InitContext() was introduced in NSS 3.12.5 and helps to prevent
  1917. dnl collisions on NSS initialization/shutdown with other libraries
  1918. AC_CHECK_FUNC(NSS_InitContext,
  1919. [
  1920. AC_DEFINE(HAVE_NSS_INITCONTEXT, 1, [if you have the NSS_InitContext function])
  1921. AC_SUBST(HAVE_NSS_INITCONTEXT, [1])
  1922. ])
  1923. dnl when shared libs were found in a path that the run-time
  1924. dnl linker doesn't search through, we need to add it to
  1925. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1926. dnl due to this
  1927. if test "x$cross_compiling" != "xyes"; then
  1928. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
  1929. export LD_LIBRARY_PATH
  1930. AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
  1931. fi
  1932. fi
  1933. fi
  1934. fi dnl NSS not disabled
  1935. fi dnl curl_ssl_msg = init_ssl_msg
  1936. OPT_AXTLS=off
  1937. AC_ARG_WITH(axtls,dnl
  1938. AC_HELP_STRING([--with-axtls=PATH],[Where to look for axTLS, PATH points to the axTLS installation prefix (default: /usr/local). Ignored if another SSL engine is selected.])
  1939. AC_HELP_STRING([--without-axtls], [disable axTLS]),
  1940. OPT_AXTLS=$withval)
  1941. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1942. if test X"$OPT_AXTLS" != Xno; then
  1943. dnl backup the pre-axtls variables
  1944. CLEANLDFLAGS="$LDFLAGS"
  1945. CLEANCPPFLAGS="$CPPFLAGS"
  1946. CLEANLIBS="$LIBS"
  1947. case "$OPT_AXTLS" in
  1948. yes)
  1949. dnl --with-axtls (without path) used
  1950. PREFIX_AXTLS=/usr/local
  1951. LIB_AXTLS="$PREFIX_AXTLS/lib"
  1952. LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
  1953. CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
  1954. ;;
  1955. off)
  1956. dnl no --with-axtls option given, just check default places
  1957. PREFIX_AXTLS=
  1958. ;;
  1959. *)
  1960. dnl check the given --with-axtls spot
  1961. PREFIX_AXTLS=$OPT_AXTLS
  1962. LIB_AXTLS="$PREFIX_AXTLS/lib"
  1963. LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
  1964. CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
  1965. ;;
  1966. esac
  1967. AC_CHECK_LIB(axtls, ssl_version,[
  1968. LIBS="-laxtls $LIBS"
  1969. AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
  1970. AC_SUBST(USE_AXTLS, [1])
  1971. AXTLS_ENABLED=1
  1972. USE_AXTLS="yes"
  1973. curl_ssl_msg="enabled (axTLS)"
  1974. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
  1975. export LD_LIBRARY_PATH
  1976. AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
  1977. ],[
  1978. LDFLAGS="$CLEANLDFLAGS"
  1979. CPPFLAGS="$CLEANCPPFLAGS"
  1980. LIBS="$CLEANLIBS"
  1981. ])
  1982. fi
  1983. fi
  1984. if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" = "x"; then
  1985. AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
  1986. AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
  1987. else
  1988. # SSL is enabled, genericly
  1989. AC_SUBST(SSL_ENABLED)
  1990. SSL_ENABLED="1"
  1991. fi
  1992. dnl **********************************************************************
  1993. dnl Check for the CA bundle
  1994. dnl **********************************************************************
  1995. CURL_CHECK_CA_BUNDLE
  1996. dnl **********************************************************************
  1997. dnl Check for libmetalink
  1998. dnl **********************************************************************
  1999. OPT_LIBMETALINK=no
  2000. AC_ARG_WITH(libmetalink,dnl
  2001. AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
  2002. AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
  2003. OPT_LIBMETALINK=$withval)
  2004. if test X"$OPT_LIBMETALINK" != Xno; then
  2005. addld=""
  2006. addlib=""
  2007. addcflags=""
  2008. version=""
  2009. libmetalinklib=""
  2010. PKGTEST="no"
  2011. if test "x$OPT_LIBMETALINK" = "xyes"; then
  2012. dnl this is with no partiular path given
  2013. PKGTEST="yes"
  2014. CURL_CHECK_PKGCONFIG(libmetalink)
  2015. else
  2016. dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
  2017. LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
  2018. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
  2019. if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
  2020. PKGTEST="yes"
  2021. fi
  2022. if test "$PKGTEST" = "yes"; then
  2023. CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
  2024. fi
  2025. fi
  2026. if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
  2027. addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  2028. $PKGCONFIG --libs-only-l libmetalink`
  2029. addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  2030. $PKGCONFIG --libs-only-L libmetalink`
  2031. addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  2032. $PKGCONFIG --cflags-only-I libmetalink`
  2033. version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  2034. $PKGCONFIG --modversion libmetalink`
  2035. libmetalinklib=`echo $addld | $SED -e 's/-L//'`
  2036. fi
  2037. if test -n "$addlib"; then
  2038. clean_CPPFLAGS="$CPPFLAGS"
  2039. clean_LDFLAGS="$LDFLAGS"
  2040. clean_LIBS="$LIBS"
  2041. CPPFLAGS="$addcflags $clean_CPPFLAGS"
  2042. LDFLAGS="$addld $clean_LDFLAGS"
  2043. LIBS="$addlib $clean_LIBS"
  2044. AC_MSG_CHECKING([if libmetalink is recent enough])
  2045. AC_LINK_IFELSE([
  2046. AC_LANG_PROGRAM([[
  2047. # include <metalink/metalink.h>
  2048. ]],[[
  2049. if(0 != metalink_strerror(0)) /* added in 0.1.0 */
  2050. return 1;
  2051. ]])
  2052. ],[
  2053. AC_MSG_RESULT([yes ($version)])
  2054. want_metalink="yes"
  2055. ],[
  2056. AC_MSG_RESULT([no ($version)])
  2057. AC_MSG_NOTICE([libmetalink library defective or too old])
  2058. want_metalink="no"
  2059. ])
  2060. CPPFLAGS="$clean_CPPFLAGS"
  2061. LDFLAGS="$clean_LDFLAGS"
  2062. LIBS="$clean_LIBS"
  2063. if test "$want_metalink" = "yes"; then
  2064. dnl finally libmetalink will be used
  2065. AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
  2066. LIBMETALINK_LIBS=$addlib
  2067. LIBMETALINK_LDFLAGS=$addld
  2068. LIBMETALINK_CPPFLAGS=$addcflags
  2069. AC_SUBST([LIBMETALINK_LIBS])
  2070. AC_SUBST([LIBMETALINK_LDFLAGS])
  2071. AC_SUBST([LIBMETALINK_CPPFLAGS])
  2072. curl_mtlnk_msg="enabled"
  2073. fi
  2074. fi
  2075. fi
  2076. dnl **********************************************************************
  2077. dnl Check for the presence of LIBSSH2 libraries and headers
  2078. dnl **********************************************************************
  2079. dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
  2080. OPT_LIBSSH2=off
  2081. AC_ARG_WITH(libssh2,dnl
  2082. AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  2083. AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
  2084. OPT_LIBSSH2=$withval)
  2085. if test X"$OPT_LIBSSH2" != Xno; then
  2086. dnl backup the pre-libssh2 variables
  2087. CLEANLDFLAGS="$LDFLAGS"
  2088. CLEANCPPFLAGS="$CPPFLAGS"
  2089. CLEANLIBS="$LIBS"
  2090. case "$OPT_LIBSSH2" in
  2091. yes)
  2092. dnl --with-libssh2 (without path) used
  2093. CURL_CHECK_PKGCONFIG(libssh2)
  2094. if test "$PKGCONFIG" != "no" ; then
  2095. LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
  2096. LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
  2097. CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
  2098. version=`$PKGCONFIG --modversion libssh2`
  2099. DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
  2100. fi
  2101. ;;
  2102. off)
  2103. dnl no --with-libssh2 option given, just check default places
  2104. ;;
  2105. *)
  2106. dnl use the given --with-libssh2 spot
  2107. PREFIX_SSH2=$OPT_LIBSSH2
  2108. ;;
  2109. esac
  2110. dnl if given with a prefix, we set -L and -I based on that
  2111. if test -n "$PREFIX_SSH2"; then
  2112. LIB_SSH2="-lssh2"
  2113. LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
  2114. CPP_SSH2=-I${PREFIX_SSH2}/include
  2115. DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
  2116. fi
  2117. LDFLAGS="$LDFLAGS $LD_SSH2"
  2118. CPPFLAGS="$CPPFLAGS $CPP_SSH2"
  2119. LIBS="$LIB_SSH2 $LIBS"
  2120. AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
  2121. AC_CHECK_HEADERS(libssh2.h,
  2122. curl_ssh_msg="enabled (libSSH2)"
  2123. LIBSSH2_ENABLED=1
  2124. AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
  2125. AC_SUBST(USE_LIBSSH2, [1])
  2126. )
  2127. if test X"$OPT_LIBSSH2" != Xoff &&
  2128. test "$LIBSSH2_ENABLED" != "1"; then
  2129. AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
  2130. fi
  2131. if test "$LIBSSH2_ENABLED" = "1"; then
  2132. if test -n "$DIR_SSH2"; then
  2133. dnl when the libssh2 shared libs were found in a path that the run-time
  2134. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  2135. dnl to prevent further configure tests to fail due to this
  2136. dnl libssh2_version is a post 1.0 addition
  2137. dnl libssh2_init and libssh2_exit were added in 1.2.5
  2138. dnl libssh2_scp_send64 was added in 1.2.6
  2139. dnl libssh2_session_handshake was added in 1.2.8
  2140. AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
  2141. libssh2_scp_send64 libssh2_session_handshake)
  2142. if test "x$cross_compiling" != "xyes"; then
  2143. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
  2144. export LD_LIBRARY_PATH
  2145. AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
  2146. fi
  2147. fi
  2148. else
  2149. dnl no libssh2, revert back to clean variables
  2150. LDFLAGS=$CLEANLDFLAGS
  2151. CPPFLAGS=$CLEANCPPFLAGS
  2152. LIBS=$CLEANLIBS
  2153. fi
  2154. fi
  2155. dnl **********************************************************************
  2156. dnl Check for the presence of LIBRTMP libraries and headers
  2157. dnl **********************************************************************
  2158. dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
  2159. OPT_LIBRTMP=off
  2160. AC_ARG_WITH(librtmp,dnl
  2161. AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
  2162. AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
  2163. OPT_LIBRTMP=$withval)
  2164. if test X"$OPT_LIBRTMP" != Xno; then
  2165. dnl backup the pre-librtmp variables
  2166. CLEANLDFLAGS="$LDFLAGS"
  2167. CLEANCPPFLAGS="$CPPFLAGS"
  2168. CLEANLIBS="$LIBS"
  2169. case "$OPT_LIBRTMP" in
  2170. yes)
  2171. dnl --with-librtmp (without path) used
  2172. CURL_CHECK_PKGCONFIG(librtmp)
  2173. if test "$PKGCONFIG" != "no" ; then
  2174. LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
  2175. LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
  2176. CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
  2177. version=`$PKGCONFIG --modversion librtmp`
  2178. DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
  2179. else
  2180. dnl To avoid link errors, we do not allow --librtmp without
  2181. dnl a pkgconfig file
  2182. AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
  2183. fi
  2184. ;;
  2185. off)
  2186. dnl no --with-librtmp option given, just check default places
  2187. LIB_RTMP="-lrtmp"
  2188. ;;
  2189. *)
  2190. dnl use the given --with-librtmp spot
  2191. PREFIX_RTMP=$OPT_LIBRTMP
  2192. ;;
  2193. esac
  2194. dnl if given with a prefix, we set -L and -I based on that
  2195. if test -n "$PREFIX_RTMP"; then
  2196. LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
  2197. CPP_RTMP=-I${PREFIX_RTMP}/include
  2198. DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
  2199. fi
  2200. LDFLAGS="$LDFLAGS $LD_RTMP"
  2201. CPPFLAGS="$CPPFLAGS $CPP_RTMP"
  2202. LIBS="$LIB_RTMP $LIBS"
  2203. AC_CHECK_LIB(rtmp, RTMP_Init,
  2204. [
  2205. AC_CHECK_HEADERS(librtmp/rtmp.h,
  2206. curl_rtmp_msg="enabled (librtmp)"
  2207. LIBRTMP_ENABLED=1
  2208. AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
  2209. AC_SUBST(USE_LIBRTMP, [1])
  2210. )
  2211. ],
  2212. dnl not found, revert back to clean variables
  2213. LDFLAGS=$CLEANLDFLAGS
  2214. CPPFLAGS=$CLEANCPPFLAGS
  2215. LIBS=$CLEANLIBS
  2216. )
  2217. if test X"$OPT_LIBRTMP" != Xoff &&
  2218. test "$LIBRTMP_ENABLED" != "1"; then
  2219. AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
  2220. fi
  2221. fi
  2222. dnl **********************************************************************
  2223. dnl Check for linker switch for versioned symbols
  2224. dnl **********************************************************************
  2225. versioned_symbols_flavour=
  2226. AC_MSG_CHECKING([whether versioned symbols are wanted])
  2227. AC_ARG_ENABLE(versioned-symbols,
  2228. AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
  2229. AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
  2230. [ case "$enableval" in
  2231. yes) AC_MSG_RESULT(yes)
  2232. AC_MSG_CHECKING([if libraries can be versioned])
  2233. GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
  2234. if test -z "$GLD"; then
  2235. AC_MSG_RESULT(no)
  2236. AC_MSG_WARN([You need an ld version supporting the --version-script option])
  2237. else
  2238. AC_MSG_RESULT(yes)
  2239. if test "x$OPENSSL_ENABLED" = "x1"; then
  2240. versioned_symbols_flavour="OPENSSL_"
  2241. elif test "x$GNUTLS_ENABLED" == "x1"; then
  2242. versioned_symbols_flavour="GNUTLS_"
  2243. elif test "x$NSS_ENABLED" == "x1"; then
  2244. versioned_symbols_flavour="NSS_"
  2245. elif test "x$POLARSSL_ENABLED" == "x1"; then
  2246. versioned_symbols_flavour="POLARSSL_"
  2247. elif test "x$CYASSL_ENABLED" == "x1"; then
  2248. versioned_symbols_flavour="CYASSL_"
  2249. elif test "x$AXTLS_ENABLED" == "x1"; then
  2250. versioned_symbols_flavour="AXTLS_"
  2251. elif test "x$WINSSL_ENABLED" == "x1"; then
  2252. versioned_symbols_flavour="WINSSL_"
  2253. elif test "x$DARWINSSL_ENABLED" == "x1"; then
  2254. versioned_symbols_flavour="DARWINSSL_"
  2255. else
  2256. versioned_symbols_flavour=""
  2257. fi
  2258. versioned_symbols="yes"
  2259. fi
  2260. ;;
  2261. *) AC_MSG_RESULT(no)
  2262. ;;
  2263. esac
  2264. ], [
  2265. AC_MSG_RESULT(no)
  2266. ]
  2267. )
  2268. AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
  2269. ["$versioned_symbols_flavour"])
  2270. AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
  2271. [test "x$versioned_symbols" = 'xyes'])
  2272. dnl -------------------------------------------------
  2273. dnl check winidn option before other IDN libraries
  2274. dnl -------------------------------------------------
  2275. AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
  2276. OPT_WINIDN="default"
  2277. AC_ARG_WITH(winidn,
  2278. AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
  2279. AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
  2280. OPT_WINIDN=$withval)
  2281. case "$OPT_WINIDN" in
  2282. no|default)
  2283. dnl --without-winidn option used or configure option not specified
  2284. want_winidn="no"
  2285. AC_MSG_RESULT([no])
  2286. ;;
  2287. yes)
  2288. dnl --with-winidn option used without path
  2289. want_winidn="yes"
  2290. want_winidn_path="default"
  2291. AC_MSG_RESULT([yes])
  2292. ;;
  2293. *)
  2294. dnl --with-winidn option used with path
  2295. want_winidn="yes"
  2296. want_winidn_path="$withval"
  2297. AC_MSG_RESULT([yes ($withval)])
  2298. ;;
  2299. esac
  2300. if test "$want_winidn" = "yes"; then
  2301. dnl winidn library support has been requested
  2302. clean_CPPFLAGS="$CPPFLAGS"
  2303. clean_LDFLAGS="$LDFLAGS"
  2304. clean_LIBS="$LIBS"
  2305. WINIDN_LIBS="-lnormaliz"
  2306. #
  2307. if test "$want_winidn_path" != "default"; then
  2308. dnl path has been specified
  2309. dnl pkg-config not available or provides no info
  2310. WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
  2311. WINIDN_CPPFLAGS="-I$want_winidn_path/include"
  2312. WINIDN_DIR="$want_winidn_path/lib$libsuff"
  2313. fi
  2314. #
  2315. CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
  2316. LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
  2317. LIBS="$WINIDN_LIBS $LIBS"
  2318. #
  2319. AC_MSG_CHECKING([if IdnToUnicode can be linked])
  2320. AC_LINK_IFELSE([
  2321. AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
  2322. ],[
  2323. AC_MSG_RESULT([yes])
  2324. tst_links_winidn="yes"
  2325. ],[
  2326. AC_MSG_RESULT([no])
  2327. tst_links_winidn="no"
  2328. ])
  2329. #
  2330. if test "$tst_links_winidn" = "yes"; then
  2331. AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
  2332. AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
  2333. AC_SUBST([IDN_ENABLED], [1])
  2334. curl_idn_msg="enabled (Windows-native)"
  2335. else
  2336. AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
  2337. CPPFLAGS="$clean_CPPFLAGS"
  2338. LDFLAGS="$clean_LDFLAGS"
  2339. LIBS="$clean_LIBS"
  2340. fi
  2341. fi
  2342. dnl **********************************************************************
  2343. dnl Check for the presence of IDN libraries and headers
  2344. dnl **********************************************************************
  2345. AC_MSG_CHECKING([whether to build with libidn])
  2346. OPT_IDN="default"
  2347. AC_ARG_WITH(libidn,
  2348. AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
  2349. AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
  2350. [OPT_IDN=$withval])
  2351. case "$OPT_IDN" in
  2352. no)
  2353. dnl --without-libidn option used
  2354. want_idn="no"
  2355. AC_MSG_RESULT([no])
  2356. ;;
  2357. default)
  2358. dnl configure option not specified
  2359. want_idn="yes"
  2360. want_idn_path="default"
  2361. AC_MSG_RESULT([(assumed) yes])
  2362. ;;
  2363. yes)
  2364. dnl --with-libidn option used without path
  2365. want_idn="yes"
  2366. want_idn_path="default"
  2367. AC_MSG_RESULT([yes])
  2368. ;;
  2369. *)
  2370. dnl --with-libidn option used with path
  2371. want_idn="yes"
  2372. want_idn_path="$withval"
  2373. AC_MSG_RESULT([yes ($withval)])
  2374. ;;
  2375. esac
  2376. if test "$want_idn" = "yes"; then
  2377. dnl idn library support has been requested
  2378. clean_CPPFLAGS="$CPPFLAGS"
  2379. clean_LDFLAGS="$LDFLAGS"
  2380. clean_LIBS="$LIBS"
  2381. PKGCONFIG="no"
  2382. #
  2383. if test "$want_idn_path" != "default"; then
  2384. dnl path has been specified
  2385. IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
  2386. CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
  2387. if test "$PKGCONFIG" != "no"; then
  2388. IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2389. $PKGCONFIG --libs-only-l libidn 2>/dev/null`
  2390. IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2391. $PKGCONFIG --libs-only-L libidn 2>/dev/null`
  2392. IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2393. $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
  2394. IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
  2395. else
  2396. dnl pkg-config not available or provides no info
  2397. IDN_LIBS="-lidn"
  2398. IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
  2399. IDN_CPPFLAGS="-I$want_idn_path/include"
  2400. IDN_DIR="$want_idn_path/lib$libsuff"
  2401. fi
  2402. else
  2403. dnl path not specified
  2404. CURL_CHECK_PKGCONFIG(libidn)
  2405. if test "$PKGCONFIG" != "no"; then
  2406. IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
  2407. IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
  2408. IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
  2409. IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
  2410. else
  2411. dnl pkg-config not available or provides no info
  2412. IDN_LIBS="-lidn"
  2413. fi
  2414. fi
  2415. #
  2416. if test "$PKGCONFIG" != "no"; then
  2417. AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
  2418. AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
  2419. AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
  2420. AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
  2421. else
  2422. AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
  2423. AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
  2424. AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
  2425. AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
  2426. fi
  2427. #
  2428. CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
  2429. LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
  2430. LIBS="$IDN_LIBS $LIBS"
  2431. #
  2432. AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
  2433. AC_LINK_IFELSE([
  2434. AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
  2435. ],[
  2436. AC_MSG_RESULT([yes])
  2437. tst_links_libidn="yes"
  2438. ],[
  2439. AC_MSG_RESULT([no])
  2440. tst_links_libidn="no"
  2441. ])
  2442. if test "$tst_links_libidn" = "no"; then
  2443. AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
  2444. AC_LINK_IFELSE([
  2445. AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
  2446. ],[
  2447. AC_MSG_RESULT([yes])
  2448. tst_links_libidn="yes"
  2449. ],[
  2450. AC_MSG_RESULT([no])
  2451. tst_links_libidn="no"
  2452. ])
  2453. fi
  2454. #
  2455. if test "$tst_links_libidn" = "yes"; then
  2456. AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
  2457. dnl different versions of libidn have different setups of these:
  2458. AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
  2459. AC_CHECK_HEADERS( idn-free.h tld.h )
  2460. if test "x$ac_cv_header_tld_h" = "xyes"; then
  2461. AC_SUBST([IDN_ENABLED], [1])
  2462. curl_idn_msg="enabled"
  2463. if test -n "$IDN_DIR"; then
  2464. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
  2465. export LD_LIBRARY_PATH
  2466. AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
  2467. fi
  2468. else
  2469. AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
  2470. CPPFLAGS="$clean_CPPFLAGS"
  2471. LDFLAGS="$clean_LDFLAGS"
  2472. LIBS="$clean_LIBS"
  2473. fi
  2474. else
  2475. AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
  2476. CPPFLAGS="$clean_CPPFLAGS"
  2477. LDFLAGS="$clean_LDFLAGS"
  2478. LIBS="$clean_LIBS"
  2479. fi
  2480. fi
  2481. dnl Let's hope this split URL remains working:
  2482. dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
  2483. dnl genprogc/thread_quick_ref.htm
  2484. dnl **********************************************************************
  2485. dnl Back to "normal" configuring
  2486. dnl **********************************************************************
  2487. dnl Checks for header files.
  2488. AC_HEADER_STDC
  2489. CURL_CHECK_HEADER_MALLOC
  2490. CURL_CHECK_HEADER_MEMORY
  2491. dnl Now check for the very most basic headers. Then we can use these
  2492. dnl ones as default-headers when checking for the rest!
  2493. AC_CHECK_HEADERS(
  2494. sys/types.h \
  2495. sys/time.h \
  2496. sys/select.h \
  2497. sys/socket.h \
  2498. sys/ioctl.h \
  2499. sys/uio.h \
  2500. assert.h \
  2501. unistd.h \
  2502. stdlib.h \
  2503. limits.h \
  2504. arpa/inet.h \
  2505. net/if.h \
  2506. netinet/in.h \
  2507. sys/un.h \
  2508. netinet/tcp.h \
  2509. netdb.h \
  2510. sys/sockio.h \
  2511. sys/stat.h \
  2512. sys/param.h \
  2513. termios.h \
  2514. termio.h \
  2515. sgtty.h \
  2516. fcntl.h \
  2517. alloca.h \
  2518. time.h \
  2519. io.h \
  2520. pwd.h \
  2521. utime.h \
  2522. sys/utime.h \
  2523. sys/poll.h \
  2524. poll.h \
  2525. socket.h \
  2526. sys/resource.h \
  2527. libgen.h \
  2528. locale.h \
  2529. errno.h \
  2530. stdbool.h \
  2531. arpa/tftp.h \
  2532. sys/filio.h \
  2533. sys/wait.h \
  2534. setjmp.h,
  2535. dnl to do if not found
  2536. [],
  2537. dnl to do if found
  2538. [],
  2539. dnl default includes
  2540. [
  2541. #ifdef HAVE_SYS_TYPES_H
  2542. #include <sys/types.h>
  2543. #endif
  2544. #ifdef HAVE_SYS_TIME_H
  2545. #include <sys/time.h>
  2546. #endif
  2547. #ifdef HAVE_SYS_SELECT_H
  2548. #include <sys/select.h>
  2549. #endif
  2550. #ifdef HAVE_SYS_SOCKET_H
  2551. #include <sys/socket.h>
  2552. #endif
  2553. #ifdef HAVE_NETINET_IN_H
  2554. #include <netinet/in.h>
  2555. #endif
  2556. #ifdef HAVE_SYS_UN_H
  2557. #include <sys/un.h>
  2558. #endif
  2559. ]
  2560. )
  2561. dnl Checks for typedefs, structures, and compiler characteristics.
  2562. AC_C_CONST
  2563. CURL_CHECK_VARIADIC_MACROS
  2564. AC_TYPE_SIZE_T
  2565. AC_HEADER_TIME
  2566. CURL_CHECK_STRUCT_TIMEVAL
  2567. CURL_VERIFY_RUNTIMELIBS
  2568. AC_CHECK_SIZEOF(size_t)
  2569. AC_CHECK_SIZEOF(long)
  2570. AC_CHECK_SIZEOF(int)
  2571. AC_CHECK_SIZEOF(short)
  2572. CURL_CONFIGURE_LONG
  2573. AC_CHECK_SIZEOF(time_t)
  2574. AC_CHECK_SIZEOF(off_t)
  2575. soname_bump=no
  2576. if test x"$ac_cv_native_windows" != "xyes" &&
  2577. test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
  2578. AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
  2579. AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
  2580. soname_bump=yes
  2581. fi
  2582. AC_CHECK_TYPE(long long,
  2583. [AC_DEFINE(HAVE_LONGLONG, 1,
  2584. [Define to 1 if the compiler supports the 'long long' data type.])]
  2585. longlong="yes"
  2586. )
  2587. if test "xyes" = "x$longlong"; then
  2588. AC_MSG_CHECKING([if numberLL works])
  2589. AC_COMPILE_IFELSE([
  2590. AC_LANG_PROGRAM([[
  2591. ]],[[
  2592. long long val = 1000LL;
  2593. ]])
  2594. ],[
  2595. AC_MSG_RESULT([yes])
  2596. AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
  2597. ],[
  2598. AC_MSG_RESULT([no])
  2599. ])
  2600. fi
  2601. # check for ssize_t
  2602. AC_CHECK_TYPE(ssize_t, ,
  2603. AC_DEFINE(ssize_t, int, [the signed version of size_t]))
  2604. # check for bool type
  2605. AC_CHECK_TYPE([bool],[
  2606. AC_DEFINE(HAVE_BOOL_T, 1,
  2607. [Define to 1 if bool is an available type.])
  2608. ], ,[
  2609. #ifdef HAVE_SYS_TYPES_H
  2610. #include <sys/types.h>
  2611. #endif
  2612. #ifdef HAVE_STDBOOL_H
  2613. #include <stdbool.h>
  2614. #endif
  2615. ])
  2616. CURL_CONFIGURE_CURL_SOCKLEN_T
  2617. CURL_CONFIGURE_PULL_SYS_POLL
  2618. TYPE_IN_ADDR_T
  2619. TYPE_SOCKADDR_STORAGE
  2620. TYPE_SIG_ATOMIC_T
  2621. AC_TYPE_SIGNAL
  2622. CURL_CHECK_FUNC_SELECT
  2623. CURL_CHECK_FUNC_RECV
  2624. CURL_CHECK_FUNC_RECVFROM
  2625. CURL_CHECK_FUNC_SEND
  2626. CURL_CHECK_MSG_NOSIGNAL
  2627. CURL_CHECK_FUNC_ALARM
  2628. CURL_CHECK_FUNC_BASENAME
  2629. CURL_CHECK_FUNC_CLOSESOCKET
  2630. CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  2631. CURL_CHECK_FUNC_CONNECT
  2632. CURL_CHECK_FUNC_FCNTL
  2633. CURL_CHECK_FUNC_FDOPEN
  2634. CURL_CHECK_FUNC_FREEADDRINFO
  2635. CURL_CHECK_FUNC_FREEIFADDRS
  2636. CURL_CHECK_FUNC_FSETXATTR
  2637. CURL_CHECK_FUNC_FTRUNCATE
  2638. CURL_CHECK_FUNC_GETADDRINFO
  2639. CURL_CHECK_FUNC_GAI_STRERROR
  2640. CURL_CHECK_FUNC_GETHOSTBYADDR
  2641. CURL_CHECK_FUNC_GETHOSTBYADDR_R
  2642. CURL_CHECK_FUNC_GETHOSTBYNAME
  2643. CURL_CHECK_FUNC_GETHOSTBYNAME_R
  2644. CURL_CHECK_FUNC_GETHOSTNAME
  2645. CURL_CHECK_FUNC_GETIFADDRS
  2646. CURL_CHECK_FUNC_GETSERVBYPORT_R
  2647. CURL_CHECK_FUNC_GMTIME_R
  2648. CURL_CHECK_FUNC_INET_NTOA_R
  2649. CURL_CHECK_FUNC_INET_NTOP
  2650. CURL_CHECK_FUNC_INET_PTON
  2651. CURL_CHECK_FUNC_IOCTL
  2652. CURL_CHECK_FUNC_IOCTLSOCKET
  2653. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  2654. CURL_CHECK_FUNC_LOCALTIME_R
  2655. CURL_CHECK_FUNC_MEMRCHR
  2656. CURL_CHECK_FUNC_POLL
  2657. CURL_CHECK_FUNC_SETSOCKOPT
  2658. CURL_CHECK_FUNC_SIGACTION
  2659. CURL_CHECK_FUNC_SIGINTERRUPT
  2660. CURL_CHECK_FUNC_SIGNAL
  2661. CURL_CHECK_FUNC_SIGSETJMP
  2662. CURL_CHECK_FUNC_SOCKET
  2663. CURL_CHECK_FUNC_SOCKETPAIR
  2664. CURL_CHECK_FUNC_STRCASECMP
  2665. CURL_CHECK_FUNC_STRCMPI
  2666. CURL_CHECK_FUNC_STRDUP
  2667. CURL_CHECK_FUNC_STRERROR_R
  2668. CURL_CHECK_FUNC_STRICMP
  2669. CURL_CHECK_FUNC_STRNCASECMP
  2670. CURL_CHECK_FUNC_STRNCMPI
  2671. CURL_CHECK_FUNC_STRNICMP
  2672. CURL_CHECK_FUNC_STRSTR
  2673. CURL_CHECK_FUNC_STRTOK_R
  2674. CURL_CHECK_FUNC_STRTOLL
  2675. CURL_CHECK_FUNC_WRITEV
  2676. case $host in
  2677. *msdosdjgpp)
  2678. ac_cv_func_pipe=no
  2679. skipcheck_pipe=yes
  2680. AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
  2681. ;;
  2682. esac
  2683. AC_CHECK_FUNCS([fork \
  2684. geteuid \
  2685. getpass_r \
  2686. getppid \
  2687. getprotobyname \
  2688. getpwuid \
  2689. getrlimit \
  2690. gettimeofday \
  2691. inet_addr \
  2692. perror \
  2693. pipe \
  2694. setlocale \
  2695. setmode \
  2696. setrlimit \
  2697. uname \
  2698. utime
  2699. ],[
  2700. ],[
  2701. func="$ac_func"
  2702. eval skipcheck=\$skipcheck_$func
  2703. if test "x$skipcheck" != "xyes"; then
  2704. AC_MSG_CHECKING([deeper for $func])
  2705. AC_LINK_IFELSE([
  2706. AC_LANG_PROGRAM([[
  2707. ]],[[
  2708. $func ();
  2709. ]])
  2710. ],[
  2711. AC_MSG_RESULT([yes])
  2712. eval "ac_cv_func_$func=yes"
  2713. AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
  2714. [Define to 1 if you have the $func function.])
  2715. ],[
  2716. AC_MSG_RESULT([but still no])
  2717. ])
  2718. fi
  2719. ])
  2720. dnl Check if the getnameinfo function is available
  2721. dnl and get the types of five of its arguments.
  2722. CURL_CHECK_FUNC_GETNAMEINFO
  2723. if test "$ipv6" = "yes"; then
  2724. if test "$ac_cv_func_getaddrinfo" = "yes"; then
  2725. AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
  2726. IPV6_ENABLED=1
  2727. AC_SUBST(IPV6_ENABLED)
  2728. fi
  2729. CURL_CHECK_NI_WITHSCOPEID
  2730. fi
  2731. CURL_CHECK_NONBLOCKING_SOCKET
  2732. dnl ************************************************************
  2733. dnl nroff tool stuff
  2734. dnl
  2735. AC_PATH_PROG( PERL, perl, ,
  2736. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  2737. AC_SUBST(PERL)
  2738. AC_PATH_PROGS( NROFF, gnroff nroff, ,
  2739. $PATH:/usr/bin/:/usr/local/bin )
  2740. AC_SUBST(NROFF)
  2741. if test -n "$NROFF"; then
  2742. dnl only check for nroff options if an nroff command was found
  2743. AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  2744. MANOPT="-man"
  2745. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  2746. if test -z "$mancheck"; then
  2747. MANOPT="-mandoc"
  2748. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  2749. if test -z "$mancheck"; then
  2750. MANOPT=""
  2751. AC_MSG_RESULT([failed])
  2752. AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
  2753. else
  2754. AC_MSG_RESULT([$MANOPT])
  2755. fi
  2756. else
  2757. AC_MSG_RESULT([$MANOPT])
  2758. fi
  2759. AC_SUBST(MANOPT)
  2760. fi
  2761. if test -z "$MANOPT"
  2762. then
  2763. dnl if no nroff tool was found, or no option that could convert man pages
  2764. dnl was found, then disable the built-in manual stuff
  2765. AC_MSG_WARN([disabling built-in manual])
  2766. USE_MANUAL="no";
  2767. fi
  2768. dnl *************************************************************************
  2769. dnl If the manual variable still is set, then we go with providing a built-in
  2770. dnl manual
  2771. if test "$USE_MANUAL" = "1"; then
  2772. AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
  2773. curl_manual_msg="enabled"
  2774. fi
  2775. dnl set variable for use in automakefile(s)
  2776. AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
  2777. CURL_CHECK_LIB_ARES
  2778. AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
  2779. if test "x$ac_cv_native_windows" != "xyes" &&
  2780. test "x$enable_shared" = "xyes"; then
  2781. build_libhostname=yes
  2782. else
  2783. build_libhostname=no
  2784. fi
  2785. AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
  2786. CURL_CHECK_OPTION_THREADED_RESOLVER
  2787. if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
  2788. AC_MSG_ERROR(
  2789. [Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
  2790. fi
  2791. if test "$want_thres" = "yes"; then
  2792. AC_CHECK_HEADER(pthread.h,
  2793. [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
  2794. save_CFLAGS="$CFLAGS"
  2795. CFLAGS="$CFLAGS -pthread"
  2796. AC_CHECK_LIB(pthread, pthread_create,
  2797. [ AC_MSG_NOTICE([using POSIX threaded DNS lookup])
  2798. AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
  2799. USE_THREADS_POSIX=1
  2800. curl_res_msg="threaded"
  2801. ],
  2802. [ CFLAGS="$save_CFLAGS"])
  2803. ])
  2804. fi
  2805. dnl ************************************************************
  2806. dnl disable verbose text strings
  2807. dnl
  2808. AC_MSG_CHECKING([whether to enable verbose strings])
  2809. AC_ARG_ENABLE(verbose,
  2810. AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
  2811. AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
  2812. [ case "$enableval" in
  2813. no)
  2814. AC_MSG_RESULT(no)
  2815. AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
  2816. curl_verbose_msg="no"
  2817. ;;
  2818. *) AC_MSG_RESULT(yes)
  2819. ;;
  2820. esac ],
  2821. AC_MSG_RESULT(yes)
  2822. )
  2823. dnl ************************************************************
  2824. dnl enable SSPI support
  2825. dnl
  2826. AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
  2827. AC_ARG_ENABLE(sspi,
  2828. AC_HELP_STRING([--enable-sspi],[Enable SSPI])
  2829. AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
  2830. [ case "$enableval" in
  2831. yes)
  2832. if test "$ac_cv_native_windows" = "yes"; then
  2833. AC_MSG_RESULT(yes)
  2834. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  2835. AC_SUBST(USE_WINDOWS_SSPI, [1])
  2836. curl_sspi_msg="enabled"
  2837. else
  2838. AC_MSG_RESULT(no)
  2839. AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
  2840. fi
  2841. ;;
  2842. *)
  2843. if test "x$WINSSL_ENABLED" = "x1"; then
  2844. # --with-winssl implies --enable-sspi
  2845. AC_MSG_RESULT(yes)
  2846. else
  2847. AC_MSG_RESULT(no)
  2848. fi
  2849. ;;
  2850. esac ],
  2851. if test "x$WINSSL_ENABLED" = "x1"; then
  2852. # --with-winssl implies --enable-sspi
  2853. AC_MSG_RESULT(yes)
  2854. else
  2855. AC_MSG_RESULT(no)
  2856. fi
  2857. )
  2858. dnl ************************************************************
  2859. dnl disable cryptographic authentication
  2860. dnl
  2861. AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
  2862. AC_ARG_ENABLE(crypto-auth,
  2863. AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
  2864. AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
  2865. [ case "$enableval" in
  2866. no)
  2867. AC_MSG_RESULT(no)
  2868. AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
  2869. ;;
  2870. *) AC_MSG_RESULT(yes)
  2871. ;;
  2872. esac ],
  2873. AC_MSG_RESULT(yes)
  2874. )
  2875. CURL_CHECK_OPTION_NTLM_WB
  2876. CURL_CHECK_NTLM_WB
  2877. dnl ************************************************************
  2878. dnl disable TLS-SRP authentication
  2879. dnl
  2880. AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
  2881. AC_ARG_ENABLE(tls-srp,
  2882. AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
  2883. AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
  2884. [ case "$enableval" in
  2885. no)
  2886. AC_MSG_RESULT(no)
  2887. AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
  2888. want_tls_srp=no
  2889. ;;
  2890. *) AC_MSG_RESULT(yes)
  2891. want_tls_srp=yes
  2892. ;;
  2893. esac ],
  2894. AC_MSG_RESULT(yes)
  2895. want_tls_srp=yes
  2896. )
  2897. if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_SSLEAY_SRP" = "x1") ; then
  2898. AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
  2899. USE_TLS_SRP=1
  2900. curl_tls_srp_msg="enabled"
  2901. fi
  2902. dnl ************************************************************
  2903. dnl disable cookies support
  2904. dnl
  2905. AC_MSG_CHECKING([whether to enable support for cookies])
  2906. AC_ARG_ENABLE(cookies,
  2907. AC_HELP_STRING([--enable-cookies],[Enable cookies support])
  2908. AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
  2909. [ case "$enableval" in
  2910. no)
  2911. AC_MSG_RESULT(no)
  2912. AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
  2913. ;;
  2914. *) AC_MSG_RESULT(yes)
  2915. ;;
  2916. esac ],
  2917. AC_MSG_RESULT(yes)
  2918. )
  2919. dnl ************************************************************
  2920. dnl hiding of library internal symbols
  2921. dnl
  2922. CURL_CONFIGURE_SYMBOL_HIDING
  2923. dnl ************************************************************
  2924. dnl enforce SONAME bump
  2925. dnl
  2926. AC_MSG_CHECKING([whether to enforce SONAME bump])
  2927. AC_ARG_ENABLE(soname-bump,
  2928. AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
  2929. AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
  2930. [ case "$enableval" in
  2931. yes) AC_MSG_RESULT(yes)
  2932. soname_bump=yes
  2933. ;;
  2934. *)
  2935. AC_MSG_RESULT(no)
  2936. ;;
  2937. esac ],
  2938. AC_MSG_RESULT($soname_bump)
  2939. )
  2940. AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
  2941. dnl
  2942. dnl All the library dependencies put into $LIB apply to libcurl only.
  2943. dnl
  2944. LIBCURL_LIBS=$LIBS
  2945. AC_SUBST(LIBCURL_LIBS)
  2946. AC_SUBST(CURL_NETWORK_LIBS)
  2947. AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
  2948. dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
  2949. dnl LIBS variable used in generated makefile at makefile processing
  2950. dnl time. Doing this functionally prevents LIBS from being used for
  2951. dnl all link targets in given makefile.
  2952. BLANK_AT_MAKETIME=
  2953. AC_SUBST(BLANK_AT_MAKETIME)
  2954. AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
  2955. dnl yes or no
  2956. ENABLE_SHARED="$enable_shared"
  2957. AC_SUBST(ENABLE_SHARED)
  2958. dnl
  2959. dnl For keeping supported features and protocols also in pkg-config file
  2960. dnl since it is more cross-compile friendly than curl-config
  2961. dnl
  2962. if test "x$USE_SSLEAY" = "x1"; then
  2963. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2964. elif test -n "$SSL_ENABLED"; then
  2965. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2966. fi
  2967. if test "@KRB4_ENABLED@" = "x1"; then
  2968. SUPPORT_FEATURES="$SUPPORT_FEATURES KRB4"
  2969. fi
  2970. if test "x$IPV6_ENABLED" = "x1"; then
  2971. SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
  2972. fi
  2973. if test "x$HAVE_LIBZ" = "x1"; then
  2974. SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
  2975. fi
  2976. if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
  2977. SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
  2978. fi
  2979. if test "x$IDN_ENABLED" = "x1"; then
  2980. SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
  2981. fi
  2982. if test "x$USE_WINDOWS_SSPI" = "x1"; then
  2983. SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
  2984. fi
  2985. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  2986. if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
  2987. -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
  2988. -o "x$DARWINSSL_ENABLED" = "x1"; then
  2989. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
  2990. if test "x$NTLM_WB_ENABLED" = "x1"; then
  2991. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
  2992. fi
  2993. fi
  2994. fi
  2995. if test "x$USE_TLS_SRP" = "x1"; then
  2996. SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
  2997. fi
  2998. AC_SUBST(SUPPORT_FEATURES)
  2999. dnl For supported protocols in pkg-config file
  3000. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  3001. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
  3002. if test "x$SSL_ENABLED" = "x1"; then
  3003. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
  3004. fi
  3005. fi
  3006. if test "x$CURL_DISABLE_FTP" != "x1"; then
  3007. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
  3008. if test "x$SSL_ENABLED" = "x1"; then
  3009. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
  3010. fi
  3011. fi
  3012. if test "x$CURL_DISABLE_FILE" != "x1"; then
  3013. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
  3014. fi
  3015. if test "x$CURL_DISABLE_TELNET" != "x1"; then
  3016. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
  3017. fi
  3018. if test "x$CURL_DISABLE_LDAP" != "x1"; then
  3019. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
  3020. if test "x$CURL_DISABLE_LDAPS" != "x1"; then
  3021. if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
  3022. (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
  3023. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
  3024. fi
  3025. fi
  3026. fi
  3027. if test "x$CURL_DISABLE_DICT" != "x1"; then
  3028. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
  3029. fi
  3030. if test "x$CURL_DISABLE_TFTP" != "x1"; then
  3031. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
  3032. fi
  3033. if test "x$CURL_DISABLE_GOPHER" != "x1"; then
  3034. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
  3035. fi
  3036. if test "x$CURL_DISABLE_POP3" != "x1"; then
  3037. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
  3038. if test "x$SSL_ENABLED" = "x1"; then
  3039. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
  3040. fi
  3041. fi
  3042. if test "x$CURL_DISABLE_IMAP" != "x1"; then
  3043. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
  3044. if test "x$SSL_ENABLED" = "x1"; then
  3045. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
  3046. fi
  3047. fi
  3048. if test "x$CURL_DISABLE_SMTP" != "x1"; then
  3049. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
  3050. if test "x$SSL_ENABLED" = "x1"; then
  3051. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
  3052. fi
  3053. fi
  3054. if test "x$USE_LIBSSH2" = "x1"; then
  3055. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  3056. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
  3057. fi
  3058. if test "x$CURL_DISABLE_RTSP" != "x1"; then
  3059. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
  3060. fi
  3061. if test "x$USE_LIBRTMP" = "x1"; then
  3062. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
  3063. fi
  3064. dnl replace spaces with newlines
  3065. dnl sort the lines
  3066. dnl replace the newlines back to spaces
  3067. SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
  3068. AC_SUBST(SUPPORT_PROTOCOLS)
  3069. dnl squeeze whitespace out of some variables
  3070. squeeze CFLAGS
  3071. squeeze CPPFLAGS
  3072. squeeze DEFS
  3073. squeeze LDFLAGS
  3074. squeeze LIBS
  3075. squeeze LIBCURL_LIBS
  3076. squeeze CURL_NETWORK_LIBS
  3077. squeeze CURL_NETWORK_AND_TIME_LIBS
  3078. squeeze SUPPORT_FEATURES
  3079. squeeze SUPPORT_PROTOCOLS
  3080. XC_CHECK_BUILD_FLAGS
  3081. if test "x$want_curldebug_assumed" = "xyes" &&
  3082. test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
  3083. ac_configure_args="$ac_configure_args --enable-curldebug"
  3084. fi
  3085. AC_CONFIG_FILES([Makefile \
  3086. docs/Makefile \
  3087. docs/examples/Makefile \
  3088. docs/libcurl/Makefile \
  3089. include/Makefile \
  3090. include/curl/Makefile \
  3091. src/Makefile \
  3092. lib/Makefile \
  3093. lib/libcurl.vers \
  3094. tests/Makefile \
  3095. tests/certs/Makefile \
  3096. tests/certs/scripts/Makefile \
  3097. tests/data/Makefile \
  3098. tests/server/Makefile \
  3099. tests/libtest/Makefile \
  3100. tests/unit/Makefile \
  3101. packages/Makefile \
  3102. packages/Win32/Makefile \
  3103. packages/Win32/cygwin/Makefile \
  3104. packages/Linux/Makefile \
  3105. packages/Linux/RPM/Makefile \
  3106. packages/Linux/RPM/curl.spec \
  3107. packages/Linux/RPM/curl-ssl.spec \
  3108. packages/Solaris/Makefile \
  3109. packages/EPM/curl.list \
  3110. packages/EPM/Makefile \
  3111. packages/vms/Makefile \
  3112. packages/AIX/Makefile \
  3113. packages/AIX/RPM/Makefile \
  3114. packages/AIX/RPM/curl.spec \
  3115. curl-config \
  3116. libcurl.pc
  3117. ])
  3118. AC_OUTPUT
  3119. CURL_GENERATE_CONFIGUREHELP_PM
  3120. AC_MSG_NOTICE([Configured to build curl/libcurl:
  3121. curl version: ${CURLVERSION}
  3122. Host setup: ${host}
  3123. Install prefix: ${prefix}
  3124. Compiler: ${CC}
  3125. SSL support: ${curl_ssl_msg}
  3126. SSH support: ${curl_ssh_msg}
  3127. zlib support: ${curl_zlib_msg}
  3128. krb4 support: ${curl_krb4_msg}
  3129. GSSAPI support: ${curl_gss_msg}
  3130. SPNEGO support: ${curl_spnego_msg}
  3131. TLS-SRP support: ${curl_tls_srp_msg}
  3132. resolver: ${curl_res_msg}
  3133. ipv6 support: ${curl_ipv6_msg}
  3134. IDN support: ${curl_idn_msg}
  3135. Build libcurl: Shared=${enable_shared}, Static=${enable_static}
  3136. Built-in manual: ${curl_manual_msg}
  3137. --libcurl option: ${curl_libcurl_msg}
  3138. Verbose errors: ${curl_verbose_msg}
  3139. SSPI support: ${curl_sspi_msg}
  3140. ca cert bundle: ${ca}
  3141. ca cert path: ${capath}
  3142. LDAP support: ${curl_ldap_msg}
  3143. LDAPS support: ${curl_ldaps_msg}
  3144. RTSP support: ${curl_rtsp_msg}
  3145. RTMP support: ${curl_rtmp_msg}
  3146. metalink support: ${curl_mtlnk_msg}
  3147. Protocols: ${SUPPORT_PROTOCOLS}
  3148. ])
  3149. if test "x$soname_bump" = "xyes"; then
  3150. cat <<EOM
  3151. SONAME bump: yes - WARNING: this library will be built with the SONAME
  3152. number bumped due to (a detected) ABI breakage.
  3153. See lib/README.curl_off_t for details on this.
  3154. EOM
  3155. fi