curl-functions.m4 132 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 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 https://curl.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. # SPDX-License-Identifier: curl
  22. #
  23. #***************************************************************************
  24. # File version for 'aclocal' use. Keep it a single number.
  25. # serial 73
  26. dnl CURL_INCLUDES_ARPA_INET
  27. dnl -------------------------------------------------
  28. dnl Set up variable with list of headers that must be
  29. dnl included when arpa/inet.h is to be included.
  30. AC_DEFUN([CURL_INCLUDES_ARPA_INET], [
  31. curl_includes_arpa_inet="\
  32. /* includes start */
  33. #ifdef HAVE_SYS_TYPES_H
  34. # include <sys/types.h>
  35. #endif
  36. #ifdef HAVE_SYS_SOCKET_H
  37. # include <sys/socket.h>
  38. #endif
  39. #ifdef HAVE_NETINET_IN_H
  40. # include <netinet/in.h>
  41. #endif
  42. #ifdef HAVE_ARPA_INET_H
  43. # include <arpa/inet.h>
  44. #endif
  45. #ifdef _WIN32
  46. #include <winsock2.h>
  47. #include <ws2tcpip.h>
  48. #endif
  49. /* includes end */"
  50. AC_CHECK_HEADERS(
  51. sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
  52. [], [], [$curl_includes_arpa_inet])
  53. ])
  54. dnl CURL_INCLUDES_FCNTL
  55. dnl -------------------------------------------------
  56. dnl Set up variable with list of headers that must be
  57. dnl included when fcntl.h is to be included.
  58. AC_DEFUN([CURL_INCLUDES_FCNTL], [
  59. curl_includes_fcntl="\
  60. /* includes start */
  61. #ifdef HAVE_SYS_TYPES_H
  62. # include <sys/types.h>
  63. #endif
  64. #ifdef HAVE_UNISTD_H
  65. # include <unistd.h>
  66. #endif
  67. #ifdef HAVE_FCNTL_H
  68. # include <fcntl.h>
  69. #endif
  70. /* includes end */"
  71. AC_CHECK_HEADERS(
  72. sys/types.h unistd.h fcntl.h,
  73. [], [], [$curl_includes_fcntl])
  74. ])
  75. dnl CURL_INCLUDES_IFADDRS
  76. dnl -------------------------------------------------
  77. dnl Set up variable with list of headers that must be
  78. dnl included when ifaddrs.h is to be included.
  79. AC_DEFUN([CURL_INCLUDES_IFADDRS], [
  80. curl_includes_ifaddrs="\
  81. /* includes start */
  82. #ifdef HAVE_SYS_TYPES_H
  83. # include <sys/types.h>
  84. #endif
  85. #ifdef HAVE_SYS_SOCKET_H
  86. # include <sys/socket.h>
  87. #endif
  88. #ifdef HAVE_NETINET_IN_H
  89. # include <netinet/in.h>
  90. #endif
  91. #ifdef HAVE_IFADDRS_H
  92. # include <ifaddrs.h>
  93. #endif
  94. /* includes end */"
  95. AC_CHECK_HEADERS(
  96. sys/types.h sys/socket.h netinet/in.h ifaddrs.h,
  97. [], [], [$curl_includes_ifaddrs])
  98. ])
  99. dnl CURL_INCLUDES_LIBGEN
  100. dnl -------------------------------------------------
  101. dnl Set up variable with list of headers that must be
  102. dnl included when libgen.h is to be included.
  103. AC_DEFUN([CURL_INCLUDES_LIBGEN], [
  104. curl_includes_libgen="\
  105. /* includes start */
  106. #ifdef HAVE_SYS_TYPES_H
  107. # include <sys/types.h>
  108. #endif
  109. #ifdef HAVE_LIBGEN_H
  110. # include <libgen.h>
  111. #endif
  112. /* includes end */"
  113. AC_CHECK_HEADERS(
  114. sys/types.h libgen.h,
  115. [], [], [$curl_includes_libgen])
  116. ])
  117. dnl CURL_INCLUDES_NETDB
  118. dnl -------------------------------------------------
  119. dnl Set up variable with list of headers that must be
  120. dnl included when netdb.h is to be included.
  121. AC_DEFUN([CURL_INCLUDES_NETDB], [
  122. curl_includes_netdb="\
  123. /* includes start */
  124. #ifdef HAVE_SYS_TYPES_H
  125. # include <sys/types.h>
  126. #endif
  127. #ifdef HAVE_NETDB_H
  128. # include <netdb.h>
  129. #endif
  130. /* includes end */"
  131. AC_CHECK_HEADERS(
  132. sys/types.h netdb.h,
  133. [], [], [$curl_includes_netdb])
  134. ])
  135. dnl CURL_INCLUDES_POLL
  136. dnl -------------------------------------------------
  137. dnl Set up variable with list of headers that must be
  138. dnl included when poll.h is to be included.
  139. AC_DEFUN([CURL_INCLUDES_POLL], [
  140. curl_includes_poll="\
  141. /* includes start */
  142. #ifdef HAVE_SYS_TYPES_H
  143. # include <sys/types.h>
  144. #endif
  145. #ifdef HAVE_POLL_H
  146. # include <poll.h>
  147. #endif
  148. #ifdef HAVE_SYS_POLL_H
  149. # include <sys/poll.h>
  150. #endif
  151. /* includes end */"
  152. AC_CHECK_HEADERS(
  153. sys/types.h poll.h sys/poll.h,
  154. [], [], [$curl_includes_poll])
  155. ])
  156. dnl CURL_INCLUDES_SETJMP
  157. dnl -------------------------------------------------
  158. dnl Set up variable with list of headers that must be
  159. dnl included when setjmp.h is to be included.
  160. AC_DEFUN([CURL_INCLUDES_SETJMP], [
  161. curl_includes_setjmp="\
  162. /* includes start */
  163. #ifdef HAVE_SYS_TYPES_H
  164. # include <sys/types.h>
  165. #endif
  166. #include <setjmp.h>
  167. /* includes end */"
  168. AC_CHECK_HEADERS(
  169. sys/types.h,
  170. [], [], [$curl_includes_setjmp])
  171. ])
  172. dnl CURL_INCLUDES_SIGNAL
  173. dnl -------------------------------------------------
  174. dnl Set up variable with list of headers that must be
  175. dnl included when signal.h is to be included.
  176. AC_DEFUN([CURL_INCLUDES_SIGNAL], [
  177. curl_includes_signal="\
  178. /* includes start */
  179. #ifdef HAVE_SYS_TYPES_H
  180. # include <sys/types.h>
  181. #endif
  182. #include <signal.h>
  183. /* includes end */"
  184. AC_CHECK_HEADERS(
  185. sys/types.h,
  186. [], [], [$curl_includes_signal])
  187. ])
  188. dnl CURL_INCLUDES_SOCKET
  189. dnl -------------------------------------------------
  190. dnl Set up variable with list of headers that must be
  191. dnl included when socket.h is to be included.
  192. AC_DEFUN([CURL_INCLUDES_SOCKET], [
  193. curl_includes_socket="\
  194. /* includes start */
  195. #ifdef HAVE_SYS_TYPES_H
  196. # include <sys/types.h>
  197. #endif
  198. #ifdef HAVE_SOCKET_H
  199. # include <socket.h>
  200. #endif
  201. /* includes end */"
  202. AC_CHECK_HEADERS(
  203. sys/types.h socket.h,
  204. [], [], [$curl_includes_socket])
  205. ])
  206. dnl CURL_INCLUDES_STDLIB
  207. dnl -------------------------------------------------
  208. dnl Set up variable with list of headers that must be
  209. dnl included when stdlib.h is to be included.
  210. AC_DEFUN([CURL_INCLUDES_STDLIB], [
  211. curl_includes_stdlib="\
  212. /* includes start */
  213. #ifdef HAVE_SYS_TYPES_H
  214. # include <sys/types.h>
  215. #endif
  216. #include <stdlib.h>
  217. /* includes end */"
  218. AC_CHECK_HEADERS(
  219. sys/types.h,
  220. [], [], [$curl_includes_stdlib])
  221. ])
  222. dnl CURL_INCLUDES_STRING
  223. dnl -------------------------------------------------
  224. dnl Set up variable with list of headers that must be
  225. dnl included when string(s).h is to be included.
  226. AC_DEFUN([CURL_INCLUDES_STRING], [
  227. curl_includes_string="\
  228. /* includes start */
  229. #ifdef HAVE_SYS_TYPES_H
  230. # include <sys/types.h>
  231. #endif
  232. #include <string.h>
  233. #ifdef HAVE_STRINGS_H
  234. # include <strings.h>
  235. #endif
  236. /* includes end */"
  237. AC_CHECK_HEADERS(
  238. sys/types.h strings.h,
  239. [], [], [$curl_includes_string])
  240. ])
  241. dnl CURL_INCLUDES_STROPTS
  242. dnl -------------------------------------------------
  243. dnl Set up variable with list of headers that must be
  244. dnl included when stropts.h is to be included.
  245. AC_DEFUN([CURL_INCLUDES_STROPTS], [
  246. curl_includes_stropts="\
  247. /* includes start */
  248. #ifdef HAVE_SYS_TYPES_H
  249. # include <sys/types.h>
  250. #endif
  251. #ifdef HAVE_UNISTD_H
  252. # include <unistd.h>
  253. #endif
  254. #ifdef HAVE_SYS_SOCKET_H
  255. # include <sys/socket.h>
  256. #endif
  257. #ifdef HAVE_SYS_IOCTL_H
  258. # include <sys/ioctl.h>
  259. #endif
  260. #ifdef HAVE_STROPTS_H
  261. # include <stropts.h>
  262. #endif
  263. /* includes end */"
  264. AC_CHECK_HEADERS(
  265. sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
  266. [], [], [$curl_includes_stropts])
  267. ])
  268. dnl CURL_INCLUDES_SYS_SOCKET
  269. dnl -------------------------------------------------
  270. dnl Set up variable with list of headers that must be
  271. dnl included when sys/socket.h is to be included.
  272. AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [
  273. curl_includes_sys_socket="\
  274. /* includes start */
  275. #ifdef HAVE_SYS_TYPES_H
  276. # include <sys/types.h>
  277. #endif
  278. #ifdef HAVE_SYS_SOCKET_H
  279. # include <sys/socket.h>
  280. #endif
  281. /* includes end */"
  282. AC_CHECK_HEADERS(
  283. sys/types.h sys/socket.h,
  284. [], [], [$curl_includes_sys_socket])
  285. ])
  286. dnl CURL_INCLUDES_SYS_TYPES
  287. dnl -------------------------------------------------
  288. dnl Set up variable with list of headers that must be
  289. dnl included when sys/types.h is to be included.
  290. AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [
  291. curl_includes_sys_types="\
  292. /* includes start */
  293. #ifdef HAVE_SYS_TYPES_H
  294. # include <sys/types.h>
  295. #endif
  296. /* includes end */"
  297. AC_CHECK_HEADERS(
  298. sys/types.h,
  299. [], [], [$curl_includes_sys_types])
  300. ])
  301. dnl CURL_INCLUDES_SYS_XATTR
  302. dnl -------------------------------------------------
  303. dnl Set up variable with list of headers that must be
  304. dnl included when sys/xattr.h is to be included.
  305. AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [
  306. curl_includes_sys_xattr="\
  307. /* includes start */
  308. #ifdef HAVE_SYS_TYPES_H
  309. # include <sys/types.h>
  310. #endif
  311. #ifdef HAVE_SYS_XATTR_H
  312. # include <sys/xattr.h>
  313. #endif
  314. /* includes end */"
  315. AC_CHECK_HEADERS(
  316. sys/types.h sys/xattr.h,
  317. [], [], [$curl_includes_sys_xattr])
  318. ])
  319. dnl CURL_INCLUDES_TIME
  320. dnl -------------------------------------------------
  321. dnl Set up variable with list of headers that must be
  322. dnl included when time.h is to be included.
  323. AC_DEFUN([CURL_INCLUDES_TIME], [
  324. curl_includes_time="\
  325. /* includes start */
  326. #ifdef HAVE_SYS_TYPES_H
  327. # include <sys/types.h>
  328. #endif
  329. #ifdef HAVE_SYS_TIME_H
  330. # include <sys/time.h>
  331. #endif
  332. #include <time.h>
  333. /* includes end */"
  334. AC_CHECK_HEADERS(
  335. sys/types.h sys/time.h,
  336. [], [], [$curl_includes_time])
  337. ])
  338. dnl CURL_INCLUDES_UNISTD
  339. dnl -------------------------------------------------
  340. dnl Set up variable with list of headers that must be
  341. dnl included when unistd.h is to be included.
  342. AC_DEFUN([CURL_INCLUDES_UNISTD], [
  343. curl_includes_unistd="\
  344. /* includes start */
  345. #ifdef HAVE_SYS_TYPES_H
  346. # include <sys/types.h>
  347. #endif
  348. #ifdef HAVE_UNISTD_H
  349. # include <unistd.h>
  350. #endif
  351. /* includes end */"
  352. AC_CHECK_HEADERS(
  353. sys/types.h unistd.h,
  354. [], [], [$curl_includes_unistd])
  355. ])
  356. dnl CURL_INCLUDES_WINSOCK2
  357. dnl -------------------------------------------------
  358. dnl Set up variable with list of headers that must be
  359. dnl included when winsock2.h is to be included.
  360. AC_DEFUN([CURL_INCLUDES_WINSOCK2], [
  361. curl_includes_winsock2="\
  362. /* includes start */
  363. #ifdef _WIN32
  364. # ifndef WIN32_LEAN_AND_MEAN
  365. # define WIN32_LEAN_AND_MEAN
  366. # endif
  367. # include <winsock2.h>
  368. #endif
  369. /* includes end */"
  370. CURL_CHECK_NATIVE_WINDOWS
  371. ])
  372. dnl CURL_INCLUDES_WS2TCPIP
  373. dnl -------------------------------------------------
  374. dnl Set up variable with list of headers that must be
  375. dnl included when ws2tcpip.h is to be included.
  376. AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [
  377. curl_includes_ws2tcpip="\
  378. /* includes start */
  379. #ifdef _WIN32
  380. # ifndef WIN32_LEAN_AND_MEAN
  381. # define WIN32_LEAN_AND_MEAN
  382. # endif
  383. # include <winsock2.h>
  384. # include <ws2tcpip.h>
  385. #endif
  386. /* includes end */"
  387. CURL_CHECK_NATIVE_WINDOWS
  388. ])
  389. dnl CURL_INCLUDES_BSDSOCKET
  390. dnl -------------------------------------------------
  391. dnl Set up variable with list of headers that must be
  392. dnl included when bsdsocket.h is to be included.
  393. AC_DEFUN([CURL_INCLUDES_BSDSOCKET], [
  394. curl_includes_bsdsocket="\
  395. /* includes start */
  396. #if defined(HAVE_PROTO_BSDSOCKET_H)
  397. # define __NO_NET_API
  398. # define __USE_INLINE__
  399. # include <proto/bsdsocket.h>
  400. # ifdef HAVE_SYS_IOCTL_H
  401. # include <sys/ioctl.h>
  402. # endif
  403. # ifdef __amigaos4__
  404. struct SocketIFace *ISocket = NULL;
  405. # else
  406. struct Library *SocketBase = NULL;
  407. # endif
  408. # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
  409. #endif
  410. /* includes end */"
  411. AC_CHECK_HEADERS(
  412. proto/bsdsocket.h,
  413. [], [], [$curl_includes_bsdsocket])
  414. ])
  415. dnl CURL_INCLUDES_NETIF
  416. dnl -------------------------------------------------
  417. dnl Set up variable with list of headers that must be
  418. dnl included when net/if.h is to be included.
  419. AC_DEFUN([CURL_INCLUDES_NETIF], [
  420. curl_includes_netif="\
  421. /* includes start */
  422. #ifdef HAVE_NET_IF_H
  423. # include <net/if.h>
  424. #endif
  425. /* includes end */"
  426. AC_CHECK_HEADERS(
  427. net/if.h,
  428. [], [], [$curl_includes_netif])
  429. ])
  430. dnl CURL_PREPROCESS_CALLCONV
  431. dnl -------------------------------------------------
  432. dnl Set up variable with a preprocessor block which
  433. dnl defines function calling convention.
  434. AC_DEFUN([CURL_PREPROCESS_CALLCONV], [
  435. curl_preprocess_callconv="\
  436. /* preprocess start */
  437. #ifdef _WIN32
  438. # define FUNCALLCONV __stdcall
  439. #else
  440. # define FUNCALLCONV
  441. #endif
  442. /* preprocess end */"
  443. ])
  444. dnl CURL_CHECK_FUNC_ALARM
  445. dnl -------------------------------------------------
  446. dnl Verify if alarm is available, prototyped, and
  447. dnl can be compiled. If all of these are true, and
  448. dnl usage has not been previously disallowed with
  449. dnl shell variable curl_disallow_alarm, then
  450. dnl HAVE_ALARM will be defined.
  451. AC_DEFUN([CURL_CHECK_FUNC_ALARM], [
  452. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  453. #
  454. tst_links_alarm="unknown"
  455. tst_proto_alarm="unknown"
  456. tst_compi_alarm="unknown"
  457. tst_allow_alarm="unknown"
  458. #
  459. AC_MSG_CHECKING([if alarm can be linked])
  460. AC_LINK_IFELSE([
  461. AC_LANG_FUNC_LINK_TRY([alarm])
  462. ],[
  463. AC_MSG_RESULT([yes])
  464. tst_links_alarm="yes"
  465. ],[
  466. AC_MSG_RESULT([no])
  467. tst_links_alarm="no"
  468. ])
  469. #
  470. if test "$tst_links_alarm" = "yes"; then
  471. AC_MSG_CHECKING([if alarm is prototyped])
  472. AC_EGREP_CPP([alarm],[
  473. $curl_includes_unistd
  474. ],[
  475. AC_MSG_RESULT([yes])
  476. tst_proto_alarm="yes"
  477. ],[
  478. AC_MSG_RESULT([no])
  479. tst_proto_alarm="no"
  480. ])
  481. fi
  482. #
  483. if test "$tst_proto_alarm" = "yes"; then
  484. AC_MSG_CHECKING([if alarm is compilable])
  485. AC_COMPILE_IFELSE([
  486. AC_LANG_PROGRAM([[
  487. $curl_includes_unistd
  488. ]],[[
  489. if(0 != alarm(0))
  490. return 1;
  491. ]])
  492. ],[
  493. AC_MSG_RESULT([yes])
  494. tst_compi_alarm="yes"
  495. ],[
  496. AC_MSG_RESULT([no])
  497. tst_compi_alarm="no"
  498. ])
  499. fi
  500. #
  501. if test "$tst_compi_alarm" = "yes"; then
  502. AC_MSG_CHECKING([if alarm usage allowed])
  503. if test "x$curl_disallow_alarm" != "xyes"; then
  504. AC_MSG_RESULT([yes])
  505. tst_allow_alarm="yes"
  506. else
  507. AC_MSG_RESULT([no])
  508. tst_allow_alarm="no"
  509. fi
  510. fi
  511. #
  512. AC_MSG_CHECKING([if alarm might be used])
  513. if test "$tst_links_alarm" = "yes" &&
  514. test "$tst_proto_alarm" = "yes" &&
  515. test "$tst_compi_alarm" = "yes" &&
  516. test "$tst_allow_alarm" = "yes"; then
  517. AC_MSG_RESULT([yes])
  518. AC_DEFINE_UNQUOTED(HAVE_ALARM, 1,
  519. [Define to 1 if you have the alarm function.])
  520. curl_cv_func_alarm="yes"
  521. else
  522. AC_MSG_RESULT([no])
  523. curl_cv_func_alarm="no"
  524. fi
  525. ])
  526. dnl CURL_CHECK_FUNC_BASENAME
  527. dnl -------------------------------------------------
  528. dnl Verify if basename is available, prototyped, and
  529. dnl can be compiled. If all of these are true, and
  530. dnl usage has not been previously disallowed with
  531. dnl shell variable curl_disallow_basename, then
  532. dnl HAVE_BASENAME will be defined.
  533. AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [
  534. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  535. AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl
  536. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  537. #
  538. tst_links_basename="unknown"
  539. tst_proto_basename="unknown"
  540. tst_compi_basename="unknown"
  541. tst_allow_basename="unknown"
  542. #
  543. AC_MSG_CHECKING([if basename can be linked])
  544. AC_LINK_IFELSE([
  545. AC_LANG_FUNC_LINK_TRY([basename])
  546. ],[
  547. AC_MSG_RESULT([yes])
  548. tst_links_basename="yes"
  549. ],[
  550. AC_MSG_RESULT([no])
  551. tst_links_basename="no"
  552. ])
  553. #
  554. if test "$tst_links_basename" = "yes"; then
  555. AC_MSG_CHECKING([if basename is prototyped])
  556. AC_EGREP_CPP([basename],[
  557. $curl_includes_string
  558. $curl_includes_libgen
  559. $curl_includes_unistd
  560. ],[
  561. AC_MSG_RESULT([yes])
  562. tst_proto_basename="yes"
  563. ],[
  564. AC_MSG_RESULT([no])
  565. tst_proto_basename="no"
  566. ])
  567. fi
  568. #
  569. if test "$tst_proto_basename" = "yes"; then
  570. AC_MSG_CHECKING([if basename is compilable])
  571. AC_COMPILE_IFELSE([
  572. AC_LANG_PROGRAM([[
  573. $curl_includes_string
  574. $curl_includes_libgen
  575. $curl_includes_unistd
  576. ]],[[
  577. if(0 != basename(0))
  578. return 1;
  579. ]])
  580. ],[
  581. AC_MSG_RESULT([yes])
  582. tst_compi_basename="yes"
  583. ],[
  584. AC_MSG_RESULT([no])
  585. tst_compi_basename="no"
  586. ])
  587. fi
  588. #
  589. if test "$tst_compi_basename" = "yes"; then
  590. AC_MSG_CHECKING([if basename usage allowed])
  591. if test "x$curl_disallow_basename" != "xyes"; then
  592. AC_MSG_RESULT([yes])
  593. tst_allow_basename="yes"
  594. else
  595. AC_MSG_RESULT([no])
  596. tst_allow_basename="no"
  597. fi
  598. fi
  599. #
  600. AC_MSG_CHECKING([if basename might be used])
  601. if test "$tst_links_basename" = "yes" &&
  602. test "$tst_proto_basename" = "yes" &&
  603. test "$tst_compi_basename" = "yes" &&
  604. test "$tst_allow_basename" = "yes"; then
  605. AC_MSG_RESULT([yes])
  606. AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1,
  607. [Define to 1 if you have the basename function.])
  608. curl_cv_func_basename="yes"
  609. else
  610. AC_MSG_RESULT([no])
  611. curl_cv_func_basename="no"
  612. fi
  613. ])
  614. dnl CURL_CHECK_FUNC_CLOSESOCKET
  615. dnl -------------------------------------------------
  616. dnl Verify if closesocket is available, prototyped, and
  617. dnl can be compiled. If all of these are true, and
  618. dnl usage has not been previously disallowed with
  619. dnl shell variable curl_disallow_closesocket, then
  620. dnl HAVE_CLOSESOCKET will be defined.
  621. AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [
  622. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  623. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  624. #
  625. tst_links_closesocket="unknown"
  626. tst_proto_closesocket="unknown"
  627. tst_compi_closesocket="unknown"
  628. tst_allow_closesocket="unknown"
  629. #
  630. AC_MSG_CHECKING([if closesocket can be linked])
  631. AC_LINK_IFELSE([
  632. AC_LANG_PROGRAM([[
  633. $curl_includes_winsock2
  634. $curl_includes_socket
  635. ]],[[
  636. if(0 != closesocket(0))
  637. return 1;
  638. ]])
  639. ],[
  640. AC_MSG_RESULT([yes])
  641. tst_links_closesocket="yes"
  642. ],[
  643. AC_MSG_RESULT([no])
  644. tst_links_closesocket="no"
  645. ])
  646. #
  647. if test "$tst_links_closesocket" = "yes"; then
  648. AC_MSG_CHECKING([if closesocket is prototyped])
  649. AC_EGREP_CPP([closesocket],[
  650. $curl_includes_winsock2
  651. $curl_includes_socket
  652. ],[
  653. AC_MSG_RESULT([yes])
  654. tst_proto_closesocket="yes"
  655. ],[
  656. AC_MSG_RESULT([no])
  657. tst_proto_closesocket="no"
  658. ])
  659. fi
  660. #
  661. if test "$tst_proto_closesocket" = "yes"; then
  662. AC_MSG_CHECKING([if closesocket is compilable])
  663. AC_COMPILE_IFELSE([
  664. AC_LANG_PROGRAM([[
  665. $curl_includes_winsock2
  666. $curl_includes_socket
  667. ]],[[
  668. if(0 != closesocket(0))
  669. return 1;
  670. ]])
  671. ],[
  672. AC_MSG_RESULT([yes])
  673. tst_compi_closesocket="yes"
  674. ],[
  675. AC_MSG_RESULT([no])
  676. tst_compi_closesocket="no"
  677. ])
  678. fi
  679. #
  680. if test "$tst_compi_closesocket" = "yes"; then
  681. AC_MSG_CHECKING([if closesocket usage allowed])
  682. if test "x$curl_disallow_closesocket" != "xyes"; then
  683. AC_MSG_RESULT([yes])
  684. tst_allow_closesocket="yes"
  685. else
  686. AC_MSG_RESULT([no])
  687. tst_allow_closesocket="no"
  688. fi
  689. fi
  690. #
  691. AC_MSG_CHECKING([if closesocket might be used])
  692. if test "$tst_links_closesocket" = "yes" &&
  693. test "$tst_proto_closesocket" = "yes" &&
  694. test "$tst_compi_closesocket" = "yes" &&
  695. test "$tst_allow_closesocket" = "yes"; then
  696. AC_MSG_RESULT([yes])
  697. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1,
  698. [Define to 1 if you have the closesocket function.])
  699. curl_cv_func_closesocket="yes"
  700. else
  701. AC_MSG_RESULT([no])
  702. curl_cv_func_closesocket="no"
  703. fi
  704. ])
  705. dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  706. dnl -------------------------------------------------
  707. dnl Verify if CloseSocket is available, prototyped, and
  708. dnl can be compiled. If all of these are true, and
  709. dnl usage has not been previously disallowed with
  710. dnl shell variable curl_disallow_closesocket_camel,
  711. dnl then HAVE_CLOSESOCKET_CAMEL will be defined.
  712. AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
  713. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  714. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  715. #
  716. tst_links_closesocket_camel="unknown"
  717. tst_proto_closesocket_camel="unknown"
  718. tst_compi_closesocket_camel="unknown"
  719. tst_allow_closesocket_camel="unknown"
  720. #
  721. AC_MSG_CHECKING([if CloseSocket can be linked])
  722. AC_LINK_IFELSE([
  723. AC_LANG_PROGRAM([[
  724. $curl_includes_bsdsocket
  725. $curl_includes_sys_socket
  726. ]],[[
  727. if(0 != CloseSocket(0))
  728. return 1;
  729. ]])
  730. ],[
  731. AC_MSG_RESULT([yes])
  732. tst_links_closesocket_camel="yes"
  733. ],[
  734. AC_MSG_RESULT([no])
  735. tst_links_closesocket_camel="no"
  736. ])
  737. #
  738. if test "$tst_links_closesocket_camel" = "yes"; then
  739. AC_MSG_CHECKING([if CloseSocket is prototyped])
  740. AC_EGREP_CPP([CloseSocket],[
  741. $curl_includes_bsdsocket
  742. $curl_includes_sys_socket
  743. ],[
  744. AC_MSG_RESULT([yes])
  745. tst_proto_closesocket_camel="yes"
  746. ],[
  747. AC_MSG_RESULT([no])
  748. tst_proto_closesocket_camel="no"
  749. ])
  750. fi
  751. #
  752. if test "$tst_proto_closesocket_camel" = "yes"; then
  753. AC_MSG_CHECKING([if CloseSocket is compilable])
  754. AC_COMPILE_IFELSE([
  755. AC_LANG_PROGRAM([[
  756. $curl_includes_bsdsocket
  757. $curl_includes_sys_socket
  758. ]],[[
  759. if(0 != CloseSocket(0))
  760. return 1;
  761. ]])
  762. ],[
  763. AC_MSG_RESULT([yes])
  764. tst_compi_closesocket_camel="yes"
  765. ],[
  766. AC_MSG_RESULT([no])
  767. tst_compi_closesocket_camel="no"
  768. ])
  769. fi
  770. #
  771. if test "$tst_compi_closesocket_camel" = "yes"; then
  772. AC_MSG_CHECKING([if CloseSocket usage allowed])
  773. if test "x$curl_disallow_closesocket_camel" != "xyes"; then
  774. AC_MSG_RESULT([yes])
  775. tst_allow_closesocket_camel="yes"
  776. else
  777. AC_MSG_RESULT([no])
  778. tst_allow_closesocket_camel="no"
  779. fi
  780. fi
  781. #
  782. AC_MSG_CHECKING([if CloseSocket might be used])
  783. if test "$tst_links_closesocket_camel" = "yes" &&
  784. test "$tst_proto_closesocket_camel" = "yes" &&
  785. test "$tst_compi_closesocket_camel" = "yes" &&
  786. test "$tst_allow_closesocket_camel" = "yes"; then
  787. AC_MSG_RESULT([yes])
  788. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1,
  789. [Define to 1 if you have the CloseSocket camel case function.])
  790. curl_cv_func_closesocket_camel="yes"
  791. else
  792. AC_MSG_RESULT([no])
  793. curl_cv_func_closesocket_camel="no"
  794. fi
  795. ])
  796. dnl CURL_CHECK_FUNC_FCNTL
  797. dnl -------------------------------------------------
  798. dnl Verify if fcntl is available, prototyped, and
  799. dnl can be compiled. If all of these are true, and
  800. dnl usage has not been previously disallowed with
  801. dnl shell variable curl_disallow_fcntl, then
  802. dnl HAVE_FCNTL will be defined.
  803. AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [
  804. AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl
  805. #
  806. tst_links_fcntl="unknown"
  807. tst_proto_fcntl="unknown"
  808. tst_compi_fcntl="unknown"
  809. tst_allow_fcntl="unknown"
  810. #
  811. AC_MSG_CHECKING([if fcntl can be linked])
  812. AC_LINK_IFELSE([
  813. AC_LANG_FUNC_LINK_TRY([fcntl])
  814. ],[
  815. AC_MSG_RESULT([yes])
  816. tst_links_fcntl="yes"
  817. ],[
  818. AC_MSG_RESULT([no])
  819. tst_links_fcntl="no"
  820. ])
  821. #
  822. if test "$tst_links_fcntl" = "yes"; then
  823. AC_MSG_CHECKING([if fcntl is prototyped])
  824. AC_EGREP_CPP([fcntl],[
  825. $curl_includes_fcntl
  826. ],[
  827. AC_MSG_RESULT([yes])
  828. tst_proto_fcntl="yes"
  829. ],[
  830. AC_MSG_RESULT([no])
  831. tst_proto_fcntl="no"
  832. ])
  833. fi
  834. #
  835. if test "$tst_proto_fcntl" = "yes"; then
  836. AC_MSG_CHECKING([if fcntl is compilable])
  837. AC_COMPILE_IFELSE([
  838. AC_LANG_PROGRAM([[
  839. $curl_includes_fcntl
  840. ]],[[
  841. if(0 != fcntl(0, 0, 0))
  842. return 1;
  843. ]])
  844. ],[
  845. AC_MSG_RESULT([yes])
  846. tst_compi_fcntl="yes"
  847. ],[
  848. AC_MSG_RESULT([no])
  849. tst_compi_fcntl="no"
  850. ])
  851. fi
  852. #
  853. if test "$tst_compi_fcntl" = "yes"; then
  854. AC_MSG_CHECKING([if fcntl usage allowed])
  855. if test "x$curl_disallow_fcntl" != "xyes"; then
  856. AC_MSG_RESULT([yes])
  857. tst_allow_fcntl="yes"
  858. else
  859. AC_MSG_RESULT([no])
  860. tst_allow_fcntl="no"
  861. fi
  862. fi
  863. #
  864. AC_MSG_CHECKING([if fcntl might be used])
  865. if test "$tst_links_fcntl" = "yes" &&
  866. test "$tst_proto_fcntl" = "yes" &&
  867. test "$tst_compi_fcntl" = "yes" &&
  868. test "$tst_allow_fcntl" = "yes"; then
  869. AC_MSG_RESULT([yes])
  870. AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1,
  871. [Define to 1 if you have the fcntl function.])
  872. curl_cv_func_fcntl="yes"
  873. CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
  874. else
  875. AC_MSG_RESULT([no])
  876. curl_cv_func_fcntl="no"
  877. fi
  878. ])
  879. dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
  880. dnl -------------------------------------------------
  881. dnl Verify if fcntl with status flag O_NONBLOCK is
  882. dnl available, can be compiled, and seems to work. If
  883. dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK
  884. dnl will be defined.
  885. AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [
  886. #
  887. tst_compi_fcntl_o_nonblock="unknown"
  888. tst_allow_fcntl_o_nonblock="unknown"
  889. #
  890. case $host_os in
  891. sunos4* | aix3*)
  892. dnl O_NONBLOCK does not work on these platforms
  893. curl_disallow_fcntl_o_nonblock="yes"
  894. ;;
  895. esac
  896. #
  897. if test "$curl_cv_func_fcntl" = "yes"; then
  898. AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable])
  899. AC_COMPILE_IFELSE([
  900. AC_LANG_PROGRAM([[
  901. $curl_includes_fcntl
  902. ]],[[
  903. int flags = 0;
  904. if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
  905. return 1;
  906. ]])
  907. ],[
  908. AC_MSG_RESULT([yes])
  909. tst_compi_fcntl_o_nonblock="yes"
  910. ],[
  911. AC_MSG_RESULT([no])
  912. tst_compi_fcntl_o_nonblock="no"
  913. ])
  914. fi
  915. #
  916. if test "$tst_compi_fcntl_o_nonblock" = "yes"; then
  917. AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed])
  918. if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then
  919. AC_MSG_RESULT([yes])
  920. tst_allow_fcntl_o_nonblock="yes"
  921. else
  922. AC_MSG_RESULT([no])
  923. tst_allow_fcntl_o_nonblock="no"
  924. fi
  925. fi
  926. #
  927. AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used])
  928. if test "$tst_compi_fcntl_o_nonblock" = "yes" &&
  929. test "$tst_allow_fcntl_o_nonblock" = "yes"; then
  930. AC_MSG_RESULT([yes])
  931. AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1,
  932. [Define to 1 if you have a working fcntl O_NONBLOCK function.])
  933. curl_cv_func_fcntl_o_nonblock="yes"
  934. else
  935. AC_MSG_RESULT([no])
  936. curl_cv_func_fcntl_o_nonblock="no"
  937. fi
  938. ])
  939. dnl CURL_CHECK_FUNC_FREEADDRINFO
  940. dnl -------------------------------------------------
  941. dnl Verify if freeaddrinfo is available, prototyped,
  942. dnl and can be compiled. If all of these are true,
  943. dnl and usage has not been previously disallowed with
  944. dnl shell variable curl_disallow_freeaddrinfo, then
  945. dnl HAVE_FREEADDRINFO will be defined.
  946. AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [
  947. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  948. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  949. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  950. #
  951. tst_links_freeaddrinfo="unknown"
  952. tst_proto_freeaddrinfo="unknown"
  953. tst_compi_freeaddrinfo="unknown"
  954. tst_allow_freeaddrinfo="unknown"
  955. #
  956. AC_MSG_CHECKING([if freeaddrinfo can be linked])
  957. AC_LINK_IFELSE([
  958. AC_LANG_PROGRAM([[
  959. $curl_includes_ws2tcpip
  960. $curl_includes_sys_socket
  961. $curl_includes_netdb
  962. ]],[[
  963. freeaddrinfo(0);
  964. ]])
  965. ],[
  966. AC_MSG_RESULT([yes])
  967. tst_links_freeaddrinfo="yes"
  968. ],[
  969. AC_MSG_RESULT([no])
  970. tst_links_freeaddrinfo="no"
  971. ])
  972. #
  973. if test "$tst_links_freeaddrinfo" = "yes"; then
  974. AC_MSG_CHECKING([if freeaddrinfo is prototyped])
  975. AC_EGREP_CPP([freeaddrinfo],[
  976. $curl_includes_ws2tcpip
  977. $curl_includes_sys_socket
  978. $curl_includes_netdb
  979. ],[
  980. AC_MSG_RESULT([yes])
  981. tst_proto_freeaddrinfo="yes"
  982. ],[
  983. AC_MSG_RESULT([no])
  984. tst_proto_freeaddrinfo="no"
  985. ])
  986. fi
  987. #
  988. if test "$tst_proto_freeaddrinfo" = "yes"; then
  989. AC_MSG_CHECKING([if freeaddrinfo is compilable])
  990. AC_COMPILE_IFELSE([
  991. AC_LANG_PROGRAM([[
  992. $curl_includes_ws2tcpip
  993. $curl_includes_sys_socket
  994. $curl_includes_netdb
  995. ]],[[
  996. freeaddrinfo(0);
  997. ]])
  998. ],[
  999. AC_MSG_RESULT([yes])
  1000. tst_compi_freeaddrinfo="yes"
  1001. ],[
  1002. AC_MSG_RESULT([no])
  1003. tst_compi_freeaddrinfo="no"
  1004. ])
  1005. fi
  1006. #
  1007. if test "$tst_compi_freeaddrinfo" = "yes"; then
  1008. AC_MSG_CHECKING([if freeaddrinfo usage allowed])
  1009. if test "x$curl_disallow_freeaddrinfo" != "xyes"; then
  1010. AC_MSG_RESULT([yes])
  1011. tst_allow_freeaddrinfo="yes"
  1012. else
  1013. AC_MSG_RESULT([no])
  1014. tst_allow_freeaddrinfo="no"
  1015. fi
  1016. fi
  1017. #
  1018. AC_MSG_CHECKING([if freeaddrinfo might be used])
  1019. if test "$tst_links_freeaddrinfo" = "yes" &&
  1020. test "$tst_proto_freeaddrinfo" = "yes" &&
  1021. test "$tst_compi_freeaddrinfo" = "yes" &&
  1022. test "$tst_allow_freeaddrinfo" = "yes"; then
  1023. AC_MSG_RESULT([yes])
  1024. AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
  1025. [Define to 1 if you have the freeaddrinfo function.])
  1026. curl_cv_func_freeaddrinfo="yes"
  1027. else
  1028. AC_MSG_RESULT([no])
  1029. curl_cv_func_freeaddrinfo="no"
  1030. fi
  1031. ])
  1032. dnl CURL_CHECK_FUNC_FSETXATTR
  1033. dnl -------------------------------------------------
  1034. dnl Verify if fsetxattr is available, prototyped, and
  1035. dnl can be compiled. If all of these are true, and
  1036. dnl usage has not been previously disallowed with
  1037. dnl shell variable curl_disallow_fsetxattr, then
  1038. dnl HAVE_FSETXATTR will be defined.
  1039. AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [
  1040. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  1041. #
  1042. tst_links_fsetxattr="unknown"
  1043. tst_proto_fsetxattr="unknown"
  1044. tst_compi_fsetxattr="unknown"
  1045. tst_allow_fsetxattr="unknown"
  1046. tst_nargs_fsetxattr="unknown"
  1047. #
  1048. AC_MSG_CHECKING([if fsetxattr can be linked])
  1049. AC_LINK_IFELSE([
  1050. AC_LANG_FUNC_LINK_TRY([fsetxattr])
  1051. ],[
  1052. AC_MSG_RESULT([yes])
  1053. tst_links_fsetxattr="yes"
  1054. ],[
  1055. AC_MSG_RESULT([no])
  1056. tst_links_fsetxattr="no"
  1057. ])
  1058. #
  1059. if test "$tst_links_fsetxattr" = "yes"; then
  1060. AC_MSG_CHECKING([if fsetxattr is prototyped])
  1061. AC_EGREP_CPP([fsetxattr],[
  1062. $curl_includes_sys_xattr
  1063. ],[
  1064. AC_MSG_RESULT([yes])
  1065. tst_proto_fsetxattr="yes"
  1066. ],[
  1067. AC_MSG_RESULT([no])
  1068. tst_proto_fsetxattr="no"
  1069. ])
  1070. fi
  1071. #
  1072. if test "$tst_proto_fsetxattr" = "yes"; then
  1073. if test "$tst_nargs_fsetxattr" = "unknown"; then
  1074. AC_MSG_CHECKING([if fsetxattr takes 5 args.])
  1075. AC_COMPILE_IFELSE([
  1076. AC_LANG_PROGRAM([[
  1077. $curl_includes_sys_xattr
  1078. ]],[[
  1079. if(0 != fsetxattr(0, 0, 0, 0, 0))
  1080. return 1;
  1081. ]])
  1082. ],[
  1083. AC_MSG_RESULT([yes])
  1084. tst_compi_fsetxattr="yes"
  1085. tst_nargs_fsetxattr="5"
  1086. ],[
  1087. AC_MSG_RESULT([no])
  1088. tst_compi_fsetxattr="no"
  1089. ])
  1090. fi
  1091. if test "$tst_nargs_fsetxattr" = "unknown"; then
  1092. AC_MSG_CHECKING([if fsetxattr takes 6 args.])
  1093. AC_COMPILE_IFELSE([
  1094. AC_LANG_PROGRAM([[
  1095. $curl_includes_sys_xattr
  1096. ]],[[
  1097. if(0 != fsetxattr(0, 0, 0, 0, 0, 0))
  1098. return 1;
  1099. ]])
  1100. ],[
  1101. AC_MSG_RESULT([yes])
  1102. tst_compi_fsetxattr="yes"
  1103. tst_nargs_fsetxattr="6"
  1104. ],[
  1105. AC_MSG_RESULT([no])
  1106. tst_compi_fsetxattr="no"
  1107. ])
  1108. fi
  1109. AC_MSG_CHECKING([if fsetxattr is compilable])
  1110. if test "$tst_compi_fsetxattr" = "yes"; then
  1111. AC_MSG_RESULT([yes])
  1112. else
  1113. AC_MSG_RESULT([no])
  1114. fi
  1115. fi
  1116. #
  1117. if test "$tst_compi_fsetxattr" = "yes"; then
  1118. AC_MSG_CHECKING([if fsetxattr usage allowed])
  1119. if test "x$curl_disallow_fsetxattr" != "xyes"; then
  1120. AC_MSG_RESULT([yes])
  1121. tst_allow_fsetxattr="yes"
  1122. else
  1123. AC_MSG_RESULT([no])
  1124. tst_allow_fsetxattr="no"
  1125. fi
  1126. fi
  1127. #
  1128. AC_MSG_CHECKING([if fsetxattr might be used])
  1129. if test "$tst_links_fsetxattr" = "yes" &&
  1130. test "$tst_proto_fsetxattr" = "yes" &&
  1131. test "$tst_compi_fsetxattr" = "yes" &&
  1132. test "$tst_allow_fsetxattr" = "yes"; then
  1133. AC_MSG_RESULT([yes])
  1134. AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1,
  1135. [Define to 1 if you have the fsetxattr function.])
  1136. dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr,
  1137. dnl [Specifies the number of arguments to fsetxattr])
  1138. #
  1139. if test "$tst_nargs_fsetxattr" -eq "5"; then
  1140. AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args])
  1141. elif test "$tst_nargs_fsetxattr" -eq "6"; then
  1142. AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args])
  1143. fi
  1144. #
  1145. curl_cv_func_fsetxattr="yes"
  1146. else
  1147. AC_MSG_RESULT([no])
  1148. curl_cv_func_fsetxattr="no"
  1149. fi
  1150. ])
  1151. dnl CURL_CHECK_FUNC_FTRUNCATE
  1152. dnl -------------------------------------------------
  1153. dnl Verify if ftruncate is available, prototyped, and
  1154. dnl can be compiled. If all of these are true, and
  1155. dnl usage has not been previously disallowed with
  1156. dnl shell variable curl_disallow_ftruncate, then
  1157. dnl HAVE_FTRUNCATE will be defined.
  1158. AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
  1159. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1160. #
  1161. tst_links_ftruncate="unknown"
  1162. tst_proto_ftruncate="unknown"
  1163. tst_compi_ftruncate="unknown"
  1164. tst_allow_ftruncate="unknown"
  1165. #
  1166. AC_MSG_CHECKING([if ftruncate can be linked])
  1167. AC_LINK_IFELSE([
  1168. AC_LANG_FUNC_LINK_TRY([ftruncate])
  1169. ],[
  1170. AC_MSG_RESULT([yes])
  1171. tst_links_ftruncate="yes"
  1172. ],[
  1173. AC_MSG_RESULT([no])
  1174. tst_links_ftruncate="no"
  1175. ])
  1176. #
  1177. if test "$tst_links_ftruncate" = "yes"; then
  1178. AC_MSG_CHECKING([if ftruncate is prototyped])
  1179. AC_EGREP_CPP([ftruncate],[
  1180. $curl_includes_unistd
  1181. ],[
  1182. AC_MSG_RESULT([yes])
  1183. tst_proto_ftruncate="yes"
  1184. ],[
  1185. AC_MSG_RESULT([no])
  1186. tst_proto_ftruncate="no"
  1187. ])
  1188. fi
  1189. #
  1190. if test "$tst_proto_ftruncate" = "yes"; then
  1191. AC_MSG_CHECKING([if ftruncate is compilable])
  1192. AC_COMPILE_IFELSE([
  1193. AC_LANG_PROGRAM([[
  1194. $curl_includes_unistd
  1195. ]],[[
  1196. if(0 != ftruncate(0, 0))
  1197. return 1;
  1198. ]])
  1199. ],[
  1200. AC_MSG_RESULT([yes])
  1201. tst_compi_ftruncate="yes"
  1202. ],[
  1203. AC_MSG_RESULT([no])
  1204. tst_compi_ftruncate="no"
  1205. ])
  1206. fi
  1207. #
  1208. if test "$tst_compi_ftruncate" = "yes"; then
  1209. AC_MSG_CHECKING([if ftruncate usage allowed])
  1210. if test "x$curl_disallow_ftruncate" != "xyes"; then
  1211. AC_MSG_RESULT([yes])
  1212. tst_allow_ftruncate="yes"
  1213. else
  1214. AC_MSG_RESULT([no])
  1215. tst_allow_ftruncate="no"
  1216. fi
  1217. fi
  1218. #
  1219. AC_MSG_CHECKING([if ftruncate might be used])
  1220. if test "$tst_links_ftruncate" = "yes" &&
  1221. test "$tst_proto_ftruncate" = "yes" &&
  1222. test "$tst_compi_ftruncate" = "yes" &&
  1223. test "$tst_allow_ftruncate" = "yes"; then
  1224. AC_MSG_RESULT([yes])
  1225. AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
  1226. [Define to 1 if you have the ftruncate function.])
  1227. curl_cv_func_ftruncate="yes"
  1228. else
  1229. AC_MSG_RESULT([no])
  1230. curl_cv_func_ftruncate="no"
  1231. fi
  1232. ])
  1233. dnl CURL_CHECK_FUNC_GETADDRINFO
  1234. dnl -------------------------------------------------
  1235. dnl Verify if getaddrinfo is available, prototyped, can
  1236. dnl be compiled and seems to work. If all of these are
  1237. dnl true, and usage has not been previously disallowed
  1238. dnl with shell variable curl_disallow_getaddrinfo, then
  1239. dnl HAVE_GETADDRINFO will be defined. Additionally when
  1240. dnl HAVE_GETADDRINFO gets defined this will also attempt
  1241. dnl to find out if getaddrinfo happens to be threadsafe,
  1242. dnl defining HAVE_GETADDRINFO_THREADSAFE when true.
  1243. AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
  1244. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  1245. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  1246. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  1247. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  1248. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1249. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  1250. #
  1251. tst_links_getaddrinfo="unknown"
  1252. tst_proto_getaddrinfo="unknown"
  1253. tst_compi_getaddrinfo="unknown"
  1254. tst_works_getaddrinfo="unknown"
  1255. tst_allow_getaddrinfo="unknown"
  1256. tst_tsafe_getaddrinfo="unknown"
  1257. #
  1258. AC_MSG_CHECKING([if getaddrinfo can be linked])
  1259. AC_LINK_IFELSE([
  1260. AC_LANG_PROGRAM([[
  1261. $curl_includes_ws2tcpip
  1262. $curl_includes_sys_socket
  1263. $curl_includes_netdb
  1264. ]],[[
  1265. if(0 != getaddrinfo(0, 0, 0, 0))
  1266. return 1;
  1267. ]])
  1268. ],[
  1269. AC_MSG_RESULT([yes])
  1270. tst_links_getaddrinfo="yes"
  1271. ],[
  1272. AC_MSG_RESULT([no])
  1273. tst_links_getaddrinfo="no"
  1274. ])
  1275. #
  1276. if test "$tst_links_getaddrinfo" = "yes"; then
  1277. AC_MSG_CHECKING([if getaddrinfo is prototyped])
  1278. AC_EGREP_CPP([getaddrinfo],[
  1279. $curl_includes_ws2tcpip
  1280. $curl_includes_sys_socket
  1281. $curl_includes_netdb
  1282. ],[
  1283. AC_MSG_RESULT([yes])
  1284. tst_proto_getaddrinfo="yes"
  1285. ],[
  1286. AC_MSG_RESULT([no])
  1287. tst_proto_getaddrinfo="no"
  1288. ])
  1289. fi
  1290. #
  1291. if test "$tst_proto_getaddrinfo" = "yes"; then
  1292. AC_MSG_CHECKING([if getaddrinfo is compilable])
  1293. AC_COMPILE_IFELSE([
  1294. AC_LANG_PROGRAM([[
  1295. $curl_includes_ws2tcpip
  1296. $curl_includes_sys_socket
  1297. $curl_includes_netdb
  1298. ]],[[
  1299. if(0 != getaddrinfo(0, 0, 0, 0))
  1300. return 1;
  1301. ]])
  1302. ],[
  1303. AC_MSG_RESULT([yes])
  1304. tst_compi_getaddrinfo="yes"
  1305. ],[
  1306. AC_MSG_RESULT([no])
  1307. tst_compi_getaddrinfo="no"
  1308. ])
  1309. fi
  1310. #
  1311. dnl only do runtime verification when not cross-compiling
  1312. if test "x$cross_compiling" != "xyes" &&
  1313. test "$tst_compi_getaddrinfo" = "yes"; then
  1314. AC_MSG_CHECKING([if getaddrinfo seems to work])
  1315. CURL_RUN_IFELSE([
  1316. AC_LANG_PROGRAM([[
  1317. $curl_includes_ws2tcpip
  1318. $curl_includes_stdlib
  1319. $curl_includes_string
  1320. $curl_includes_sys_socket
  1321. $curl_includes_netdb
  1322. ]],[[
  1323. struct addrinfo hints;
  1324. struct addrinfo *ai = 0;
  1325. int error;
  1326. #ifdef _WIN32
  1327. WSADATA wsa;
  1328. if(WSAStartup(MAKEWORD(2, 2), &wsa))
  1329. exit(2);
  1330. #endif
  1331. memset(&hints, 0, sizeof(hints));
  1332. hints.ai_flags = AI_NUMERICHOST;
  1333. hints.ai_family = AF_UNSPEC;
  1334. hints.ai_socktype = SOCK_STREAM;
  1335. error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
  1336. if(error || !ai)
  1337. exit(1); /* fail */
  1338. else
  1339. exit(0);
  1340. ]])
  1341. ],[
  1342. AC_MSG_RESULT([yes])
  1343. tst_works_getaddrinfo="yes"
  1344. ],[
  1345. AC_MSG_RESULT([no])
  1346. tst_works_getaddrinfo="no"
  1347. ])
  1348. fi
  1349. #
  1350. if test "$tst_compi_getaddrinfo" = "yes" &&
  1351. test "$tst_works_getaddrinfo" != "no"; then
  1352. AC_MSG_CHECKING([if getaddrinfo usage allowed])
  1353. if test "x$curl_disallow_getaddrinfo" != "xyes"; then
  1354. AC_MSG_RESULT([yes])
  1355. tst_allow_getaddrinfo="yes"
  1356. else
  1357. AC_MSG_RESULT([no])
  1358. tst_allow_getaddrinfo="no"
  1359. fi
  1360. fi
  1361. #
  1362. AC_MSG_CHECKING([if getaddrinfo might be used])
  1363. if test "$tst_links_getaddrinfo" = "yes" &&
  1364. test "$tst_proto_getaddrinfo" = "yes" &&
  1365. test "$tst_compi_getaddrinfo" = "yes" &&
  1366. test "$tst_allow_getaddrinfo" = "yes" &&
  1367. test "$tst_works_getaddrinfo" != "no"; then
  1368. AC_MSG_RESULT([yes])
  1369. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
  1370. [Define to 1 if you have a working getaddrinfo function.])
  1371. curl_cv_func_getaddrinfo="yes"
  1372. else
  1373. AC_MSG_RESULT([no])
  1374. curl_cv_func_getaddrinfo="no"
  1375. curl_cv_func_getaddrinfo_threadsafe="no"
  1376. fi
  1377. #
  1378. if test "$curl_cv_func_getaddrinfo" = "yes"; then
  1379. AC_MSG_CHECKING([if getaddrinfo is threadsafe])
  1380. case $host_os in
  1381. aix[[1234]].* | aix5.[[01]].*)
  1382. dnl aix 5.1 and older
  1383. tst_tsafe_getaddrinfo="no"
  1384. ;;
  1385. aix*)
  1386. dnl aix 5.2 and newer
  1387. tst_tsafe_getaddrinfo="yes"
  1388. ;;
  1389. darwin[[12345]].*)
  1390. dnl darwin 5.0 and mac os x 10.1.X and older
  1391. tst_tsafe_getaddrinfo="no"
  1392. ;;
  1393. darwin*)
  1394. dnl darwin 6.0 and mac os x 10.2.X and newer
  1395. tst_tsafe_getaddrinfo="yes"
  1396. ;;
  1397. freebsd[[1234]].* | freebsd5.[[1234]]*)
  1398. dnl freebsd 5.4 and older
  1399. tst_tsafe_getaddrinfo="no"
  1400. ;;
  1401. freebsd*)
  1402. dnl freebsd 5.5 and newer
  1403. tst_tsafe_getaddrinfo="yes"
  1404. ;;
  1405. hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
  1406. dnl hpux 11.10 and older
  1407. tst_tsafe_getaddrinfo="no"
  1408. ;;
  1409. hpux*)
  1410. dnl hpux 11.11 and newer
  1411. tst_tsafe_getaddrinfo="yes"
  1412. ;;
  1413. midnightbsd*)
  1414. dnl all MidnightBSD versions
  1415. tst_tsafe_getaddrinfo="yes"
  1416. ;;
  1417. netbsd[[123]].*)
  1418. dnl netbsd 3.X and older
  1419. tst_tsafe_getaddrinfo="no"
  1420. ;;
  1421. netbsd*)
  1422. dnl netbsd 4.X and newer
  1423. tst_tsafe_getaddrinfo="yes"
  1424. ;;
  1425. *bsd*)
  1426. dnl All other bsd's
  1427. tst_tsafe_getaddrinfo="no"
  1428. ;;
  1429. solaris2*)
  1430. dnl solaris which have it
  1431. tst_tsafe_getaddrinfo="yes"
  1432. ;;
  1433. esac
  1434. if test "$tst_tsafe_getaddrinfo" = "unknown" &&
  1435. test "$curl_cv_native_windows" = "yes"; then
  1436. tst_tsafe_getaddrinfo="yes"
  1437. fi
  1438. if test "$tst_tsafe_getaddrinfo" = "unknown"; then
  1439. CURL_CHECK_DEF_CC([h_errno], [
  1440. $curl_includes_sys_socket
  1441. $curl_includes_netdb
  1442. ], [silent])
  1443. if test "$curl_cv_have_def_h_errno" = "yes"; then
  1444. tst_h_errno_macro="yes"
  1445. else
  1446. tst_h_errno_macro="no"
  1447. fi
  1448. AC_COMPILE_IFELSE([
  1449. AC_LANG_PROGRAM([[
  1450. $curl_includes_sys_socket
  1451. $curl_includes_netdb
  1452. ]],[[
  1453. h_errno = 2;
  1454. if(0 != h_errno)
  1455. return 1;
  1456. ]])
  1457. ],[
  1458. tst_h_errno_modifiable_lvalue="yes"
  1459. ],[
  1460. tst_h_errno_modifiable_lvalue="no"
  1461. ])
  1462. AC_COMPILE_IFELSE([
  1463. AC_LANG_PROGRAM([[
  1464. ]],[[
  1465. #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
  1466. return 0;
  1467. #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
  1468. return 0;
  1469. #else
  1470. #error force compilation error
  1471. #endif
  1472. ]])
  1473. ],[
  1474. tst_h_errno_sbs_issue_7="yes"
  1475. ],[
  1476. tst_h_errno_sbs_issue_7="no"
  1477. ])
  1478. if test "$tst_h_errno_macro" = "no" &&
  1479. test "$tst_h_errno_modifiable_lvalue" = "no" &&
  1480. test "$tst_h_errno_sbs_issue_7" = "no"; then
  1481. tst_tsafe_getaddrinfo="no"
  1482. else
  1483. tst_tsafe_getaddrinfo="yes"
  1484. fi
  1485. fi
  1486. AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
  1487. if test "$tst_tsafe_getaddrinfo" = "yes"; then
  1488. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
  1489. [Define to 1 if the getaddrinfo function is threadsafe.])
  1490. curl_cv_func_getaddrinfo_threadsafe="yes"
  1491. else
  1492. curl_cv_func_getaddrinfo_threadsafe="no"
  1493. fi
  1494. fi
  1495. ])
  1496. dnl CURL_CHECK_FUNC_GETHOSTBYNAME
  1497. dnl -------------------------------------------------
  1498. dnl Verify if gethostbyname is available, prototyped,
  1499. dnl and can be compiled. If all of these are true,
  1500. dnl and usage has not been previously disallowed with
  1501. dnl shell variable curl_disallow_gethostbyname, then
  1502. dnl HAVE_GETHOSTBYNAME will be defined.
  1503. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [
  1504. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1505. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1506. #
  1507. tst_links_gethostbyname="unknown"
  1508. tst_proto_gethostbyname="unknown"
  1509. tst_compi_gethostbyname="unknown"
  1510. tst_allow_gethostbyname="unknown"
  1511. #
  1512. AC_MSG_CHECKING([if gethostbyname can be linked])
  1513. AC_LINK_IFELSE([
  1514. AC_LANG_PROGRAM([[
  1515. $curl_includes_winsock2
  1516. $curl_includes_bsdsocket
  1517. $curl_includes_netdb
  1518. ]],[[
  1519. if(0 != gethostbyname(0))
  1520. return 1;
  1521. ]])
  1522. ],[
  1523. AC_MSG_RESULT([yes])
  1524. tst_links_gethostbyname="yes"
  1525. ],[
  1526. AC_MSG_RESULT([no])
  1527. tst_links_gethostbyname="no"
  1528. ])
  1529. #
  1530. if test "$tst_links_gethostbyname" = "yes"; then
  1531. AC_MSG_CHECKING([if gethostbyname is prototyped])
  1532. AC_EGREP_CPP([gethostbyname],[
  1533. $curl_includes_winsock2
  1534. $curl_includes_bsdsocket
  1535. $curl_includes_netdb
  1536. ],[
  1537. AC_MSG_RESULT([yes])
  1538. tst_proto_gethostbyname="yes"
  1539. ],[
  1540. AC_MSG_RESULT([no])
  1541. tst_proto_gethostbyname="no"
  1542. ])
  1543. fi
  1544. #
  1545. if test "$tst_proto_gethostbyname" = "yes"; then
  1546. AC_MSG_CHECKING([if gethostbyname is compilable])
  1547. AC_COMPILE_IFELSE([
  1548. AC_LANG_PROGRAM([[
  1549. $curl_includes_winsock2
  1550. $curl_includes_bsdsocket
  1551. $curl_includes_netdb
  1552. ]],[[
  1553. if(0 != gethostbyname(0))
  1554. return 1;
  1555. ]])
  1556. ],[
  1557. AC_MSG_RESULT([yes])
  1558. tst_compi_gethostbyname="yes"
  1559. ],[
  1560. AC_MSG_RESULT([no])
  1561. tst_compi_gethostbyname="no"
  1562. ])
  1563. fi
  1564. #
  1565. if test "$tst_compi_gethostbyname" = "yes"; then
  1566. AC_MSG_CHECKING([if gethostbyname usage allowed])
  1567. if test "x$curl_disallow_gethostbyname" != "xyes"; then
  1568. AC_MSG_RESULT([yes])
  1569. tst_allow_gethostbyname="yes"
  1570. else
  1571. AC_MSG_RESULT([no])
  1572. tst_allow_gethostbyname="no"
  1573. fi
  1574. fi
  1575. #
  1576. AC_MSG_CHECKING([if gethostbyname might be used])
  1577. if test "$tst_links_gethostbyname" = "yes" &&
  1578. test "$tst_proto_gethostbyname" = "yes" &&
  1579. test "$tst_compi_gethostbyname" = "yes" &&
  1580. test "$tst_allow_gethostbyname" = "yes"; then
  1581. AC_MSG_RESULT([yes])
  1582. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
  1583. [Define to 1 if you have the gethostbyname function.])
  1584. curl_cv_func_gethostbyname="yes"
  1585. else
  1586. AC_MSG_RESULT([no])
  1587. curl_cv_func_gethostbyname="no"
  1588. fi
  1589. ])
  1590. dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R
  1591. dnl -------------------------------------------------
  1592. dnl Verify if gethostbyname_r is available, prototyped,
  1593. dnl and can be compiled. If all of these are true, and
  1594. dnl usage has not been previously disallowed with
  1595. dnl shell variable curl_disallow_gethostbyname_r, then
  1596. dnl HAVE_GETHOSTBYNAME_R will be defined.
  1597. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [
  1598. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1599. #
  1600. tst_links_gethostbyname_r="unknown"
  1601. tst_proto_gethostbyname_r="unknown"
  1602. tst_compi_gethostbyname_r="unknown"
  1603. tst_allow_gethostbyname_r="unknown"
  1604. tst_nargs_gethostbyname_r="unknown"
  1605. #
  1606. AC_MSG_CHECKING([if gethostbyname_r can be linked])
  1607. AC_LINK_IFELSE([
  1608. AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
  1609. ],[
  1610. AC_MSG_RESULT([yes])
  1611. tst_links_gethostbyname_r="yes"
  1612. ],[
  1613. AC_MSG_RESULT([no])
  1614. tst_links_gethostbyname_r="no"
  1615. ])
  1616. #
  1617. if test "$tst_links_gethostbyname_r" = "yes"; then
  1618. AC_MSG_CHECKING([if gethostbyname_r is prototyped])
  1619. AC_EGREP_CPP([gethostbyname_r],[
  1620. $curl_includes_netdb
  1621. ],[
  1622. AC_MSG_RESULT([yes])
  1623. tst_proto_gethostbyname_r="yes"
  1624. ],[
  1625. AC_MSG_RESULT([no])
  1626. tst_proto_gethostbyname_r="no"
  1627. ])
  1628. fi
  1629. #
  1630. if test "$tst_proto_gethostbyname_r" = "yes"; then
  1631. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1632. AC_MSG_CHECKING([if gethostbyname_r takes 3 args.])
  1633. AC_COMPILE_IFELSE([
  1634. AC_LANG_PROGRAM([[
  1635. $curl_includes_netdb
  1636. $curl_includes_bsdsocket
  1637. ]],[[
  1638. if(0 != gethostbyname_r(0, 0, 0))
  1639. return 1;
  1640. ]])
  1641. ],[
  1642. AC_MSG_RESULT([yes])
  1643. tst_compi_gethostbyname_r="yes"
  1644. tst_nargs_gethostbyname_r="3"
  1645. ],[
  1646. AC_MSG_RESULT([no])
  1647. tst_compi_gethostbyname_r="no"
  1648. ])
  1649. fi
  1650. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1651. AC_MSG_CHECKING([if gethostbyname_r takes 5 args.])
  1652. AC_COMPILE_IFELSE([
  1653. AC_LANG_PROGRAM([[
  1654. $curl_includes_netdb
  1655. $curl_includes_bsdsocket
  1656. ]],[[
  1657. if(0 != gethostbyname_r(0, 0, 0, 0, 0))
  1658. return 1;
  1659. ]])
  1660. ],[
  1661. AC_MSG_RESULT([yes])
  1662. tst_compi_gethostbyname_r="yes"
  1663. tst_nargs_gethostbyname_r="5"
  1664. ],[
  1665. AC_MSG_RESULT([no])
  1666. tst_compi_gethostbyname_r="no"
  1667. ])
  1668. fi
  1669. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1670. AC_MSG_CHECKING([if gethostbyname_r takes 6 args.])
  1671. AC_COMPILE_IFELSE([
  1672. AC_LANG_PROGRAM([[
  1673. $curl_includes_netdb
  1674. $curl_includes_bsdsocket
  1675. ]],[[
  1676. if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0))
  1677. return 1;
  1678. ]])
  1679. ],[
  1680. AC_MSG_RESULT([yes])
  1681. tst_compi_gethostbyname_r="yes"
  1682. tst_nargs_gethostbyname_r="6"
  1683. ],[
  1684. AC_MSG_RESULT([no])
  1685. tst_compi_gethostbyname_r="no"
  1686. ])
  1687. fi
  1688. AC_MSG_CHECKING([if gethostbyname_r is compilable])
  1689. if test "$tst_compi_gethostbyname_r" = "yes"; then
  1690. AC_MSG_RESULT([yes])
  1691. else
  1692. AC_MSG_RESULT([no])
  1693. fi
  1694. fi
  1695. #
  1696. if test "$tst_compi_gethostbyname_r" = "yes"; then
  1697. AC_MSG_CHECKING([if gethostbyname_r usage allowed])
  1698. if test "x$curl_disallow_gethostbyname_r" != "xyes"; then
  1699. AC_MSG_RESULT([yes])
  1700. tst_allow_gethostbyname_r="yes"
  1701. else
  1702. AC_MSG_RESULT([no])
  1703. tst_allow_gethostbyname_r="no"
  1704. fi
  1705. fi
  1706. #
  1707. AC_MSG_CHECKING([if gethostbyname_r might be used])
  1708. if test "$tst_links_gethostbyname_r" = "yes" &&
  1709. test "$tst_proto_gethostbyname_r" = "yes" &&
  1710. test "$tst_compi_gethostbyname_r" = "yes" &&
  1711. test "$tst_allow_gethostbyname_r" = "yes"; then
  1712. AC_MSG_RESULT([yes])
  1713. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
  1714. [Define to 1 if you have the gethostbyname_r function.])
  1715. dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r,
  1716. dnl [Specifies the number of arguments to gethostbyname_r])
  1717. #
  1718. if test "$tst_nargs_gethostbyname_r" -eq "3"; then
  1719. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
  1720. elif test "$tst_nargs_gethostbyname_r" -eq "5"; then
  1721. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
  1722. elif test "$tst_nargs_gethostbyname_r" -eq "6"; then
  1723. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
  1724. fi
  1725. #
  1726. curl_cv_func_gethostbyname_r="yes"
  1727. else
  1728. AC_MSG_RESULT([no])
  1729. curl_cv_func_gethostbyname_r="no"
  1730. fi
  1731. ])
  1732. dnl CURL_CHECK_FUNC_GETHOSTNAME
  1733. dnl -------------------------------------------------
  1734. dnl Verify if gethostname is available, prototyped, and
  1735. dnl can be compiled. If all of these are true, and
  1736. dnl usage has not been previously disallowed with
  1737. dnl shell variable curl_disallow_gethostname, then
  1738. dnl HAVE_GETHOSTNAME will be defined.
  1739. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
  1740. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1741. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1742. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1743. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1744. #
  1745. tst_links_gethostname="unknown"
  1746. tst_proto_gethostname="unknown"
  1747. tst_compi_gethostname="unknown"
  1748. tst_allow_gethostname="unknown"
  1749. #
  1750. AC_MSG_CHECKING([if gethostname can be linked])
  1751. AC_LINK_IFELSE([
  1752. AC_LANG_PROGRAM([[
  1753. $curl_includes_winsock2
  1754. $curl_includes_unistd
  1755. $curl_includes_bsdsocket
  1756. ]],[[
  1757. if(0 != gethostname(0, 0))
  1758. return 1;
  1759. ]])
  1760. ],[
  1761. AC_MSG_RESULT([yes])
  1762. tst_links_gethostname="yes"
  1763. ],[
  1764. AC_MSG_RESULT([no])
  1765. tst_links_gethostname="no"
  1766. ])
  1767. #
  1768. if test "$tst_links_gethostname" = "yes"; then
  1769. AC_MSG_CHECKING([if gethostname is prototyped])
  1770. AC_EGREP_CPP([gethostname],[
  1771. $curl_includes_winsock2
  1772. $curl_includes_unistd
  1773. $curl_includes_bsdsocket
  1774. ],[
  1775. AC_MSG_RESULT([yes])
  1776. tst_proto_gethostname="yes"
  1777. ],[
  1778. AC_MSG_RESULT([no])
  1779. tst_proto_gethostname="no"
  1780. ])
  1781. fi
  1782. #
  1783. if test "$tst_proto_gethostname" = "yes"; then
  1784. AC_MSG_CHECKING([if gethostname is compilable])
  1785. AC_COMPILE_IFELSE([
  1786. AC_LANG_PROGRAM([[
  1787. $curl_includes_winsock2
  1788. $curl_includes_unistd
  1789. $curl_includes_bsdsocket
  1790. ]],[[
  1791. if(0 != gethostname(0, 0))
  1792. return 1;
  1793. ]])
  1794. ],[
  1795. AC_MSG_RESULT([yes])
  1796. tst_compi_gethostname="yes"
  1797. ],[
  1798. AC_MSG_RESULT([no])
  1799. tst_compi_gethostname="no"
  1800. ])
  1801. fi
  1802. #
  1803. if test "$tst_compi_gethostname" = "yes"; then
  1804. AC_MSG_CHECKING([for gethostname arg 2 data type])
  1805. tst_gethostname_type_arg2="unknown"
  1806. for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do
  1807. for tst_arg2 in 'int' 'unsigned int' 'size_t'; do
  1808. if test "$tst_gethostname_type_arg2" = "unknown"; then
  1809. AC_COMPILE_IFELSE([
  1810. AC_LANG_PROGRAM([[
  1811. $curl_includes_winsock2
  1812. $curl_includes_unistd
  1813. $curl_includes_bsdsocket
  1814. $curl_preprocess_callconv
  1815. extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
  1816. ]],[[
  1817. if(0 != gethostname(0, 0))
  1818. return 1;
  1819. ]])
  1820. ],[
  1821. tst_gethostname_type_arg2="$tst_arg2"
  1822. ])
  1823. fi
  1824. done
  1825. done
  1826. AC_MSG_RESULT([$tst_gethostname_type_arg2])
  1827. if test "$tst_gethostname_type_arg2" != "unknown"; then
  1828. AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2,
  1829. [Define to the type of arg 2 for gethostname.])
  1830. fi
  1831. fi
  1832. #
  1833. if test "$tst_compi_gethostname" = "yes"; then
  1834. AC_MSG_CHECKING([if gethostname usage allowed])
  1835. if test "x$curl_disallow_gethostname" != "xyes"; then
  1836. AC_MSG_RESULT([yes])
  1837. tst_allow_gethostname="yes"
  1838. else
  1839. AC_MSG_RESULT([no])
  1840. tst_allow_gethostname="no"
  1841. fi
  1842. fi
  1843. #
  1844. AC_MSG_CHECKING([if gethostname might be used])
  1845. if test "$tst_links_gethostname" = "yes" &&
  1846. test "$tst_proto_gethostname" = "yes" &&
  1847. test "$tst_compi_gethostname" = "yes" &&
  1848. test "$tst_allow_gethostname" = "yes"; then
  1849. AC_MSG_RESULT([yes])
  1850. AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
  1851. [Define to 1 if you have the gethostname function.])
  1852. curl_cv_func_gethostname="yes"
  1853. else
  1854. AC_MSG_RESULT([no])
  1855. curl_cv_func_gethostname="no"
  1856. fi
  1857. ])
  1858. dnl CURL_CHECK_FUNC_GETPEERNAME
  1859. dnl -------------------------------------------------
  1860. dnl Verify if getpeername is available, prototyped, and
  1861. dnl can be compiled. If all of these are true, and
  1862. dnl usage has not been previously disallowed with
  1863. dnl shell variable curl_disallow_getpeername, then
  1864. dnl HAVE_GETPEERNAME will be defined.
  1865. AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [
  1866. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1867. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1868. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1869. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1870. #
  1871. tst_links_getpeername="unknown"
  1872. tst_proto_getpeername="unknown"
  1873. tst_compi_getpeername="unknown"
  1874. tst_allow_getpeername="unknown"
  1875. #
  1876. AC_MSG_CHECKING([if getpeername can be linked])
  1877. AC_LINK_IFELSE([
  1878. AC_LANG_PROGRAM([[
  1879. $curl_includes_winsock2
  1880. $curl_includes_bsdsocket
  1881. $curl_includes_sys_socket
  1882. ]],[[
  1883. if(0 != getpeername(0, (void *)0, (void *)0))
  1884. return 1;
  1885. ]])
  1886. ],[
  1887. AC_MSG_RESULT([yes])
  1888. tst_links_getpeername="yes"
  1889. ],[
  1890. AC_MSG_RESULT([no])
  1891. tst_links_getpeername="no"
  1892. ])
  1893. #
  1894. if test "$tst_links_getpeername" = "yes"; then
  1895. AC_MSG_CHECKING([if getpeername is prototyped])
  1896. AC_EGREP_CPP([getpeername],[
  1897. $curl_includes_winsock2
  1898. $curl_includes_bsdsocket
  1899. $curl_includes_sys_socket
  1900. ],[
  1901. AC_MSG_RESULT([yes])
  1902. tst_proto_getpeername="yes"
  1903. ],[
  1904. AC_MSG_RESULT([no])
  1905. tst_proto_getpeername="no"
  1906. ])
  1907. fi
  1908. #
  1909. if test "$tst_proto_getpeername" = "yes"; then
  1910. AC_MSG_CHECKING([if getpeername is compilable])
  1911. AC_COMPILE_IFELSE([
  1912. AC_LANG_PROGRAM([[
  1913. $curl_includes_winsock2
  1914. $curl_includes_bsdsocket
  1915. $curl_includes_sys_socket
  1916. ]],[[
  1917. if(0 != getpeername(0, (void *)0, (void *)0))
  1918. return 1;
  1919. ]])
  1920. ],[
  1921. AC_MSG_RESULT([yes])
  1922. tst_compi_getpeername="yes"
  1923. ],[
  1924. AC_MSG_RESULT([no])
  1925. tst_compi_getpeername="no"
  1926. ])
  1927. fi
  1928. #
  1929. if test "$tst_compi_getpeername" = "yes"; then
  1930. AC_MSG_CHECKING([if getpeername usage allowed])
  1931. if test "x$curl_disallow_getpeername" != "xyes"; then
  1932. AC_MSG_RESULT([yes])
  1933. tst_allow_getpeername="yes"
  1934. else
  1935. AC_MSG_RESULT([no])
  1936. tst_allow_getpeername="no"
  1937. fi
  1938. fi
  1939. #
  1940. AC_MSG_CHECKING([if getpeername might be used])
  1941. if test "$tst_links_getpeername" = "yes" &&
  1942. test "$tst_proto_getpeername" = "yes" &&
  1943. test "$tst_compi_getpeername" = "yes" &&
  1944. test "$tst_allow_getpeername" = "yes"; then
  1945. AC_MSG_RESULT([yes])
  1946. AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1,
  1947. [Define to 1 if you have the getpeername function.])
  1948. curl_cv_func_getpeername="yes"
  1949. else
  1950. AC_MSG_RESULT([no])
  1951. curl_cv_func_getpeername="no"
  1952. fi
  1953. ])
  1954. dnl CURL_CHECK_FUNC_GETSOCKNAME
  1955. dnl -------------------------------------------------
  1956. dnl Verify if getsockname is available, prototyped, and
  1957. dnl can be compiled. If all of these are true, and
  1958. dnl usage has not been previously disallowed with
  1959. dnl shell variable curl_disallow_getsockname, then
  1960. dnl HAVE_GETSOCKNAME will be defined.
  1961. AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [
  1962. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1963. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1964. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1965. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1966. #
  1967. tst_links_getsockname="unknown"
  1968. tst_proto_getsockname="unknown"
  1969. tst_compi_getsockname="unknown"
  1970. tst_allow_getsockname="unknown"
  1971. #
  1972. AC_MSG_CHECKING([if getsockname can be linked])
  1973. AC_LINK_IFELSE([
  1974. AC_LANG_PROGRAM([[
  1975. $curl_includes_winsock2
  1976. $curl_includes_bsdsocket
  1977. $curl_includes_sys_socket
  1978. ]],[[
  1979. if(0 != getsockname(0, (void *)0, (void *)0))
  1980. return 1;
  1981. ]])
  1982. ],[
  1983. AC_MSG_RESULT([yes])
  1984. tst_links_getsockname="yes"
  1985. ],[
  1986. AC_MSG_RESULT([no])
  1987. tst_links_getsockname="no"
  1988. ])
  1989. #
  1990. if test "$tst_links_getsockname" = "yes"; then
  1991. AC_MSG_CHECKING([if getsockname is prototyped])
  1992. AC_EGREP_CPP([getsockname],[
  1993. $curl_includes_winsock2
  1994. $curl_includes_bsdsocket
  1995. $curl_includes_sys_socket
  1996. ],[
  1997. AC_MSG_RESULT([yes])
  1998. tst_proto_getsockname="yes"
  1999. ],[
  2000. AC_MSG_RESULT([no])
  2001. tst_proto_getsockname="no"
  2002. ])
  2003. fi
  2004. #
  2005. if test "$tst_proto_getsockname" = "yes"; then
  2006. AC_MSG_CHECKING([if getsockname is compilable])
  2007. AC_COMPILE_IFELSE([
  2008. AC_LANG_PROGRAM([[
  2009. $curl_includes_winsock2
  2010. $curl_includes_bsdsocket
  2011. $curl_includes_sys_socket
  2012. ]],[[
  2013. if(0 != getsockname(0, (void *)0, (void *)0))
  2014. return 1;
  2015. ]])
  2016. ],[
  2017. AC_MSG_RESULT([yes])
  2018. tst_compi_getsockname="yes"
  2019. ],[
  2020. AC_MSG_RESULT([no])
  2021. tst_compi_getsockname="no"
  2022. ])
  2023. fi
  2024. #
  2025. if test "$tst_compi_getsockname" = "yes"; then
  2026. AC_MSG_CHECKING([if getsockname usage allowed])
  2027. if test "x$curl_disallow_getsockname" != "xyes"; then
  2028. AC_MSG_RESULT([yes])
  2029. tst_allow_getsockname="yes"
  2030. else
  2031. AC_MSG_RESULT([no])
  2032. tst_allow_getsockname="no"
  2033. fi
  2034. fi
  2035. #
  2036. AC_MSG_CHECKING([if getsockname might be used])
  2037. if test "$tst_links_getsockname" = "yes" &&
  2038. test "$tst_proto_getsockname" = "yes" &&
  2039. test "$tst_compi_getsockname" = "yes" &&
  2040. test "$tst_allow_getsockname" = "yes"; then
  2041. AC_MSG_RESULT([yes])
  2042. AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1,
  2043. [Define to 1 if you have the getsockname function.])
  2044. curl_cv_func_getsockname="yes"
  2045. else
  2046. AC_MSG_RESULT([no])
  2047. curl_cv_func_getsockname="no"
  2048. fi
  2049. ])
  2050. dnl CURL_CHECK_FUNC_IF_NAMETOINDEX
  2051. dnl -------------------------------------------------
  2052. dnl Verify if if_nametoindex is available, prototyped, and
  2053. dnl can be compiled. If all of these are true, and
  2054. dnl usage has not been previously disallowed with
  2055. dnl shell variable curl_disallow_if_nametoindex, then
  2056. dnl HAVE_IF_NAMETOINDEX will be defined.
  2057. AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
  2058. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2059. AC_REQUIRE([CURL_INCLUDES_NETIF])dnl
  2060. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2061. #
  2062. tst_links_if_nametoindex="unknown"
  2063. tst_proto_if_nametoindex="unknown"
  2064. tst_compi_if_nametoindex="unknown"
  2065. tst_allow_if_nametoindex="unknown"
  2066. #
  2067. AC_MSG_CHECKING([if if_nametoindex can be linked])
  2068. AC_LINK_IFELSE([
  2069. AC_LANG_PROGRAM([[
  2070. $curl_includes_winsock2
  2071. $curl_includes_bsdsocket
  2072. #include <net/if.h>
  2073. ]],[[
  2074. if(0 != if_nametoindex(""))
  2075. return 1;
  2076. ]])
  2077. ],[
  2078. AC_MSG_RESULT([yes])
  2079. tst_links_if_nametoindex="yes"
  2080. ],[
  2081. AC_MSG_RESULT([no])
  2082. tst_links_if_nametoindex="no"
  2083. ])
  2084. #
  2085. if test "$tst_links_if_nametoindex" = "yes"; then
  2086. AC_MSG_CHECKING([if if_nametoindex is prototyped])
  2087. AC_EGREP_CPP([if_nametoindex],[
  2088. $curl_includes_winsock2
  2089. $curl_includes_netif
  2090. ],[
  2091. AC_MSG_RESULT([yes])
  2092. tst_proto_if_nametoindex="yes"
  2093. ],[
  2094. AC_MSG_RESULT([no])
  2095. tst_proto_if_nametoindex="no"
  2096. ])
  2097. fi
  2098. #
  2099. if test "$tst_proto_if_nametoindex" = "yes"; then
  2100. AC_MSG_CHECKING([if if_nametoindex is compilable])
  2101. AC_COMPILE_IFELSE([
  2102. AC_LANG_PROGRAM([[
  2103. $curl_includes_winsock2
  2104. $curl_includes_netif
  2105. ]],[[
  2106. if(0 != if_nametoindex(""))
  2107. return 1;
  2108. ]])
  2109. ],[
  2110. AC_MSG_RESULT([yes])
  2111. tst_compi_if_nametoindex="yes"
  2112. ],[
  2113. AC_MSG_RESULT([no])
  2114. tst_compi_if_nametoindex="no"
  2115. ])
  2116. fi
  2117. #
  2118. if test "$tst_compi_if_nametoindex" = "yes"; then
  2119. AC_MSG_CHECKING([if if_nametoindex usage allowed])
  2120. if test "x$curl_disallow_if_nametoindex" != "xyes"; then
  2121. AC_MSG_RESULT([yes])
  2122. tst_allow_if_nametoindex="yes"
  2123. else
  2124. AC_MSG_RESULT([no])
  2125. tst_allow_if_nametoindex="no"
  2126. fi
  2127. fi
  2128. #
  2129. AC_MSG_CHECKING([if if_nametoindex might be used])
  2130. if test "$tst_links_if_nametoindex" = "yes" &&
  2131. test "$tst_proto_if_nametoindex" = "yes" &&
  2132. test "$tst_compi_if_nametoindex" = "yes" &&
  2133. test "$tst_allow_if_nametoindex" = "yes"; then
  2134. AC_MSG_RESULT([yes])
  2135. AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1,
  2136. [Define to 1 if you have the if_nametoindex function.])
  2137. curl_cv_func_if_nametoindex="yes"
  2138. else
  2139. AC_MSG_RESULT([no])
  2140. curl_cv_func_if_nametoindex="no"
  2141. fi
  2142. ])
  2143. dnl CURL_CHECK_FUNC_GETIFADDRS
  2144. dnl -------------------------------------------------
  2145. dnl Verify if getifaddrs is available, prototyped, can
  2146. dnl be compiled and seems to work. If all of these are
  2147. dnl true, and usage has not been previously disallowed
  2148. dnl with shell variable curl_disallow_getifaddrs, then
  2149. dnl HAVE_GETIFADDRS will be defined.
  2150. AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
  2151. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2152. AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl
  2153. #
  2154. tst_links_getifaddrs="unknown"
  2155. tst_proto_getifaddrs="unknown"
  2156. tst_compi_getifaddrs="unknown"
  2157. tst_works_getifaddrs="unknown"
  2158. tst_allow_getifaddrs="unknown"
  2159. #
  2160. AC_MSG_CHECKING([if getifaddrs can be linked])
  2161. AC_LINK_IFELSE([
  2162. AC_LANG_FUNC_LINK_TRY([getifaddrs])
  2163. ],[
  2164. AC_MSG_RESULT([yes])
  2165. tst_links_getifaddrs="yes"
  2166. ],[
  2167. AC_MSG_RESULT([no])
  2168. tst_links_getifaddrs="no"
  2169. ])
  2170. #
  2171. if test "$tst_links_getifaddrs" = "yes"; then
  2172. AC_MSG_CHECKING([if getifaddrs is prototyped])
  2173. AC_EGREP_CPP([getifaddrs],[
  2174. $curl_includes_ifaddrs
  2175. ],[
  2176. AC_MSG_RESULT([yes])
  2177. tst_proto_getifaddrs="yes"
  2178. ],[
  2179. AC_MSG_RESULT([no])
  2180. tst_proto_getifaddrs="no"
  2181. ])
  2182. fi
  2183. #
  2184. if test "$tst_proto_getifaddrs" = "yes"; then
  2185. AC_MSG_CHECKING([if getifaddrs is compilable])
  2186. AC_COMPILE_IFELSE([
  2187. AC_LANG_PROGRAM([[
  2188. $curl_includes_ifaddrs
  2189. ]],[[
  2190. if(0 != getifaddrs(0))
  2191. return 1;
  2192. ]])
  2193. ],[
  2194. AC_MSG_RESULT([yes])
  2195. tst_compi_getifaddrs="yes"
  2196. ],[
  2197. AC_MSG_RESULT([no])
  2198. tst_compi_getifaddrs="no"
  2199. ])
  2200. fi
  2201. #
  2202. dnl only do runtime verification when not cross-compiling
  2203. if test "x$cross_compiling" != "xyes" &&
  2204. test "$tst_compi_getifaddrs" = "yes"; then
  2205. AC_MSG_CHECKING([if getifaddrs seems to work])
  2206. CURL_RUN_IFELSE([
  2207. AC_LANG_PROGRAM([[
  2208. $curl_includes_stdlib
  2209. $curl_includes_ifaddrs
  2210. ]],[[
  2211. struct ifaddrs *ifa = 0;
  2212. int error;
  2213. error = getifaddrs(&ifa);
  2214. if(error || !ifa)
  2215. exit(1); /* fail */
  2216. else
  2217. exit(0);
  2218. ]])
  2219. ],[
  2220. AC_MSG_RESULT([yes])
  2221. tst_works_getifaddrs="yes"
  2222. ],[
  2223. AC_MSG_RESULT([no])
  2224. tst_works_getifaddrs="no"
  2225. ])
  2226. fi
  2227. #
  2228. if test "$tst_compi_getifaddrs" = "yes" &&
  2229. test "$tst_works_getifaddrs" != "no"; then
  2230. AC_MSG_CHECKING([if getifaddrs usage allowed])
  2231. if test "x$curl_disallow_getifaddrs" != "xyes"; then
  2232. AC_MSG_RESULT([yes])
  2233. tst_allow_getifaddrs="yes"
  2234. else
  2235. AC_MSG_RESULT([no])
  2236. tst_allow_getifaddrs="no"
  2237. fi
  2238. fi
  2239. #
  2240. AC_MSG_CHECKING([if getifaddrs might be used])
  2241. if test "$tst_links_getifaddrs" = "yes" &&
  2242. test "$tst_proto_getifaddrs" = "yes" &&
  2243. test "$tst_compi_getifaddrs" = "yes" &&
  2244. test "$tst_allow_getifaddrs" = "yes" &&
  2245. test "$tst_works_getifaddrs" != "no"; then
  2246. AC_MSG_RESULT([yes])
  2247. AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1,
  2248. [Define to 1 if you have a working getifaddrs function.])
  2249. curl_cv_func_getifaddrs="yes"
  2250. else
  2251. AC_MSG_RESULT([no])
  2252. curl_cv_func_getifaddrs="no"
  2253. fi
  2254. ])
  2255. dnl CURL_CHECK_FUNC_GMTIME_R
  2256. dnl -------------------------------------------------
  2257. dnl Verify if gmtime_r is available, prototyped, can
  2258. dnl be compiled and seems to work. If all of these are
  2259. dnl true, and usage has not been previously disallowed
  2260. dnl with shell variable curl_disallow_gmtime_r, then
  2261. dnl HAVE_GMTIME_R will be defined.
  2262. AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
  2263. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2264. AC_REQUIRE([CURL_INCLUDES_TIME])dnl
  2265. #
  2266. tst_links_gmtime_r="unknown"
  2267. tst_proto_gmtime_r="unknown"
  2268. tst_compi_gmtime_r="unknown"
  2269. tst_works_gmtime_r="unknown"
  2270. tst_allow_gmtime_r="unknown"
  2271. #
  2272. AC_MSG_CHECKING([if gmtime_r can be linked])
  2273. AC_LINK_IFELSE([
  2274. AC_LANG_FUNC_LINK_TRY([gmtime_r])
  2275. ],[
  2276. AC_MSG_RESULT([yes])
  2277. tst_links_gmtime_r="yes"
  2278. ],[
  2279. AC_MSG_RESULT([no])
  2280. tst_links_gmtime_r="no"
  2281. ])
  2282. #
  2283. if test "$tst_links_gmtime_r" = "yes"; then
  2284. AC_MSG_CHECKING([if gmtime_r is prototyped])
  2285. AC_EGREP_CPP([gmtime_r],[
  2286. $curl_includes_time
  2287. ],[
  2288. AC_MSG_RESULT([yes])
  2289. tst_proto_gmtime_r="yes"
  2290. ],[
  2291. AC_MSG_RESULT([no])
  2292. tst_proto_gmtime_r="no"
  2293. ])
  2294. fi
  2295. #
  2296. if test "$tst_proto_gmtime_r" = "yes"; then
  2297. AC_MSG_CHECKING([if gmtime_r is compilable])
  2298. AC_COMPILE_IFELSE([
  2299. AC_LANG_PROGRAM([[
  2300. $curl_includes_time
  2301. ]],[[
  2302. if(0 != gmtime_r(0, 0))
  2303. return 1;
  2304. ]])
  2305. ],[
  2306. AC_MSG_RESULT([yes])
  2307. tst_compi_gmtime_r="yes"
  2308. ],[
  2309. AC_MSG_RESULT([no])
  2310. tst_compi_gmtime_r="no"
  2311. ])
  2312. fi
  2313. #
  2314. dnl only do runtime verification when not cross-compiling
  2315. if test "x$cross_compiling" != "xyes" &&
  2316. test "$tst_compi_gmtime_r" = "yes"; then
  2317. AC_MSG_CHECKING([if gmtime_r seems to work])
  2318. CURL_RUN_IFELSE([
  2319. AC_LANG_PROGRAM([[
  2320. $curl_includes_stdlib
  2321. $curl_includes_time
  2322. ]],[[
  2323. time_t local = 1170352587;
  2324. struct tm *gmt = 0;
  2325. struct tm result;
  2326. gmt = gmtime_r(&local, &result);
  2327. if(gmt)
  2328. exit(0);
  2329. else
  2330. exit(1);
  2331. ]])
  2332. ],[
  2333. AC_MSG_RESULT([yes])
  2334. tst_works_gmtime_r="yes"
  2335. ],[
  2336. AC_MSG_RESULT([no])
  2337. tst_works_gmtime_r="no"
  2338. ])
  2339. fi
  2340. #
  2341. if test "$tst_compi_gmtime_r" = "yes" &&
  2342. test "$tst_works_gmtime_r" != "no"; then
  2343. AC_MSG_CHECKING([if gmtime_r usage allowed])
  2344. if test "x$curl_disallow_gmtime_r" != "xyes"; then
  2345. AC_MSG_RESULT([yes])
  2346. tst_allow_gmtime_r="yes"
  2347. else
  2348. AC_MSG_RESULT([no])
  2349. tst_allow_gmtime_r="no"
  2350. fi
  2351. fi
  2352. #
  2353. AC_MSG_CHECKING([if gmtime_r might be used])
  2354. if test "$tst_links_gmtime_r" = "yes" &&
  2355. test "$tst_proto_gmtime_r" = "yes" &&
  2356. test "$tst_compi_gmtime_r" = "yes" &&
  2357. test "$tst_allow_gmtime_r" = "yes" &&
  2358. test "$tst_works_gmtime_r" != "no"; then
  2359. AC_MSG_RESULT([yes])
  2360. AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
  2361. [Define to 1 if you have a working gmtime_r function.])
  2362. curl_cv_func_gmtime_r="yes"
  2363. else
  2364. AC_MSG_RESULT([no])
  2365. curl_cv_func_gmtime_r="no"
  2366. fi
  2367. ])
  2368. dnl CURL_CHECK_FUNC_INET_NTOP
  2369. dnl -------------------------------------------------
  2370. dnl Verify if inet_ntop is available, prototyped, can
  2371. dnl be compiled and seems to work. If all of these are
  2372. dnl true, and usage has not been previously disallowed
  2373. dnl with shell variable curl_disallow_inet_ntop, then
  2374. dnl HAVE_INET_NTOP will be defined.
  2375. AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
  2376. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2377. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  2378. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  2379. #
  2380. tst_links_inet_ntop="unknown"
  2381. tst_proto_inet_ntop="unknown"
  2382. tst_compi_inet_ntop="unknown"
  2383. tst_works_inet_ntop="unknown"
  2384. tst_allow_inet_ntop="unknown"
  2385. #
  2386. AC_MSG_CHECKING([if inet_ntop can be linked])
  2387. AC_LINK_IFELSE([
  2388. AC_LANG_FUNC_LINK_TRY([inet_ntop])
  2389. ],[
  2390. AC_MSG_RESULT([yes])
  2391. tst_links_inet_ntop="yes"
  2392. ],[
  2393. AC_MSG_RESULT([no])
  2394. tst_links_inet_ntop="no"
  2395. ])
  2396. #
  2397. if test "$tst_links_inet_ntop" = "yes"; then
  2398. AC_MSG_CHECKING([if inet_ntop is prototyped])
  2399. AC_EGREP_CPP([inet_ntop],[
  2400. $curl_includes_arpa_inet
  2401. ],[
  2402. AC_MSG_RESULT([yes])
  2403. tst_proto_inet_ntop="yes"
  2404. ],[
  2405. AC_MSG_RESULT([no])
  2406. tst_proto_inet_ntop="no"
  2407. ])
  2408. fi
  2409. #
  2410. if test "$tst_proto_inet_ntop" = "yes"; then
  2411. AC_MSG_CHECKING([if inet_ntop is compilable])
  2412. AC_COMPILE_IFELSE([
  2413. AC_LANG_PROGRAM([[
  2414. $curl_includes_arpa_inet
  2415. ]],[[
  2416. if(0 != inet_ntop(0, 0, 0, 0))
  2417. return 1;
  2418. ]])
  2419. ],[
  2420. AC_MSG_RESULT([yes])
  2421. tst_compi_inet_ntop="yes"
  2422. ],[
  2423. AC_MSG_RESULT([no])
  2424. tst_compi_inet_ntop="no"
  2425. ])
  2426. fi
  2427. #
  2428. dnl only do runtime verification when not cross-compiling
  2429. if test "x$cross_compiling" != "xyes" &&
  2430. test "$tst_compi_inet_ntop" = "yes"; then
  2431. AC_MSG_CHECKING([if inet_ntop seems to work])
  2432. CURL_RUN_IFELSE([
  2433. AC_LANG_PROGRAM([[
  2434. $curl_includes_stdlib
  2435. $curl_includes_arpa_inet
  2436. $curl_includes_string
  2437. ]],[[
  2438. char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
  2439. char ipv4res[sizeof "255.255.255.255"];
  2440. unsigned char ipv6a[26];
  2441. unsigned char ipv4a[5];
  2442. char *ipv6ptr = 0;
  2443. char *ipv4ptr = 0;
  2444. /* - */
  2445. ipv4res[0] = '\0';
  2446. ipv4a[0] = 0xc0;
  2447. ipv4a[1] = 0xa8;
  2448. ipv4a[2] = 0x64;
  2449. ipv4a[3] = 0x01;
  2450. ipv4a[4] = 0x01;
  2451. /* - */
  2452. ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
  2453. if(!ipv4ptr)
  2454. exit(1); /* fail */
  2455. if(ipv4ptr != ipv4res)
  2456. exit(1); /* fail */
  2457. if(!ipv4ptr[0])
  2458. exit(1); /* fail */
  2459. if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
  2460. exit(1); /* fail */
  2461. /* - */
  2462. ipv6res[0] = '\0';
  2463. memset(ipv6a, 0, sizeof(ipv6a));
  2464. ipv6a[0] = 0xfe;
  2465. ipv6a[1] = 0x80;
  2466. ipv6a[8] = 0x02;
  2467. ipv6a[9] = 0x14;
  2468. ipv6a[10] = 0x4f;
  2469. ipv6a[11] = 0xff;
  2470. ipv6a[12] = 0xfe;
  2471. ipv6a[13] = 0x0b;
  2472. ipv6a[14] = 0x76;
  2473. ipv6a[15] = 0xc8;
  2474. ipv6a[25] = 0x01;
  2475. /* - */
  2476. ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
  2477. if(!ipv6ptr)
  2478. exit(1); /* fail */
  2479. if(ipv6ptr != ipv6res)
  2480. exit(1); /* fail */
  2481. if(!ipv6ptr[0])
  2482. exit(1); /* fail */
  2483. if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
  2484. exit(1); /* fail */
  2485. /* - */
  2486. exit(0);
  2487. ]])
  2488. ],[
  2489. AC_MSG_RESULT([yes])
  2490. tst_works_inet_ntop="yes"
  2491. ],[
  2492. AC_MSG_RESULT([no])
  2493. tst_works_inet_ntop="no"
  2494. ])
  2495. fi
  2496. #
  2497. if test "$tst_compi_inet_ntop" = "yes" &&
  2498. test "$tst_works_inet_ntop" != "no"; then
  2499. AC_MSG_CHECKING([if inet_ntop usage allowed])
  2500. if test "x$curl_disallow_inet_ntop" != "xyes"; then
  2501. AC_MSG_RESULT([yes])
  2502. tst_allow_inet_ntop="yes"
  2503. else
  2504. AC_MSG_RESULT([no])
  2505. tst_allow_inet_ntop="no"
  2506. fi
  2507. fi
  2508. #
  2509. AC_MSG_CHECKING([if inet_ntop might be used])
  2510. if test "$tst_links_inet_ntop" = "yes" &&
  2511. test "$tst_proto_inet_ntop" = "yes" &&
  2512. test "$tst_compi_inet_ntop" = "yes" &&
  2513. test "$tst_allow_inet_ntop" = "yes" &&
  2514. test "$tst_works_inet_ntop" != "no"; then
  2515. AC_MSG_RESULT([yes])
  2516. AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
  2517. [Define to 1 if you have a IPv6 capable working inet_ntop function.])
  2518. curl_cv_func_inet_ntop="yes"
  2519. else
  2520. AC_MSG_RESULT([no])
  2521. curl_cv_func_inet_ntop="no"
  2522. fi
  2523. ])
  2524. dnl CURL_CHECK_FUNC_INET_PTON
  2525. dnl -------------------------------------------------
  2526. dnl Verify if inet_pton is available, prototyped, can
  2527. dnl be compiled and seems to work. If all of these are
  2528. dnl true, and usage has not been previously disallowed
  2529. dnl with shell variable curl_disallow_inet_pton, then
  2530. dnl HAVE_INET_PTON will be defined.
  2531. AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
  2532. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2533. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  2534. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  2535. #
  2536. tst_links_inet_pton="unknown"
  2537. tst_proto_inet_pton="unknown"
  2538. tst_compi_inet_pton="unknown"
  2539. tst_works_inet_pton="unknown"
  2540. tst_allow_inet_pton="unknown"
  2541. #
  2542. AC_MSG_CHECKING([if inet_pton can be linked])
  2543. AC_LINK_IFELSE([
  2544. AC_LANG_FUNC_LINK_TRY([inet_pton])
  2545. ],[
  2546. AC_MSG_RESULT([yes])
  2547. tst_links_inet_pton="yes"
  2548. ],[
  2549. AC_MSG_RESULT([no])
  2550. tst_links_inet_pton="no"
  2551. ])
  2552. #
  2553. if test "$tst_links_inet_pton" = "yes"; then
  2554. AC_MSG_CHECKING([if inet_pton is prototyped])
  2555. AC_EGREP_CPP([inet_pton],[
  2556. $curl_includes_arpa_inet
  2557. ],[
  2558. AC_MSG_RESULT([yes])
  2559. tst_proto_inet_pton="yes"
  2560. ],[
  2561. AC_MSG_RESULT([no])
  2562. tst_proto_inet_pton="no"
  2563. ])
  2564. fi
  2565. #
  2566. if test "$tst_proto_inet_pton" = "yes"; then
  2567. AC_MSG_CHECKING([if inet_pton is compilable])
  2568. AC_COMPILE_IFELSE([
  2569. AC_LANG_PROGRAM([[
  2570. $curl_includes_arpa_inet
  2571. ]],[[
  2572. if(0 != inet_pton(0, 0, 0))
  2573. return 1;
  2574. ]])
  2575. ],[
  2576. AC_MSG_RESULT([yes])
  2577. tst_compi_inet_pton="yes"
  2578. ],[
  2579. AC_MSG_RESULT([no])
  2580. tst_compi_inet_pton="no"
  2581. ])
  2582. fi
  2583. #
  2584. dnl only do runtime verification when not cross-compiling
  2585. if test "x$cross_compiling" != "xyes" &&
  2586. test "$tst_compi_inet_pton" = "yes"; then
  2587. AC_MSG_CHECKING([if inet_pton seems to work])
  2588. CURL_RUN_IFELSE([
  2589. AC_LANG_PROGRAM([[
  2590. $curl_includes_stdlib
  2591. $curl_includes_arpa_inet
  2592. $curl_includes_string
  2593. ]],[[
  2594. unsigned char ipv6a[16+1];
  2595. unsigned char ipv4a[4+1];
  2596. const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
  2597. const char *ipv4src = "192.168.100.1";
  2598. /* - */
  2599. memset(ipv4a, 1, sizeof(ipv4a));
  2600. if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
  2601. exit(1); /* fail */
  2602. /* - */
  2603. if( (ipv4a[0] != 0xc0) ||
  2604. (ipv4a[1] != 0xa8) ||
  2605. (ipv4a[2] != 0x64) ||
  2606. (ipv4a[3] != 0x01) ||
  2607. (ipv4a[4] != 0x01) )
  2608. exit(1); /* fail */
  2609. /* - */
  2610. memset(ipv6a, 1, sizeof(ipv6a));
  2611. if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
  2612. exit(1); /* fail */
  2613. /* - */
  2614. if( (ipv6a[0] != 0xfe) ||
  2615. (ipv6a[1] != 0x80) ||
  2616. (ipv6a[8] != 0x02) ||
  2617. (ipv6a[9] != 0x14) ||
  2618. (ipv6a[10] != 0x4f) ||
  2619. (ipv6a[11] != 0xff) ||
  2620. (ipv6a[12] != 0xfe) ||
  2621. (ipv6a[13] != 0x0b) ||
  2622. (ipv6a[14] != 0x76) ||
  2623. (ipv6a[15] != 0xc8) ||
  2624. (ipv6a[16] != 0x01) )
  2625. exit(1); /* fail */
  2626. /* - */
  2627. if( (ipv6a[2] != 0x0) ||
  2628. (ipv6a[3] != 0x0) ||
  2629. (ipv6a[4] != 0x0) ||
  2630. (ipv6a[5] != 0x0) ||
  2631. (ipv6a[6] != 0x0) ||
  2632. (ipv6a[7] != 0x0) )
  2633. exit(1); /* fail */
  2634. /* - */
  2635. exit(0);
  2636. ]])
  2637. ],[
  2638. AC_MSG_RESULT([yes])
  2639. tst_works_inet_pton="yes"
  2640. ],[
  2641. AC_MSG_RESULT([no])
  2642. tst_works_inet_pton="no"
  2643. ])
  2644. fi
  2645. #
  2646. if test "$tst_compi_inet_pton" = "yes" &&
  2647. test "$tst_works_inet_pton" != "no"; then
  2648. AC_MSG_CHECKING([if inet_pton usage allowed])
  2649. if test "x$curl_disallow_inet_pton" != "xyes"; then
  2650. AC_MSG_RESULT([yes])
  2651. tst_allow_inet_pton="yes"
  2652. else
  2653. AC_MSG_RESULT([no])
  2654. tst_allow_inet_pton="no"
  2655. fi
  2656. fi
  2657. #
  2658. AC_MSG_CHECKING([if inet_pton might be used])
  2659. if test "$tst_links_inet_pton" = "yes" &&
  2660. test "$tst_proto_inet_pton" = "yes" &&
  2661. test "$tst_compi_inet_pton" = "yes" &&
  2662. test "$tst_allow_inet_pton" = "yes" &&
  2663. test "$tst_works_inet_pton" != "no"; then
  2664. AC_MSG_RESULT([yes])
  2665. AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
  2666. [Define to 1 if you have a IPv6 capable working inet_pton function.])
  2667. curl_cv_func_inet_pton="yes"
  2668. else
  2669. AC_MSG_RESULT([no])
  2670. curl_cv_func_inet_pton="no"
  2671. fi
  2672. ])
  2673. dnl CURL_CHECK_FUNC_IOCTL
  2674. dnl -------------------------------------------------
  2675. dnl Verify if ioctl is available, prototyped, and
  2676. dnl can be compiled. If all of these are true, and
  2677. dnl usage has not been previously disallowed with
  2678. dnl shell variable curl_disallow_ioctl, then
  2679. dnl HAVE_IOCTL will be defined.
  2680. AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [
  2681. AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl
  2682. #
  2683. tst_links_ioctl="unknown"
  2684. tst_proto_ioctl="unknown"
  2685. tst_compi_ioctl="unknown"
  2686. tst_allow_ioctl="unknown"
  2687. #
  2688. AC_MSG_CHECKING([if ioctl can be linked])
  2689. AC_LINK_IFELSE([
  2690. AC_LANG_FUNC_LINK_TRY([ioctl])
  2691. ],[
  2692. AC_MSG_RESULT([yes])
  2693. tst_links_ioctl="yes"
  2694. ],[
  2695. AC_MSG_RESULT([no])
  2696. tst_links_ioctl="no"
  2697. ])
  2698. #
  2699. if test "$tst_links_ioctl" = "yes"; then
  2700. AC_MSG_CHECKING([if ioctl is prototyped])
  2701. AC_EGREP_CPP([ioctl],[
  2702. $curl_includes_stropts
  2703. ],[
  2704. AC_MSG_RESULT([yes])
  2705. tst_proto_ioctl="yes"
  2706. ],[
  2707. AC_MSG_RESULT([no])
  2708. tst_proto_ioctl="no"
  2709. ])
  2710. fi
  2711. #
  2712. if test "$tst_proto_ioctl" = "yes"; then
  2713. AC_MSG_CHECKING([if ioctl is compilable])
  2714. AC_COMPILE_IFELSE([
  2715. AC_LANG_PROGRAM([[
  2716. $curl_includes_stropts
  2717. ]],[[
  2718. if(0 != ioctl(0, 0, 0))
  2719. return 1;
  2720. ]])
  2721. ],[
  2722. AC_MSG_RESULT([yes])
  2723. tst_compi_ioctl="yes"
  2724. ],[
  2725. AC_MSG_RESULT([no])
  2726. tst_compi_ioctl="no"
  2727. ])
  2728. fi
  2729. #
  2730. if test "$tst_compi_ioctl" = "yes"; then
  2731. AC_MSG_CHECKING([if ioctl usage allowed])
  2732. if test "x$curl_disallow_ioctl" != "xyes"; then
  2733. AC_MSG_RESULT([yes])
  2734. tst_allow_ioctl="yes"
  2735. else
  2736. AC_MSG_RESULT([no])
  2737. tst_allow_ioctl="no"
  2738. fi
  2739. fi
  2740. #
  2741. AC_MSG_CHECKING([if ioctl might be used])
  2742. if test "$tst_links_ioctl" = "yes" &&
  2743. test "$tst_proto_ioctl" = "yes" &&
  2744. test "$tst_compi_ioctl" = "yes" &&
  2745. test "$tst_allow_ioctl" = "yes"; then
  2746. AC_MSG_RESULT([yes])
  2747. AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1,
  2748. [Define to 1 if you have the ioctl function.])
  2749. curl_cv_func_ioctl="yes"
  2750. CURL_CHECK_FUNC_IOCTL_FIONBIO
  2751. CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2752. else
  2753. AC_MSG_RESULT([no])
  2754. curl_cv_func_ioctl="no"
  2755. fi
  2756. ])
  2757. dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
  2758. dnl -------------------------------------------------
  2759. dnl Verify if ioctl with the FIONBIO command is
  2760. dnl available, can be compiled, and seems to work. If
  2761. dnl all of these are true, then HAVE_IOCTL_FIONBIO
  2762. dnl will be defined.
  2763. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [
  2764. #
  2765. tst_compi_ioctl_fionbio="unknown"
  2766. tst_allow_ioctl_fionbio="unknown"
  2767. #
  2768. if test "$curl_cv_func_ioctl" = "yes"; then
  2769. AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
  2770. AC_COMPILE_IFELSE([
  2771. AC_LANG_PROGRAM([[
  2772. $curl_includes_stropts
  2773. ]],[[
  2774. int flags = 0;
  2775. if(0 != ioctl(0, FIONBIO, &flags))
  2776. return 1;
  2777. ]])
  2778. ],[
  2779. AC_MSG_RESULT([yes])
  2780. tst_compi_ioctl_fionbio="yes"
  2781. ],[
  2782. AC_MSG_RESULT([no])
  2783. tst_compi_ioctl_fionbio="no"
  2784. ])
  2785. fi
  2786. #
  2787. if test "$tst_compi_ioctl_fionbio" = "yes"; then
  2788. AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
  2789. if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then
  2790. AC_MSG_RESULT([yes])
  2791. tst_allow_ioctl_fionbio="yes"
  2792. else
  2793. AC_MSG_RESULT([no])
  2794. tst_allow_ioctl_fionbio="no"
  2795. fi
  2796. fi
  2797. #
  2798. AC_MSG_CHECKING([if ioctl FIONBIO might be used])
  2799. if test "$tst_compi_ioctl_fionbio" = "yes" &&
  2800. test "$tst_allow_ioctl_fionbio" = "yes"; then
  2801. AC_MSG_RESULT([yes])
  2802. AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
  2803. [Define to 1 if you have a working ioctl FIONBIO function.])
  2804. curl_cv_func_ioctl_fionbio="yes"
  2805. else
  2806. AC_MSG_RESULT([no])
  2807. curl_cv_func_ioctl_fionbio="no"
  2808. fi
  2809. ])
  2810. dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2811. dnl -------------------------------------------------
  2812. dnl Verify if ioctl with the SIOCGIFADDR command is available,
  2813. dnl struct ifreq is defined, they can be compiled, and seem to
  2814. dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
  2815. dnl will be defined.
  2816. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
  2817. #
  2818. tst_compi_ioctl_siocgifaddr="unknown"
  2819. tst_allow_ioctl_siocgifaddr="unknown"
  2820. #
  2821. if test "$curl_cv_func_ioctl" = "yes"; then
  2822. AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
  2823. AC_COMPILE_IFELSE([
  2824. AC_LANG_PROGRAM([[
  2825. $curl_includes_stropts
  2826. #include <net/if.h>
  2827. ]],[[
  2828. struct ifreq ifr;
  2829. if(0 != ioctl(0, SIOCGIFADDR, &ifr))
  2830. return 1;
  2831. ]])
  2832. ],[
  2833. AC_MSG_RESULT([yes])
  2834. tst_compi_ioctl_siocgifaddr="yes"
  2835. ],[
  2836. AC_MSG_RESULT([no])
  2837. tst_compi_ioctl_siocgifaddr="no"
  2838. ])
  2839. fi
  2840. #
  2841. if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
  2842. AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
  2843. if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then
  2844. AC_MSG_RESULT([yes])
  2845. tst_allow_ioctl_siocgifaddr="yes"
  2846. else
  2847. AC_MSG_RESULT([no])
  2848. tst_allow_ioctl_siocgifaddr="no"
  2849. fi
  2850. fi
  2851. #
  2852. AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
  2853. if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
  2854. test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
  2855. AC_MSG_RESULT([yes])
  2856. AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
  2857. [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
  2858. curl_cv_func_ioctl_siocgifaddr="yes"
  2859. else
  2860. AC_MSG_RESULT([no])
  2861. curl_cv_func_ioctl_siocgifaddr="no"
  2862. fi
  2863. ])
  2864. dnl CURL_CHECK_FUNC_IOCTLSOCKET
  2865. dnl -------------------------------------------------
  2866. dnl Verify if ioctlsocket is available, prototyped, and
  2867. dnl can be compiled. If all of these are true, and
  2868. dnl usage has not been previously disallowed with
  2869. dnl shell variable curl_disallow_ioctlsocket, then
  2870. dnl HAVE_IOCTLSOCKET will be defined.
  2871. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [
  2872. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2873. #
  2874. tst_links_ioctlsocket="unknown"
  2875. tst_proto_ioctlsocket="unknown"
  2876. tst_compi_ioctlsocket="unknown"
  2877. tst_allow_ioctlsocket="unknown"
  2878. #
  2879. AC_MSG_CHECKING([if ioctlsocket can be linked])
  2880. AC_LINK_IFELSE([
  2881. AC_LANG_PROGRAM([[
  2882. $curl_includes_winsock2
  2883. ]],[[
  2884. if(0 != ioctlsocket(0, 0, 0))
  2885. return 1;
  2886. ]])
  2887. ],[
  2888. AC_MSG_RESULT([yes])
  2889. tst_links_ioctlsocket="yes"
  2890. ],[
  2891. AC_MSG_RESULT([no])
  2892. tst_links_ioctlsocket="no"
  2893. ])
  2894. #
  2895. if test "$tst_links_ioctlsocket" = "yes"; then
  2896. AC_MSG_CHECKING([if ioctlsocket is prototyped])
  2897. AC_EGREP_CPP([ioctlsocket],[
  2898. $curl_includes_winsock2
  2899. ],[
  2900. AC_MSG_RESULT([yes])
  2901. tst_proto_ioctlsocket="yes"
  2902. ],[
  2903. AC_MSG_RESULT([no])
  2904. tst_proto_ioctlsocket="no"
  2905. ])
  2906. fi
  2907. #
  2908. if test "$tst_proto_ioctlsocket" = "yes"; then
  2909. AC_MSG_CHECKING([if ioctlsocket is compilable])
  2910. AC_COMPILE_IFELSE([
  2911. AC_LANG_PROGRAM([[
  2912. $curl_includes_winsock2
  2913. ]],[[
  2914. if(0 != ioctlsocket(0, 0, 0))
  2915. return 1;
  2916. ]])
  2917. ],[
  2918. AC_MSG_RESULT([yes])
  2919. tst_compi_ioctlsocket="yes"
  2920. ],[
  2921. AC_MSG_RESULT([no])
  2922. tst_compi_ioctlsocket="no"
  2923. ])
  2924. fi
  2925. #
  2926. if test "$tst_compi_ioctlsocket" = "yes"; then
  2927. AC_MSG_CHECKING([if ioctlsocket usage allowed])
  2928. if test "x$curl_disallow_ioctlsocket" != "xyes"; then
  2929. AC_MSG_RESULT([yes])
  2930. tst_allow_ioctlsocket="yes"
  2931. else
  2932. AC_MSG_RESULT([no])
  2933. tst_allow_ioctlsocket="no"
  2934. fi
  2935. fi
  2936. #
  2937. AC_MSG_CHECKING([if ioctlsocket might be used])
  2938. if test "$tst_links_ioctlsocket" = "yes" &&
  2939. test "$tst_proto_ioctlsocket" = "yes" &&
  2940. test "$tst_compi_ioctlsocket" = "yes" &&
  2941. test "$tst_allow_ioctlsocket" = "yes"; then
  2942. AC_MSG_RESULT([yes])
  2943. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
  2944. [Define to 1 if you have the ioctlsocket function.])
  2945. curl_cv_func_ioctlsocket="yes"
  2946. CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2947. else
  2948. AC_MSG_RESULT([no])
  2949. curl_cv_func_ioctlsocket="no"
  2950. fi
  2951. ])
  2952. dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2953. dnl -------------------------------------------------
  2954. dnl Verify if ioctlsocket with the FIONBIO command is
  2955. dnl available, can be compiled, and seems to work. If
  2956. dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
  2957. dnl will be defined.
  2958. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
  2959. #
  2960. tst_compi_ioctlsocket_fionbio="unknown"
  2961. tst_allow_ioctlsocket_fionbio="unknown"
  2962. #
  2963. if test "$curl_cv_func_ioctlsocket" = "yes"; then
  2964. AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
  2965. AC_COMPILE_IFELSE([
  2966. AC_LANG_PROGRAM([[
  2967. $curl_includes_winsock2
  2968. ]],[[
  2969. unsigned long flags = 0;
  2970. if(0 != ioctlsocket(0, FIONBIO, &flags))
  2971. return 1;
  2972. ]])
  2973. ],[
  2974. AC_MSG_RESULT([yes])
  2975. tst_compi_ioctlsocket_fionbio="yes"
  2976. ],[
  2977. AC_MSG_RESULT([no])
  2978. tst_compi_ioctlsocket_fionbio="no"
  2979. ])
  2980. fi
  2981. #
  2982. if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
  2983. AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
  2984. if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then
  2985. AC_MSG_RESULT([yes])
  2986. tst_allow_ioctlsocket_fionbio="yes"
  2987. else
  2988. AC_MSG_RESULT([no])
  2989. tst_allow_ioctlsocket_fionbio="no"
  2990. fi
  2991. fi
  2992. #
  2993. AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
  2994. if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
  2995. test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
  2996. AC_MSG_RESULT([yes])
  2997. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
  2998. [Define to 1 if you have a working ioctlsocket FIONBIO function.])
  2999. curl_cv_func_ioctlsocket_fionbio="yes"
  3000. else
  3001. AC_MSG_RESULT([no])
  3002. curl_cv_func_ioctlsocket_fionbio="no"
  3003. fi
  3004. ])
  3005. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  3006. dnl -------------------------------------------------
  3007. dnl Verify if IoctlSocket is available, prototyped, and
  3008. dnl can be compiled. If all of these are true, and
  3009. dnl usage has not been previously disallowed with
  3010. dnl shell variable curl_disallow_ioctlsocket_camel,
  3011. dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
  3012. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
  3013. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3014. #
  3015. tst_links_ioctlsocket_camel="unknown"
  3016. tst_proto_ioctlsocket_camel="unknown"
  3017. tst_compi_ioctlsocket_camel="unknown"
  3018. tst_allow_ioctlsocket_camel="unknown"
  3019. #
  3020. AC_MSG_CHECKING([if IoctlSocket can be linked])
  3021. AC_LINK_IFELSE([
  3022. AC_LANG_PROGRAM([[
  3023. $curl_includes_bsdsocket
  3024. ]],[[
  3025. IoctlSocket(0, 0, 0);
  3026. ]])
  3027. ],[
  3028. AC_MSG_RESULT([yes])
  3029. tst_links_ioctlsocket_camel="yes"
  3030. ],[
  3031. AC_MSG_RESULT([no])
  3032. tst_links_ioctlsocket_camel="no"
  3033. ])
  3034. #
  3035. if test "$tst_links_ioctlsocket_camel" = "yes"; then
  3036. AC_MSG_CHECKING([if IoctlSocket is prototyped])
  3037. AC_EGREP_CPP([IoctlSocket],[
  3038. $curl_includes_bsdsocket
  3039. ],[
  3040. AC_MSG_RESULT([yes])
  3041. tst_proto_ioctlsocket_camel="yes"
  3042. ],[
  3043. AC_MSG_RESULT([no])
  3044. tst_proto_ioctlsocket_camel="no"
  3045. ])
  3046. fi
  3047. #
  3048. if test "$tst_proto_ioctlsocket_camel" = "yes"; then
  3049. AC_MSG_CHECKING([if IoctlSocket is compilable])
  3050. AC_COMPILE_IFELSE([
  3051. AC_LANG_PROGRAM([[
  3052. $curl_includes_bsdsocket
  3053. ]],[[
  3054. if(0 != IoctlSocket(0, 0, 0))
  3055. return 1;
  3056. ]])
  3057. ],[
  3058. AC_MSG_RESULT([yes])
  3059. tst_compi_ioctlsocket_camel="yes"
  3060. ],[
  3061. AC_MSG_RESULT([no])
  3062. tst_compi_ioctlsocket_camel="no"
  3063. ])
  3064. fi
  3065. #
  3066. if test "$tst_compi_ioctlsocket_camel" = "yes"; then
  3067. AC_MSG_CHECKING([if IoctlSocket usage allowed])
  3068. if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then
  3069. AC_MSG_RESULT([yes])
  3070. tst_allow_ioctlsocket_camel="yes"
  3071. else
  3072. AC_MSG_RESULT([no])
  3073. tst_allow_ioctlsocket_camel="no"
  3074. fi
  3075. fi
  3076. #
  3077. AC_MSG_CHECKING([if IoctlSocket might be used])
  3078. if test "$tst_links_ioctlsocket_camel" = "yes" &&
  3079. test "$tst_proto_ioctlsocket_camel" = "yes" &&
  3080. test "$tst_compi_ioctlsocket_camel" = "yes" &&
  3081. test "$tst_allow_ioctlsocket_camel" = "yes"; then
  3082. AC_MSG_RESULT([yes])
  3083. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
  3084. [Define to 1 if you have the IoctlSocket camel case function.])
  3085. curl_cv_func_ioctlsocket_camel="yes"
  3086. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3087. else
  3088. AC_MSG_RESULT([no])
  3089. curl_cv_func_ioctlsocket_camel="no"
  3090. fi
  3091. ])
  3092. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3093. dnl -------------------------------------------------
  3094. dnl Verify if IoctlSocket with FIONBIO command is available,
  3095. dnl can be compiled, and seems to work. If all of these are
  3096. dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
  3097. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
  3098. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3099. #
  3100. tst_compi_ioctlsocket_camel_fionbio="unknown"
  3101. tst_allow_ioctlsocket_camel_fionbio="unknown"
  3102. #
  3103. if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then
  3104. AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
  3105. AC_COMPILE_IFELSE([
  3106. AC_LANG_PROGRAM([[
  3107. $curl_includes_bsdsocket
  3108. ]],[[
  3109. long flags = 0;
  3110. if(0 != IoctlSocket(0, FIONBIO, &flags))
  3111. return 1;
  3112. ]])
  3113. ],[
  3114. AC_MSG_RESULT([yes])
  3115. tst_compi_ioctlsocket_camel_fionbio="yes"
  3116. ],[
  3117. AC_MSG_RESULT([no])
  3118. tst_compi_ioctlsocket_camel_fionbio="no"
  3119. ])
  3120. fi
  3121. #
  3122. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
  3123. AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
  3124. if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
  3125. AC_MSG_RESULT([yes])
  3126. tst_allow_ioctlsocket_camel_fionbio="yes"
  3127. else
  3128. AC_MSG_RESULT([no])
  3129. tst_allow_ioctlsocket_camel_fionbio="no"
  3130. fi
  3131. fi
  3132. #
  3133. AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
  3134. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
  3135. test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
  3136. AC_MSG_RESULT([yes])
  3137. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
  3138. [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
  3139. curl_cv_func_ioctlsocket_camel_fionbio="yes"
  3140. else
  3141. AC_MSG_RESULT([no])
  3142. curl_cv_func_ioctlsocket_camel_fionbio="no"
  3143. fi
  3144. ])
  3145. dnl CURL_CHECK_FUNC_MEMRCHR
  3146. dnl -------------------------------------------------
  3147. dnl Verify if memrchr is available, prototyped, and
  3148. dnl can be compiled. If all of these are true, and
  3149. dnl usage has not been previously disallowed with
  3150. dnl shell variable curl_disallow_memrchr, then
  3151. dnl HAVE_MEMRCHR will be defined.
  3152. AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [
  3153. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3154. #
  3155. tst_links_memrchr="unknown"
  3156. tst_macro_memrchr="unknown"
  3157. tst_proto_memrchr="unknown"
  3158. tst_compi_memrchr="unknown"
  3159. tst_allow_memrchr="unknown"
  3160. #
  3161. AC_MSG_CHECKING([if memrchr can be linked])
  3162. AC_LINK_IFELSE([
  3163. AC_LANG_FUNC_LINK_TRY([memrchr])
  3164. ],[
  3165. AC_MSG_RESULT([yes])
  3166. tst_links_memrchr="yes"
  3167. ],[
  3168. AC_MSG_RESULT([no])
  3169. tst_links_memrchr="no"
  3170. ])
  3171. #
  3172. if test "$tst_links_memrchr" = "no"; then
  3173. AC_MSG_CHECKING([if memrchr seems a macro])
  3174. AC_LINK_IFELSE([
  3175. AC_LANG_PROGRAM([[
  3176. $curl_includes_string
  3177. ]],[[
  3178. if(0 != memrchr(0, 0, 0))
  3179. return 1;
  3180. ]])
  3181. ],[
  3182. AC_MSG_RESULT([yes])
  3183. tst_macro_memrchr="yes"
  3184. ],[
  3185. AC_MSG_RESULT([no])
  3186. tst_macro_memrchr="no"
  3187. ])
  3188. fi
  3189. #
  3190. if test "$tst_links_memrchr" = "yes"; then
  3191. AC_MSG_CHECKING([if memrchr is prototyped])
  3192. AC_EGREP_CPP([memrchr],[
  3193. $curl_includes_string
  3194. ],[
  3195. AC_MSG_RESULT([yes])
  3196. tst_proto_memrchr="yes"
  3197. ],[
  3198. AC_MSG_RESULT([no])
  3199. tst_proto_memrchr="no"
  3200. ])
  3201. fi
  3202. #
  3203. if test "$tst_proto_memrchr" = "yes" ||
  3204. test "$tst_macro_memrchr" = "yes"; then
  3205. AC_MSG_CHECKING([if memrchr is compilable])
  3206. AC_COMPILE_IFELSE([
  3207. AC_LANG_PROGRAM([[
  3208. $curl_includes_string
  3209. ]],[[
  3210. if(0 != memrchr(0, 0, 0))
  3211. return 1;
  3212. ]])
  3213. ],[
  3214. AC_MSG_RESULT([yes])
  3215. tst_compi_memrchr="yes"
  3216. ],[
  3217. AC_MSG_RESULT([no])
  3218. tst_compi_memrchr="no"
  3219. ])
  3220. fi
  3221. #
  3222. if test "$tst_compi_memrchr" = "yes"; then
  3223. AC_MSG_CHECKING([if memrchr usage allowed])
  3224. if test "x$curl_disallow_memrchr" != "xyes"; then
  3225. AC_MSG_RESULT([yes])
  3226. tst_allow_memrchr="yes"
  3227. else
  3228. AC_MSG_RESULT([no])
  3229. tst_allow_memrchr="no"
  3230. fi
  3231. fi
  3232. #
  3233. AC_MSG_CHECKING([if memrchr might be used])
  3234. if (test "$tst_proto_memrchr" = "yes" ||
  3235. test "$tst_macro_memrchr" = "yes") &&
  3236. test "$tst_compi_memrchr" = "yes" &&
  3237. test "$tst_allow_memrchr" = "yes"; then
  3238. AC_MSG_RESULT([yes])
  3239. AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1,
  3240. [Define to 1 if you have the memrchr function or macro.])
  3241. curl_cv_func_memrchr="yes"
  3242. else
  3243. AC_MSG_RESULT([no])
  3244. curl_cv_func_memrchr="no"
  3245. fi
  3246. ])
  3247. dnl CURL_CHECK_FUNC_POLL
  3248. dnl -------------------------------------------------
  3249. dnl Verify if poll is available, prototyped, can
  3250. dnl be compiled and seems to work.
  3251. AC_DEFUN([CURL_CHECK_FUNC_POLL], [
  3252. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  3253. AC_REQUIRE([CURL_INCLUDES_POLL])dnl
  3254. #
  3255. tst_links_poll="unknown"
  3256. tst_proto_poll="unknown"
  3257. tst_compi_poll="unknown"
  3258. tst_works_poll="unknown"
  3259. tst_allow_poll="unknown"
  3260. #
  3261. case $host_os in
  3262. darwin*|interix*)
  3263. dnl poll() does not work on these platforms
  3264. dnl Interix: "does provide poll(), but the implementing developer must
  3265. dnl have been in a bad mood, because poll() only works on the /proc
  3266. dnl filesystem here"
  3267. dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9
  3268. dnl only to break again in 10.12.
  3269. curl_disallow_poll="yes"
  3270. tst_compi_poll="no"
  3271. ;;
  3272. esac
  3273. #
  3274. AC_MSG_CHECKING([if poll can be linked])
  3275. AC_LINK_IFELSE([
  3276. AC_LANG_PROGRAM([[
  3277. $curl_includes_poll
  3278. ]],[[
  3279. if(0 != poll(0, 0, 0))
  3280. return 1;
  3281. ]])
  3282. ],[
  3283. AC_MSG_RESULT([yes])
  3284. tst_links_poll="yes"
  3285. ],[
  3286. AC_MSG_RESULT([no])
  3287. tst_links_poll="no"
  3288. ])
  3289. #
  3290. if test "$tst_links_poll" = "yes"; then
  3291. AC_MSG_CHECKING([if poll is prototyped])
  3292. AC_EGREP_CPP([poll],[
  3293. $curl_includes_poll
  3294. ],[
  3295. AC_MSG_RESULT([yes])
  3296. tst_proto_poll="yes"
  3297. ],[
  3298. AC_MSG_RESULT([no])
  3299. tst_proto_poll="no"
  3300. ])
  3301. fi
  3302. #
  3303. if test "$tst_proto_poll" = "yes"; then
  3304. AC_MSG_CHECKING([if poll is compilable])
  3305. AC_COMPILE_IFELSE([
  3306. AC_LANG_PROGRAM([[
  3307. $curl_includes_poll
  3308. ]],[[
  3309. if(0 != poll(0, 0, 0))
  3310. return 1;
  3311. ]])
  3312. ],[
  3313. AC_MSG_RESULT([yes])
  3314. tst_compi_poll="yes"
  3315. ],[
  3316. AC_MSG_RESULT([no])
  3317. tst_compi_poll="no"
  3318. ])
  3319. fi
  3320. #
  3321. dnl only do runtime verification when not cross-compiling
  3322. if test "x$cross_compiling" != "xyes" &&
  3323. test "$tst_compi_poll" = "yes"; then
  3324. AC_MSG_CHECKING([if poll seems to work])
  3325. CURL_RUN_IFELSE([
  3326. AC_LANG_PROGRAM([[
  3327. $curl_includes_stdlib
  3328. $curl_includes_poll
  3329. $curl_includes_time
  3330. ]],[[
  3331. /* detect the original poll() breakage */
  3332. if(0 != poll(0, 0, 10))
  3333. exit(1); /* fail */
  3334. else {
  3335. /* detect the 10.12 poll() breakage */
  3336. struct timeval before, after;
  3337. int rc;
  3338. size_t us;
  3339. gettimeofday(&before, NULL);
  3340. rc = poll(NULL, 0, 500);
  3341. gettimeofday(&after, NULL);
  3342. us = (after.tv_sec - before.tv_sec) * 1000000 +
  3343. (after.tv_usec - before.tv_usec);
  3344. if(us < 400000)
  3345. exit(1);
  3346. }
  3347. ]])
  3348. ],[
  3349. AC_MSG_RESULT([yes])
  3350. tst_works_poll="yes"
  3351. ],[
  3352. AC_MSG_RESULT([no])
  3353. tst_works_poll="no"
  3354. ])
  3355. fi
  3356. #
  3357. if test "$tst_compi_poll" = "yes" &&
  3358. test "$tst_works_poll" != "no"; then
  3359. AC_MSG_CHECKING([if poll usage allowed])
  3360. if test "x$curl_disallow_poll" != "xyes"; then
  3361. AC_MSG_RESULT([yes])
  3362. tst_allow_poll="yes"
  3363. else
  3364. AC_MSG_RESULT([no])
  3365. tst_allow_poll="no"
  3366. fi
  3367. fi
  3368. #
  3369. AC_MSG_CHECKING([if poll might be used])
  3370. if test "$tst_links_poll" = "yes" &&
  3371. test "$tst_proto_poll" = "yes" &&
  3372. test "$tst_compi_poll" = "yes" &&
  3373. test "$tst_allow_poll" = "yes" &&
  3374. test "$tst_works_poll" != "no"; then
  3375. AC_MSG_RESULT([yes])
  3376. AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1,
  3377. [If you have a fine poll])
  3378. curl_cv_func_poll="yes"
  3379. else
  3380. AC_MSG_RESULT([no])
  3381. curl_cv_func_poll="no"
  3382. fi
  3383. ])
  3384. fi
  3385. ])
  3386. dnl CURL_CHECK_FUNC_SIGACTION
  3387. dnl -------------------------------------------------
  3388. dnl Verify if sigaction is available, prototyped, and
  3389. dnl can be compiled. If all of these are true, and
  3390. dnl usage has not been previously disallowed with
  3391. dnl shell variable curl_disallow_sigaction, then
  3392. dnl HAVE_SIGACTION will be defined.
  3393. AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
  3394. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3395. #
  3396. tst_links_sigaction="unknown"
  3397. tst_proto_sigaction="unknown"
  3398. tst_compi_sigaction="unknown"
  3399. tst_allow_sigaction="unknown"
  3400. #
  3401. AC_MSG_CHECKING([if sigaction can be linked])
  3402. AC_LINK_IFELSE([
  3403. AC_LANG_FUNC_LINK_TRY([sigaction])
  3404. ],[
  3405. AC_MSG_RESULT([yes])
  3406. tst_links_sigaction="yes"
  3407. ],[
  3408. AC_MSG_RESULT([no])
  3409. tst_links_sigaction="no"
  3410. ])
  3411. #
  3412. if test "$tst_links_sigaction" = "yes"; then
  3413. AC_MSG_CHECKING([if sigaction is prototyped])
  3414. AC_EGREP_CPP([sigaction],[
  3415. $curl_includes_signal
  3416. ],[
  3417. AC_MSG_RESULT([yes])
  3418. tst_proto_sigaction="yes"
  3419. ],[
  3420. AC_MSG_RESULT([no])
  3421. tst_proto_sigaction="no"
  3422. ])
  3423. fi
  3424. #
  3425. if test "$tst_proto_sigaction" = "yes"; then
  3426. AC_MSG_CHECKING([if sigaction is compilable])
  3427. AC_COMPILE_IFELSE([
  3428. AC_LANG_PROGRAM([[
  3429. $curl_includes_signal
  3430. ]],[[
  3431. if(0 != sigaction(0, 0, 0))
  3432. return 1;
  3433. ]])
  3434. ],[
  3435. AC_MSG_RESULT([yes])
  3436. tst_compi_sigaction="yes"
  3437. ],[
  3438. AC_MSG_RESULT([no])
  3439. tst_compi_sigaction="no"
  3440. ])
  3441. fi
  3442. #
  3443. if test "$tst_compi_sigaction" = "yes"; then
  3444. AC_MSG_CHECKING([if sigaction usage allowed])
  3445. if test "x$curl_disallow_sigaction" != "xyes"; then
  3446. AC_MSG_RESULT([yes])
  3447. tst_allow_sigaction="yes"
  3448. else
  3449. AC_MSG_RESULT([no])
  3450. tst_allow_sigaction="no"
  3451. fi
  3452. fi
  3453. #
  3454. AC_MSG_CHECKING([if sigaction might be used])
  3455. if test "$tst_links_sigaction" = "yes" &&
  3456. test "$tst_proto_sigaction" = "yes" &&
  3457. test "$tst_compi_sigaction" = "yes" &&
  3458. test "$tst_allow_sigaction" = "yes"; then
  3459. AC_MSG_RESULT([yes])
  3460. AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
  3461. [Define to 1 if you have the sigaction function.])
  3462. curl_cv_func_sigaction="yes"
  3463. else
  3464. AC_MSG_RESULT([no])
  3465. curl_cv_func_sigaction="no"
  3466. fi
  3467. ])
  3468. dnl CURL_CHECK_FUNC_SIGINTERRUPT
  3469. dnl -------------------------------------------------
  3470. dnl Verify if siginterrupt is available, prototyped, and
  3471. dnl can be compiled. If all of these are true, and
  3472. dnl usage has not been previously disallowed with
  3473. dnl shell variable curl_disallow_siginterrupt, then
  3474. dnl HAVE_SIGINTERRUPT will be defined.
  3475. AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [
  3476. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3477. #
  3478. tst_links_siginterrupt="unknown"
  3479. tst_proto_siginterrupt="unknown"
  3480. tst_compi_siginterrupt="unknown"
  3481. tst_allow_siginterrupt="unknown"
  3482. #
  3483. AC_MSG_CHECKING([if siginterrupt can be linked])
  3484. AC_LINK_IFELSE([
  3485. AC_LANG_FUNC_LINK_TRY([siginterrupt])
  3486. ],[
  3487. AC_MSG_RESULT([yes])
  3488. tst_links_siginterrupt="yes"
  3489. ],[
  3490. AC_MSG_RESULT([no])
  3491. tst_links_siginterrupt="no"
  3492. ])
  3493. #
  3494. if test "$tst_links_siginterrupt" = "yes"; then
  3495. AC_MSG_CHECKING([if siginterrupt is prototyped])
  3496. AC_EGREP_CPP([siginterrupt],[
  3497. $curl_includes_signal
  3498. ],[
  3499. AC_MSG_RESULT([yes])
  3500. tst_proto_siginterrupt="yes"
  3501. ],[
  3502. AC_MSG_RESULT([no])
  3503. tst_proto_siginterrupt="no"
  3504. ])
  3505. fi
  3506. #
  3507. if test "$tst_proto_siginterrupt" = "yes"; then
  3508. AC_MSG_CHECKING([if siginterrupt is compilable])
  3509. AC_COMPILE_IFELSE([
  3510. AC_LANG_PROGRAM([[
  3511. $curl_includes_signal
  3512. ]],[[
  3513. if(0 != siginterrupt(0, 0))
  3514. return 1;
  3515. ]])
  3516. ],[
  3517. AC_MSG_RESULT([yes])
  3518. tst_compi_siginterrupt="yes"
  3519. ],[
  3520. AC_MSG_RESULT([no])
  3521. tst_compi_siginterrupt="no"
  3522. ])
  3523. fi
  3524. #
  3525. if test "$tst_compi_siginterrupt" = "yes"; then
  3526. AC_MSG_CHECKING([if siginterrupt usage allowed])
  3527. if test "x$curl_disallow_siginterrupt" != "xyes"; then
  3528. AC_MSG_RESULT([yes])
  3529. tst_allow_siginterrupt="yes"
  3530. else
  3531. AC_MSG_RESULT([no])
  3532. tst_allow_siginterrupt="no"
  3533. fi
  3534. fi
  3535. #
  3536. AC_MSG_CHECKING([if siginterrupt might be used])
  3537. if test "$tst_links_siginterrupt" = "yes" &&
  3538. test "$tst_proto_siginterrupt" = "yes" &&
  3539. test "$tst_compi_siginterrupt" = "yes" &&
  3540. test "$tst_allow_siginterrupt" = "yes"; then
  3541. AC_MSG_RESULT([yes])
  3542. AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1,
  3543. [Define to 1 if you have the siginterrupt function.])
  3544. curl_cv_func_siginterrupt="yes"
  3545. else
  3546. AC_MSG_RESULT([no])
  3547. curl_cv_func_siginterrupt="no"
  3548. fi
  3549. ])
  3550. dnl CURL_CHECK_FUNC_SIGNAL
  3551. dnl -------------------------------------------------
  3552. dnl Verify if signal is available, prototyped, and
  3553. dnl can be compiled. If all of these are true, and
  3554. dnl usage has not been previously disallowed with
  3555. dnl shell variable curl_disallow_signal, then
  3556. dnl HAVE_SIGNAL will be defined.
  3557. AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [
  3558. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3559. #
  3560. tst_links_signal="unknown"
  3561. tst_proto_signal="unknown"
  3562. tst_compi_signal="unknown"
  3563. tst_allow_signal="unknown"
  3564. #
  3565. AC_MSG_CHECKING([if signal can be linked])
  3566. AC_LINK_IFELSE([
  3567. AC_LANG_FUNC_LINK_TRY([signal])
  3568. ],[
  3569. AC_MSG_RESULT([yes])
  3570. tst_links_signal="yes"
  3571. ],[
  3572. AC_MSG_RESULT([no])
  3573. tst_links_signal="no"
  3574. ])
  3575. #
  3576. if test "$tst_links_signal" = "yes"; then
  3577. AC_MSG_CHECKING([if signal is prototyped])
  3578. AC_EGREP_CPP([signal],[
  3579. $curl_includes_signal
  3580. ],[
  3581. AC_MSG_RESULT([yes])
  3582. tst_proto_signal="yes"
  3583. ],[
  3584. AC_MSG_RESULT([no])
  3585. tst_proto_signal="no"
  3586. ])
  3587. fi
  3588. #
  3589. if test "$tst_proto_signal" = "yes"; then
  3590. AC_MSG_CHECKING([if signal is compilable])
  3591. AC_COMPILE_IFELSE([
  3592. AC_LANG_PROGRAM([[
  3593. $curl_includes_signal
  3594. ]],[[
  3595. if(0 != signal(0, 0))
  3596. return 1;
  3597. ]])
  3598. ],[
  3599. AC_MSG_RESULT([yes])
  3600. tst_compi_signal="yes"
  3601. ],[
  3602. AC_MSG_RESULT([no])
  3603. tst_compi_signal="no"
  3604. ])
  3605. fi
  3606. #
  3607. if test "$tst_compi_signal" = "yes"; then
  3608. AC_MSG_CHECKING([if signal usage allowed])
  3609. if test "x$curl_disallow_signal" != "xyes"; then
  3610. AC_MSG_RESULT([yes])
  3611. tst_allow_signal="yes"
  3612. else
  3613. AC_MSG_RESULT([no])
  3614. tst_allow_signal="no"
  3615. fi
  3616. fi
  3617. #
  3618. AC_MSG_CHECKING([if signal might be used])
  3619. if test "$tst_links_signal" = "yes" &&
  3620. test "$tst_proto_signal" = "yes" &&
  3621. test "$tst_compi_signal" = "yes" &&
  3622. test "$tst_allow_signal" = "yes"; then
  3623. AC_MSG_RESULT([yes])
  3624. AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1,
  3625. [Define to 1 if you have the signal function.])
  3626. curl_cv_func_signal="yes"
  3627. else
  3628. AC_MSG_RESULT([no])
  3629. curl_cv_func_signal="no"
  3630. fi
  3631. ])
  3632. dnl CURL_CHECK_FUNC_SIGSETJMP
  3633. dnl -------------------------------------------------
  3634. dnl Verify if sigsetjmp is available, prototyped, and
  3635. dnl can be compiled. If all of these are true, and
  3636. dnl usage has not been previously disallowed with
  3637. dnl shell variable curl_disallow_sigsetjmp, then
  3638. dnl HAVE_SIGSETJMP will be defined.
  3639. AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [
  3640. AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl
  3641. #
  3642. tst_links_sigsetjmp="unknown"
  3643. tst_macro_sigsetjmp="unknown"
  3644. tst_proto_sigsetjmp="unknown"
  3645. tst_compi_sigsetjmp="unknown"
  3646. tst_allow_sigsetjmp="unknown"
  3647. #
  3648. AC_MSG_CHECKING([if sigsetjmp can be linked])
  3649. AC_LINK_IFELSE([
  3650. AC_LANG_FUNC_LINK_TRY([sigsetjmp])
  3651. ],[
  3652. AC_MSG_RESULT([yes])
  3653. tst_links_sigsetjmp="yes"
  3654. ],[
  3655. AC_MSG_RESULT([no])
  3656. tst_links_sigsetjmp="no"
  3657. ])
  3658. #
  3659. if test "$tst_links_sigsetjmp" = "no"; then
  3660. AC_MSG_CHECKING([if sigsetjmp seems a macro])
  3661. AC_LINK_IFELSE([
  3662. AC_LANG_PROGRAM([[
  3663. $curl_includes_setjmp
  3664. ]],[[
  3665. sigjmp_buf env;
  3666. if(0 != sigsetjmp(env, 0))
  3667. return 1;
  3668. ]])
  3669. ],[
  3670. AC_MSG_RESULT([yes])
  3671. tst_macro_sigsetjmp="yes"
  3672. ],[
  3673. AC_MSG_RESULT([no])
  3674. tst_macro_sigsetjmp="no"
  3675. ])
  3676. fi
  3677. #
  3678. if test "$tst_links_sigsetjmp" = "yes"; then
  3679. AC_MSG_CHECKING([if sigsetjmp is prototyped])
  3680. AC_EGREP_CPP([sigsetjmp],[
  3681. $curl_includes_setjmp
  3682. ],[
  3683. AC_MSG_RESULT([yes])
  3684. tst_proto_sigsetjmp="yes"
  3685. ],[
  3686. AC_MSG_RESULT([no])
  3687. tst_proto_sigsetjmp="no"
  3688. ])
  3689. fi
  3690. #
  3691. if test "$tst_proto_sigsetjmp" = "yes" ||
  3692. test "$tst_macro_sigsetjmp" = "yes"; then
  3693. AC_MSG_CHECKING([if sigsetjmp is compilable])
  3694. AC_COMPILE_IFELSE([
  3695. AC_LANG_PROGRAM([[
  3696. $curl_includes_setjmp
  3697. ]],[[
  3698. sigjmp_buf env;
  3699. if(0 != sigsetjmp(env, 0))
  3700. return 1;
  3701. ]])
  3702. ],[
  3703. AC_MSG_RESULT([yes])
  3704. tst_compi_sigsetjmp="yes"
  3705. ],[
  3706. AC_MSG_RESULT([no])
  3707. tst_compi_sigsetjmp="no"
  3708. ])
  3709. fi
  3710. #
  3711. if test "$tst_compi_sigsetjmp" = "yes"; then
  3712. AC_MSG_CHECKING([if sigsetjmp usage allowed])
  3713. if test "x$curl_disallow_sigsetjmp" != "xyes"; then
  3714. AC_MSG_RESULT([yes])
  3715. tst_allow_sigsetjmp="yes"
  3716. else
  3717. AC_MSG_RESULT([no])
  3718. tst_allow_sigsetjmp="no"
  3719. fi
  3720. fi
  3721. #
  3722. AC_MSG_CHECKING([if sigsetjmp might be used])
  3723. if (test "$tst_proto_sigsetjmp" = "yes" ||
  3724. test "$tst_macro_sigsetjmp" = "yes") &&
  3725. test "$tst_compi_sigsetjmp" = "yes" &&
  3726. test "$tst_allow_sigsetjmp" = "yes"; then
  3727. AC_MSG_RESULT([yes])
  3728. AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1,
  3729. [Define to 1 if you have the sigsetjmp function or macro.])
  3730. curl_cv_func_sigsetjmp="yes"
  3731. else
  3732. AC_MSG_RESULT([no])
  3733. curl_cv_func_sigsetjmp="no"
  3734. fi
  3735. ])
  3736. dnl CURL_CHECK_FUNC_SOCKET
  3737. dnl -------------------------------------------------
  3738. dnl Verify if socket is available, prototyped, and
  3739. dnl can be compiled. If all of these are true, and
  3740. dnl usage has not been previously disallowed with
  3741. dnl shell variable curl_disallow_socket, then
  3742. dnl HAVE_SOCKET will be defined.
  3743. AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [
  3744. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  3745. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  3746. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  3747. #
  3748. tst_links_socket="unknown"
  3749. tst_proto_socket="unknown"
  3750. tst_compi_socket="unknown"
  3751. tst_allow_socket="unknown"
  3752. #
  3753. AC_MSG_CHECKING([if socket can be linked])
  3754. AC_LINK_IFELSE([
  3755. AC_LANG_PROGRAM([[
  3756. $curl_includes_winsock2
  3757. $curl_includes_bsdsocket
  3758. $curl_includes_sys_socket
  3759. $curl_includes_socket
  3760. ]],[[
  3761. if(0 != socket(0, 0, 0))
  3762. return 1;
  3763. ]])
  3764. ],[
  3765. AC_MSG_RESULT([yes])
  3766. tst_links_socket="yes"
  3767. ],[
  3768. AC_MSG_RESULT([no])
  3769. tst_links_socket="no"
  3770. ])
  3771. #
  3772. if test "$tst_links_socket" = "yes"; then
  3773. AC_MSG_CHECKING([if socket is prototyped])
  3774. AC_EGREP_CPP([socket],[
  3775. $curl_includes_winsock2
  3776. $curl_includes_bsdsocket
  3777. $curl_includes_sys_socket
  3778. $curl_includes_socket
  3779. ],[
  3780. AC_MSG_RESULT([yes])
  3781. tst_proto_socket="yes"
  3782. ],[
  3783. AC_MSG_RESULT([no])
  3784. tst_proto_socket="no"
  3785. ])
  3786. fi
  3787. #
  3788. if test "$tst_proto_socket" = "yes"; then
  3789. AC_MSG_CHECKING([if socket is compilable])
  3790. AC_COMPILE_IFELSE([
  3791. AC_LANG_PROGRAM([[
  3792. $curl_includes_winsock2
  3793. $curl_includes_bsdsocket
  3794. $curl_includes_sys_socket
  3795. $curl_includes_socket
  3796. ]],[[
  3797. if(0 != socket(0, 0, 0))
  3798. return 1;
  3799. ]])
  3800. ],[
  3801. AC_MSG_RESULT([yes])
  3802. tst_compi_socket="yes"
  3803. ],[
  3804. AC_MSG_RESULT([no])
  3805. tst_compi_socket="no"
  3806. ])
  3807. fi
  3808. #
  3809. if test "$tst_compi_socket" = "yes"; then
  3810. AC_MSG_CHECKING([if socket usage allowed])
  3811. if test "x$curl_disallow_socket" != "xyes"; then
  3812. AC_MSG_RESULT([yes])
  3813. tst_allow_socket="yes"
  3814. else
  3815. AC_MSG_RESULT([no])
  3816. tst_allow_socket="no"
  3817. fi
  3818. fi
  3819. #
  3820. AC_MSG_CHECKING([if socket might be used])
  3821. if test "$tst_links_socket" = "yes" &&
  3822. test "$tst_proto_socket" = "yes" &&
  3823. test "$tst_compi_socket" = "yes" &&
  3824. test "$tst_allow_socket" = "yes"; then
  3825. AC_MSG_RESULT([yes])
  3826. AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1,
  3827. [Define to 1 if you have the socket function.])
  3828. curl_cv_func_socket="yes"
  3829. else
  3830. AC_MSG_RESULT([no])
  3831. curl_cv_func_socket="no"
  3832. fi
  3833. ])
  3834. dnl CURL_CHECK_FUNC_SOCKETPAIR
  3835. dnl -------------------------------------------------
  3836. dnl Verify if socketpair is available, prototyped, and
  3837. dnl can be compiled. If all of these are true, and
  3838. dnl usage has not been previously disallowed with
  3839. dnl shell variable curl_disallow_socketpair, then
  3840. dnl HAVE_SOCKETPAIR will be defined.
  3841. AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [
  3842. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  3843. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  3844. #
  3845. tst_links_socketpair="unknown"
  3846. tst_proto_socketpair="unknown"
  3847. tst_compi_socketpair="unknown"
  3848. tst_allow_socketpair="unknown"
  3849. #
  3850. AC_MSG_CHECKING([if socketpair can be linked])
  3851. AC_LINK_IFELSE([
  3852. AC_LANG_FUNC_LINK_TRY([socketpair])
  3853. ],[
  3854. AC_MSG_RESULT([yes])
  3855. tst_links_socketpair="yes"
  3856. ],[
  3857. AC_MSG_RESULT([no])
  3858. tst_links_socketpair="no"
  3859. ])
  3860. #
  3861. if test "$tst_links_socketpair" = "yes"; then
  3862. AC_MSG_CHECKING([if socketpair is prototyped])
  3863. AC_EGREP_CPP([socketpair],[
  3864. $curl_includes_sys_socket
  3865. $curl_includes_socket
  3866. ],[
  3867. AC_MSG_RESULT([yes])
  3868. tst_proto_socketpair="yes"
  3869. ],[
  3870. AC_MSG_RESULT([no])
  3871. tst_proto_socketpair="no"
  3872. ])
  3873. fi
  3874. #
  3875. if test "$tst_proto_socketpair" = "yes"; then
  3876. AC_MSG_CHECKING([if socketpair is compilable])
  3877. AC_COMPILE_IFELSE([
  3878. AC_LANG_PROGRAM([[
  3879. $curl_includes_sys_socket
  3880. $curl_includes_socket
  3881. ]],[[
  3882. int sv[2];
  3883. if(0 != socketpair(0, 0, 0, sv))
  3884. return 1;
  3885. ]])
  3886. ],[
  3887. AC_MSG_RESULT([yes])
  3888. tst_compi_socketpair="yes"
  3889. ],[
  3890. AC_MSG_RESULT([no])
  3891. tst_compi_socketpair="no"
  3892. ])
  3893. fi
  3894. #
  3895. if test "$tst_compi_socketpair" = "yes"; then
  3896. AC_MSG_CHECKING([if socketpair usage allowed])
  3897. if test "x$curl_disallow_socketpair" != "xyes"; then
  3898. AC_MSG_RESULT([yes])
  3899. tst_allow_socketpair="yes"
  3900. else
  3901. AC_MSG_RESULT([no])
  3902. tst_allow_socketpair="no"
  3903. fi
  3904. fi
  3905. #
  3906. AC_MSG_CHECKING([if socketpair might be used])
  3907. if test "$tst_links_socketpair" = "yes" &&
  3908. test "$tst_proto_socketpair" = "yes" &&
  3909. test "$tst_compi_socketpair" = "yes" &&
  3910. test "$tst_allow_socketpair" = "yes"; then
  3911. AC_MSG_RESULT([yes])
  3912. AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1,
  3913. [Define to 1 if you have the socketpair function.])
  3914. curl_cv_func_socketpair="yes"
  3915. else
  3916. AC_MSG_RESULT([no])
  3917. curl_cv_func_socketpair="no"
  3918. fi
  3919. ])
  3920. dnl CURL_CHECK_FUNC_STRCASECMP
  3921. dnl -------------------------------------------------
  3922. dnl Verify if strcasecmp is available, prototyped, and
  3923. dnl can be compiled. If all of these are true, and
  3924. dnl usage has not been previously disallowed with
  3925. dnl shell variable curl_disallow_strcasecmp, then
  3926. dnl HAVE_STRCASECMP will be defined.
  3927. AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
  3928. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3929. #
  3930. tst_links_strcasecmp="unknown"
  3931. tst_proto_strcasecmp="unknown"
  3932. tst_compi_strcasecmp="unknown"
  3933. tst_allow_strcasecmp="unknown"
  3934. #
  3935. AC_MSG_CHECKING([if strcasecmp can be linked])
  3936. AC_LINK_IFELSE([
  3937. AC_LANG_FUNC_LINK_TRY([strcasecmp])
  3938. ],[
  3939. AC_MSG_RESULT([yes])
  3940. tst_links_strcasecmp="yes"
  3941. ],[
  3942. AC_MSG_RESULT([no])
  3943. tst_links_strcasecmp="no"
  3944. ])
  3945. #
  3946. if test "$tst_links_strcasecmp" = "yes"; then
  3947. AC_MSG_CHECKING([if strcasecmp is prototyped])
  3948. AC_EGREP_CPP([strcasecmp],[
  3949. $curl_includes_string
  3950. ],[
  3951. AC_MSG_RESULT([yes])
  3952. tst_proto_strcasecmp="yes"
  3953. ],[
  3954. AC_MSG_RESULT([no])
  3955. tst_proto_strcasecmp="no"
  3956. ])
  3957. fi
  3958. #
  3959. if test "$tst_proto_strcasecmp" = "yes"; then
  3960. AC_MSG_CHECKING([if strcasecmp is compilable])
  3961. AC_COMPILE_IFELSE([
  3962. AC_LANG_PROGRAM([[
  3963. $curl_includes_string
  3964. ]],[[
  3965. if(0 != strcasecmp(0, 0))
  3966. return 1;
  3967. ]])
  3968. ],[
  3969. AC_MSG_RESULT([yes])
  3970. tst_compi_strcasecmp="yes"
  3971. ],[
  3972. AC_MSG_RESULT([no])
  3973. tst_compi_strcasecmp="no"
  3974. ])
  3975. fi
  3976. #
  3977. if test "$tst_compi_strcasecmp" = "yes"; then
  3978. AC_MSG_CHECKING([if strcasecmp usage allowed])
  3979. if test "x$curl_disallow_strcasecmp" != "xyes"; then
  3980. AC_MSG_RESULT([yes])
  3981. tst_allow_strcasecmp="yes"
  3982. else
  3983. AC_MSG_RESULT([no])
  3984. tst_allow_strcasecmp="no"
  3985. fi
  3986. fi
  3987. #
  3988. AC_MSG_CHECKING([if strcasecmp might be used])
  3989. if test "$tst_links_strcasecmp" = "yes" &&
  3990. test "$tst_proto_strcasecmp" = "yes" &&
  3991. test "$tst_compi_strcasecmp" = "yes" &&
  3992. test "$tst_allow_strcasecmp" = "yes"; then
  3993. AC_MSG_RESULT([yes])
  3994. AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
  3995. [Define to 1 if you have the strcasecmp function.])
  3996. curl_cv_func_strcasecmp="yes"
  3997. else
  3998. AC_MSG_RESULT([no])
  3999. curl_cv_func_strcasecmp="no"
  4000. fi
  4001. ])
  4002. dnl CURL_CHECK_FUNC_STRCMPI
  4003. dnl -------------------------------------------------
  4004. dnl Verify if strcmpi is available, prototyped, and
  4005. dnl can be compiled. If all of these are true, and
  4006. dnl usage has not been previously disallowed with
  4007. dnl shell variable curl_disallow_strcmpi, then
  4008. dnl HAVE_STRCMPI will be defined.
  4009. AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
  4010. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4011. #
  4012. tst_links_strcmpi="unknown"
  4013. tst_proto_strcmpi="unknown"
  4014. tst_compi_strcmpi="unknown"
  4015. tst_allow_strcmpi="unknown"
  4016. #
  4017. AC_MSG_CHECKING([if strcmpi can be linked])
  4018. AC_LINK_IFELSE([
  4019. AC_LANG_FUNC_LINK_TRY([strcmpi])
  4020. ],[
  4021. AC_MSG_RESULT([yes])
  4022. tst_links_strcmpi="yes"
  4023. ],[
  4024. AC_MSG_RESULT([no])
  4025. tst_links_strcmpi="no"
  4026. ])
  4027. #
  4028. if test "$tst_links_strcmpi" = "yes"; then
  4029. AC_MSG_CHECKING([if strcmpi is prototyped])
  4030. AC_EGREP_CPP([strcmpi],[
  4031. $curl_includes_string
  4032. ],[
  4033. AC_MSG_RESULT([yes])
  4034. tst_proto_strcmpi="yes"
  4035. ],[
  4036. AC_MSG_RESULT([no])
  4037. tst_proto_strcmpi="no"
  4038. ])
  4039. fi
  4040. #
  4041. if test "$tst_proto_strcmpi" = "yes"; then
  4042. AC_MSG_CHECKING([if strcmpi is compilable])
  4043. AC_COMPILE_IFELSE([
  4044. AC_LANG_PROGRAM([[
  4045. $curl_includes_string
  4046. ]],[[
  4047. if(0 != strcmpi(0, 0))
  4048. return 1;
  4049. ]])
  4050. ],[
  4051. AC_MSG_RESULT([yes])
  4052. tst_compi_strcmpi="yes"
  4053. ],[
  4054. AC_MSG_RESULT([no])
  4055. tst_compi_strcmpi="no"
  4056. ])
  4057. fi
  4058. #
  4059. if test "$tst_compi_strcmpi" = "yes"; then
  4060. AC_MSG_CHECKING([if strcmpi usage allowed])
  4061. if test "x$curl_disallow_strcmpi" != "xyes"; then
  4062. AC_MSG_RESULT([yes])
  4063. tst_allow_strcmpi="yes"
  4064. else
  4065. AC_MSG_RESULT([no])
  4066. tst_allow_strcmpi="no"
  4067. fi
  4068. fi
  4069. #
  4070. AC_MSG_CHECKING([if strcmpi might be used])
  4071. if test "$tst_links_strcmpi" = "yes" &&
  4072. test "$tst_proto_strcmpi" = "yes" &&
  4073. test "$tst_compi_strcmpi" = "yes" &&
  4074. test "$tst_allow_strcmpi" = "yes"; then
  4075. AC_MSG_RESULT([yes])
  4076. AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
  4077. [Define to 1 if you have the strcmpi function.])
  4078. curl_cv_func_strcmpi="yes"
  4079. else
  4080. AC_MSG_RESULT([no])
  4081. curl_cv_func_strcmpi="no"
  4082. fi
  4083. ])
  4084. dnl CURL_CHECK_FUNC_STRDUP
  4085. dnl -------------------------------------------------
  4086. dnl Verify if strdup is available, prototyped, and
  4087. dnl can be compiled. If all of these are true, and
  4088. dnl usage has not been previously disallowed with
  4089. dnl shell variable curl_disallow_strdup, then
  4090. dnl HAVE_STRDUP will be defined.
  4091. AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
  4092. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4093. #
  4094. tst_links_strdup="unknown"
  4095. tst_proto_strdup="unknown"
  4096. tst_compi_strdup="unknown"
  4097. tst_allow_strdup="unknown"
  4098. #
  4099. AC_MSG_CHECKING([if strdup can be linked])
  4100. AC_LINK_IFELSE([
  4101. AC_LANG_FUNC_LINK_TRY([strdup])
  4102. ],[
  4103. AC_MSG_RESULT([yes])
  4104. tst_links_strdup="yes"
  4105. ],[
  4106. AC_MSG_RESULT([no])
  4107. tst_links_strdup="no"
  4108. ])
  4109. #
  4110. if test "$tst_links_strdup" = "yes"; then
  4111. AC_MSG_CHECKING([if strdup is prototyped])
  4112. AC_EGREP_CPP([strdup],[
  4113. $curl_includes_string
  4114. ],[
  4115. AC_MSG_RESULT([yes])
  4116. tst_proto_strdup="yes"
  4117. ],[
  4118. AC_MSG_RESULT([no])
  4119. tst_proto_strdup="no"
  4120. ])
  4121. fi
  4122. #
  4123. if test "$tst_proto_strdup" = "yes"; then
  4124. AC_MSG_CHECKING([if strdup is compilable])
  4125. AC_COMPILE_IFELSE([
  4126. AC_LANG_PROGRAM([[
  4127. $curl_includes_string
  4128. ]],[[
  4129. if(0 != strdup(0))
  4130. return 1;
  4131. ]])
  4132. ],[
  4133. AC_MSG_RESULT([yes])
  4134. tst_compi_strdup="yes"
  4135. ],[
  4136. AC_MSG_RESULT([no])
  4137. tst_compi_strdup="no"
  4138. ])
  4139. fi
  4140. #
  4141. if test "$tst_compi_strdup" = "yes"; then
  4142. AC_MSG_CHECKING([if strdup usage allowed])
  4143. if test "x$curl_disallow_strdup" != "xyes"; then
  4144. AC_MSG_RESULT([yes])
  4145. tst_allow_strdup="yes"
  4146. else
  4147. AC_MSG_RESULT([no])
  4148. tst_allow_strdup="no"
  4149. fi
  4150. fi
  4151. #
  4152. AC_MSG_CHECKING([if strdup might be used])
  4153. if test "$tst_links_strdup" = "yes" &&
  4154. test "$tst_proto_strdup" = "yes" &&
  4155. test "$tst_compi_strdup" = "yes" &&
  4156. test "$tst_allow_strdup" = "yes"; then
  4157. AC_MSG_RESULT([yes])
  4158. AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
  4159. [Define to 1 if you have the strdup function.])
  4160. curl_cv_func_strdup="yes"
  4161. else
  4162. AC_MSG_RESULT([no])
  4163. curl_cv_func_strdup="no"
  4164. fi
  4165. ])
  4166. dnl CURL_CHECK_FUNC_STRERROR_R
  4167. dnl -------------------------------------------------
  4168. dnl Verify if strerror_r is available, prototyped, can be compiled and
  4169. dnl seems to work. If all of these are true, and usage has not been
  4170. dnl previously disallowed with shell variable curl_disallow_strerror_r,
  4171. dnl then HAVE_STRERROR_R will be defined, as well as one of
  4172. dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
  4173. dnl
  4174. dnl glibc-style strerror_r:
  4175. dnl
  4176. dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
  4177. dnl
  4178. dnl glibc-style strerror_r returns a pointer to the error string,
  4179. dnl and might use the provided workbuf as a scratch area if needed. A
  4180. dnl quick test on a few systems shows that it's usually not used at all.
  4181. dnl
  4182. dnl POSIX-style strerror_r:
  4183. dnl
  4184. dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
  4185. dnl
  4186. dnl POSIX-style strerror_r returns 0 upon successful completion and the
  4187. dnl error string in the provided resultbuf.
  4188. dnl
  4189. AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
  4190. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  4191. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4192. #
  4193. tst_links_strerror_r="unknown"
  4194. tst_proto_strerror_r="unknown"
  4195. tst_compi_strerror_r="unknown"
  4196. tst_glibc_strerror_r="unknown"
  4197. tst_posix_strerror_r="unknown"
  4198. tst_allow_strerror_r="unknown"
  4199. tst_works_glibc_strerror_r="unknown"
  4200. tst_works_posix_strerror_r="unknown"
  4201. tst_glibc_strerror_r_type_arg3="unknown"
  4202. tst_posix_strerror_r_type_arg3="unknown"
  4203. #
  4204. AC_MSG_CHECKING([if strerror_r can be linked])
  4205. AC_LINK_IFELSE([
  4206. AC_LANG_FUNC_LINK_TRY([strerror_r])
  4207. ],[
  4208. AC_MSG_RESULT([yes])
  4209. tst_links_strerror_r="yes"
  4210. ],[
  4211. AC_MSG_RESULT([no])
  4212. tst_links_strerror_r="no"
  4213. ])
  4214. #
  4215. if test "$tst_links_strerror_r" = "yes"; then
  4216. AC_MSG_CHECKING([if strerror_r is prototyped])
  4217. AC_EGREP_CPP([strerror_r],[
  4218. $curl_includes_string
  4219. ],[
  4220. AC_MSG_RESULT([yes])
  4221. tst_proto_strerror_r="yes"
  4222. ],[
  4223. AC_MSG_RESULT([no])
  4224. tst_proto_strerror_r="no"
  4225. ])
  4226. fi
  4227. #
  4228. if test "$tst_proto_strerror_r" = "yes"; then
  4229. AC_MSG_CHECKING([if strerror_r is compilable])
  4230. AC_COMPILE_IFELSE([
  4231. AC_LANG_PROGRAM([[
  4232. $curl_includes_string
  4233. ]],[[
  4234. if(0 != strerror_r(0, 0, 0))
  4235. return 1;
  4236. ]])
  4237. ],[
  4238. AC_MSG_RESULT([yes])
  4239. tst_compi_strerror_r="yes"
  4240. ],[
  4241. AC_MSG_RESULT([no])
  4242. tst_compi_strerror_r="no"
  4243. ])
  4244. fi
  4245. #
  4246. if test "$tst_compi_strerror_r" = "yes"; then
  4247. AC_MSG_CHECKING([if strerror_r is glibc like])
  4248. tst_glibc_strerror_r_type_arg3="unknown"
  4249. for arg3 in 'size_t' 'int' 'unsigned int'; do
  4250. if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
  4251. AC_COMPILE_IFELSE([
  4252. AC_LANG_PROGRAM([[
  4253. $curl_includes_string
  4254. char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
  4255. ]],[[
  4256. if(0 != strerror_r(0, 0, 0))
  4257. return 1;
  4258. ]])
  4259. ],[
  4260. tst_glibc_strerror_r_type_arg3="$arg3"
  4261. ])
  4262. fi
  4263. done
  4264. case "$tst_glibc_strerror_r_type_arg3" in
  4265. unknown)
  4266. AC_MSG_RESULT([no])
  4267. tst_glibc_strerror_r="no"
  4268. ;;
  4269. *)
  4270. AC_MSG_RESULT([yes])
  4271. tst_glibc_strerror_r="yes"
  4272. ;;
  4273. esac
  4274. fi
  4275. #
  4276. dnl only do runtime verification when not cross-compiling
  4277. if test "x$cross_compiling" != "xyes" &&
  4278. test "$tst_glibc_strerror_r" = "yes"; then
  4279. AC_MSG_CHECKING([if strerror_r seems to work])
  4280. CURL_RUN_IFELSE([
  4281. AC_LANG_PROGRAM([[
  4282. $curl_includes_stdlib
  4283. $curl_includes_string
  4284. # include <errno.h>
  4285. ]],[[
  4286. char buffer[1024];
  4287. char *string = 0;
  4288. buffer[0] = '\0';
  4289. string = strerror_r(EACCES, buffer, sizeof(buffer));
  4290. if(!string)
  4291. exit(1); /* fail */
  4292. if(!string[0])
  4293. exit(1); /* fail */
  4294. else
  4295. exit(0);
  4296. ]])
  4297. ],[
  4298. AC_MSG_RESULT([yes])
  4299. tst_works_glibc_strerror_r="yes"
  4300. ],[
  4301. AC_MSG_RESULT([no])
  4302. tst_works_glibc_strerror_r="no"
  4303. ])
  4304. fi
  4305. #
  4306. if test "$tst_compi_strerror_r" = "yes" &&
  4307. test "$tst_works_glibc_strerror_r" != "yes"; then
  4308. AC_MSG_CHECKING([if strerror_r is POSIX like])
  4309. tst_posix_strerror_r_type_arg3="unknown"
  4310. for arg3 in 'size_t' 'int' 'unsigned int'; do
  4311. if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
  4312. AC_COMPILE_IFELSE([
  4313. AC_LANG_PROGRAM([[
  4314. $curl_includes_string
  4315. int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
  4316. ]],[[
  4317. if(0 != strerror_r(0, 0, 0))
  4318. return 1;
  4319. ]])
  4320. ],[
  4321. tst_posix_strerror_r_type_arg3="$arg3"
  4322. ])
  4323. fi
  4324. done
  4325. case "$tst_posix_strerror_r_type_arg3" in
  4326. unknown)
  4327. AC_MSG_RESULT([no])
  4328. tst_posix_strerror_r="no"
  4329. ;;
  4330. *)
  4331. AC_MSG_RESULT([yes])
  4332. tst_posix_strerror_r="yes"
  4333. ;;
  4334. esac
  4335. fi
  4336. #
  4337. dnl only do runtime verification when not cross-compiling
  4338. if test "x$cross_compiling" != "xyes" &&
  4339. test "$tst_posix_strerror_r" = "yes"; then
  4340. AC_MSG_CHECKING([if strerror_r seems to work])
  4341. CURL_RUN_IFELSE([
  4342. AC_LANG_PROGRAM([[
  4343. $curl_includes_stdlib
  4344. $curl_includes_string
  4345. # include <errno.h>
  4346. ]],[[
  4347. char buffer[1024];
  4348. int error = 1;
  4349. buffer[0] = '\0';
  4350. error = strerror_r(EACCES, buffer, sizeof(buffer));
  4351. if(error)
  4352. exit(1); /* fail */
  4353. if(buffer[0] == '\0')
  4354. exit(1); /* fail */
  4355. else
  4356. exit(0);
  4357. ]])
  4358. ],[
  4359. AC_MSG_RESULT([yes])
  4360. tst_works_posix_strerror_r="yes"
  4361. ],[
  4362. AC_MSG_RESULT([no])
  4363. tst_works_posix_strerror_r="no"
  4364. ])
  4365. fi
  4366. #
  4367. if test "$tst_works_glibc_strerror_r" = "yes"; then
  4368. tst_posix_strerror_r="no"
  4369. fi
  4370. if test "$tst_works_posix_strerror_r" = "yes"; then
  4371. tst_glibc_strerror_r="no"
  4372. fi
  4373. if test "$tst_glibc_strerror_r" = "yes" &&
  4374. test "$tst_works_glibc_strerror_r" != "no" &&
  4375. test "$tst_posix_strerror_r" != "yes"; then
  4376. tst_allow_strerror_r="check"
  4377. fi
  4378. if test "$tst_posix_strerror_r" = "yes" &&
  4379. test "$tst_works_posix_strerror_r" != "no" &&
  4380. test "$tst_glibc_strerror_r" != "yes"; then
  4381. tst_allow_strerror_r="check"
  4382. fi
  4383. if test "$tst_allow_strerror_r" = "check"; then
  4384. AC_MSG_CHECKING([if strerror_r usage allowed])
  4385. if test "x$curl_disallow_strerror_r" != "xyes"; then
  4386. AC_MSG_RESULT([yes])
  4387. tst_allow_strerror_r="yes"
  4388. else
  4389. AC_MSG_RESULT([no])
  4390. tst_allow_strerror_r="no"
  4391. fi
  4392. fi
  4393. #
  4394. AC_MSG_CHECKING([if strerror_r might be used])
  4395. if test "$tst_links_strerror_r" = "yes" &&
  4396. test "$tst_proto_strerror_r" = "yes" &&
  4397. test "$tst_compi_strerror_r" = "yes" &&
  4398. test "$tst_allow_strerror_r" = "yes"; then
  4399. AC_MSG_RESULT([yes])
  4400. if test "$tst_glibc_strerror_r" = "yes"; then
  4401. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  4402. [Define to 1 if you have the strerror_r function.])
  4403. AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
  4404. [Define to 1 if you have a working glibc-style strerror_r function.])
  4405. fi
  4406. if test "$tst_posix_strerror_r" = "yes"; then
  4407. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  4408. [Define to 1 if you have the strerror_r function.])
  4409. AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
  4410. [Define to 1 if you have a working POSIX-style strerror_r function.])
  4411. fi
  4412. curl_cv_func_strerror_r="yes"
  4413. else
  4414. AC_MSG_RESULT([no])
  4415. curl_cv_func_strerror_r="no"
  4416. fi
  4417. #
  4418. if test "$tst_compi_strerror_r" = "yes" &&
  4419. test "$tst_allow_strerror_r" = "unknown"; then
  4420. AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.])
  4421. fi
  4422. #
  4423. ])
  4424. dnl CURL_CHECK_FUNC_STRICMP
  4425. dnl -------------------------------------------------
  4426. dnl Verify if stricmp is available, prototyped, and
  4427. dnl can be compiled. If all of these are true, and
  4428. dnl usage has not been previously disallowed with
  4429. dnl shell variable curl_disallow_stricmp, then
  4430. dnl HAVE_STRICMP will be defined.
  4431. AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
  4432. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4433. #
  4434. tst_links_stricmp="unknown"
  4435. tst_proto_stricmp="unknown"
  4436. tst_compi_stricmp="unknown"
  4437. tst_allow_stricmp="unknown"
  4438. #
  4439. AC_MSG_CHECKING([if stricmp can be linked])
  4440. AC_LINK_IFELSE([
  4441. AC_LANG_FUNC_LINK_TRY([stricmp])
  4442. ],[
  4443. AC_MSG_RESULT([yes])
  4444. tst_links_stricmp="yes"
  4445. ],[
  4446. AC_MSG_RESULT([no])
  4447. tst_links_stricmp="no"
  4448. ])
  4449. #
  4450. if test "$tst_links_stricmp" = "yes"; then
  4451. AC_MSG_CHECKING([if stricmp is prototyped])
  4452. AC_EGREP_CPP([stricmp],[
  4453. $curl_includes_string
  4454. ],[
  4455. AC_MSG_RESULT([yes])
  4456. tst_proto_stricmp="yes"
  4457. ],[
  4458. AC_MSG_RESULT([no])
  4459. tst_proto_stricmp="no"
  4460. ])
  4461. fi
  4462. #
  4463. if test "$tst_proto_stricmp" = "yes"; then
  4464. AC_MSG_CHECKING([if stricmp is compilable])
  4465. AC_COMPILE_IFELSE([
  4466. AC_LANG_PROGRAM([[
  4467. $curl_includes_string
  4468. ]],[[
  4469. if(0 != stricmp(0, 0))
  4470. return 1;
  4471. ]])
  4472. ],[
  4473. AC_MSG_RESULT([yes])
  4474. tst_compi_stricmp="yes"
  4475. ],[
  4476. AC_MSG_RESULT([no])
  4477. tst_compi_stricmp="no"
  4478. ])
  4479. fi
  4480. #
  4481. if test "$tst_compi_stricmp" = "yes"; then
  4482. AC_MSG_CHECKING([if stricmp usage allowed])
  4483. if test "x$curl_disallow_stricmp" != "xyes"; then
  4484. AC_MSG_RESULT([yes])
  4485. tst_allow_stricmp="yes"
  4486. else
  4487. AC_MSG_RESULT([no])
  4488. tst_allow_stricmp="no"
  4489. fi
  4490. fi
  4491. #
  4492. AC_MSG_CHECKING([if stricmp might be used])
  4493. if test "$tst_links_stricmp" = "yes" &&
  4494. test "$tst_proto_stricmp" = "yes" &&
  4495. test "$tst_compi_stricmp" = "yes" &&
  4496. test "$tst_allow_stricmp" = "yes"; then
  4497. AC_MSG_RESULT([yes])
  4498. AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
  4499. [Define to 1 if you have the stricmp function.])
  4500. curl_cv_func_stricmp="yes"
  4501. else
  4502. AC_MSG_RESULT([no])
  4503. curl_cv_func_stricmp="no"
  4504. fi
  4505. ])
  4506. dnl CURL_CHECK_FUNC_STRTOK_R
  4507. dnl -------------------------------------------------
  4508. dnl Verify if strtok_r is available, prototyped, and
  4509. dnl can be compiled. If all of these are true, and
  4510. dnl usage has not been previously disallowed with
  4511. dnl shell variable curl_disallow_strtok_r, then
  4512. dnl HAVE_STRTOK_R will be defined.
  4513. AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
  4514. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4515. #
  4516. tst_links_strtok_r="unknown"
  4517. tst_proto_strtok_r="unknown"
  4518. tst_compi_strtok_r="unknown"
  4519. tst_allow_strtok_r="unknown"
  4520. #
  4521. AC_MSG_CHECKING([if strtok_r can be linked])
  4522. AC_LINK_IFELSE([
  4523. AC_LANG_FUNC_LINK_TRY([strtok_r])
  4524. ],[
  4525. AC_MSG_RESULT([yes])
  4526. tst_links_strtok_r="yes"
  4527. ],[
  4528. AC_MSG_RESULT([no])
  4529. tst_links_strtok_r="no"
  4530. ])
  4531. #
  4532. if test "$tst_links_strtok_r" = "yes"; then
  4533. AC_MSG_CHECKING([if strtok_r is prototyped])
  4534. AC_EGREP_CPP([strtok_r],[
  4535. $curl_includes_string
  4536. ],[
  4537. AC_MSG_RESULT([yes])
  4538. tst_proto_strtok_r="yes"
  4539. ],[
  4540. AC_MSG_RESULT([no])
  4541. tst_proto_strtok_r="no"
  4542. ])
  4543. fi
  4544. #
  4545. if test "$tst_proto_strtok_r" = "yes"; then
  4546. AC_MSG_CHECKING([if strtok_r is compilable])
  4547. AC_COMPILE_IFELSE([
  4548. AC_LANG_PROGRAM([[
  4549. $curl_includes_string
  4550. ]],[[
  4551. if(0 != strtok_r(0, 0, 0))
  4552. return 1;
  4553. ]])
  4554. ],[
  4555. AC_MSG_RESULT([yes])
  4556. tst_compi_strtok_r="yes"
  4557. ],[
  4558. AC_MSG_RESULT([no])
  4559. tst_compi_strtok_r="no"
  4560. ])
  4561. fi
  4562. #
  4563. if test "$tst_compi_strtok_r" = "yes"; then
  4564. AC_MSG_CHECKING([if strtok_r usage allowed])
  4565. if test "x$curl_disallow_strtok_r" != "xyes"; then
  4566. AC_MSG_RESULT([yes])
  4567. tst_allow_strtok_r="yes"
  4568. else
  4569. AC_MSG_RESULT([no])
  4570. tst_allow_strtok_r="no"
  4571. fi
  4572. fi
  4573. #
  4574. AC_MSG_CHECKING([if strtok_r might be used])
  4575. if test "$tst_links_strtok_r" = "yes" &&
  4576. test "$tst_proto_strtok_r" = "yes" &&
  4577. test "$tst_compi_strtok_r" = "yes" &&
  4578. test "$tst_allow_strtok_r" = "yes"; then
  4579. AC_MSG_RESULT([yes])
  4580. AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
  4581. [Define to 1 if you have the strtok_r function.])
  4582. curl_cv_func_strtok_r="yes"
  4583. else
  4584. AC_MSG_RESULT([no])
  4585. curl_cv_func_strtok_r="no"
  4586. fi
  4587. ])
  4588. dnl CURL_CHECK_FUNC_STRTOLL
  4589. dnl -------------------------------------------------
  4590. dnl Verify if strtoll is available, prototyped, and
  4591. dnl can be compiled. If all of these are true, and
  4592. dnl usage has not been previously disallowed with
  4593. dnl shell variable curl_disallow_strtoll, then
  4594. dnl HAVE_STRTOLL will be defined.
  4595. AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
  4596. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  4597. #
  4598. tst_links_strtoll="unknown"
  4599. tst_proto_strtoll="unknown"
  4600. tst_compi_strtoll="unknown"
  4601. tst_allow_strtoll="unknown"
  4602. #
  4603. AC_MSG_CHECKING([if strtoll can be linked])
  4604. AC_LINK_IFELSE([
  4605. AC_LANG_FUNC_LINK_TRY([strtoll])
  4606. ],[
  4607. AC_MSG_RESULT([yes])
  4608. tst_links_strtoll="yes"
  4609. ],[
  4610. AC_MSG_RESULT([no])
  4611. tst_links_strtoll="no"
  4612. ])
  4613. #
  4614. if test "$tst_links_strtoll" = "yes"; then
  4615. AC_MSG_CHECKING([if strtoll is prototyped])
  4616. AC_EGREP_CPP([strtoll],[
  4617. $curl_includes_stdlib
  4618. ],[
  4619. AC_MSG_RESULT([yes])
  4620. tst_proto_strtoll="yes"
  4621. ],[
  4622. AC_MSG_RESULT([no])
  4623. tst_proto_strtoll="no"
  4624. ])
  4625. fi
  4626. #
  4627. if test "$tst_proto_strtoll" = "yes"; then
  4628. AC_MSG_CHECKING([if strtoll is compilable])
  4629. AC_COMPILE_IFELSE([
  4630. AC_LANG_PROGRAM([[
  4631. $curl_includes_stdlib
  4632. ]],[[
  4633. if(0 != strtoll(0, 0, 0))
  4634. return 1;
  4635. ]])
  4636. ],[
  4637. AC_MSG_RESULT([yes])
  4638. tst_compi_strtoll="yes"
  4639. ],[
  4640. AC_MSG_RESULT([no])
  4641. tst_compi_strtoll="no"
  4642. ])
  4643. fi
  4644. #
  4645. if test "$tst_compi_strtoll" = "yes"; then
  4646. AC_MSG_CHECKING([if strtoll usage allowed])
  4647. if test "x$curl_disallow_strtoll" != "xyes"; then
  4648. AC_MSG_RESULT([yes])
  4649. tst_allow_strtoll="yes"
  4650. else
  4651. AC_MSG_RESULT([no])
  4652. tst_allow_strtoll="no"
  4653. fi
  4654. fi
  4655. #
  4656. AC_MSG_CHECKING([if strtoll might be used])
  4657. if test "$tst_links_strtoll" = "yes" &&
  4658. test "$tst_proto_strtoll" = "yes" &&
  4659. test "$tst_compi_strtoll" = "yes" &&
  4660. test "$tst_allow_strtoll" = "yes"; then
  4661. AC_MSG_RESULT([yes])
  4662. AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
  4663. [Define to 1 if you have the strtoll function.])
  4664. curl_cv_func_strtoll="yes"
  4665. else
  4666. AC_MSG_RESULT([no])
  4667. curl_cv_func_strtoll="no"
  4668. fi
  4669. ])
  4670. dnl CURL_RUN_IFELSE
  4671. dnl -------------------------------------------------
  4672. dnl Wrapper macro to use instead of AC_RUN_IFELSE. It
  4673. dnl sets LD_LIBRARY_PATH locally for this run only, from the
  4674. dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH
  4675. dnl changes contained within this macro.
  4676. AC_DEFUN([CURL_RUN_IFELSE], [
  4677. case $host_os in
  4678. darwin*)
  4679. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  4680. ;;
  4681. *)
  4682. oldcc=$CC
  4683. old=$LD_LIBRARY_PATH
  4684. CC="sh ./run-compiler"
  4685. LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old
  4686. export LD_LIBRARY_PATH
  4687. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  4688. LD_LIBRARY_PATH=$old # restore
  4689. CC=$oldcc
  4690. ;;
  4691. esac
  4692. ])
  4693. dnl CURL_COVERAGE
  4694. dnl --------------------------------------------------
  4695. dnl Switch on options and libs to build with gcc's code coverage.
  4696. dnl
  4697. AC_DEFUN([CURL_COVERAGE],[
  4698. AC_REQUIRE([AC_PROG_SED])
  4699. AC_REQUIRE([AC_ARG_ENABLE])
  4700. AC_MSG_CHECKING([for code coverage support])
  4701. coverage="no"
  4702. curl_coverage_msg="disabled"
  4703. dnl check if enabled by argument
  4704. AC_ARG_ENABLE(code-coverage,
  4705. AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]),
  4706. coverage="$enableval")
  4707. dnl if not gcc switch off again
  4708. AS_IF([ test "$GCC" != "yes" ], coverage="no" )
  4709. AC_MSG_RESULT($coverage)
  4710. if test "x$coverage" = "xyes"; then
  4711. curl_coverage_msg="enabled"
  4712. AC_CHECK_TOOL([GCOV], [gcov], [gcov])
  4713. if test -z "$GCOV"; then
  4714. AC_MSG_ERROR([needs gcov for code coverage])
  4715. fi
  4716. AC_CHECK_PROG([LCOV], [lcov], [lcov])
  4717. if test -z "$LCOV"; then
  4718. AC_MSG_ERROR([needs lcov for code coverage])
  4719. fi
  4720. CPPFLAGS="$CPPFLAGS -DNDEBUG"
  4721. CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
  4722. LIBS="$LIBS -lgcov"
  4723. fi
  4724. ])
  4725. dnl CURL_ATOMIC
  4726. dnl -------------------------------------------------------------
  4727. dnl Check if _Atomic works. But only check if stdatomic.h exists.
  4728. dnl
  4729. AC_DEFUN([CURL_ATOMIC],[
  4730. AC_CHECK_HEADERS(stdatomic.h, [
  4731. AC_MSG_CHECKING([if _Atomic is available])
  4732. AC_LINK_IFELSE([
  4733. AC_LANG_PROGRAM([[
  4734. $curl_includes_unistd
  4735. ]],[[
  4736. _Atomic int i = 0;
  4737. i = 4; // Force an atomic-write operation.
  4738. ]])
  4739. ],[
  4740. AC_MSG_RESULT([yes])
  4741. AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
  4742. [Define to 1 if you have _Atomic support.])
  4743. tst_atomic="yes"
  4744. ],[
  4745. AC_MSG_RESULT([no])
  4746. tst_atomic="no"
  4747. ])
  4748. ])
  4749. ])
  4750. # Rewrite inspired by the functionality once provided by
  4751. # AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the
  4752. # given type.
  4753. #
  4754. # This code fails to compile:
  4755. #
  4756. # switch() { case 0: case 0: }
  4757. #
  4758. # By making the second case number a boolean check, it fails to compile the
  4759. # test code when the boolean is false and thus creating a zero, making it a
  4760. # duplicated case label. If the boolean equals true, it becomes a one, the
  4761. # code compiles and we know it was a match.
  4762. #
  4763. # The check iterates over all possible sizes and stops as soon it compiles
  4764. # error-free.
  4765. #
  4766. # Usage:
  4767. #
  4768. # CURL_SIZEOF(TYPE, [HEADERS])
  4769. #
  4770. AC_DEFUN([CURL_SIZEOF], [
  4771. dnl The #define name to make autoheader put the name in curl_config.h.in
  4772. define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
  4773. AC_MSG_CHECKING(size of $1)
  4774. r=0
  4775. dnl Check the sizes in a reasonable order
  4776. for typesize in 8 4 2 16 1; do
  4777. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  4778. #include <sys/types.h>
  4779. $2
  4780. ]],
  4781. [switch(0) {
  4782. case 0:
  4783. case (sizeof($1) == $typesize):;
  4784. }
  4785. ]) ],
  4786. [
  4787. r=$typesize],
  4788. [
  4789. r=0])
  4790. dnl get out of the loop once matched
  4791. if test $r -gt 0; then
  4792. break;
  4793. fi
  4794. done
  4795. if test $r -eq 0; then
  4796. AC_MSG_ERROR([Failed to find size of $1])
  4797. fi
  4798. AC_MSG_RESULT($r)
  4799. dnl lowercase and underscore instead of space
  4800. tname=`echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_"`
  4801. eval "$tname=$r"
  4802. AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes])
  4803. ])