configure.ac 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563
  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 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 GSSAPI header]),
  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 GSSAPI 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 GSSAPI]), [
  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 GSSAPI 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 the GNU gssapi libraries])
  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 the Heimdal gssapi libraries])
  1114. ],
  1115. [
  1116. dnl no header found, disabling GSS
  1117. want_gss=no
  1118. AC_MSG_WARN(disabling GSSAPI since no header files was found)
  1119. ]
  1120. )
  1121. else
  1122. dnl MIT found
  1123. AC_DEFINE(HAVE_GSSMIT, 1, [if you have the MIT gssapi libraries])
  1124. dnl check if we have a really old MIT kerberos (<= 1.2)
  1125. AC_MSG_CHECKING([if gssapi 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 gssapi library, 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 the gssapi libraries])
  1153. curl_gss_msg="enabled (MIT/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. *)
  1164. if test -f "$GSSAPI_ROOT/bin/krb5-config"; then
  1165. dnl krb5-config doesn't have --libs-only-L or similar, put everything
  1166. dnl into LIBS
  1167. gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi`
  1168. LIBS="$gss_libs $LIBS"
  1169. elif test "$GSSAPI_ROOT" != "yes"; then
  1170. LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
  1171. LIBS="-lgssapi $LIBS"
  1172. else
  1173. LIBS="-lgssapi $LIBS"
  1174. fi
  1175. ;;
  1176. esac
  1177. else
  1178. LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
  1179. LIBS="-lgssapi $LIBS"
  1180. fi
  1181. else
  1182. CPPFLAGS="$save_CPPFLAGS"
  1183. fi
  1184. dnl -------------------------------------------------
  1185. dnl check winssl option before other SSL libraries
  1186. dnl -------------------------------------------------
  1187. OPT_WINSSL=no
  1188. AC_ARG_WITH(winssl,dnl
  1189. AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
  1190. AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
  1191. OPT_WINSSL=$withval)
  1192. AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
  1193. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1194. if test "x$OPT_WINSSL" != "xno" &&
  1195. test "x$ac_cv_native_windows" = "xyes"; then
  1196. AC_MSG_RESULT(yes)
  1197. AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
  1198. AC_SUBST(USE_SCHANNEL, [1])
  1199. curl_ssl_msg="enabled (Windows-native)"
  1200. WINSSL_ENABLED=1
  1201. # --with-winssl implies --enable-sspi
  1202. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  1203. AC_SUBST(USE_WINDOWS_SSPI, [1])
  1204. curl_sspi_msg="enabled"
  1205. else
  1206. AC_MSG_RESULT(no)
  1207. fi
  1208. else
  1209. AC_MSG_RESULT(no)
  1210. fi
  1211. OPT_DARWINSSL=no
  1212. AC_ARG_WITH(darwinssl,dnl
  1213. AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
  1214. AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
  1215. OPT_DARWINSSL=$withval)
  1216. AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
  1217. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1218. if test "x$OPT_DARWINSSL" != "xno" &&
  1219. test -d "/System/Library/Frameworks/Security.framework"; then
  1220. AC_MSG_RESULT(yes)
  1221. AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
  1222. AC_SUBST(USE_DARWINSSL, [1])
  1223. curl_ssl_msg="enabled (iOS/Mac OS X-native)"
  1224. DARWINSSL_ENABLED=1
  1225. LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
  1226. else
  1227. AC_MSG_RESULT(no)
  1228. fi
  1229. else
  1230. AC_MSG_RESULT(no)
  1231. fi
  1232. dnl **********************************************************************
  1233. dnl Check for the presence of SSL libraries and headers
  1234. dnl **********************************************************************
  1235. dnl Default to compiler & linker defaults for SSL files & libraries.
  1236. OPT_SSL=off
  1237. dnl Default to no CA bundle
  1238. ca="no"
  1239. AC_ARG_WITH(ssl,dnl
  1240. 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])
  1241. AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
  1242. OPT_SSL=$withval)
  1243. if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
  1244. dnl backup the pre-ssl variables
  1245. CLEANLDFLAGS="$LDFLAGS"
  1246. CLEANCPPFLAGS="$CPPFLAGS"
  1247. CLEANLIBS="$LIBS"
  1248. case "$OPT_SSL" in
  1249. yes)
  1250. dnl --with-ssl (without path) used
  1251. if test x$cross_compiling != xyes; then
  1252. dnl only do pkg-config magic when not cross-compiling
  1253. PKGTEST="yes"
  1254. fi
  1255. PREFIX_OPENSSL=/usr/local/ssl
  1256. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1257. ;;
  1258. off)
  1259. dnl no --with-ssl option given, just check default places
  1260. if test x$cross_compiling != xyes; then
  1261. dnl only do pkg-config magic when not cross-compiling
  1262. PKGTEST="yes"
  1263. fi
  1264. PREFIX_OPENSSL=
  1265. ;;
  1266. *)
  1267. dnl check the given --with-ssl spot
  1268. PKGTEST="no"
  1269. PREFIX_OPENSSL=$OPT_SSL
  1270. dnl Try pkg-config even when cross-compiling. Since we
  1271. dnl specify PKG_CONFIG_LIBDIR we're only looking where
  1272. dnl the user told us to look
  1273. OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
  1274. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
  1275. if test -f "$OPENSSL_PCDIR/openssl.pc"; then
  1276. PKGTEST="yes"
  1277. fi
  1278. dnl in case pkg-config comes up empty, use what we got
  1279. dnl via --with-ssl
  1280. LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
  1281. if test "$PREFIX_OPENSSL" != "/usr" ; then
  1282. SSL_LDFLAGS="-L$LIB_OPENSSL"
  1283. SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
  1284. fi
  1285. SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
  1286. ;;
  1287. esac
  1288. if test "$PKGTEST" = "yes"; then
  1289. CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
  1290. if test "$PKGCONFIG" != "no" ; then
  1291. SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1292. $PKGCONFIG --libs-only-l openssl 2>/dev/null`
  1293. SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1294. $PKGCONFIG --libs-only-L openssl 2>/dev/null`
  1295. SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
  1296. $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
  1297. AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
  1298. AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
  1299. AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
  1300. LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
  1301. dnl use the values pkg-config reported. This is here
  1302. dnl instead of below with CPPFLAGS and LDFLAGS because we only
  1303. dnl learn about this via pkg-config. If we only have
  1304. dnl the argument to --with-ssl we don't know what
  1305. dnl additional libs may be necessary. Hope that we
  1306. dnl don't need any.
  1307. LIBS="$SSL_LIBS $LIBS"
  1308. fi
  1309. fi
  1310. dnl finally, set flags to use SSL
  1311. CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
  1312. LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
  1313. dnl This is for Msys/Mingw
  1314. case $host in
  1315. *-*-msys* | *-*-mingw*)
  1316. AC_MSG_CHECKING([for gdi32])
  1317. my_ac_save_LIBS=$LIBS
  1318. LIBS="-lgdi32 $LIBS"
  1319. AC_TRY_LINK([#include <windef.h>
  1320. #include <wingdi.h>],
  1321. [GdiFlush();],
  1322. [ dnl worked!
  1323. AC_MSG_RESULT([yes])],
  1324. [ dnl failed, restore LIBS
  1325. LIBS=$my_ac_save_LIBS
  1326. AC_MSG_RESULT(no)]
  1327. )
  1328. ;;
  1329. esac
  1330. AC_CHECK_LIB(crypto, CRYPTO_lock,[
  1331. HAVECRYPTO="yes"
  1332. LIBS="-lcrypto $LIBS"
  1333. ],[
  1334. LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
  1335. CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
  1336. AC_CHECK_LIB(crypto, CRYPTO_add_lock,[
  1337. HAVECRYPTO="yes"
  1338. LIBS="-lcrypto $LIBS"], [
  1339. LDFLAGS="$CLEANLDFLAGS"
  1340. CPPFLAGS="$CLEANCPPFLAGS"
  1341. LIBS="$CLEANLIBS"
  1342. ])
  1343. ])
  1344. if test X"$HAVECRYPTO" = X"yes"; then
  1345. dnl This is only reasonable to do if crypto actually is there: check for
  1346. dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
  1347. AC_CHECK_LIB(ssl, SSL_connect)
  1348. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1349. dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
  1350. AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
  1351. OLIBS=$LIBS
  1352. LIBS="-lRSAglue -lrsaref $LIBS"
  1353. AC_CHECK_LIB(ssl, SSL_connect)
  1354. if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
  1355. dnl still no SSL_connect
  1356. AC_MSG_RESULT(no)
  1357. LIBS=$OLIBS
  1358. else
  1359. AC_MSG_RESULT(yes)
  1360. fi
  1361. else
  1362. dnl Have the libraries--check for SSLeay/OpenSSL headers
  1363. AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
  1364. openssl/pem.h openssl/ssl.h openssl/err.h,
  1365. curl_ssl_msg="enabled (OpenSSL)"
  1366. OPENSSL_ENABLED=1
  1367. AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
  1368. if test $ac_cv_header_openssl_x509_h = no; then
  1369. dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
  1370. dnl since 'err.h' might in fact find a krb4 header with the same
  1371. dnl name
  1372. AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
  1373. if test $ac_cv_header_x509_h = yes &&
  1374. test $ac_cv_header_crypto_h = yes &&
  1375. test $ac_cv_header_ssl_h = yes; then
  1376. dnl three matches
  1377. curl_ssl_msg="enabled (OpenSSL)"
  1378. OPENSSL_ENABLED=1
  1379. fi
  1380. fi
  1381. fi
  1382. if test X"$OPENSSL_ENABLED" = X"1"; then
  1383. AC_DEFINE(USE_SSLEAY, 1, [if SSL is enabled])
  1384. dnl is there a pkcs12.h header present?
  1385. AC_CHECK_HEADERS(openssl/pkcs12.h)
  1386. else
  1387. LIBS="$CLEANLIBS"
  1388. fi
  1389. dnl USE_SSLEAY is the historical name for what configure calls
  1390. dnl OPENSSL_ENABLED; the names should really be unified
  1391. USE_SSLEAY="$OPENSSL_ENABLED"
  1392. AC_SUBST(USE_SSLEAY)
  1393. if test X"$OPT_SSL" != Xoff &&
  1394. test "$OPENSSL_ENABLED" != "1"; then
  1395. AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
  1396. fi
  1397. fi
  1398. if test X"$OPENSSL_ENABLED" = X"1"; then
  1399. dnl If the ENGINE library seems to be around, check for the OpenSSL engine
  1400. dnl stuff, it is kind of "separated" from the main SSL check
  1401. AC_CHECK_FUNC(ENGINE_init,
  1402. [
  1403. AC_CHECK_HEADERS(openssl/engine.h)
  1404. AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
  1405. ])
  1406. dnl these can only exist if openssl exists
  1407. dnl yassl doesn't have SSL_get_shutdown
  1408. AC_CHECK_FUNCS( RAND_status \
  1409. RAND_screen \
  1410. RAND_egd \
  1411. ENGINE_cleanup \
  1412. CRYPTO_cleanup_all_ex_data \
  1413. SSL_get_shutdown \
  1414. SSLv2_client_method )
  1415. dnl Make an attempt to detect if this is actually yassl's headers and
  1416. dnl OpenSSL emulation layer. We still leave everything else believing
  1417. dnl and acting like OpenSSL.
  1418. AC_MSG_CHECKING([for yaSSL using OpenSSL compatibility mode])
  1419. AC_COMPILE_IFELSE([
  1420. AC_LANG_PROGRAM([[
  1421. #include <openssl/ssl.h>
  1422. ]],[[
  1423. #if defined(YASSL_VERSION) && defined(OPENSSL_VERSION_NUMBER)
  1424. int dummy = SSL_ERROR_NONE;
  1425. #else
  1426. Not the yaSSL OpenSSL compatibility header.
  1427. #endif
  1428. ]])
  1429. ],[
  1430. AC_MSG_RESULT([yes])
  1431. AC_DEFINE_UNQUOTED(USE_YASSLEMUL, 1,
  1432. [Define to 1 if using yaSSL in OpenSSL compatibility mode.])
  1433. curl_ssl_msg="enabled (OpenSSL emulation by yaSSL)"
  1434. ],[
  1435. AC_MSG_RESULT([no])
  1436. ])
  1437. fi
  1438. if test "$OPENSSL_ENABLED" = "1"; then
  1439. if test -n "$LIB_OPENSSL"; then
  1440. dnl when the ssl shared libs were found in a path that the run-time
  1441. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  1442. dnl to prevent further configure tests to fail due to this
  1443. if test "x$cross_compiling" != "xyes"; then
  1444. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
  1445. export LD_LIBRARY_PATH
  1446. AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
  1447. fi
  1448. fi
  1449. CURL_CHECK_OPENSSL_API
  1450. fi
  1451. fi
  1452. dnl **********************************************************************
  1453. dnl Check for the random seed preferences
  1454. dnl **********************************************************************
  1455. if test X"$OPENSSL_ENABLED" = X"1"; then
  1456. AC_ARG_WITH(egd-socket,
  1457. AC_HELP_STRING([--with-egd-socket=FILE],
  1458. [Entropy Gathering Daemon socket pathname]),
  1459. [ EGD_SOCKET="$withval" ]
  1460. )
  1461. if test -n "$EGD_SOCKET" ; then
  1462. AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
  1463. [your Entropy Gathering Daemon socket pathname] )
  1464. fi
  1465. dnl Check for user-specified random device
  1466. AC_ARG_WITH(random,
  1467. AC_HELP_STRING([--with-random=FILE],
  1468. [read randomness from FILE (default=/dev/urandom)]),
  1469. [ RANDOM_FILE="$withval" ],
  1470. [
  1471. if test x$cross_compiling != xyes; then
  1472. dnl Check for random device
  1473. AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
  1474. else
  1475. AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
  1476. fi
  1477. ]
  1478. )
  1479. if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
  1480. AC_SUBST(RANDOM_FILE)
  1481. AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
  1482. [a suitable file to read random data from])
  1483. fi
  1484. fi
  1485. dnl ---
  1486. dnl We require OpenSSL with SRP support.
  1487. dnl ---
  1488. if test "$OPENSSL_ENABLED" = "1"; then
  1489. AC_CHECK_LIB(crypto, SRP_Calc_client_key,
  1490. [
  1491. AC_DEFINE(HAVE_SSLEAY_SRP, 1, [if you have the function SRP_Calc_client_key])
  1492. AC_SUBST(HAVE_SSLEAY_SRP, [1])
  1493. ])
  1494. fi
  1495. dnl ----------------------------------------------------
  1496. dnl check for GnuTLS
  1497. dnl ----------------------------------------------------
  1498. dnl Default to compiler & linker defaults for GnuTLS files & libraries.
  1499. OPT_GNUTLS=no
  1500. AC_ARG_WITH(gnutls,dnl
  1501. AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
  1502. AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
  1503. OPT_GNUTLS=$withval)
  1504. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1505. if test X"$OPT_GNUTLS" != Xno; then
  1506. addld=""
  1507. addlib=""
  1508. gtlslib=""
  1509. version=""
  1510. addcflags=""
  1511. if test "x$OPT_GNUTLS" = "xyes"; then
  1512. dnl this is with no partiular path given
  1513. CURL_CHECK_PKGCONFIG(gnutls)
  1514. if test "$PKGCONFIG" != "no" ; then
  1515. addlib=`$PKGCONFIG --libs-only-l gnutls`
  1516. addld=`$PKGCONFIG --libs-only-L gnutls`
  1517. addcflags=`$PKGCONFIG --cflags-only-I gnutls`
  1518. version=`$PKGCONFIG --modversion gnutls`
  1519. gtlslib=`echo $addld | $SED -e 's/-L//'`
  1520. else
  1521. dnl without pkg-config, we try libgnutls-config as that was how it
  1522. dnl used to be done
  1523. check=`libgnutls-config --version 2>/dev/null`
  1524. if test -n "$check"; then
  1525. addlib=`libgnutls-config --libs`
  1526. addcflags=`libgnutls-config --cflags`
  1527. version=`libgnutls-config --version`
  1528. gtlslib=`libgnutls-config --prefix`/lib$libsuff
  1529. fi
  1530. fi
  1531. else
  1532. dnl this is with a given path, first check if there's a libgnutls-config
  1533. dnl there and if not, make an educated guess
  1534. cfg=$OPT_GNUTLS/bin/libgnutls-config
  1535. check=`$cfg --version 2>/dev/null`
  1536. if test -n "$check"; then
  1537. addlib=`$cfg --libs`
  1538. addcflags=`$cfg --cflags`
  1539. version=`$cfg --version`
  1540. gtlslib=`$cfg --prefix`/lib$libsuff
  1541. else
  1542. dnl without pkg-config and libgnutls-config, we guess a lot!
  1543. addlib=-lgnutls
  1544. addld=-L$OPT_GNUTLS/lib$libsuff
  1545. addcflags=-I$OPT_GNUTLS/include
  1546. version="" # we just don't know
  1547. gtlslib=$OPT_GNUTLS/lib$libsuff
  1548. fi
  1549. fi
  1550. if test -z "$version"; then
  1551. dnl lots of efforts, still no go
  1552. version="unknown"
  1553. fi
  1554. if test -n "$addlib"; then
  1555. CLEANLIBS="$LIBS"
  1556. CLEANCPPFLAGS="$CPPFLAGS"
  1557. CLEANLDFLAGS="$LDFLAGS"
  1558. LIBS="$addlib $LIBS"
  1559. LDFLAGS="$LDFLAGS $addld"
  1560. if test "$addcflags" != "-I/usr/include"; then
  1561. CPPFLAGS="$CPPFLAGS $addcflags"
  1562. fi
  1563. AC_CHECK_LIB(gnutls, gnutls_check_version,
  1564. [
  1565. AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
  1566. AC_SUBST(USE_GNUTLS, [1])
  1567. GNUTLS_ENABLED=1
  1568. USE_GNUTLS="yes"
  1569. curl_ssl_msg="enabled (GnuTLS)"
  1570. ],
  1571. [
  1572. LIBS="$CLEANLIBS"
  1573. CPPFLAGS="$CLEANCPPFLAGS"
  1574. ])
  1575. if test "x$USE_GNUTLS" = "xyes"; then
  1576. AC_MSG_NOTICE([detected GnuTLS version $version])
  1577. if test -n "$gtlslib"; then
  1578. dnl when shared libs were found in a path that the run-time
  1579. dnl linker doesn't search through, we need to add it to
  1580. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1581. dnl due to this
  1582. if test "x$cross_compiling" != "xyes"; then
  1583. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
  1584. export LD_LIBRARY_PATH
  1585. AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
  1586. fi
  1587. fi
  1588. fi
  1589. fi
  1590. fi dnl GNUTLS not disabled
  1591. fi
  1592. dnl ---
  1593. dnl Check which crypto backend GnuTLS uses
  1594. dnl ---
  1595. if test "$GNUTLS_ENABLED" = "1"; then
  1596. USE_GNUTLS_NETTLE=
  1597. # First check if we can detect either crypto library via transitive linking
  1598. AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
  1599. if test "$USE_GNUTLS_NETTLE" = ""; then
  1600. AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
  1601. fi
  1602. # If not, try linking directly to both of them to see if they are available
  1603. if test "$USE_GNUTLS_NETTLE" = ""; then
  1604. AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
  1605. fi
  1606. if test "$USE_GNUTLS_NETTLE" = ""; then
  1607. AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
  1608. fi
  1609. if test "$USE_GNUTLS_NETTLE" = ""; then
  1610. AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
  1611. fi
  1612. if test "$USE_GNUTLS_NETTLE" = "1"; then
  1613. AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
  1614. AC_SUBST(USE_GNUTLS_NETTLE, [1])
  1615. LIBS="-lnettle $LIBS"
  1616. else
  1617. LIBS="-lgcrypt $LIBS"
  1618. fi
  1619. fi
  1620. dnl ---
  1621. dnl We require GnuTLS with SRP support.
  1622. dnl ---
  1623. if test "$GNUTLS_ENABLED" = "1"; then
  1624. AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
  1625. [
  1626. AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
  1627. AC_SUBST(HAVE_GNUTLS_SRP, [1])
  1628. ])
  1629. fi
  1630. dnl ----------------------------------------------------
  1631. dnl check for PolarSSL
  1632. dnl ----------------------------------------------------
  1633. dnl Default to compiler & linker defaults for PolarSSL files & libraries.
  1634. OPT_POLARSSL=no
  1635. _cppflags=$CPPFLAGS
  1636. _ldflags=$LDFLAGS
  1637. AC_ARG_WITH(polarssl,dnl
  1638. AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
  1639. AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
  1640. OPT_POLARSSL=$withval)
  1641. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1642. if test X"$OPT_POLARSSL" != Xno; then
  1643. if test "$OPT_POLARSSL" = "yes"; then
  1644. OPT_POLARSSL=""
  1645. fi
  1646. if test -z "$OPT_POLARSSL" ; then
  1647. dnl check for lib first without setting any new path
  1648. AC_CHECK_LIB(polarssl, havege_init,
  1649. dnl libpolarssl found, set the variable
  1650. [
  1651. AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
  1652. AC_SUBST(USE_POLARSSL, [1])
  1653. POLARSSL_ENABLED=1
  1654. USE_POLARSSL="yes"
  1655. curl_ssl_msg="enabled (PolarSSL)"
  1656. ])
  1657. fi
  1658. addld=""
  1659. addlib=""
  1660. addcflags=""
  1661. polarssllib=""
  1662. if test "x$USE_POLARSSL" != "xyes"; then
  1663. dnl add the path and test again
  1664. addld=-L$OPT_POLARSSL/lib$libsuff
  1665. addcflags=-I$OPT_POLARSSL/include
  1666. polarssllib=$OPT_POLARSSL/lib$libsuff
  1667. LDFLAGS="$LDFLAGS $addld"
  1668. if test "$addcflags" != "-I/usr/include"; then
  1669. CPPFLAGS="$CPPFLAGS $addcflags"
  1670. fi
  1671. AC_CHECK_LIB(polarssl, ssl_init,
  1672. [
  1673. AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
  1674. AC_SUBST(USE_POLARSSL, [1])
  1675. POLARSSL_ENABLED=1
  1676. USE_POLARSSL="yes"
  1677. curl_ssl_msg="enabled (PolarSSL)"
  1678. ],
  1679. [
  1680. CPPFLAGS=$_cppflags
  1681. LDFLAGS=$_ldflags
  1682. ])
  1683. fi
  1684. if test "x$USE_POLARSSL" = "xyes"; then
  1685. AC_MSG_NOTICE([detected PolarSSL])
  1686. LIBS="-lpolarssl $LIBS"
  1687. if test -n "$polarssllib"; then
  1688. dnl when shared libs were found in a path that the run-time
  1689. dnl linker doesn't search through, we need to add it to
  1690. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1691. dnl due to this
  1692. if test "x$cross_compiling" != "xyes"; then
  1693. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
  1694. export LD_LIBRARY_PATH
  1695. AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
  1696. fi
  1697. fi
  1698. fi
  1699. fi dnl PolarSSL not disabled
  1700. fi
  1701. dnl ----------------------------------------------------
  1702. dnl check for CyaSSL
  1703. dnl ----------------------------------------------------
  1704. dnl Default to compiler & linker defaults for CyaSSL files & libraries.
  1705. OPT_CYASSL=no
  1706. _cppflags=$CPPFLAGS
  1707. _ldflags=$LDFLAGS
  1708. AC_ARG_WITH(cyassl,dnl
  1709. AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
  1710. AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
  1711. OPT_CYASSL=$withval)
  1712. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1713. if test X"$OPT_CYASSL" != Xno; then
  1714. if test "$OPT_CYASSL" = "yes"; then
  1715. OPT_CYASSL=""
  1716. fi
  1717. if test -z "$OPT_CYASSL" ; then
  1718. dnl check for lib in system default first
  1719. AC_CHECK_LIB(cyassl, CyaSSL_Init,
  1720. dnl libcyassl found, set the variable
  1721. [
  1722. AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  1723. AC_SUBST(USE_CYASSL, [1])
  1724. CYASSL_ENABLED=1
  1725. USE_CYASSL="yes"
  1726. curl_ssl_msg="enabled (CyaSSL)"
  1727. ])
  1728. fi
  1729. addld=""
  1730. addlib=""
  1731. addcflags=""
  1732. cyassllib=""
  1733. if test "x$USE_CYASSL" != "xyes"; then
  1734. dnl add the path and test again
  1735. addld=-L$OPT_CYASSL/lib$libsuff
  1736. addcflags=-I$OPT_CYASSL/include
  1737. cyassllib=$OPT_CYASSL/lib$libsuff
  1738. LDFLAGS="$LDFLAGS $addld"
  1739. if test "$addcflags" != "-I/usr/include"; then
  1740. CPPFLAGS="$CPPFLAGS $addcflags"
  1741. fi
  1742. AC_CHECK_LIB(cyassl, CyaSSL_Init,
  1743. [
  1744. AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
  1745. AC_SUBST(USE_CYASSL, [1])
  1746. CYASSL_ENABLED=1
  1747. USE_CYASSL="yes"
  1748. curl_ssl_msg="enabled (CyaSSL)"
  1749. ],
  1750. [
  1751. CPPFLAGS=$_cppflags
  1752. LDFLAGS=$_ldflags
  1753. ])
  1754. fi
  1755. if test "x$USE_CYASSL" = "xyes"; then
  1756. AC_MSG_NOTICE([detected CyaSSL])
  1757. dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
  1758. AC_CHECK_SIZEOF(long long)
  1759. LIBS="-lcyassl -lm $LIBS"
  1760. if test -n "$cyassllib"; then
  1761. dnl when shared libs were found in a path that the run-time
  1762. dnl linker doesn't search through, we need to add it to
  1763. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1764. dnl due to this
  1765. if test "x$cross_compiling" != "xyes"; then
  1766. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
  1767. export LD_LIBRARY_PATH
  1768. AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
  1769. fi
  1770. fi
  1771. fi
  1772. fi dnl CyaSSL not disabled
  1773. fi
  1774. dnl ----------------------------------------------------
  1775. dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
  1776. dnl ----------------------------------------------------
  1777. dnl Default to compiler & linker defaults for NSS files & libraries.
  1778. OPT_NSS=no
  1779. AC_ARG_WITH(nss,dnl
  1780. AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
  1781. AC_HELP_STRING([--without-nss], [disable NSS detection]),
  1782. OPT_NSS=$withval)
  1783. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1784. if test X"$OPT_NSS" != Xno; then
  1785. addld=""
  1786. addlib=""
  1787. addcflags=""
  1788. nssprefix=""
  1789. version=""
  1790. if test "x$OPT_NSS" = "xyes"; then
  1791. CURL_CHECK_PKGCONFIG(nss)
  1792. if test "$PKGCONFIG" != "no" ; then
  1793. addlib=`$PKGCONFIG --libs nss`
  1794. addcflags=`$PKGCONFIG --cflags nss`
  1795. version=`$PKGCONFIG --modversion nss`
  1796. nssprefix=`$PKGCONFIG --variable=prefix nss`
  1797. else
  1798. dnl Without pkg-config, we check for nss-config
  1799. check=`nss-config --version 2>/dev/null`
  1800. if test -n "$check"; then
  1801. addlib=`nss-config --libs`
  1802. addcflags=`nss-config --cflags`
  1803. version=`nss-config --version`
  1804. nssprefix=`nss-config --prefix`
  1805. else
  1806. addlib="-lnss3"
  1807. addcflags=""
  1808. version="unknown"
  1809. fi
  1810. fi
  1811. else
  1812. # Without pkg-config, we'll kludge in some defaults
  1813. addlib="-L$OPT_NSS/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
  1814. addcflags="-I$OPT_NSS/include"
  1815. version="unknown"
  1816. nssprefix=$OPT_NSS
  1817. fi
  1818. if test -n "$addlib"; then
  1819. CLEANLIBS="$LIBS"
  1820. CLEANCPPFLAGS="$CPPFLAGS"
  1821. LIBS="$addlib $LIBS"
  1822. if test "$addcflags" != "-I/usr/include"; then
  1823. CPPFLAGS="$CPPFLAGS $addcflags"
  1824. fi
  1825. dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
  1826. AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
  1827. [
  1828. AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
  1829. AC_SUBST(USE_NSS, [1])
  1830. USE_NSS="yes"
  1831. NSS_ENABLED=1
  1832. curl_ssl_msg="enabled (NSS)"
  1833. ],
  1834. [
  1835. LIBS="$CLEANLIBS"
  1836. CPPFLAGS="$CLEANCPPFLAGS"
  1837. ])
  1838. if test "x$USE_NSS" = "xyes"; then
  1839. AC_MSG_NOTICE([detected NSS version $version])
  1840. dnl when shared libs were found in a path that the run-time
  1841. dnl linker doesn't search through, we need to add it to
  1842. dnl LD_LIBRARY_PATH to prevent further configure tests to fail
  1843. dnl due to this
  1844. if test "x$cross_compiling" != "xyes"; then
  1845. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
  1846. export LD_LIBRARY_PATH
  1847. AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
  1848. fi
  1849. fi
  1850. fi
  1851. fi dnl NSS not disabled
  1852. fi dnl curl_ssl_msg = init_ssl_msg
  1853. OPT_AXTLS=off
  1854. AC_ARG_WITH(axtls,dnl
  1855. 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.])
  1856. AC_HELP_STRING([--without-axtls], [disable axTLS]),
  1857. OPT_AXTLS=$withval)
  1858. if test "$curl_ssl_msg" = "$init_ssl_msg"; then
  1859. if test X"$OPT_AXTLS" != Xno; then
  1860. dnl backup the pre-axtls variables
  1861. CLEANLDFLAGS="$LDFLAGS"
  1862. CLEANCPPFLAGS="$CPPFLAGS"
  1863. CLEANLIBS="$LIBS"
  1864. case "$OPT_AXTLS" in
  1865. yes)
  1866. dnl --with-axtls (without path) used
  1867. PREFIX_AXTLS=/usr/local
  1868. LIB_AXTLS="$PREFIX_AXTLS/lib"
  1869. LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
  1870. CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
  1871. ;;
  1872. off)
  1873. dnl no --with-axtls option given, just check default places
  1874. PREFIX_AXTLS=
  1875. ;;
  1876. *)
  1877. dnl check the given --with-axtls spot
  1878. PREFIX_AXTLS=$OPT_AXTLS
  1879. LIB_AXTLS="$PREFIX_AXTLS/lib"
  1880. LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
  1881. CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
  1882. ;;
  1883. esac
  1884. AC_CHECK_LIB(axtls, ssl_version,[
  1885. LIBS="-laxtls $LIBS"
  1886. AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
  1887. AC_SUBST(USE_AXTLS, [1])
  1888. AXTLS_ENABLED=1
  1889. USE_AXTLS="yes"
  1890. curl_ssl_msg="enabled (axTLS)"
  1891. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
  1892. export LD_LIBRARY_PATH
  1893. AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
  1894. ],[
  1895. LDFLAGS="$CLEANLDFLAGS"
  1896. CPPFLAGS="$CLEANCPPFLAGS"
  1897. LIBS="$CLEANLIBS"
  1898. ])
  1899. fi
  1900. fi
  1901. if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" = "x"; then
  1902. AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
  1903. AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
  1904. else
  1905. # SSL is enabled, genericly
  1906. AC_SUBST(SSL_ENABLED)
  1907. SSL_ENABLED="1"
  1908. fi
  1909. dnl **********************************************************************
  1910. dnl Check for the CA bundle
  1911. dnl **********************************************************************
  1912. CURL_CHECK_CA_BUNDLE
  1913. dnl **********************************************************************
  1914. dnl Check for libmetalink
  1915. dnl **********************************************************************
  1916. OPT_LIBMETALINK=no
  1917. AC_ARG_WITH(libmetalink,dnl
  1918. AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
  1919. AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
  1920. OPT_LIBMETALINK=$withval)
  1921. if test X"$OPT_LIBMETALINK" != Xno; then
  1922. addld=""
  1923. addlib=""
  1924. addcflags=""
  1925. version=""
  1926. libmetalinklib=""
  1927. PKGTEST="no"
  1928. if test "x$OPT_LIBMETALINK" = "xyes"; then
  1929. dnl this is with no partiular path given
  1930. PKGTEST="yes"
  1931. CURL_CHECK_PKGCONFIG(libmetalink)
  1932. else
  1933. dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
  1934. LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
  1935. AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
  1936. if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
  1937. PKGTEST="yes"
  1938. fi
  1939. if test "$PKGTEST" = "yes"; then
  1940. CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
  1941. fi
  1942. fi
  1943. if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
  1944. addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1945. $PKGCONFIG --libs-only-l libmetalink`
  1946. addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1947. $PKGCONFIG --libs-only-L libmetalink`
  1948. addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1949. $PKGCONFIG --cflags-only-I libmetalink`
  1950. version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
  1951. $PKGCONFIG --modversion libmetalink`
  1952. libmetalinklib=`echo $addld | $SED -e 's/-L//'`
  1953. fi
  1954. if test -n "$addlib"; then
  1955. clean_CPPFLAGS="$CPPFLAGS"
  1956. clean_LDFLAGS="$LDFLAGS"
  1957. clean_LIBS="$LIBS"
  1958. CPPFLAGS="$addcflags $clean_CPPFLAGS"
  1959. LDFLAGS="$addld $clean_LDFLAGS"
  1960. LIBS="$addlib $clean_LIBS"
  1961. AC_MSG_CHECKING([if libmetalink is recent enough])
  1962. AC_LINK_IFELSE([
  1963. AC_LANG_PROGRAM([[
  1964. # include <metalink/metalink.h>
  1965. ]],[[
  1966. if(0 != metalink_strerror(0)) /* added in 0.1.0 */
  1967. return 1;
  1968. ]])
  1969. ],[
  1970. AC_MSG_RESULT([yes ($version)])
  1971. want_metalink="yes"
  1972. ],[
  1973. AC_MSG_RESULT([no ($version)])
  1974. AC_MSG_NOTICE([libmetalink library defective or too old])
  1975. want_metalink="no"
  1976. ])
  1977. CPPFLAGS="$clean_CPPFLAGS"
  1978. LDFLAGS="$clean_LDFLAGS"
  1979. LIBS="$clean_LIBS"
  1980. if test "$want_metalink" = "yes"; then
  1981. dnl finally libmetalink will be used
  1982. AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
  1983. LIBMETALINK_LIBS=$addlib
  1984. LIBMETALINK_LDFLAGS=$addld
  1985. LIBMETALINK_CPPFLAGS=$addcflags
  1986. AC_SUBST([LIBMETALINK_LIBS])
  1987. AC_SUBST([LIBMETALINK_LDFLAGS])
  1988. AC_SUBST([LIBMETALINK_CPPFLAGS])
  1989. curl_mtlnk_msg="enabled"
  1990. fi
  1991. fi
  1992. fi
  1993. dnl **********************************************************************
  1994. dnl Check for the presence of LIBSSH2 libraries and headers
  1995. dnl **********************************************************************
  1996. dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
  1997. OPT_LIBSSH2=off
  1998. AC_ARG_WITH(libssh2,dnl
  1999. 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])
  2000. AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
  2001. OPT_LIBSSH2=$withval)
  2002. if test X"$OPT_LIBSSH2" != Xno; then
  2003. dnl backup the pre-libssh2 variables
  2004. CLEANLDFLAGS="$LDFLAGS"
  2005. CLEANCPPFLAGS="$CPPFLAGS"
  2006. CLEANLIBS="$LIBS"
  2007. case "$OPT_LIBSSH2" in
  2008. yes)
  2009. dnl --with-libssh2 (without path) used
  2010. CURL_CHECK_PKGCONFIG(libssh2)
  2011. if test "$PKGCONFIG" != "no" ; then
  2012. LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
  2013. LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
  2014. CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
  2015. version=`$PKGCONFIG --modversion libssh2`
  2016. DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
  2017. fi
  2018. ;;
  2019. off)
  2020. dnl no --with-libssh2 option given, just check default places
  2021. ;;
  2022. *)
  2023. dnl use the given --with-libssh2 spot
  2024. PREFIX_SSH2=$OPT_LIBSSH2
  2025. ;;
  2026. esac
  2027. dnl if given with a prefix, we set -L and -I based on that
  2028. if test -n "$PREFIX_SSH2"; then
  2029. LIB_SSH2="-lssh2"
  2030. LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
  2031. CPP_SSH2=-I${PREFIX_SSH2}/include
  2032. DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
  2033. fi
  2034. LDFLAGS="$LDFLAGS $LD_SSH2"
  2035. CPPFLAGS="$CPPFLAGS $CPP_SSH2"
  2036. LIBS="$LIB_SSH2 $LIBS"
  2037. AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
  2038. AC_CHECK_HEADERS(libssh2.h,
  2039. curl_ssh_msg="enabled (libSSH2)"
  2040. LIBSSH2_ENABLED=1
  2041. AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
  2042. AC_SUBST(USE_LIBSSH2, [1])
  2043. )
  2044. if test X"$OPT_LIBSSH2" != Xoff &&
  2045. test "$LIBSSH2_ENABLED" != "1"; then
  2046. AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
  2047. fi
  2048. if test "$LIBSSH2_ENABLED" = "1"; then
  2049. if test -n "$DIR_SSH2"; then
  2050. dnl when the libssh2 shared libs were found in a path that the run-time
  2051. dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
  2052. dnl to prevent further configure tests to fail due to this
  2053. dnl libssh2_version is a post 1.0 addition
  2054. dnl libssh2_init and libssh2_exit were added in 1.2.5
  2055. dnl libssh2_scp_send64 was added in 1.2.6
  2056. dnl libssh2_session_handshake was added in 1.2.8
  2057. AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
  2058. libssh2_scp_send64 libssh2_session_handshake)
  2059. if test "x$cross_compiling" != "xyes"; then
  2060. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
  2061. export LD_LIBRARY_PATH
  2062. AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
  2063. fi
  2064. fi
  2065. else
  2066. dnl no libssh2, revert back to clean variables
  2067. LDFLAGS=$CLEANLDFLAGS
  2068. CPPFLAGS=$CLEANCPPFLAGS
  2069. LIBS=$CLEANLIBS
  2070. fi
  2071. fi
  2072. dnl **********************************************************************
  2073. dnl Check for the presence of LIBRTMP libraries and headers
  2074. dnl **********************************************************************
  2075. dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
  2076. OPT_LIBRTMP=off
  2077. AC_ARG_WITH(librtmp,dnl
  2078. 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])
  2079. AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
  2080. OPT_LIBRTMP=$withval)
  2081. if test X"$OPT_LIBRTMP" != Xno; then
  2082. dnl backup the pre-librtmp variables
  2083. CLEANLDFLAGS="$LDFLAGS"
  2084. CLEANCPPFLAGS="$CPPFLAGS"
  2085. CLEANLIBS="$LIBS"
  2086. case "$OPT_LIBRTMP" in
  2087. yes)
  2088. dnl --with-librtmp (without path) used
  2089. CURL_CHECK_PKGCONFIG(librtmp)
  2090. if test "$PKGCONFIG" != "no" ; then
  2091. LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
  2092. LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
  2093. CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
  2094. version=`$PKGCONFIG --modversion librtmp`
  2095. DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
  2096. else
  2097. dnl To avoid link errors, we do not allow --librtmp without
  2098. dnl a pkgconfig file
  2099. AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
  2100. fi
  2101. ;;
  2102. off)
  2103. dnl no --with-librtmp option given, just check default places
  2104. LIB_RTMP="-lrtmp"
  2105. ;;
  2106. *)
  2107. dnl use the given --with-librtmp spot
  2108. PREFIX_RTMP=$OPT_LIBRTMP
  2109. ;;
  2110. esac
  2111. dnl if given with a prefix, we set -L and -I based on that
  2112. if test -n "$PREFIX_RTMP"; then
  2113. LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
  2114. CPP_RTMP=-I${PREFIX_RTMP}/include
  2115. DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
  2116. fi
  2117. LDFLAGS="$LDFLAGS $LD_RTMP"
  2118. CPPFLAGS="$CPPFLAGS $CPP_RTMP"
  2119. LIBS="$LIB_RTMP $LIBS"
  2120. AC_CHECK_LIB(rtmp, RTMP_Init,
  2121. [
  2122. AC_CHECK_HEADERS(librtmp/rtmp.h,
  2123. curl_rtmp_msg="enabled (librtmp)"
  2124. LIBRTMP_ENABLED=1
  2125. AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
  2126. AC_SUBST(USE_LIBRTMP, [1])
  2127. )
  2128. ],
  2129. dnl not found, revert back to clean variables
  2130. LDFLAGS=$CLEANLDFLAGS
  2131. CPPFLAGS=$CLEANCPPFLAGS
  2132. LIBS=$CLEANLIBS
  2133. )
  2134. if test X"$OPT_LIBRTMP" != Xoff &&
  2135. test "$LIBRTMP_ENABLED" != "1"; then
  2136. AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
  2137. fi
  2138. fi
  2139. dnl **********************************************************************
  2140. dnl Check for linker switch for versioned symbols
  2141. dnl **********************************************************************
  2142. versioned_symbols_flavour=
  2143. AC_MSG_CHECKING([whether versioned symbols are wanted])
  2144. AC_ARG_ENABLE(versioned-symbols,
  2145. AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
  2146. AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
  2147. [ case "$enableval" in
  2148. yes) AC_MSG_RESULT(yes)
  2149. AC_MSG_CHECKING([if libraries can be versioned])
  2150. GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
  2151. if test -z "$GLD"; then
  2152. AC_MSG_RESULT(no)
  2153. AC_MSG_WARN([You need an ld version supporting the --version-script option])
  2154. else
  2155. AC_MSG_RESULT(yes)
  2156. if test "x$OPENSSL_ENABLED" = "x1"; then
  2157. versioned_symbols_flavour="OPENSSL_"
  2158. elif test "x$GNUTLS_ENABLED" == "x1"; then
  2159. versioned_symbols_flavour="GNUTLS_"
  2160. elif test "x$NSS_ENABLED" == "x1"; then
  2161. versioned_symbols_flavour="NSS_"
  2162. elif test "x$POLARSSL_ENABLED" == "x1"; then
  2163. versioned_symbols_flavour="POLARSSL_"
  2164. elif test "x$CYASSL_ENABLED" == "x1"; then
  2165. versioned_symbols_flavour="CYASSL_"
  2166. elif test "x$AXTLS_ENABLED" == "x1"; then
  2167. versioned_symbols_flavour="AXTLS_"
  2168. elif test "x$WINSSL_ENABLED" == "x1"; then
  2169. versioned_symbols_flavour="WINSSL_"
  2170. elif test "x$DARWINSSL_ENABLED" == "x1"; then
  2171. versioned_symbols_flavour="DARWINSSL_"
  2172. else
  2173. versioned_symbols_flavour=""
  2174. fi
  2175. versioned_symbols="yes"
  2176. fi
  2177. ;;
  2178. *) AC_MSG_RESULT(no)
  2179. ;;
  2180. esac
  2181. ], [
  2182. AC_MSG_RESULT(no)
  2183. ]
  2184. )
  2185. AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
  2186. ["$versioned_symbols_flavour"])
  2187. AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
  2188. [test "x$versioned_symbols" = 'xyes'])
  2189. dnl -------------------------------------------------
  2190. dnl check winidn option before other IDN libraries
  2191. dnl -------------------------------------------------
  2192. AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
  2193. OPT_WINIDN="default"
  2194. AC_ARG_WITH(winidn,
  2195. AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
  2196. AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
  2197. OPT_WINIDN=$withval)
  2198. case "$OPT_WINIDN" in
  2199. no|default)
  2200. dnl --without-winidn option used or configure option not specified
  2201. want_winidn="no"
  2202. AC_MSG_RESULT([no])
  2203. ;;
  2204. yes)
  2205. dnl --with-winidn option used without path
  2206. want_winidn="yes"
  2207. want_winidn_path="default"
  2208. AC_MSG_RESULT([yes])
  2209. ;;
  2210. *)
  2211. dnl --with-winidn option used with path
  2212. want_winidn="yes"
  2213. want_winidn_path="$withval"
  2214. AC_MSG_RESULT([yes ($withval)])
  2215. ;;
  2216. esac
  2217. if test "$want_winidn" = "yes"; then
  2218. dnl winidn library support has been requested
  2219. clean_CPPFLAGS="$CPPFLAGS"
  2220. clean_LDFLAGS="$LDFLAGS"
  2221. clean_LIBS="$LIBS"
  2222. WINIDN_LIBS="-lnormaliz"
  2223. #
  2224. if test "$want_winidn_path" != "default"; then
  2225. dnl path has been specified
  2226. dnl pkg-config not available or provides no info
  2227. WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
  2228. WINIDN_CPPFLAGS="-I$want_winidn_path/include"
  2229. WINIDN_DIR="$want_winidn_path/lib$libsuff"
  2230. fi
  2231. #
  2232. CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
  2233. LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
  2234. LIBS="$WINIDN_LIBS $LIBS"
  2235. #
  2236. AC_MSG_CHECKING([if IdnToUnicode can be linked])
  2237. AC_LINK_IFELSE([
  2238. AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
  2239. ],[
  2240. AC_MSG_RESULT([yes])
  2241. tst_links_winidn="yes"
  2242. ],[
  2243. AC_MSG_RESULT([no])
  2244. tst_links_winidn="no"
  2245. ])
  2246. #
  2247. if test "$tst_links_winidn" = "yes"; then
  2248. AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
  2249. AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
  2250. AC_SUBST([IDN_ENABLED], [1])
  2251. curl_idn_msg="enabled (Windows-native)"
  2252. else
  2253. AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
  2254. CPPFLAGS="$clean_CPPFLAGS"
  2255. LDFLAGS="$clean_LDFLAGS"
  2256. LIBS="$clean_LIBS"
  2257. fi
  2258. fi
  2259. dnl **********************************************************************
  2260. dnl Check for the presence of IDN libraries and headers
  2261. dnl **********************************************************************
  2262. AC_MSG_CHECKING([whether to build with libidn])
  2263. OPT_IDN="default"
  2264. AC_ARG_WITH(libidn,
  2265. AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
  2266. AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
  2267. [OPT_IDN=$withval])
  2268. case "$OPT_IDN" in
  2269. no)
  2270. dnl --without-libidn option used
  2271. want_idn="no"
  2272. AC_MSG_RESULT([no])
  2273. ;;
  2274. default)
  2275. dnl configure option not specified
  2276. want_idn="yes"
  2277. want_idn_path="default"
  2278. AC_MSG_RESULT([(assumed) yes])
  2279. ;;
  2280. yes)
  2281. dnl --with-libidn option used without path
  2282. want_idn="yes"
  2283. want_idn_path="default"
  2284. AC_MSG_RESULT([yes])
  2285. ;;
  2286. *)
  2287. dnl --with-libidn option used with path
  2288. want_idn="yes"
  2289. want_idn_path="$withval"
  2290. AC_MSG_RESULT([yes ($withval)])
  2291. ;;
  2292. esac
  2293. if test "$want_idn" = "yes"; then
  2294. dnl idn library support has been requested
  2295. clean_CPPFLAGS="$CPPFLAGS"
  2296. clean_LDFLAGS="$LDFLAGS"
  2297. clean_LIBS="$LIBS"
  2298. PKGCONFIG="no"
  2299. #
  2300. if test "$want_idn_path" != "default"; then
  2301. dnl path has been specified
  2302. IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
  2303. CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
  2304. if test "$PKGCONFIG" != "no"; then
  2305. IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2306. $PKGCONFIG --libs-only-l libidn 2>/dev/null`
  2307. IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2308. $PKGCONFIG --libs-only-L libidn 2>/dev/null`
  2309. IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
  2310. $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
  2311. IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
  2312. else
  2313. dnl pkg-config not available or provides no info
  2314. IDN_LIBS="-lidn"
  2315. IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
  2316. IDN_CPPFLAGS="-I$want_idn_path/include"
  2317. IDN_DIR="$want_idn_path/lib$libsuff"
  2318. fi
  2319. else
  2320. dnl path not specified
  2321. CURL_CHECK_PKGCONFIG(libidn)
  2322. if test "$PKGCONFIG" != "no"; then
  2323. IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
  2324. IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
  2325. IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
  2326. IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
  2327. else
  2328. dnl pkg-config not available or provides no info
  2329. IDN_LIBS="-lidn"
  2330. fi
  2331. fi
  2332. #
  2333. if test "$PKGCONFIG" != "no"; then
  2334. AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
  2335. AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
  2336. AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
  2337. AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
  2338. else
  2339. AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
  2340. AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
  2341. AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
  2342. AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
  2343. fi
  2344. #
  2345. CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
  2346. LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
  2347. LIBS="$IDN_LIBS $LIBS"
  2348. #
  2349. AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
  2350. AC_LINK_IFELSE([
  2351. AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
  2352. ],[
  2353. AC_MSG_RESULT([yes])
  2354. tst_links_libidn="yes"
  2355. ],[
  2356. AC_MSG_RESULT([no])
  2357. tst_links_libidn="no"
  2358. ])
  2359. if test "$tst_links_libidn" = "no"; then
  2360. AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
  2361. AC_LINK_IFELSE([
  2362. AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
  2363. ],[
  2364. AC_MSG_RESULT([yes])
  2365. tst_links_libidn="yes"
  2366. ],[
  2367. AC_MSG_RESULT([no])
  2368. tst_links_libidn="no"
  2369. ])
  2370. fi
  2371. #
  2372. if test "$tst_links_libidn" = "yes"; then
  2373. AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
  2374. dnl different versions of libidn have different setups of these:
  2375. AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
  2376. AC_CHECK_HEADERS( idn-free.h tld.h )
  2377. if test "x$ac_cv_header_tld_h" = "xyes"; then
  2378. AC_SUBST([IDN_ENABLED], [1])
  2379. curl_idn_msg="enabled"
  2380. if test -n "$IDN_DIR"; then
  2381. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
  2382. export LD_LIBRARY_PATH
  2383. AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
  2384. fi
  2385. else
  2386. AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
  2387. CPPFLAGS="$clean_CPPFLAGS"
  2388. LDFLAGS="$clean_LDFLAGS"
  2389. LIBS="$clean_LIBS"
  2390. fi
  2391. else
  2392. AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
  2393. CPPFLAGS="$clean_CPPFLAGS"
  2394. LDFLAGS="$clean_LDFLAGS"
  2395. LIBS="$clean_LIBS"
  2396. fi
  2397. fi
  2398. dnl Let's hope this split URL remains working:
  2399. dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
  2400. dnl genprogc/thread_quick_ref.htm
  2401. dnl **********************************************************************
  2402. dnl Check for nghttp2
  2403. dnl **********************************************************************
  2404. AC_MSG_CHECKING([whether to build with nghttp2])
  2405. OPT_H2="no"
  2406. AC_ARG_WITH(nghttp2,
  2407. AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
  2408. AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
  2409. [OPT_H2=$withval])
  2410. case "$OPT_H2" in
  2411. no)
  2412. dnl --without-nghttp2 option used
  2413. want_idn="no"
  2414. AC_MSG_RESULT([no])
  2415. ;;
  2416. default)
  2417. dnl configure option not specified
  2418. want_h2="no"
  2419. want_h2_path="default"
  2420. AC_MSG_RESULT([no])
  2421. ;;
  2422. yes)
  2423. dnl --with-nghttp2 option used without path
  2424. want_h2="yes"
  2425. want_h2_path=""
  2426. AC_MSG_RESULT([yes])
  2427. ;;
  2428. *)
  2429. dnl --with-nghttp2 option used with path
  2430. want_h2="yes"
  2431. want_h2_path="$withval"
  2432. AC_MSG_RESULT([yes ($withval)])
  2433. ;;
  2434. esac
  2435. curl_h2_msg="disabled (--with-nghttp2)"
  2436. if test X"$OPT_H2" != Xno; then
  2437. dnl backup the pre-librtmp variables
  2438. CLEANLDFLAGS="$LDFLAGS"
  2439. CLEANCPPFLAGS="$CPPFLAGS"
  2440. CLEANLIBS="$LIBS"
  2441. h2pcdir=${want_h2_path}/lib/pkgconfig
  2442. CURL_CHECK_PKGCONFIG(libnghttp2, $h2pcdir)
  2443. if test "$PKGCONFIG" != "no" ; then
  2444. LIB_H2=`CURL_EXPORT_PCDIR([$h2pcdir])
  2445. $PKGCONFIG --libs-only-l libnghttp2`
  2446. AC_MSG_NOTICE([-l is $LIB_H2])
  2447. CPP_H2=`CURL_EXPORT_PCDIR([$h2pcdir]) dnl
  2448. $PKGCONFIG --cflags-only-I libnghttp2`
  2449. AC_MSG_NOTICE([-I is $CPP_H2])
  2450. LD_H2=`CURL_EXPORT_PCDIR([$h2pcdir])
  2451. $PKGCONFIG --libs-only-L libnghttp2`
  2452. AC_MSG_NOTICE([-L is $LD_H2])
  2453. else
  2454. dnl To avoid link errors, we do not allow --libnghttp2 without
  2455. dnl a pkgconfig file
  2456. AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
  2457. fi
  2458. LDFLAGS="$LDFLAGS $LD_H2"
  2459. CPPFLAGS="$CPPFLAGS $CPP_H2"
  2460. LIBS="$LIB_H2 $LIBS"
  2461. AC_CHECK_LIB(nghttp2, nghttp2_session_client_new,
  2462. [
  2463. AC_CHECK_HEADERS(nghttp2/nghttp2.h,
  2464. curl_h2_msg="enabled (nghttp2)"
  2465. NGHTTP2_ENABLED=1
  2466. AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
  2467. AC_SUBST(USE_NGHTTP2, [1])
  2468. )
  2469. ],
  2470. dnl not found, revert back to clean variables
  2471. LDFLAGS=$CLEANLDFLAGS
  2472. CPPFLAGS=$CLEANCPPFLAGS
  2473. LIBS=$CLEANLIBS
  2474. )
  2475. fi
  2476. dnl **********************************************************************
  2477. dnl Back to "normal" configuring
  2478. dnl **********************************************************************
  2479. dnl Checks for header files.
  2480. AC_HEADER_STDC
  2481. CURL_CHECK_HEADER_MALLOC
  2482. CURL_CHECK_HEADER_MEMORY
  2483. dnl Now check for the very most basic headers. Then we can use these
  2484. dnl ones as default-headers when checking for the rest!
  2485. AC_CHECK_HEADERS(
  2486. sys/types.h \
  2487. sys/time.h \
  2488. sys/select.h \
  2489. sys/socket.h \
  2490. sys/ioctl.h \
  2491. sys/uio.h \
  2492. assert.h \
  2493. unistd.h \
  2494. stdlib.h \
  2495. limits.h \
  2496. arpa/inet.h \
  2497. net/if.h \
  2498. netinet/in.h \
  2499. sys/un.h \
  2500. netinet/tcp.h \
  2501. netdb.h \
  2502. sys/sockio.h \
  2503. sys/stat.h \
  2504. sys/param.h \
  2505. termios.h \
  2506. termio.h \
  2507. sgtty.h \
  2508. fcntl.h \
  2509. alloca.h \
  2510. time.h \
  2511. io.h \
  2512. pwd.h \
  2513. utime.h \
  2514. sys/utime.h \
  2515. sys/poll.h \
  2516. poll.h \
  2517. socket.h \
  2518. sys/resource.h \
  2519. libgen.h \
  2520. locale.h \
  2521. errno.h \
  2522. stdbool.h \
  2523. arpa/tftp.h \
  2524. sys/filio.h \
  2525. sys/wait.h \
  2526. setjmp.h,
  2527. dnl to do if not found
  2528. [],
  2529. dnl to do if found
  2530. [],
  2531. dnl default includes
  2532. [
  2533. #ifdef HAVE_SYS_TYPES_H
  2534. #include <sys/types.h>
  2535. #endif
  2536. #ifdef HAVE_SYS_TIME_H
  2537. #include <sys/time.h>
  2538. #endif
  2539. #ifdef HAVE_SYS_SELECT_H
  2540. #include <sys/select.h>
  2541. #endif
  2542. #ifdef HAVE_SYS_SOCKET_H
  2543. #include <sys/socket.h>
  2544. #endif
  2545. #ifdef HAVE_NETINET_IN_H
  2546. #include <netinet/in.h>
  2547. #endif
  2548. #ifdef HAVE_SYS_UN_H
  2549. #include <sys/un.h>
  2550. #endif
  2551. ]
  2552. )
  2553. dnl Checks for typedefs, structures, and compiler characteristics.
  2554. AC_C_CONST
  2555. CURL_CHECK_VARIADIC_MACROS
  2556. AC_TYPE_SIZE_T
  2557. AC_HEADER_TIME
  2558. CURL_CHECK_STRUCT_TIMEVAL
  2559. CURL_VERIFY_RUNTIMELIBS
  2560. AC_CHECK_SIZEOF(size_t)
  2561. AC_CHECK_SIZEOF(long)
  2562. AC_CHECK_SIZEOF(int)
  2563. AC_CHECK_SIZEOF(short)
  2564. CURL_CONFIGURE_LONG
  2565. AC_CHECK_SIZEOF(time_t)
  2566. AC_CHECK_SIZEOF(off_t)
  2567. soname_bump=no
  2568. if test x"$ac_cv_native_windows" != "xyes" &&
  2569. test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
  2570. AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
  2571. AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
  2572. soname_bump=yes
  2573. fi
  2574. AC_CHECK_TYPE(long long,
  2575. [AC_DEFINE(HAVE_LONGLONG, 1,
  2576. [Define to 1 if the compiler supports the 'long long' data type.])]
  2577. longlong="yes"
  2578. )
  2579. if test "xyes" = "x$longlong"; then
  2580. AC_MSG_CHECKING([if numberLL works])
  2581. AC_COMPILE_IFELSE([
  2582. AC_LANG_PROGRAM([[
  2583. ]],[[
  2584. long long val = 1000LL;
  2585. ]])
  2586. ],[
  2587. AC_MSG_RESULT([yes])
  2588. AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
  2589. ],[
  2590. AC_MSG_RESULT([no])
  2591. ])
  2592. fi
  2593. # check for ssize_t
  2594. AC_CHECK_TYPE(ssize_t, ,
  2595. AC_DEFINE(ssize_t, int, [the signed version of size_t]))
  2596. # check for bool type
  2597. AC_CHECK_TYPE([bool],[
  2598. AC_DEFINE(HAVE_BOOL_T, 1,
  2599. [Define to 1 if bool is an available type.])
  2600. ], ,[
  2601. #ifdef HAVE_SYS_TYPES_H
  2602. #include <sys/types.h>
  2603. #endif
  2604. #ifdef HAVE_STDBOOL_H
  2605. #include <stdbool.h>
  2606. #endif
  2607. ])
  2608. CURL_CONFIGURE_CURL_SOCKLEN_T
  2609. CURL_CONFIGURE_PULL_SYS_POLL
  2610. TYPE_IN_ADDR_T
  2611. TYPE_SOCKADDR_STORAGE
  2612. TYPE_SIG_ATOMIC_T
  2613. AC_TYPE_SIGNAL
  2614. CURL_CHECK_FUNC_SELECT
  2615. CURL_CHECK_FUNC_RECV
  2616. CURL_CHECK_FUNC_SEND
  2617. CURL_CHECK_MSG_NOSIGNAL
  2618. CURL_CHECK_FUNC_ALARM
  2619. CURL_CHECK_FUNC_BASENAME
  2620. CURL_CHECK_FUNC_CLOSESOCKET
  2621. CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  2622. CURL_CHECK_FUNC_CONNECT
  2623. CURL_CHECK_FUNC_FCNTL
  2624. CURL_CHECK_FUNC_FDOPEN
  2625. CURL_CHECK_FUNC_FREEADDRINFO
  2626. CURL_CHECK_FUNC_FREEIFADDRS
  2627. CURL_CHECK_FUNC_FSETXATTR
  2628. CURL_CHECK_FUNC_FTRUNCATE
  2629. CURL_CHECK_FUNC_GETADDRINFO
  2630. CURL_CHECK_FUNC_GAI_STRERROR
  2631. CURL_CHECK_FUNC_GETHOSTBYADDR
  2632. CURL_CHECK_FUNC_GETHOSTBYADDR_R
  2633. CURL_CHECK_FUNC_GETHOSTBYNAME
  2634. CURL_CHECK_FUNC_GETHOSTBYNAME_R
  2635. CURL_CHECK_FUNC_GETHOSTNAME
  2636. CURL_CHECK_FUNC_GETIFADDRS
  2637. CURL_CHECK_FUNC_GETSERVBYPORT_R
  2638. CURL_CHECK_FUNC_GMTIME_R
  2639. CURL_CHECK_FUNC_INET_NTOA_R
  2640. CURL_CHECK_FUNC_INET_NTOP
  2641. CURL_CHECK_FUNC_INET_PTON
  2642. CURL_CHECK_FUNC_IOCTL
  2643. CURL_CHECK_FUNC_IOCTLSOCKET
  2644. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  2645. CURL_CHECK_FUNC_LOCALTIME_R
  2646. CURL_CHECK_FUNC_MEMRCHR
  2647. CURL_CHECK_FUNC_POLL
  2648. CURL_CHECK_FUNC_SETSOCKOPT
  2649. CURL_CHECK_FUNC_SIGACTION
  2650. CURL_CHECK_FUNC_SIGINTERRUPT
  2651. CURL_CHECK_FUNC_SIGNAL
  2652. CURL_CHECK_FUNC_SIGSETJMP
  2653. CURL_CHECK_FUNC_SOCKET
  2654. CURL_CHECK_FUNC_SOCKETPAIR
  2655. CURL_CHECK_FUNC_STRCASECMP
  2656. CURL_CHECK_FUNC_STRCMPI
  2657. CURL_CHECK_FUNC_STRDUP
  2658. CURL_CHECK_FUNC_STRERROR_R
  2659. CURL_CHECK_FUNC_STRICMP
  2660. CURL_CHECK_FUNC_STRNCASECMP
  2661. CURL_CHECK_FUNC_STRNCMPI
  2662. CURL_CHECK_FUNC_STRNICMP
  2663. CURL_CHECK_FUNC_STRSTR
  2664. CURL_CHECK_FUNC_STRTOK_R
  2665. CURL_CHECK_FUNC_STRTOLL
  2666. CURL_CHECK_FUNC_WRITEV
  2667. case $host in
  2668. *msdosdjgpp)
  2669. ac_cv_func_pipe=no
  2670. skipcheck_pipe=yes
  2671. AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
  2672. ;;
  2673. esac
  2674. AC_CHECK_FUNCS([fork \
  2675. geteuid \
  2676. getpass_r \
  2677. getppid \
  2678. getprotobyname \
  2679. getpwuid \
  2680. getrlimit \
  2681. gettimeofday \
  2682. inet_addr \
  2683. perror \
  2684. pipe \
  2685. setlocale \
  2686. setmode \
  2687. setrlimit \
  2688. uname \
  2689. utime
  2690. ],[
  2691. ],[
  2692. func="$ac_func"
  2693. eval skipcheck=\$skipcheck_$func
  2694. if test "x$skipcheck" != "xyes"; then
  2695. AC_MSG_CHECKING([deeper for $func])
  2696. AC_LINK_IFELSE([
  2697. AC_LANG_PROGRAM([[
  2698. ]],[[
  2699. $func ();
  2700. ]])
  2701. ],[
  2702. AC_MSG_RESULT([yes])
  2703. eval "ac_cv_func_$func=yes"
  2704. AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
  2705. [Define to 1 if you have the $func function.])
  2706. ],[
  2707. AC_MSG_RESULT([but still no])
  2708. ])
  2709. fi
  2710. ])
  2711. dnl Check if the getnameinfo function is available
  2712. dnl and get the types of five of its arguments.
  2713. CURL_CHECK_FUNC_GETNAMEINFO
  2714. if test "$ipv6" = "yes"; then
  2715. if test "$ac_cv_func_getaddrinfo" = "yes"; then
  2716. AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
  2717. IPV6_ENABLED=1
  2718. AC_SUBST(IPV6_ENABLED)
  2719. fi
  2720. CURL_CHECK_NI_WITHSCOPEID
  2721. fi
  2722. CURL_CHECK_NONBLOCKING_SOCKET
  2723. dnl ************************************************************
  2724. dnl nroff tool stuff
  2725. dnl
  2726. AC_PATH_PROG( PERL, perl, ,
  2727. $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
  2728. AC_SUBST(PERL)
  2729. AC_PATH_PROGS( NROFF, gnroff nroff, ,
  2730. $PATH:/usr/bin/:/usr/local/bin )
  2731. AC_SUBST(NROFF)
  2732. if test -n "$NROFF"; then
  2733. dnl only check for nroff options if an nroff command was found
  2734. AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
  2735. MANOPT="-man"
  2736. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  2737. if test -z "$mancheck"; then
  2738. MANOPT="-mandoc"
  2739. mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
  2740. if test -z "$mancheck"; then
  2741. MANOPT=""
  2742. AC_MSG_RESULT([failed])
  2743. AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
  2744. else
  2745. AC_MSG_RESULT([$MANOPT])
  2746. fi
  2747. else
  2748. AC_MSG_RESULT([$MANOPT])
  2749. fi
  2750. AC_SUBST(MANOPT)
  2751. fi
  2752. if test -z "$MANOPT"
  2753. then
  2754. dnl if no nroff tool was found, or no option that could convert man pages
  2755. dnl was found, then disable the built-in manual stuff
  2756. AC_MSG_WARN([disabling built-in manual])
  2757. USE_MANUAL="no";
  2758. fi
  2759. dnl *************************************************************************
  2760. dnl If the manual variable still is set, then we go with providing a built-in
  2761. dnl manual
  2762. if test "$USE_MANUAL" = "1"; then
  2763. AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
  2764. curl_manual_msg="enabled"
  2765. fi
  2766. dnl set variable for use in automakefile(s)
  2767. AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
  2768. CURL_CHECK_LIB_ARES
  2769. AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
  2770. if test "x$ac_cv_native_windows" != "xyes" &&
  2771. test "x$enable_shared" = "xyes"; then
  2772. build_libhostname=yes
  2773. else
  2774. build_libhostname=no
  2775. fi
  2776. AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
  2777. CURL_CHECK_OPTION_THREADED_RESOLVER
  2778. if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
  2779. AC_MSG_ERROR(
  2780. [Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
  2781. fi
  2782. if test "$want_thres" = "yes"; then
  2783. AC_CHECK_HEADER(pthread.h,
  2784. [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
  2785. save_CFLAGS="$CFLAGS"
  2786. dnl first check for function without lib
  2787. AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
  2788. dnl if it wasn't found without lib, search for it in pthread lib
  2789. if test "$USE_THREADS_POSIX" != "1"
  2790. then
  2791. CFLAGS="$CFLAGS -pthread"
  2792. AC_CHECK_LIB(pthread, pthread_create,
  2793. [USE_THREADS_POSIX=1],
  2794. [ CFLAGS="$save_CFLAGS"])
  2795. fi
  2796. if test "x$USE_THREADS_POSIX" = "x1"
  2797. then
  2798. AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
  2799. curl_res_msg="POSIX threaded"
  2800. fi
  2801. ])
  2802. fi
  2803. dnl ************************************************************
  2804. dnl disable verbose text strings
  2805. dnl
  2806. AC_MSG_CHECKING([whether to enable verbose strings])
  2807. AC_ARG_ENABLE(verbose,
  2808. AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
  2809. AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
  2810. [ case "$enableval" in
  2811. no)
  2812. AC_MSG_RESULT(no)
  2813. AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
  2814. curl_verbose_msg="no"
  2815. ;;
  2816. *) AC_MSG_RESULT(yes)
  2817. ;;
  2818. esac ],
  2819. AC_MSG_RESULT(yes)
  2820. )
  2821. dnl ************************************************************
  2822. dnl enable SSPI support
  2823. dnl
  2824. AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
  2825. AC_ARG_ENABLE(sspi,
  2826. AC_HELP_STRING([--enable-sspi],[Enable SSPI])
  2827. AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
  2828. [ case "$enableval" in
  2829. yes)
  2830. if test "$ac_cv_native_windows" = "yes"; then
  2831. AC_MSG_RESULT(yes)
  2832. AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
  2833. AC_SUBST(USE_WINDOWS_SSPI, [1])
  2834. curl_sspi_msg="enabled"
  2835. else
  2836. AC_MSG_RESULT(no)
  2837. AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
  2838. fi
  2839. ;;
  2840. *)
  2841. if test "x$WINSSL_ENABLED" = "x1"; then
  2842. # --with-winssl implies --enable-sspi
  2843. AC_MSG_RESULT(yes)
  2844. else
  2845. AC_MSG_RESULT(no)
  2846. fi
  2847. ;;
  2848. esac ],
  2849. if test "x$WINSSL_ENABLED" = "x1"; then
  2850. # --with-winssl implies --enable-sspi
  2851. AC_MSG_RESULT(yes)
  2852. else
  2853. AC_MSG_RESULT(no)
  2854. fi
  2855. )
  2856. dnl ************************************************************
  2857. dnl disable cryptographic authentication
  2858. dnl
  2859. AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
  2860. AC_ARG_ENABLE(crypto-auth,
  2861. AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
  2862. AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
  2863. [ case "$enableval" in
  2864. no)
  2865. AC_MSG_RESULT(no)
  2866. AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
  2867. ;;
  2868. *) AC_MSG_RESULT(yes)
  2869. ;;
  2870. esac ],
  2871. AC_MSG_RESULT(yes)
  2872. )
  2873. CURL_CHECK_OPTION_NTLM_WB
  2874. CURL_CHECK_NTLM_WB
  2875. dnl ************************************************************
  2876. dnl disable TLS-SRP authentication
  2877. dnl
  2878. AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
  2879. AC_ARG_ENABLE(tls-srp,
  2880. AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
  2881. AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
  2882. [ case "$enableval" in
  2883. no)
  2884. AC_MSG_RESULT(no)
  2885. AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
  2886. want_tls_srp=no
  2887. ;;
  2888. *) AC_MSG_RESULT(yes)
  2889. want_tls_srp=yes
  2890. ;;
  2891. esac ],
  2892. AC_MSG_RESULT(yes)
  2893. want_tls_srp=yes
  2894. )
  2895. if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_SSLEAY_SRP" = "x1") ; then
  2896. AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
  2897. USE_TLS_SRP=1
  2898. curl_tls_srp_msg="enabled"
  2899. fi
  2900. dnl ************************************************************
  2901. dnl disable cookies support
  2902. dnl
  2903. AC_MSG_CHECKING([whether to enable support for cookies])
  2904. AC_ARG_ENABLE(cookies,
  2905. AC_HELP_STRING([--enable-cookies],[Enable cookies support])
  2906. AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
  2907. [ case "$enableval" in
  2908. no)
  2909. AC_MSG_RESULT(no)
  2910. AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
  2911. ;;
  2912. *) AC_MSG_RESULT(yes)
  2913. ;;
  2914. esac ],
  2915. AC_MSG_RESULT(yes)
  2916. )
  2917. dnl ************************************************************
  2918. dnl hiding of library internal symbols
  2919. dnl
  2920. CURL_CONFIGURE_SYMBOL_HIDING
  2921. dnl ************************************************************
  2922. dnl enforce SONAME bump
  2923. dnl
  2924. AC_MSG_CHECKING([whether to enforce SONAME bump])
  2925. AC_ARG_ENABLE(soname-bump,
  2926. AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
  2927. AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
  2928. [ case "$enableval" in
  2929. yes) AC_MSG_RESULT(yes)
  2930. soname_bump=yes
  2931. ;;
  2932. *)
  2933. AC_MSG_RESULT(no)
  2934. ;;
  2935. esac ],
  2936. AC_MSG_RESULT($soname_bump)
  2937. )
  2938. AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
  2939. dnl
  2940. dnl All the library dependencies put into $LIB apply to libcurl only.
  2941. dnl
  2942. LIBCURL_LIBS=$LIBS
  2943. AC_SUBST(LIBCURL_LIBS)
  2944. AC_SUBST(CURL_NETWORK_LIBS)
  2945. AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
  2946. dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
  2947. dnl LIBS variable used in generated makefile at makefile processing
  2948. dnl time. Doing this functionally prevents LIBS from being used for
  2949. dnl all link targets in given makefile.
  2950. BLANK_AT_MAKETIME=
  2951. AC_SUBST(BLANK_AT_MAKETIME)
  2952. AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
  2953. dnl yes or no
  2954. ENABLE_SHARED="$enable_shared"
  2955. AC_SUBST(ENABLE_SHARED)
  2956. dnl to let curl-config output the static libraries correctly
  2957. ENABLE_STATIC="$enable_static"
  2958. AC_SUBST(ENABLE_STATIC)
  2959. dnl
  2960. dnl For keeping supported features and protocols also in pkg-config file
  2961. dnl since it is more cross-compile friendly than curl-config
  2962. dnl
  2963. if test "x$USE_SSLEAY" = "x1"; then
  2964. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2965. elif test -n "$SSL_ENABLED"; then
  2966. SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
  2967. fi
  2968. if test "x$IPV6_ENABLED" = "x1"; then
  2969. SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
  2970. fi
  2971. if test "x$HAVE_LIBZ" = "x1"; then
  2972. SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
  2973. fi
  2974. if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
  2975. SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
  2976. fi
  2977. if test "x$IDN_ENABLED" = "x1"; then
  2978. SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
  2979. fi
  2980. if test "x$USE_WINDOWS_SSPI" = "x1"; then
  2981. SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
  2982. fi
  2983. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  2984. if test "x$USE_SSLEAY" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
  2985. -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
  2986. -o "x$DARWINSSL_ENABLED" = "x1"; then
  2987. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
  2988. if test "x$NTLM_WB_ENABLED" = "x1"; then
  2989. SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
  2990. fi
  2991. fi
  2992. fi
  2993. if test "x$USE_TLS_SRP" = "x1"; then
  2994. SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
  2995. fi
  2996. if test "x$USE_NGHTTP2" = "x1"; then
  2997. SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
  2998. fi
  2999. AC_SUBST(SUPPORT_FEATURES)
  3000. dnl For supported protocols in pkg-config file
  3001. if test "x$CURL_DISABLE_HTTP" != "x1"; then
  3002. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
  3003. if test "x$SSL_ENABLED" = "x1"; then
  3004. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
  3005. fi
  3006. fi
  3007. if test "x$CURL_DISABLE_FTP" != "x1"; then
  3008. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
  3009. if test "x$SSL_ENABLED" = "x1"; then
  3010. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
  3011. fi
  3012. fi
  3013. if test "x$CURL_DISABLE_FILE" != "x1"; then
  3014. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
  3015. fi
  3016. if test "x$CURL_DISABLE_TELNET" != "x1"; then
  3017. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
  3018. fi
  3019. if test "x$CURL_DISABLE_LDAP" != "x1"; then
  3020. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
  3021. if test "x$CURL_DISABLE_LDAPS" != "x1"; then
  3022. if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
  3023. (test "x$USE_OPENLDAP" != "x1" && test "x$HAVE_LDAP_SSL" = "x1"); then
  3024. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
  3025. fi
  3026. fi
  3027. fi
  3028. if test "x$CURL_DISABLE_DICT" != "x1"; then
  3029. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
  3030. fi
  3031. if test "x$CURL_DISABLE_TFTP" != "x1"; then
  3032. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
  3033. fi
  3034. if test "x$CURL_DISABLE_GOPHER" != "x1"; then
  3035. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
  3036. fi
  3037. if test "x$CURL_DISABLE_POP3" != "x1"; then
  3038. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
  3039. if test "x$SSL_ENABLED" = "x1"; then
  3040. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
  3041. fi
  3042. fi
  3043. if test "x$CURL_DISABLE_IMAP" != "x1"; then
  3044. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
  3045. if test "x$SSL_ENABLED" = "x1"; then
  3046. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
  3047. fi
  3048. fi
  3049. if test "x$CURL_DISABLE_SMTP" != "x1"; then
  3050. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
  3051. if test "x$SSL_ENABLED" = "x1"; then
  3052. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
  3053. fi
  3054. fi
  3055. if test "x$USE_LIBSSH2" = "x1"; then
  3056. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
  3057. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
  3058. fi
  3059. if test "x$CURL_DISABLE_RTSP" != "x1"; then
  3060. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
  3061. fi
  3062. if test "x$USE_LIBRTMP" = "x1"; then
  3063. SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
  3064. fi
  3065. dnl replace spaces with newlines
  3066. dnl sort the lines
  3067. dnl replace the newlines back to spaces
  3068. SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
  3069. AC_SUBST(SUPPORT_PROTOCOLS)
  3070. dnl squeeze whitespace out of some variables
  3071. squeeze CFLAGS
  3072. squeeze CPPFLAGS
  3073. squeeze DEFS
  3074. squeeze LDFLAGS
  3075. squeeze LIBS
  3076. squeeze LIBCURL_LIBS
  3077. squeeze CURL_NETWORK_LIBS
  3078. squeeze CURL_NETWORK_AND_TIME_LIBS
  3079. squeeze SUPPORT_FEATURES
  3080. squeeze SUPPORT_PROTOCOLS
  3081. XC_CHECK_BUILD_FLAGS
  3082. if test "x$want_curldebug_assumed" = "xyes" &&
  3083. test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
  3084. ac_configure_args="$ac_configure_args --enable-curldebug"
  3085. fi
  3086. AC_CONFIG_FILES([Makefile \
  3087. docs/Makefile \
  3088. docs/examples/Makefile \
  3089. docs/libcurl/Makefile \
  3090. include/Makefile \
  3091. include/curl/Makefile \
  3092. src/Makefile \
  3093. lib/Makefile \
  3094. lib/libcurl.vers \
  3095. tests/Makefile \
  3096. tests/certs/Makefile \
  3097. tests/certs/scripts/Makefile \
  3098. tests/data/Makefile \
  3099. tests/server/Makefile \
  3100. tests/libtest/Makefile \
  3101. tests/unit/Makefile \
  3102. packages/Makefile \
  3103. packages/Win32/Makefile \
  3104. packages/Win32/cygwin/Makefile \
  3105. packages/Linux/Makefile \
  3106. packages/Linux/RPM/Makefile \
  3107. packages/Linux/RPM/curl.spec \
  3108. packages/Linux/RPM/curl-ssl.spec \
  3109. packages/Solaris/Makefile \
  3110. packages/EPM/curl.list \
  3111. packages/EPM/Makefile \
  3112. packages/vms/Makefile \
  3113. packages/AIX/Makefile \
  3114. packages/AIX/RPM/Makefile \
  3115. packages/AIX/RPM/curl.spec \
  3116. curl-config \
  3117. libcurl.pc
  3118. ])
  3119. AC_OUTPUT
  3120. CURL_GENERATE_CONFIGUREHELP_PM
  3121. XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
  3122. AC_MSG_NOTICE([Configured to build curl/libcurl:
  3123. curl version: ${CURLVERSION}
  3124. Host setup: ${host}
  3125. Install prefix: ${prefix}
  3126. Compiler: ${CC}
  3127. SSL support: ${curl_ssl_msg}
  3128. SSH support: ${curl_ssh_msg}
  3129. zlib support: ${curl_zlib_msg}
  3130. GSSAPI support: ${curl_gss_msg}
  3131. SPNEGO support: ${curl_spnego_msg}
  3132. TLS-SRP support: ${curl_tls_srp_msg}
  3133. resolver: ${curl_res_msg}
  3134. ipv6 support: ${curl_ipv6_msg}
  3135. IDN support: ${curl_idn_msg}
  3136. Build libcurl: Shared=${enable_shared}, Static=${enable_static}
  3137. Built-in manual: ${curl_manual_msg}
  3138. --libcurl option: ${curl_libcurl_msg}
  3139. Verbose errors: ${curl_verbose_msg}
  3140. SSPI support: ${curl_sspi_msg}
  3141. ca cert bundle: ${ca}
  3142. ca cert path: ${capath}
  3143. LDAP support: ${curl_ldap_msg}
  3144. LDAPS support: ${curl_ldaps_msg}
  3145. RTSP support: ${curl_rtsp_msg}
  3146. RTMP support: ${curl_rtmp_msg}
  3147. metalink support: ${curl_mtlnk_msg}
  3148. HTTP2 support: ${curl_h2_msg}
  3149. Protocols: ${SUPPORT_PROTOCOLS}
  3150. ])
  3151. if test "x$soname_bump" = "xyes"; then
  3152. cat <<EOM
  3153. SONAME bump: yes - WARNING: this library will be built with the SONAME
  3154. number bumped due to (a detected) ABI breakage.
  3155. See lib/README.curl_off_t for details on this.
  3156. EOM
  3157. fi