configure.ac 103 KB

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