curl-functions.m4 132 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018
  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 in
  1381. *-apple-*)
  1382. dnl Darwin 6.0 and macOS 10.2.X and newer
  1383. tst_tsafe_getaddrinfo="yes"
  1384. esac
  1385. case $host_os in
  1386. aix[[1234]].* | aix5.[[01]].*)
  1387. dnl AIX 5.1 and older
  1388. tst_tsafe_getaddrinfo="no"
  1389. ;;
  1390. aix*)
  1391. dnl AIX 5.2 and newer
  1392. tst_tsafe_getaddrinfo="yes"
  1393. ;;
  1394. darwin[[12345]].*)
  1395. dnl Darwin 5.0 and macOS 10.1.X and older
  1396. tst_tsafe_getaddrinfo="no"
  1397. ;;
  1398. freebsd[[1234]].* | freebsd5.[[1234]]*)
  1399. dnl FreeBSD 5.4 and older
  1400. tst_tsafe_getaddrinfo="no"
  1401. ;;
  1402. freebsd*)
  1403. dnl FreeBSD 5.5 and newer
  1404. tst_tsafe_getaddrinfo="yes"
  1405. ;;
  1406. hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
  1407. dnl HP-UX 11.10 and older
  1408. tst_tsafe_getaddrinfo="no"
  1409. ;;
  1410. hpux*)
  1411. dnl HP-UX 11.11 and newer
  1412. tst_tsafe_getaddrinfo="yes"
  1413. ;;
  1414. midnightbsd*)
  1415. dnl all MidnightBSD versions
  1416. tst_tsafe_getaddrinfo="yes"
  1417. ;;
  1418. netbsd[[123]].*)
  1419. dnl NetBSD 3.X and older
  1420. tst_tsafe_getaddrinfo="no"
  1421. ;;
  1422. netbsd*)
  1423. dnl NetBSD 4.X and newer
  1424. tst_tsafe_getaddrinfo="yes"
  1425. ;;
  1426. *bsd*)
  1427. dnl All other BSD's
  1428. tst_tsafe_getaddrinfo="no"
  1429. ;;
  1430. solaris2*)
  1431. dnl Solaris which have it
  1432. tst_tsafe_getaddrinfo="yes"
  1433. ;;
  1434. esac
  1435. if test "$tst_tsafe_getaddrinfo" = "unknown" &&
  1436. test "$curl_cv_native_windows" = "yes"; then
  1437. tst_tsafe_getaddrinfo="yes"
  1438. fi
  1439. if test "$tst_tsafe_getaddrinfo" = "unknown"; then
  1440. CURL_CHECK_DEF_CC([h_errno], [
  1441. $curl_includes_sys_socket
  1442. $curl_includes_netdb
  1443. ], [silent])
  1444. if test "$curl_cv_have_def_h_errno" = "yes"; then
  1445. tst_h_errno_macro="yes"
  1446. else
  1447. tst_h_errno_macro="no"
  1448. fi
  1449. AC_COMPILE_IFELSE([
  1450. AC_LANG_PROGRAM([[
  1451. $curl_includes_sys_socket
  1452. $curl_includes_netdb
  1453. ]],[[
  1454. h_errno = 2;
  1455. if(0 != h_errno)
  1456. return 1;
  1457. ]])
  1458. ],[
  1459. tst_h_errno_modifiable_lvalue="yes"
  1460. ],[
  1461. tst_h_errno_modifiable_lvalue="no"
  1462. ])
  1463. AC_COMPILE_IFELSE([
  1464. AC_LANG_PROGRAM([[
  1465. ]],[[
  1466. #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
  1467. return 0;
  1468. #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
  1469. return 0;
  1470. #else
  1471. #error force compilation error
  1472. #endif
  1473. ]])
  1474. ],[
  1475. tst_h_errno_sbs_issue_7="yes"
  1476. ],[
  1477. tst_h_errno_sbs_issue_7="no"
  1478. ])
  1479. if test "$tst_h_errno_macro" = "no" &&
  1480. test "$tst_h_errno_modifiable_lvalue" = "no" &&
  1481. test "$tst_h_errno_sbs_issue_7" = "no"; then
  1482. tst_tsafe_getaddrinfo="no"
  1483. else
  1484. tst_tsafe_getaddrinfo="yes"
  1485. fi
  1486. fi
  1487. AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
  1488. if test "$tst_tsafe_getaddrinfo" = "yes"; then
  1489. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
  1490. [Define to 1 if the getaddrinfo function is threadsafe.])
  1491. curl_cv_func_getaddrinfo_threadsafe="yes"
  1492. else
  1493. curl_cv_func_getaddrinfo_threadsafe="no"
  1494. fi
  1495. fi
  1496. ])
  1497. dnl CURL_CHECK_FUNC_GETHOSTBYNAME
  1498. dnl -------------------------------------------------
  1499. dnl Verify if gethostbyname is available, prototyped,
  1500. dnl and can be compiled. If all of these are true,
  1501. dnl and usage has not been previously disallowed with
  1502. dnl shell variable curl_disallow_gethostbyname, then
  1503. dnl HAVE_GETHOSTBYNAME will be defined.
  1504. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [
  1505. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1506. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1507. #
  1508. tst_links_gethostbyname="unknown"
  1509. tst_proto_gethostbyname="unknown"
  1510. tst_compi_gethostbyname="unknown"
  1511. tst_allow_gethostbyname="unknown"
  1512. #
  1513. AC_MSG_CHECKING([if gethostbyname can be linked])
  1514. AC_LINK_IFELSE([
  1515. AC_LANG_PROGRAM([[
  1516. $curl_includes_winsock2
  1517. $curl_includes_bsdsocket
  1518. $curl_includes_netdb
  1519. ]],[[
  1520. if(0 != gethostbyname(0))
  1521. return 1;
  1522. ]])
  1523. ],[
  1524. AC_MSG_RESULT([yes])
  1525. tst_links_gethostbyname="yes"
  1526. ],[
  1527. AC_MSG_RESULT([no])
  1528. tst_links_gethostbyname="no"
  1529. ])
  1530. #
  1531. if test "$tst_links_gethostbyname" = "yes"; then
  1532. AC_MSG_CHECKING([if gethostbyname is prototyped])
  1533. AC_EGREP_CPP([gethostbyname],[
  1534. $curl_includes_winsock2
  1535. $curl_includes_bsdsocket
  1536. $curl_includes_netdb
  1537. ],[
  1538. AC_MSG_RESULT([yes])
  1539. tst_proto_gethostbyname="yes"
  1540. ],[
  1541. AC_MSG_RESULT([no])
  1542. tst_proto_gethostbyname="no"
  1543. ])
  1544. fi
  1545. #
  1546. if test "$tst_proto_gethostbyname" = "yes"; then
  1547. AC_MSG_CHECKING([if gethostbyname is compilable])
  1548. AC_COMPILE_IFELSE([
  1549. AC_LANG_PROGRAM([[
  1550. $curl_includes_winsock2
  1551. $curl_includes_bsdsocket
  1552. $curl_includes_netdb
  1553. ]],[[
  1554. if(0 != gethostbyname(0))
  1555. return 1;
  1556. ]])
  1557. ],[
  1558. AC_MSG_RESULT([yes])
  1559. tst_compi_gethostbyname="yes"
  1560. ],[
  1561. AC_MSG_RESULT([no])
  1562. tst_compi_gethostbyname="no"
  1563. ])
  1564. fi
  1565. #
  1566. if test "$tst_compi_gethostbyname" = "yes"; then
  1567. AC_MSG_CHECKING([if gethostbyname usage allowed])
  1568. if test "x$curl_disallow_gethostbyname" != "xyes"; then
  1569. AC_MSG_RESULT([yes])
  1570. tst_allow_gethostbyname="yes"
  1571. else
  1572. AC_MSG_RESULT([no])
  1573. tst_allow_gethostbyname="no"
  1574. fi
  1575. fi
  1576. #
  1577. AC_MSG_CHECKING([if gethostbyname might be used])
  1578. if test "$tst_links_gethostbyname" = "yes" &&
  1579. test "$tst_proto_gethostbyname" = "yes" &&
  1580. test "$tst_compi_gethostbyname" = "yes" &&
  1581. test "$tst_allow_gethostbyname" = "yes"; then
  1582. AC_MSG_RESULT([yes])
  1583. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
  1584. [Define to 1 if you have the gethostbyname function.])
  1585. curl_cv_func_gethostbyname="yes"
  1586. else
  1587. AC_MSG_RESULT([no])
  1588. curl_cv_func_gethostbyname="no"
  1589. fi
  1590. ])
  1591. dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R
  1592. dnl -------------------------------------------------
  1593. dnl Verify if gethostbyname_r is available, prototyped,
  1594. dnl and can be compiled. If all of these are true, and
  1595. dnl usage has not been previously disallowed with
  1596. dnl shell variable curl_disallow_gethostbyname_r, then
  1597. dnl HAVE_GETHOSTBYNAME_R will be defined.
  1598. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [
  1599. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1600. #
  1601. tst_links_gethostbyname_r="unknown"
  1602. tst_proto_gethostbyname_r="unknown"
  1603. tst_compi_gethostbyname_r="unknown"
  1604. tst_allow_gethostbyname_r="unknown"
  1605. tst_nargs_gethostbyname_r="unknown"
  1606. #
  1607. AC_MSG_CHECKING([if gethostbyname_r can be linked])
  1608. AC_LINK_IFELSE([
  1609. AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
  1610. ],[
  1611. AC_MSG_RESULT([yes])
  1612. tst_links_gethostbyname_r="yes"
  1613. ],[
  1614. AC_MSG_RESULT([no])
  1615. tst_links_gethostbyname_r="no"
  1616. ])
  1617. #
  1618. if test "$tst_links_gethostbyname_r" = "yes"; then
  1619. AC_MSG_CHECKING([if gethostbyname_r is prototyped])
  1620. AC_EGREP_CPP([gethostbyname_r],[
  1621. $curl_includes_netdb
  1622. ],[
  1623. AC_MSG_RESULT([yes])
  1624. tst_proto_gethostbyname_r="yes"
  1625. ],[
  1626. AC_MSG_RESULT([no])
  1627. tst_proto_gethostbyname_r="no"
  1628. ])
  1629. fi
  1630. #
  1631. if test "$tst_proto_gethostbyname_r" = "yes"; then
  1632. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1633. AC_MSG_CHECKING([if gethostbyname_r takes 3 args.])
  1634. AC_COMPILE_IFELSE([
  1635. AC_LANG_PROGRAM([[
  1636. $curl_includes_netdb
  1637. $curl_includes_bsdsocket
  1638. ]],[[
  1639. if(0 != gethostbyname_r(0, 0, 0))
  1640. return 1;
  1641. ]])
  1642. ],[
  1643. AC_MSG_RESULT([yes])
  1644. tst_compi_gethostbyname_r="yes"
  1645. tst_nargs_gethostbyname_r="3"
  1646. ],[
  1647. AC_MSG_RESULT([no])
  1648. tst_compi_gethostbyname_r="no"
  1649. ])
  1650. fi
  1651. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1652. AC_MSG_CHECKING([if gethostbyname_r takes 5 args.])
  1653. AC_COMPILE_IFELSE([
  1654. AC_LANG_PROGRAM([[
  1655. $curl_includes_netdb
  1656. $curl_includes_bsdsocket
  1657. ]],[[
  1658. if(0 != gethostbyname_r(0, 0, 0, 0, 0))
  1659. return 1;
  1660. ]])
  1661. ],[
  1662. AC_MSG_RESULT([yes])
  1663. tst_compi_gethostbyname_r="yes"
  1664. tst_nargs_gethostbyname_r="5"
  1665. ],[
  1666. AC_MSG_RESULT([no])
  1667. tst_compi_gethostbyname_r="no"
  1668. ])
  1669. fi
  1670. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  1671. AC_MSG_CHECKING([if gethostbyname_r takes 6 args.])
  1672. AC_COMPILE_IFELSE([
  1673. AC_LANG_PROGRAM([[
  1674. $curl_includes_netdb
  1675. $curl_includes_bsdsocket
  1676. ]],[[
  1677. if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0))
  1678. return 1;
  1679. ]])
  1680. ],[
  1681. AC_MSG_RESULT([yes])
  1682. tst_compi_gethostbyname_r="yes"
  1683. tst_nargs_gethostbyname_r="6"
  1684. ],[
  1685. AC_MSG_RESULT([no])
  1686. tst_compi_gethostbyname_r="no"
  1687. ])
  1688. fi
  1689. AC_MSG_CHECKING([if gethostbyname_r is compilable])
  1690. if test "$tst_compi_gethostbyname_r" = "yes"; then
  1691. AC_MSG_RESULT([yes])
  1692. else
  1693. AC_MSG_RESULT([no])
  1694. fi
  1695. fi
  1696. #
  1697. if test "$tst_compi_gethostbyname_r" = "yes"; then
  1698. AC_MSG_CHECKING([if gethostbyname_r usage allowed])
  1699. if test "x$curl_disallow_gethostbyname_r" != "xyes"; then
  1700. AC_MSG_RESULT([yes])
  1701. tst_allow_gethostbyname_r="yes"
  1702. else
  1703. AC_MSG_RESULT([no])
  1704. tst_allow_gethostbyname_r="no"
  1705. fi
  1706. fi
  1707. #
  1708. AC_MSG_CHECKING([if gethostbyname_r might be used])
  1709. if test "$tst_links_gethostbyname_r" = "yes" &&
  1710. test "$tst_proto_gethostbyname_r" = "yes" &&
  1711. test "$tst_compi_gethostbyname_r" = "yes" &&
  1712. test "$tst_allow_gethostbyname_r" = "yes"; then
  1713. AC_MSG_RESULT([yes])
  1714. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
  1715. [Define to 1 if you have the gethostbyname_r function.])
  1716. dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r,
  1717. dnl [Specifies the number of arguments to gethostbyname_r])
  1718. #
  1719. if test "$tst_nargs_gethostbyname_r" -eq "3"; then
  1720. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
  1721. elif test "$tst_nargs_gethostbyname_r" -eq "5"; then
  1722. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
  1723. elif test "$tst_nargs_gethostbyname_r" -eq "6"; then
  1724. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
  1725. fi
  1726. #
  1727. curl_cv_func_gethostbyname_r="yes"
  1728. else
  1729. AC_MSG_RESULT([no])
  1730. curl_cv_func_gethostbyname_r="no"
  1731. fi
  1732. ])
  1733. dnl CURL_CHECK_FUNC_GETHOSTNAME
  1734. dnl -------------------------------------------------
  1735. dnl Verify if gethostname is available, prototyped, and
  1736. dnl can be compiled. If all of these are true, and
  1737. dnl usage has not been previously disallowed with
  1738. dnl shell variable curl_disallow_gethostname, then
  1739. dnl HAVE_GETHOSTNAME will be defined.
  1740. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
  1741. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1742. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1743. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1744. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1745. #
  1746. tst_links_gethostname="unknown"
  1747. tst_proto_gethostname="unknown"
  1748. tst_compi_gethostname="unknown"
  1749. tst_allow_gethostname="unknown"
  1750. #
  1751. AC_MSG_CHECKING([if gethostname can be linked])
  1752. AC_LINK_IFELSE([
  1753. AC_LANG_PROGRAM([[
  1754. $curl_includes_winsock2
  1755. $curl_includes_unistd
  1756. $curl_includes_bsdsocket
  1757. ]],[[
  1758. if(0 != gethostname(0, 0))
  1759. return 1;
  1760. ]])
  1761. ],[
  1762. AC_MSG_RESULT([yes])
  1763. tst_links_gethostname="yes"
  1764. ],[
  1765. AC_MSG_RESULT([no])
  1766. tst_links_gethostname="no"
  1767. ])
  1768. #
  1769. if test "$tst_links_gethostname" = "yes"; then
  1770. AC_MSG_CHECKING([if gethostname is prototyped])
  1771. AC_EGREP_CPP([gethostname],[
  1772. $curl_includes_winsock2
  1773. $curl_includes_unistd
  1774. $curl_includes_bsdsocket
  1775. ],[
  1776. AC_MSG_RESULT([yes])
  1777. tst_proto_gethostname="yes"
  1778. ],[
  1779. AC_MSG_RESULT([no])
  1780. tst_proto_gethostname="no"
  1781. ])
  1782. fi
  1783. #
  1784. if test "$tst_proto_gethostname" = "yes"; then
  1785. AC_MSG_CHECKING([if gethostname is compilable])
  1786. AC_COMPILE_IFELSE([
  1787. AC_LANG_PROGRAM([[
  1788. $curl_includes_winsock2
  1789. $curl_includes_unistd
  1790. $curl_includes_bsdsocket
  1791. ]],[[
  1792. if(0 != gethostname(0, 0))
  1793. return 1;
  1794. ]])
  1795. ],[
  1796. AC_MSG_RESULT([yes])
  1797. tst_compi_gethostname="yes"
  1798. ],[
  1799. AC_MSG_RESULT([no])
  1800. tst_compi_gethostname="no"
  1801. ])
  1802. fi
  1803. #
  1804. if test "$tst_compi_gethostname" = "yes"; then
  1805. AC_MSG_CHECKING([for gethostname arg 2 data type])
  1806. tst_gethostname_type_arg2="unknown"
  1807. for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do
  1808. for tst_arg2 in 'int' 'unsigned int' 'size_t'; do
  1809. if test "$tst_gethostname_type_arg2" = "unknown"; then
  1810. AC_COMPILE_IFELSE([
  1811. AC_LANG_PROGRAM([[
  1812. $curl_includes_winsock2
  1813. $curl_includes_unistd
  1814. $curl_includes_bsdsocket
  1815. $curl_preprocess_callconv
  1816. extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
  1817. ]],[[
  1818. if(0 != gethostname(0, 0))
  1819. return 1;
  1820. ]])
  1821. ],[
  1822. tst_gethostname_type_arg2="$tst_arg2"
  1823. ])
  1824. fi
  1825. done
  1826. done
  1827. AC_MSG_RESULT([$tst_gethostname_type_arg2])
  1828. if test "$tst_gethostname_type_arg2" != "unknown"; then
  1829. AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2,
  1830. [Define to the type of arg 2 for gethostname.])
  1831. fi
  1832. fi
  1833. #
  1834. if test "$tst_compi_gethostname" = "yes"; then
  1835. AC_MSG_CHECKING([if gethostname usage allowed])
  1836. if test "x$curl_disallow_gethostname" != "xyes"; then
  1837. AC_MSG_RESULT([yes])
  1838. tst_allow_gethostname="yes"
  1839. else
  1840. AC_MSG_RESULT([no])
  1841. tst_allow_gethostname="no"
  1842. fi
  1843. fi
  1844. #
  1845. AC_MSG_CHECKING([if gethostname might be used])
  1846. if test "$tst_links_gethostname" = "yes" &&
  1847. test "$tst_proto_gethostname" = "yes" &&
  1848. test "$tst_compi_gethostname" = "yes" &&
  1849. test "$tst_allow_gethostname" = "yes"; then
  1850. AC_MSG_RESULT([yes])
  1851. AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
  1852. [Define to 1 if you have the gethostname function.])
  1853. curl_cv_func_gethostname="yes"
  1854. else
  1855. AC_MSG_RESULT([no])
  1856. curl_cv_func_gethostname="no"
  1857. fi
  1858. ])
  1859. dnl CURL_CHECK_FUNC_GETPEERNAME
  1860. dnl -------------------------------------------------
  1861. dnl Verify if getpeername is available, prototyped, and
  1862. dnl can be compiled. If all of these are true, and
  1863. dnl usage has not been previously disallowed with
  1864. dnl shell variable curl_disallow_getpeername, then
  1865. dnl HAVE_GETPEERNAME will be defined.
  1866. AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [
  1867. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1868. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1869. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1870. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1871. #
  1872. tst_links_getpeername="unknown"
  1873. tst_proto_getpeername="unknown"
  1874. tst_compi_getpeername="unknown"
  1875. tst_allow_getpeername="unknown"
  1876. #
  1877. AC_MSG_CHECKING([if getpeername can be linked])
  1878. AC_LINK_IFELSE([
  1879. AC_LANG_PROGRAM([[
  1880. $curl_includes_winsock2
  1881. $curl_includes_bsdsocket
  1882. $curl_includes_sys_socket
  1883. ]],[[
  1884. if(0 != getpeername(0, (void *)0, (void *)0))
  1885. return 1;
  1886. ]])
  1887. ],[
  1888. AC_MSG_RESULT([yes])
  1889. tst_links_getpeername="yes"
  1890. ],[
  1891. AC_MSG_RESULT([no])
  1892. tst_links_getpeername="no"
  1893. ])
  1894. #
  1895. if test "$tst_links_getpeername" = "yes"; then
  1896. AC_MSG_CHECKING([if getpeername is prototyped])
  1897. AC_EGREP_CPP([getpeername],[
  1898. $curl_includes_winsock2
  1899. $curl_includes_bsdsocket
  1900. $curl_includes_sys_socket
  1901. ],[
  1902. AC_MSG_RESULT([yes])
  1903. tst_proto_getpeername="yes"
  1904. ],[
  1905. AC_MSG_RESULT([no])
  1906. tst_proto_getpeername="no"
  1907. ])
  1908. fi
  1909. #
  1910. if test "$tst_proto_getpeername" = "yes"; then
  1911. AC_MSG_CHECKING([if getpeername is compilable])
  1912. AC_COMPILE_IFELSE([
  1913. AC_LANG_PROGRAM([[
  1914. $curl_includes_winsock2
  1915. $curl_includes_bsdsocket
  1916. $curl_includes_sys_socket
  1917. ]],[[
  1918. if(0 != getpeername(0, (void *)0, (void *)0))
  1919. return 1;
  1920. ]])
  1921. ],[
  1922. AC_MSG_RESULT([yes])
  1923. tst_compi_getpeername="yes"
  1924. ],[
  1925. AC_MSG_RESULT([no])
  1926. tst_compi_getpeername="no"
  1927. ])
  1928. fi
  1929. #
  1930. if test "$tst_compi_getpeername" = "yes"; then
  1931. AC_MSG_CHECKING([if getpeername usage allowed])
  1932. if test "x$curl_disallow_getpeername" != "xyes"; then
  1933. AC_MSG_RESULT([yes])
  1934. tst_allow_getpeername="yes"
  1935. else
  1936. AC_MSG_RESULT([no])
  1937. tst_allow_getpeername="no"
  1938. fi
  1939. fi
  1940. #
  1941. AC_MSG_CHECKING([if getpeername might be used])
  1942. if test "$tst_links_getpeername" = "yes" &&
  1943. test "$tst_proto_getpeername" = "yes" &&
  1944. test "$tst_compi_getpeername" = "yes" &&
  1945. test "$tst_allow_getpeername" = "yes"; then
  1946. AC_MSG_RESULT([yes])
  1947. AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1,
  1948. [Define to 1 if you have the getpeername function.])
  1949. curl_cv_func_getpeername="yes"
  1950. else
  1951. AC_MSG_RESULT([no])
  1952. curl_cv_func_getpeername="no"
  1953. fi
  1954. ])
  1955. dnl CURL_CHECK_FUNC_GETSOCKNAME
  1956. dnl -------------------------------------------------
  1957. dnl Verify if getsockname is available, prototyped, and
  1958. dnl can be compiled. If all of these are true, and
  1959. dnl usage has not been previously disallowed with
  1960. dnl shell variable curl_disallow_getsockname, then
  1961. dnl HAVE_GETSOCKNAME will be defined.
  1962. AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [
  1963. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  1964. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1965. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  1966. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  1967. #
  1968. tst_links_getsockname="unknown"
  1969. tst_proto_getsockname="unknown"
  1970. tst_compi_getsockname="unknown"
  1971. tst_allow_getsockname="unknown"
  1972. #
  1973. AC_MSG_CHECKING([if getsockname can be linked])
  1974. AC_LINK_IFELSE([
  1975. AC_LANG_PROGRAM([[
  1976. $curl_includes_winsock2
  1977. $curl_includes_bsdsocket
  1978. $curl_includes_sys_socket
  1979. ]],[[
  1980. if(0 != getsockname(0, (void *)0, (void *)0))
  1981. return 1;
  1982. ]])
  1983. ],[
  1984. AC_MSG_RESULT([yes])
  1985. tst_links_getsockname="yes"
  1986. ],[
  1987. AC_MSG_RESULT([no])
  1988. tst_links_getsockname="no"
  1989. ])
  1990. #
  1991. if test "$tst_links_getsockname" = "yes"; then
  1992. AC_MSG_CHECKING([if getsockname is prototyped])
  1993. AC_EGREP_CPP([getsockname],[
  1994. $curl_includes_winsock2
  1995. $curl_includes_bsdsocket
  1996. $curl_includes_sys_socket
  1997. ],[
  1998. AC_MSG_RESULT([yes])
  1999. tst_proto_getsockname="yes"
  2000. ],[
  2001. AC_MSG_RESULT([no])
  2002. tst_proto_getsockname="no"
  2003. ])
  2004. fi
  2005. #
  2006. if test "$tst_proto_getsockname" = "yes"; then
  2007. AC_MSG_CHECKING([if getsockname is compilable])
  2008. AC_COMPILE_IFELSE([
  2009. AC_LANG_PROGRAM([[
  2010. $curl_includes_winsock2
  2011. $curl_includes_bsdsocket
  2012. $curl_includes_sys_socket
  2013. ]],[[
  2014. if(0 != getsockname(0, (void *)0, (void *)0))
  2015. return 1;
  2016. ]])
  2017. ],[
  2018. AC_MSG_RESULT([yes])
  2019. tst_compi_getsockname="yes"
  2020. ],[
  2021. AC_MSG_RESULT([no])
  2022. tst_compi_getsockname="no"
  2023. ])
  2024. fi
  2025. #
  2026. if test "$tst_compi_getsockname" = "yes"; then
  2027. AC_MSG_CHECKING([if getsockname usage allowed])
  2028. if test "x$curl_disallow_getsockname" != "xyes"; then
  2029. AC_MSG_RESULT([yes])
  2030. tst_allow_getsockname="yes"
  2031. else
  2032. AC_MSG_RESULT([no])
  2033. tst_allow_getsockname="no"
  2034. fi
  2035. fi
  2036. #
  2037. AC_MSG_CHECKING([if getsockname might be used])
  2038. if test "$tst_links_getsockname" = "yes" &&
  2039. test "$tst_proto_getsockname" = "yes" &&
  2040. test "$tst_compi_getsockname" = "yes" &&
  2041. test "$tst_allow_getsockname" = "yes"; then
  2042. AC_MSG_RESULT([yes])
  2043. AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1,
  2044. [Define to 1 if you have the getsockname function.])
  2045. curl_cv_func_getsockname="yes"
  2046. else
  2047. AC_MSG_RESULT([no])
  2048. curl_cv_func_getsockname="no"
  2049. fi
  2050. ])
  2051. dnl CURL_CHECK_FUNC_IF_NAMETOINDEX
  2052. dnl -------------------------------------------------
  2053. dnl Verify if if_nametoindex is available, prototyped, and
  2054. dnl can be compiled. If all of these are true, and
  2055. dnl usage has not been previously disallowed with
  2056. dnl shell variable curl_disallow_if_nametoindex, then
  2057. dnl HAVE_IF_NAMETOINDEX will be defined.
  2058. AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
  2059. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2060. AC_REQUIRE([CURL_INCLUDES_NETIF])dnl
  2061. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2062. #
  2063. tst_links_if_nametoindex="unknown"
  2064. tst_proto_if_nametoindex="unknown"
  2065. tst_compi_if_nametoindex="unknown"
  2066. tst_allow_if_nametoindex="unknown"
  2067. #
  2068. AC_MSG_CHECKING([if if_nametoindex can be linked])
  2069. AC_LINK_IFELSE([
  2070. AC_LANG_PROGRAM([[
  2071. $curl_includes_winsock2
  2072. $curl_includes_bsdsocket
  2073. #include <net/if.h>
  2074. ]],[[
  2075. if(0 != if_nametoindex(""))
  2076. return 1;
  2077. ]])
  2078. ],[
  2079. AC_MSG_RESULT([yes])
  2080. tst_links_if_nametoindex="yes"
  2081. ],[
  2082. AC_MSG_RESULT([no])
  2083. tst_links_if_nametoindex="no"
  2084. ])
  2085. #
  2086. if test "$tst_links_if_nametoindex" = "yes"; then
  2087. AC_MSG_CHECKING([if if_nametoindex is prototyped])
  2088. AC_EGREP_CPP([if_nametoindex],[
  2089. $curl_includes_winsock2
  2090. $curl_includes_netif
  2091. ],[
  2092. AC_MSG_RESULT([yes])
  2093. tst_proto_if_nametoindex="yes"
  2094. ],[
  2095. AC_MSG_RESULT([no])
  2096. tst_proto_if_nametoindex="no"
  2097. ])
  2098. fi
  2099. #
  2100. if test "$tst_proto_if_nametoindex" = "yes"; then
  2101. AC_MSG_CHECKING([if if_nametoindex is compilable])
  2102. AC_COMPILE_IFELSE([
  2103. AC_LANG_PROGRAM([[
  2104. $curl_includes_winsock2
  2105. $curl_includes_netif
  2106. ]],[[
  2107. if(0 != if_nametoindex(""))
  2108. return 1;
  2109. ]])
  2110. ],[
  2111. AC_MSG_RESULT([yes])
  2112. tst_compi_if_nametoindex="yes"
  2113. ],[
  2114. AC_MSG_RESULT([no])
  2115. tst_compi_if_nametoindex="no"
  2116. ])
  2117. fi
  2118. #
  2119. if test "$tst_compi_if_nametoindex" = "yes"; then
  2120. AC_MSG_CHECKING([if if_nametoindex usage allowed])
  2121. if test "x$curl_disallow_if_nametoindex" != "xyes"; then
  2122. AC_MSG_RESULT([yes])
  2123. tst_allow_if_nametoindex="yes"
  2124. else
  2125. AC_MSG_RESULT([no])
  2126. tst_allow_if_nametoindex="no"
  2127. fi
  2128. fi
  2129. #
  2130. AC_MSG_CHECKING([if if_nametoindex might be used])
  2131. if test "$tst_links_if_nametoindex" = "yes" &&
  2132. test "$tst_proto_if_nametoindex" = "yes" &&
  2133. test "$tst_compi_if_nametoindex" = "yes" &&
  2134. test "$tst_allow_if_nametoindex" = "yes"; then
  2135. AC_MSG_RESULT([yes])
  2136. AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1,
  2137. [Define to 1 if you have the if_nametoindex function.])
  2138. curl_cv_func_if_nametoindex="yes"
  2139. else
  2140. AC_MSG_RESULT([no])
  2141. curl_cv_func_if_nametoindex="no"
  2142. fi
  2143. ])
  2144. dnl CURL_CHECK_FUNC_GETIFADDRS
  2145. dnl -------------------------------------------------
  2146. dnl Verify if getifaddrs is available, prototyped, can
  2147. dnl be compiled and seems to work. If all of these are
  2148. dnl true, and usage has not been previously disallowed
  2149. dnl with shell variable curl_disallow_getifaddrs, then
  2150. dnl HAVE_GETIFADDRS will be defined.
  2151. AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
  2152. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2153. AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl
  2154. #
  2155. tst_links_getifaddrs="unknown"
  2156. tst_proto_getifaddrs="unknown"
  2157. tst_compi_getifaddrs="unknown"
  2158. tst_works_getifaddrs="unknown"
  2159. tst_allow_getifaddrs="unknown"
  2160. #
  2161. AC_MSG_CHECKING([if getifaddrs can be linked])
  2162. AC_LINK_IFELSE([
  2163. AC_LANG_FUNC_LINK_TRY([getifaddrs])
  2164. ],[
  2165. AC_MSG_RESULT([yes])
  2166. tst_links_getifaddrs="yes"
  2167. ],[
  2168. AC_MSG_RESULT([no])
  2169. tst_links_getifaddrs="no"
  2170. ])
  2171. #
  2172. if test "$tst_links_getifaddrs" = "yes"; then
  2173. AC_MSG_CHECKING([if getifaddrs is prototyped])
  2174. AC_EGREP_CPP([getifaddrs],[
  2175. $curl_includes_ifaddrs
  2176. ],[
  2177. AC_MSG_RESULT([yes])
  2178. tst_proto_getifaddrs="yes"
  2179. ],[
  2180. AC_MSG_RESULT([no])
  2181. tst_proto_getifaddrs="no"
  2182. ])
  2183. fi
  2184. #
  2185. if test "$tst_proto_getifaddrs" = "yes"; then
  2186. AC_MSG_CHECKING([if getifaddrs is compilable])
  2187. AC_COMPILE_IFELSE([
  2188. AC_LANG_PROGRAM([[
  2189. $curl_includes_ifaddrs
  2190. ]],[[
  2191. if(0 != getifaddrs(0))
  2192. return 1;
  2193. ]])
  2194. ],[
  2195. AC_MSG_RESULT([yes])
  2196. tst_compi_getifaddrs="yes"
  2197. ],[
  2198. AC_MSG_RESULT([no])
  2199. tst_compi_getifaddrs="no"
  2200. ])
  2201. fi
  2202. #
  2203. dnl only do runtime verification when not cross-compiling
  2204. if test "x$cross_compiling" != "xyes" &&
  2205. test "$tst_compi_getifaddrs" = "yes"; then
  2206. AC_MSG_CHECKING([if getifaddrs seems to work])
  2207. CURL_RUN_IFELSE([
  2208. AC_LANG_PROGRAM([[
  2209. $curl_includes_stdlib
  2210. $curl_includes_ifaddrs
  2211. ]],[[
  2212. struct ifaddrs *ifa = 0;
  2213. int error;
  2214. error = getifaddrs(&ifa);
  2215. if(error || !ifa)
  2216. exit(1); /* fail */
  2217. else
  2218. exit(0);
  2219. ]])
  2220. ],[
  2221. AC_MSG_RESULT([yes])
  2222. tst_works_getifaddrs="yes"
  2223. ],[
  2224. AC_MSG_RESULT([no])
  2225. tst_works_getifaddrs="no"
  2226. ])
  2227. fi
  2228. #
  2229. if test "$tst_compi_getifaddrs" = "yes" &&
  2230. test "$tst_works_getifaddrs" != "no"; then
  2231. AC_MSG_CHECKING([if getifaddrs usage allowed])
  2232. if test "x$curl_disallow_getifaddrs" != "xyes"; then
  2233. AC_MSG_RESULT([yes])
  2234. tst_allow_getifaddrs="yes"
  2235. else
  2236. AC_MSG_RESULT([no])
  2237. tst_allow_getifaddrs="no"
  2238. fi
  2239. fi
  2240. #
  2241. AC_MSG_CHECKING([if getifaddrs might be used])
  2242. if test "$tst_links_getifaddrs" = "yes" &&
  2243. test "$tst_proto_getifaddrs" = "yes" &&
  2244. test "$tst_compi_getifaddrs" = "yes" &&
  2245. test "$tst_allow_getifaddrs" = "yes" &&
  2246. test "$tst_works_getifaddrs" != "no"; then
  2247. AC_MSG_RESULT([yes])
  2248. AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1,
  2249. [Define to 1 if you have a working getifaddrs function.])
  2250. curl_cv_func_getifaddrs="yes"
  2251. else
  2252. AC_MSG_RESULT([no])
  2253. curl_cv_func_getifaddrs="no"
  2254. fi
  2255. ])
  2256. dnl CURL_CHECK_FUNC_GMTIME_R
  2257. dnl -------------------------------------------------
  2258. dnl Verify if gmtime_r is available, prototyped, can
  2259. dnl be compiled and seems to work. If all of these are
  2260. dnl true, and usage has not been previously disallowed
  2261. dnl with shell variable curl_disallow_gmtime_r, then
  2262. dnl HAVE_GMTIME_R will be defined.
  2263. AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
  2264. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2265. AC_REQUIRE([CURL_INCLUDES_TIME])dnl
  2266. #
  2267. tst_links_gmtime_r="unknown"
  2268. tst_proto_gmtime_r="unknown"
  2269. tst_compi_gmtime_r="unknown"
  2270. tst_works_gmtime_r="unknown"
  2271. tst_allow_gmtime_r="unknown"
  2272. #
  2273. AC_MSG_CHECKING([if gmtime_r can be linked])
  2274. AC_LINK_IFELSE([
  2275. AC_LANG_FUNC_LINK_TRY([gmtime_r])
  2276. ],[
  2277. AC_MSG_RESULT([yes])
  2278. tst_links_gmtime_r="yes"
  2279. ],[
  2280. AC_MSG_RESULT([no])
  2281. tst_links_gmtime_r="no"
  2282. ])
  2283. #
  2284. if test "$tst_links_gmtime_r" = "yes"; then
  2285. AC_MSG_CHECKING([if gmtime_r is prototyped])
  2286. AC_EGREP_CPP([gmtime_r],[
  2287. $curl_includes_time
  2288. ],[
  2289. AC_MSG_RESULT([yes])
  2290. tst_proto_gmtime_r="yes"
  2291. ],[
  2292. AC_MSG_RESULT([no])
  2293. tst_proto_gmtime_r="no"
  2294. ])
  2295. fi
  2296. #
  2297. if test "$tst_proto_gmtime_r" = "yes"; then
  2298. AC_MSG_CHECKING([if gmtime_r is compilable])
  2299. AC_COMPILE_IFELSE([
  2300. AC_LANG_PROGRAM([[
  2301. $curl_includes_time
  2302. ]],[[
  2303. if(0 != gmtime_r(0, 0))
  2304. return 1;
  2305. ]])
  2306. ],[
  2307. AC_MSG_RESULT([yes])
  2308. tst_compi_gmtime_r="yes"
  2309. ],[
  2310. AC_MSG_RESULT([no])
  2311. tst_compi_gmtime_r="no"
  2312. ])
  2313. fi
  2314. #
  2315. dnl only do runtime verification when not cross-compiling
  2316. if test "x$cross_compiling" != "xyes" &&
  2317. test "$tst_compi_gmtime_r" = "yes"; then
  2318. AC_MSG_CHECKING([if gmtime_r seems to work])
  2319. CURL_RUN_IFELSE([
  2320. AC_LANG_PROGRAM([[
  2321. $curl_includes_stdlib
  2322. $curl_includes_time
  2323. ]],[[
  2324. time_t local = 1170352587;
  2325. struct tm *gmt = 0;
  2326. struct tm result;
  2327. gmt = gmtime_r(&local, &result);
  2328. if(gmt)
  2329. exit(0);
  2330. else
  2331. exit(1);
  2332. ]])
  2333. ],[
  2334. AC_MSG_RESULT([yes])
  2335. tst_works_gmtime_r="yes"
  2336. ],[
  2337. AC_MSG_RESULT([no])
  2338. tst_works_gmtime_r="no"
  2339. ])
  2340. fi
  2341. #
  2342. if test "$tst_compi_gmtime_r" = "yes" &&
  2343. test "$tst_works_gmtime_r" != "no"; then
  2344. AC_MSG_CHECKING([if gmtime_r usage allowed])
  2345. if test "x$curl_disallow_gmtime_r" != "xyes"; then
  2346. AC_MSG_RESULT([yes])
  2347. tst_allow_gmtime_r="yes"
  2348. else
  2349. AC_MSG_RESULT([no])
  2350. tst_allow_gmtime_r="no"
  2351. fi
  2352. fi
  2353. #
  2354. AC_MSG_CHECKING([if gmtime_r might be used])
  2355. if test "$tst_links_gmtime_r" = "yes" &&
  2356. test "$tst_proto_gmtime_r" = "yes" &&
  2357. test "$tst_compi_gmtime_r" = "yes" &&
  2358. test "$tst_allow_gmtime_r" = "yes" &&
  2359. test "$tst_works_gmtime_r" != "no"; then
  2360. AC_MSG_RESULT([yes])
  2361. AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
  2362. [Define to 1 if you have a working gmtime_r function.])
  2363. curl_cv_func_gmtime_r="yes"
  2364. else
  2365. AC_MSG_RESULT([no])
  2366. curl_cv_func_gmtime_r="no"
  2367. fi
  2368. ])
  2369. dnl CURL_CHECK_FUNC_INET_NTOP
  2370. dnl -------------------------------------------------
  2371. dnl Verify if inet_ntop is available, prototyped, can
  2372. dnl be compiled and seems to work. If all of these are
  2373. dnl true, and usage has not been previously disallowed
  2374. dnl with shell variable curl_disallow_inet_ntop, then
  2375. dnl HAVE_INET_NTOP will be defined.
  2376. AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
  2377. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2378. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  2379. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  2380. #
  2381. tst_links_inet_ntop="unknown"
  2382. tst_proto_inet_ntop="unknown"
  2383. tst_compi_inet_ntop="unknown"
  2384. tst_works_inet_ntop="unknown"
  2385. tst_allow_inet_ntop="unknown"
  2386. #
  2387. AC_MSG_CHECKING([if inet_ntop can be linked])
  2388. AC_LINK_IFELSE([
  2389. AC_LANG_FUNC_LINK_TRY([inet_ntop])
  2390. ],[
  2391. AC_MSG_RESULT([yes])
  2392. tst_links_inet_ntop="yes"
  2393. ],[
  2394. AC_MSG_RESULT([no])
  2395. tst_links_inet_ntop="no"
  2396. ])
  2397. #
  2398. if test "$tst_links_inet_ntop" = "yes"; then
  2399. AC_MSG_CHECKING([if inet_ntop is prototyped])
  2400. AC_EGREP_CPP([inet_ntop],[
  2401. $curl_includes_arpa_inet
  2402. ],[
  2403. AC_MSG_RESULT([yes])
  2404. tst_proto_inet_ntop="yes"
  2405. ],[
  2406. AC_MSG_RESULT([no])
  2407. tst_proto_inet_ntop="no"
  2408. ])
  2409. fi
  2410. #
  2411. if test "$tst_proto_inet_ntop" = "yes"; then
  2412. AC_MSG_CHECKING([if inet_ntop is compilable])
  2413. AC_COMPILE_IFELSE([
  2414. AC_LANG_PROGRAM([[
  2415. $curl_includes_arpa_inet
  2416. ]],[[
  2417. if(0 != inet_ntop(0, 0, 0, 0))
  2418. return 1;
  2419. ]])
  2420. ],[
  2421. AC_MSG_RESULT([yes])
  2422. tst_compi_inet_ntop="yes"
  2423. ],[
  2424. AC_MSG_RESULT([no])
  2425. tst_compi_inet_ntop="no"
  2426. ])
  2427. fi
  2428. #
  2429. dnl only do runtime verification when not cross-compiling
  2430. if test "x$cross_compiling" != "xyes" &&
  2431. test "$tst_compi_inet_ntop" = "yes"; then
  2432. AC_MSG_CHECKING([if inet_ntop seems to work])
  2433. CURL_RUN_IFELSE([
  2434. AC_LANG_PROGRAM([[
  2435. $curl_includes_stdlib
  2436. $curl_includes_arpa_inet
  2437. $curl_includes_string
  2438. ]],[[
  2439. char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
  2440. char ipv4res[sizeof "255.255.255.255"];
  2441. unsigned char ipv6a[26];
  2442. unsigned char ipv4a[5];
  2443. char *ipv6ptr = 0;
  2444. char *ipv4ptr = 0;
  2445. /* - */
  2446. ipv4res[0] = '\0';
  2447. ipv4a[0] = 0xc0;
  2448. ipv4a[1] = 0xa8;
  2449. ipv4a[2] = 0x64;
  2450. ipv4a[3] = 0x01;
  2451. ipv4a[4] = 0x01;
  2452. /* - */
  2453. ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
  2454. if(!ipv4ptr)
  2455. exit(1); /* fail */
  2456. if(ipv4ptr != ipv4res)
  2457. exit(1); /* fail */
  2458. if(!ipv4ptr[0])
  2459. exit(1); /* fail */
  2460. if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
  2461. exit(1); /* fail */
  2462. /* - */
  2463. ipv6res[0] = '\0';
  2464. memset(ipv6a, 0, sizeof(ipv6a));
  2465. ipv6a[0] = 0xfe;
  2466. ipv6a[1] = 0x80;
  2467. ipv6a[8] = 0x02;
  2468. ipv6a[9] = 0x14;
  2469. ipv6a[10] = 0x4f;
  2470. ipv6a[11] = 0xff;
  2471. ipv6a[12] = 0xfe;
  2472. ipv6a[13] = 0x0b;
  2473. ipv6a[14] = 0x76;
  2474. ipv6a[15] = 0xc8;
  2475. ipv6a[25] = 0x01;
  2476. /* - */
  2477. ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
  2478. if(!ipv6ptr)
  2479. exit(1); /* fail */
  2480. if(ipv6ptr != ipv6res)
  2481. exit(1); /* fail */
  2482. if(!ipv6ptr[0])
  2483. exit(1); /* fail */
  2484. if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
  2485. exit(1); /* fail */
  2486. /* - */
  2487. exit(0);
  2488. ]])
  2489. ],[
  2490. AC_MSG_RESULT([yes])
  2491. tst_works_inet_ntop="yes"
  2492. ],[
  2493. AC_MSG_RESULT([no])
  2494. tst_works_inet_ntop="no"
  2495. ])
  2496. fi
  2497. #
  2498. if test "$tst_compi_inet_ntop" = "yes" &&
  2499. test "$tst_works_inet_ntop" != "no"; then
  2500. AC_MSG_CHECKING([if inet_ntop usage allowed])
  2501. if test "x$curl_disallow_inet_ntop" != "xyes"; then
  2502. AC_MSG_RESULT([yes])
  2503. tst_allow_inet_ntop="yes"
  2504. else
  2505. AC_MSG_RESULT([no])
  2506. tst_allow_inet_ntop="no"
  2507. fi
  2508. fi
  2509. #
  2510. AC_MSG_CHECKING([if inet_ntop might be used])
  2511. if test "$tst_links_inet_ntop" = "yes" &&
  2512. test "$tst_proto_inet_ntop" = "yes" &&
  2513. test "$tst_compi_inet_ntop" = "yes" &&
  2514. test "$tst_allow_inet_ntop" = "yes" &&
  2515. test "$tst_works_inet_ntop" != "no"; then
  2516. AC_MSG_RESULT([yes])
  2517. AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
  2518. [Define to 1 if you have a IPv6 capable working inet_ntop function.])
  2519. curl_cv_func_inet_ntop="yes"
  2520. else
  2521. AC_MSG_RESULT([no])
  2522. curl_cv_func_inet_ntop="no"
  2523. fi
  2524. ])
  2525. dnl CURL_CHECK_FUNC_INET_PTON
  2526. dnl -------------------------------------------------
  2527. dnl Verify if inet_pton is available, prototyped, can
  2528. dnl be compiled and seems to work. If all of these are
  2529. dnl true, and usage has not been previously disallowed
  2530. dnl with shell variable curl_disallow_inet_pton, then
  2531. dnl HAVE_INET_PTON will be defined.
  2532. AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
  2533. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2534. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  2535. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  2536. #
  2537. tst_links_inet_pton="unknown"
  2538. tst_proto_inet_pton="unknown"
  2539. tst_compi_inet_pton="unknown"
  2540. tst_works_inet_pton="unknown"
  2541. tst_allow_inet_pton="unknown"
  2542. #
  2543. AC_MSG_CHECKING([if inet_pton can be linked])
  2544. AC_LINK_IFELSE([
  2545. AC_LANG_FUNC_LINK_TRY([inet_pton])
  2546. ],[
  2547. AC_MSG_RESULT([yes])
  2548. tst_links_inet_pton="yes"
  2549. ],[
  2550. AC_MSG_RESULT([no])
  2551. tst_links_inet_pton="no"
  2552. ])
  2553. #
  2554. if test "$tst_links_inet_pton" = "yes"; then
  2555. AC_MSG_CHECKING([if inet_pton is prototyped])
  2556. AC_EGREP_CPP([inet_pton],[
  2557. $curl_includes_arpa_inet
  2558. ],[
  2559. AC_MSG_RESULT([yes])
  2560. tst_proto_inet_pton="yes"
  2561. ],[
  2562. AC_MSG_RESULT([no])
  2563. tst_proto_inet_pton="no"
  2564. ])
  2565. fi
  2566. #
  2567. if test "$tst_proto_inet_pton" = "yes"; then
  2568. AC_MSG_CHECKING([if inet_pton is compilable])
  2569. AC_COMPILE_IFELSE([
  2570. AC_LANG_PROGRAM([[
  2571. $curl_includes_arpa_inet
  2572. ]],[[
  2573. if(0 != inet_pton(0, 0, 0))
  2574. return 1;
  2575. ]])
  2576. ],[
  2577. AC_MSG_RESULT([yes])
  2578. tst_compi_inet_pton="yes"
  2579. ],[
  2580. AC_MSG_RESULT([no])
  2581. tst_compi_inet_pton="no"
  2582. ])
  2583. fi
  2584. #
  2585. dnl only do runtime verification when not cross-compiling
  2586. if test "x$cross_compiling" != "xyes" &&
  2587. test "$tst_compi_inet_pton" = "yes"; then
  2588. AC_MSG_CHECKING([if inet_pton seems to work])
  2589. CURL_RUN_IFELSE([
  2590. AC_LANG_PROGRAM([[
  2591. $curl_includes_stdlib
  2592. $curl_includes_arpa_inet
  2593. $curl_includes_string
  2594. ]],[[
  2595. unsigned char ipv6a[16+1];
  2596. unsigned char ipv4a[4+1];
  2597. const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
  2598. const char *ipv4src = "192.168.100.1";
  2599. /* - */
  2600. memset(ipv4a, 1, sizeof(ipv4a));
  2601. if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
  2602. exit(1); /* fail */
  2603. /* - */
  2604. if( (ipv4a[0] != 0xc0) ||
  2605. (ipv4a[1] != 0xa8) ||
  2606. (ipv4a[2] != 0x64) ||
  2607. (ipv4a[3] != 0x01) ||
  2608. (ipv4a[4] != 0x01) )
  2609. exit(1); /* fail */
  2610. /* - */
  2611. memset(ipv6a, 1, sizeof(ipv6a));
  2612. if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
  2613. exit(1); /* fail */
  2614. /* - */
  2615. if( (ipv6a[0] != 0xfe) ||
  2616. (ipv6a[1] != 0x80) ||
  2617. (ipv6a[8] != 0x02) ||
  2618. (ipv6a[9] != 0x14) ||
  2619. (ipv6a[10] != 0x4f) ||
  2620. (ipv6a[11] != 0xff) ||
  2621. (ipv6a[12] != 0xfe) ||
  2622. (ipv6a[13] != 0x0b) ||
  2623. (ipv6a[14] != 0x76) ||
  2624. (ipv6a[15] != 0xc8) ||
  2625. (ipv6a[16] != 0x01) )
  2626. exit(1); /* fail */
  2627. /* - */
  2628. if( (ipv6a[2] != 0x0) ||
  2629. (ipv6a[3] != 0x0) ||
  2630. (ipv6a[4] != 0x0) ||
  2631. (ipv6a[5] != 0x0) ||
  2632. (ipv6a[6] != 0x0) ||
  2633. (ipv6a[7] != 0x0) )
  2634. exit(1); /* fail */
  2635. /* - */
  2636. exit(0);
  2637. ]])
  2638. ],[
  2639. AC_MSG_RESULT([yes])
  2640. tst_works_inet_pton="yes"
  2641. ],[
  2642. AC_MSG_RESULT([no])
  2643. tst_works_inet_pton="no"
  2644. ])
  2645. fi
  2646. #
  2647. if test "$tst_compi_inet_pton" = "yes" &&
  2648. test "$tst_works_inet_pton" != "no"; then
  2649. AC_MSG_CHECKING([if inet_pton usage allowed])
  2650. if test "x$curl_disallow_inet_pton" != "xyes"; then
  2651. AC_MSG_RESULT([yes])
  2652. tst_allow_inet_pton="yes"
  2653. else
  2654. AC_MSG_RESULT([no])
  2655. tst_allow_inet_pton="no"
  2656. fi
  2657. fi
  2658. #
  2659. AC_MSG_CHECKING([if inet_pton might be used])
  2660. if test "$tst_links_inet_pton" = "yes" &&
  2661. test "$tst_proto_inet_pton" = "yes" &&
  2662. test "$tst_compi_inet_pton" = "yes" &&
  2663. test "$tst_allow_inet_pton" = "yes" &&
  2664. test "$tst_works_inet_pton" != "no"; then
  2665. AC_MSG_RESULT([yes])
  2666. AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
  2667. [Define to 1 if you have a IPv6 capable working inet_pton function.])
  2668. curl_cv_func_inet_pton="yes"
  2669. else
  2670. AC_MSG_RESULT([no])
  2671. curl_cv_func_inet_pton="no"
  2672. fi
  2673. ])
  2674. dnl CURL_CHECK_FUNC_IOCTL
  2675. dnl -------------------------------------------------
  2676. dnl Verify if ioctl is available, prototyped, and
  2677. dnl can be compiled. If all of these are true, and
  2678. dnl usage has not been previously disallowed with
  2679. dnl shell variable curl_disallow_ioctl, then
  2680. dnl HAVE_IOCTL will be defined.
  2681. AC_DEFUN([CURL_CHECK_FUNC_IOCTL], [
  2682. AC_REQUIRE([CURL_INCLUDES_STROPTS])dnl
  2683. #
  2684. tst_links_ioctl="unknown"
  2685. tst_proto_ioctl="unknown"
  2686. tst_compi_ioctl="unknown"
  2687. tst_allow_ioctl="unknown"
  2688. #
  2689. AC_MSG_CHECKING([if ioctl can be linked])
  2690. AC_LINK_IFELSE([
  2691. AC_LANG_FUNC_LINK_TRY([ioctl])
  2692. ],[
  2693. AC_MSG_RESULT([yes])
  2694. tst_links_ioctl="yes"
  2695. ],[
  2696. AC_MSG_RESULT([no])
  2697. tst_links_ioctl="no"
  2698. ])
  2699. #
  2700. if test "$tst_links_ioctl" = "yes"; then
  2701. AC_MSG_CHECKING([if ioctl is prototyped])
  2702. AC_EGREP_CPP([ioctl],[
  2703. $curl_includes_stropts
  2704. ],[
  2705. AC_MSG_RESULT([yes])
  2706. tst_proto_ioctl="yes"
  2707. ],[
  2708. AC_MSG_RESULT([no])
  2709. tst_proto_ioctl="no"
  2710. ])
  2711. fi
  2712. #
  2713. if test "$tst_proto_ioctl" = "yes"; then
  2714. AC_MSG_CHECKING([if ioctl is compilable])
  2715. AC_COMPILE_IFELSE([
  2716. AC_LANG_PROGRAM([[
  2717. $curl_includes_stropts
  2718. ]],[[
  2719. if(0 != ioctl(0, 0, 0))
  2720. return 1;
  2721. ]])
  2722. ],[
  2723. AC_MSG_RESULT([yes])
  2724. tst_compi_ioctl="yes"
  2725. ],[
  2726. AC_MSG_RESULT([no])
  2727. tst_compi_ioctl="no"
  2728. ])
  2729. fi
  2730. #
  2731. if test "$tst_compi_ioctl" = "yes"; then
  2732. AC_MSG_CHECKING([if ioctl usage allowed])
  2733. if test "x$curl_disallow_ioctl" != "xyes"; then
  2734. AC_MSG_RESULT([yes])
  2735. tst_allow_ioctl="yes"
  2736. else
  2737. AC_MSG_RESULT([no])
  2738. tst_allow_ioctl="no"
  2739. fi
  2740. fi
  2741. #
  2742. AC_MSG_CHECKING([if ioctl might be used])
  2743. if test "$tst_links_ioctl" = "yes" &&
  2744. test "$tst_proto_ioctl" = "yes" &&
  2745. test "$tst_compi_ioctl" = "yes" &&
  2746. test "$tst_allow_ioctl" = "yes"; then
  2747. AC_MSG_RESULT([yes])
  2748. AC_DEFINE_UNQUOTED(HAVE_IOCTL, 1,
  2749. [Define to 1 if you have the ioctl function.])
  2750. curl_cv_func_ioctl="yes"
  2751. CURL_CHECK_FUNC_IOCTL_FIONBIO
  2752. CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2753. else
  2754. AC_MSG_RESULT([no])
  2755. curl_cv_func_ioctl="no"
  2756. fi
  2757. ])
  2758. dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
  2759. dnl -------------------------------------------------
  2760. dnl Verify if ioctl with the FIONBIO command is
  2761. dnl available, can be compiled, and seems to work. If
  2762. dnl all of these are true, then HAVE_IOCTL_FIONBIO
  2763. dnl will be defined.
  2764. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [
  2765. #
  2766. tst_compi_ioctl_fionbio="unknown"
  2767. tst_allow_ioctl_fionbio="unknown"
  2768. #
  2769. if test "$curl_cv_func_ioctl" = "yes"; then
  2770. AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
  2771. AC_COMPILE_IFELSE([
  2772. AC_LANG_PROGRAM([[
  2773. $curl_includes_stropts
  2774. ]],[[
  2775. int flags = 0;
  2776. if(0 != ioctl(0, FIONBIO, &flags))
  2777. return 1;
  2778. ]])
  2779. ],[
  2780. AC_MSG_RESULT([yes])
  2781. tst_compi_ioctl_fionbio="yes"
  2782. ],[
  2783. AC_MSG_RESULT([no])
  2784. tst_compi_ioctl_fionbio="no"
  2785. ])
  2786. fi
  2787. #
  2788. if test "$tst_compi_ioctl_fionbio" = "yes"; then
  2789. AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
  2790. if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then
  2791. AC_MSG_RESULT([yes])
  2792. tst_allow_ioctl_fionbio="yes"
  2793. else
  2794. AC_MSG_RESULT([no])
  2795. tst_allow_ioctl_fionbio="no"
  2796. fi
  2797. fi
  2798. #
  2799. AC_MSG_CHECKING([if ioctl FIONBIO might be used])
  2800. if test "$tst_compi_ioctl_fionbio" = "yes" &&
  2801. test "$tst_allow_ioctl_fionbio" = "yes"; then
  2802. AC_MSG_RESULT([yes])
  2803. AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
  2804. [Define to 1 if you have a working ioctl FIONBIO function.])
  2805. curl_cv_func_ioctl_fionbio="yes"
  2806. else
  2807. AC_MSG_RESULT([no])
  2808. curl_cv_func_ioctl_fionbio="no"
  2809. fi
  2810. ])
  2811. dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  2812. dnl -------------------------------------------------
  2813. dnl Verify if ioctl with the SIOCGIFADDR command is available,
  2814. dnl struct ifreq is defined, they can be compiled, and seem to
  2815. dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
  2816. dnl will be defined.
  2817. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
  2818. #
  2819. tst_compi_ioctl_siocgifaddr="unknown"
  2820. tst_allow_ioctl_siocgifaddr="unknown"
  2821. #
  2822. if test "$curl_cv_func_ioctl" = "yes"; then
  2823. AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
  2824. AC_COMPILE_IFELSE([
  2825. AC_LANG_PROGRAM([[
  2826. $curl_includes_stropts
  2827. #include <net/if.h>
  2828. ]],[[
  2829. struct ifreq ifr;
  2830. if(0 != ioctl(0, SIOCGIFADDR, &ifr))
  2831. return 1;
  2832. ]])
  2833. ],[
  2834. AC_MSG_RESULT([yes])
  2835. tst_compi_ioctl_siocgifaddr="yes"
  2836. ],[
  2837. AC_MSG_RESULT([no])
  2838. tst_compi_ioctl_siocgifaddr="no"
  2839. ])
  2840. fi
  2841. #
  2842. if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
  2843. AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
  2844. if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then
  2845. AC_MSG_RESULT([yes])
  2846. tst_allow_ioctl_siocgifaddr="yes"
  2847. else
  2848. AC_MSG_RESULT([no])
  2849. tst_allow_ioctl_siocgifaddr="no"
  2850. fi
  2851. fi
  2852. #
  2853. AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
  2854. if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
  2855. test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
  2856. AC_MSG_RESULT([yes])
  2857. AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
  2858. [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
  2859. curl_cv_func_ioctl_siocgifaddr="yes"
  2860. else
  2861. AC_MSG_RESULT([no])
  2862. curl_cv_func_ioctl_siocgifaddr="no"
  2863. fi
  2864. ])
  2865. dnl CURL_CHECK_FUNC_IOCTLSOCKET
  2866. dnl -------------------------------------------------
  2867. dnl Verify if ioctlsocket is available, prototyped, and
  2868. dnl can be compiled. If all of these are true, and
  2869. dnl usage has not been previously disallowed with
  2870. dnl shell variable curl_disallow_ioctlsocket, then
  2871. dnl HAVE_IOCTLSOCKET will be defined.
  2872. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [
  2873. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2874. #
  2875. tst_links_ioctlsocket="unknown"
  2876. tst_proto_ioctlsocket="unknown"
  2877. tst_compi_ioctlsocket="unknown"
  2878. tst_allow_ioctlsocket="unknown"
  2879. #
  2880. AC_MSG_CHECKING([if ioctlsocket can be linked])
  2881. AC_LINK_IFELSE([
  2882. AC_LANG_PROGRAM([[
  2883. $curl_includes_winsock2
  2884. ]],[[
  2885. if(0 != ioctlsocket(0, 0, 0))
  2886. return 1;
  2887. ]])
  2888. ],[
  2889. AC_MSG_RESULT([yes])
  2890. tst_links_ioctlsocket="yes"
  2891. ],[
  2892. AC_MSG_RESULT([no])
  2893. tst_links_ioctlsocket="no"
  2894. ])
  2895. #
  2896. if test "$tst_links_ioctlsocket" = "yes"; then
  2897. AC_MSG_CHECKING([if ioctlsocket is prototyped])
  2898. AC_EGREP_CPP([ioctlsocket],[
  2899. $curl_includes_winsock2
  2900. ],[
  2901. AC_MSG_RESULT([yes])
  2902. tst_proto_ioctlsocket="yes"
  2903. ],[
  2904. AC_MSG_RESULT([no])
  2905. tst_proto_ioctlsocket="no"
  2906. ])
  2907. fi
  2908. #
  2909. if test "$tst_proto_ioctlsocket" = "yes"; then
  2910. AC_MSG_CHECKING([if ioctlsocket is compilable])
  2911. AC_COMPILE_IFELSE([
  2912. AC_LANG_PROGRAM([[
  2913. $curl_includes_winsock2
  2914. ]],[[
  2915. if(0 != ioctlsocket(0, 0, 0))
  2916. return 1;
  2917. ]])
  2918. ],[
  2919. AC_MSG_RESULT([yes])
  2920. tst_compi_ioctlsocket="yes"
  2921. ],[
  2922. AC_MSG_RESULT([no])
  2923. tst_compi_ioctlsocket="no"
  2924. ])
  2925. fi
  2926. #
  2927. if test "$tst_compi_ioctlsocket" = "yes"; then
  2928. AC_MSG_CHECKING([if ioctlsocket usage allowed])
  2929. if test "x$curl_disallow_ioctlsocket" != "xyes"; then
  2930. AC_MSG_RESULT([yes])
  2931. tst_allow_ioctlsocket="yes"
  2932. else
  2933. AC_MSG_RESULT([no])
  2934. tst_allow_ioctlsocket="no"
  2935. fi
  2936. fi
  2937. #
  2938. AC_MSG_CHECKING([if ioctlsocket might be used])
  2939. if test "$tst_links_ioctlsocket" = "yes" &&
  2940. test "$tst_proto_ioctlsocket" = "yes" &&
  2941. test "$tst_compi_ioctlsocket" = "yes" &&
  2942. test "$tst_allow_ioctlsocket" = "yes"; then
  2943. AC_MSG_RESULT([yes])
  2944. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
  2945. [Define to 1 if you have the ioctlsocket function.])
  2946. curl_cv_func_ioctlsocket="yes"
  2947. CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2948. else
  2949. AC_MSG_RESULT([no])
  2950. curl_cv_func_ioctlsocket="no"
  2951. fi
  2952. ])
  2953. dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  2954. dnl -------------------------------------------------
  2955. dnl Verify if ioctlsocket with the FIONBIO command is
  2956. dnl available, can be compiled, and seems to work. If
  2957. dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
  2958. dnl will be defined.
  2959. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
  2960. #
  2961. tst_compi_ioctlsocket_fionbio="unknown"
  2962. tst_allow_ioctlsocket_fionbio="unknown"
  2963. #
  2964. if test "$curl_cv_func_ioctlsocket" = "yes"; then
  2965. AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
  2966. AC_COMPILE_IFELSE([
  2967. AC_LANG_PROGRAM([[
  2968. $curl_includes_winsock2
  2969. ]],[[
  2970. unsigned long flags = 0;
  2971. if(0 != ioctlsocket(0, FIONBIO, &flags))
  2972. return 1;
  2973. ]])
  2974. ],[
  2975. AC_MSG_RESULT([yes])
  2976. tst_compi_ioctlsocket_fionbio="yes"
  2977. ],[
  2978. AC_MSG_RESULT([no])
  2979. tst_compi_ioctlsocket_fionbio="no"
  2980. ])
  2981. fi
  2982. #
  2983. if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
  2984. AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
  2985. if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then
  2986. AC_MSG_RESULT([yes])
  2987. tst_allow_ioctlsocket_fionbio="yes"
  2988. else
  2989. AC_MSG_RESULT([no])
  2990. tst_allow_ioctlsocket_fionbio="no"
  2991. fi
  2992. fi
  2993. #
  2994. AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
  2995. if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
  2996. test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
  2997. AC_MSG_RESULT([yes])
  2998. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
  2999. [Define to 1 if you have a working ioctlsocket FIONBIO function.])
  3000. curl_cv_func_ioctlsocket_fionbio="yes"
  3001. else
  3002. AC_MSG_RESULT([no])
  3003. curl_cv_func_ioctlsocket_fionbio="no"
  3004. fi
  3005. ])
  3006. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  3007. dnl -------------------------------------------------
  3008. dnl Verify if IoctlSocket is available, prototyped, and
  3009. dnl can be compiled. If all of these are true, and
  3010. dnl usage has not been previously disallowed with
  3011. dnl shell variable curl_disallow_ioctlsocket_camel,
  3012. dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
  3013. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
  3014. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3015. #
  3016. tst_links_ioctlsocket_camel="unknown"
  3017. tst_proto_ioctlsocket_camel="unknown"
  3018. tst_compi_ioctlsocket_camel="unknown"
  3019. tst_allow_ioctlsocket_camel="unknown"
  3020. #
  3021. AC_MSG_CHECKING([if IoctlSocket can be linked])
  3022. AC_LINK_IFELSE([
  3023. AC_LANG_PROGRAM([[
  3024. $curl_includes_bsdsocket
  3025. ]],[[
  3026. IoctlSocket(0, 0, 0);
  3027. ]])
  3028. ],[
  3029. AC_MSG_RESULT([yes])
  3030. tst_links_ioctlsocket_camel="yes"
  3031. ],[
  3032. AC_MSG_RESULT([no])
  3033. tst_links_ioctlsocket_camel="no"
  3034. ])
  3035. #
  3036. if test "$tst_links_ioctlsocket_camel" = "yes"; then
  3037. AC_MSG_CHECKING([if IoctlSocket is prototyped])
  3038. AC_EGREP_CPP([IoctlSocket],[
  3039. $curl_includes_bsdsocket
  3040. ],[
  3041. AC_MSG_RESULT([yes])
  3042. tst_proto_ioctlsocket_camel="yes"
  3043. ],[
  3044. AC_MSG_RESULT([no])
  3045. tst_proto_ioctlsocket_camel="no"
  3046. ])
  3047. fi
  3048. #
  3049. if test "$tst_proto_ioctlsocket_camel" = "yes"; then
  3050. AC_MSG_CHECKING([if IoctlSocket is compilable])
  3051. AC_COMPILE_IFELSE([
  3052. AC_LANG_PROGRAM([[
  3053. $curl_includes_bsdsocket
  3054. ]],[[
  3055. if(0 != IoctlSocket(0, 0, 0))
  3056. return 1;
  3057. ]])
  3058. ],[
  3059. AC_MSG_RESULT([yes])
  3060. tst_compi_ioctlsocket_camel="yes"
  3061. ],[
  3062. AC_MSG_RESULT([no])
  3063. tst_compi_ioctlsocket_camel="no"
  3064. ])
  3065. fi
  3066. #
  3067. if test "$tst_compi_ioctlsocket_camel" = "yes"; then
  3068. AC_MSG_CHECKING([if IoctlSocket usage allowed])
  3069. if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then
  3070. AC_MSG_RESULT([yes])
  3071. tst_allow_ioctlsocket_camel="yes"
  3072. else
  3073. AC_MSG_RESULT([no])
  3074. tst_allow_ioctlsocket_camel="no"
  3075. fi
  3076. fi
  3077. #
  3078. AC_MSG_CHECKING([if IoctlSocket might be used])
  3079. if test "$tst_links_ioctlsocket_camel" = "yes" &&
  3080. test "$tst_proto_ioctlsocket_camel" = "yes" &&
  3081. test "$tst_compi_ioctlsocket_camel" = "yes" &&
  3082. test "$tst_allow_ioctlsocket_camel" = "yes"; then
  3083. AC_MSG_RESULT([yes])
  3084. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
  3085. [Define to 1 if you have the IoctlSocket camel case function.])
  3086. curl_cv_func_ioctlsocket_camel="yes"
  3087. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3088. else
  3089. AC_MSG_RESULT([no])
  3090. curl_cv_func_ioctlsocket_camel="no"
  3091. fi
  3092. ])
  3093. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3094. dnl -------------------------------------------------
  3095. dnl Verify if IoctlSocket with FIONBIO command is available,
  3096. dnl can be compiled, and seems to work. If all of these are
  3097. dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
  3098. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
  3099. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3100. #
  3101. tst_compi_ioctlsocket_camel_fionbio="unknown"
  3102. tst_allow_ioctlsocket_camel_fionbio="unknown"
  3103. #
  3104. if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then
  3105. AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
  3106. AC_COMPILE_IFELSE([
  3107. AC_LANG_PROGRAM([[
  3108. $curl_includes_bsdsocket
  3109. ]],[[
  3110. long flags = 0;
  3111. if(0 != IoctlSocket(0, FIONBIO, &flags))
  3112. return 1;
  3113. ]])
  3114. ],[
  3115. AC_MSG_RESULT([yes])
  3116. tst_compi_ioctlsocket_camel_fionbio="yes"
  3117. ],[
  3118. AC_MSG_RESULT([no])
  3119. tst_compi_ioctlsocket_camel_fionbio="no"
  3120. ])
  3121. fi
  3122. #
  3123. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
  3124. AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
  3125. if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
  3126. AC_MSG_RESULT([yes])
  3127. tst_allow_ioctlsocket_camel_fionbio="yes"
  3128. else
  3129. AC_MSG_RESULT([no])
  3130. tst_allow_ioctlsocket_camel_fionbio="no"
  3131. fi
  3132. fi
  3133. #
  3134. AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
  3135. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
  3136. test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
  3137. AC_MSG_RESULT([yes])
  3138. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
  3139. [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
  3140. curl_cv_func_ioctlsocket_camel_fionbio="yes"
  3141. else
  3142. AC_MSG_RESULT([no])
  3143. curl_cv_func_ioctlsocket_camel_fionbio="no"
  3144. fi
  3145. ])
  3146. dnl CURL_CHECK_FUNC_MEMRCHR
  3147. dnl -------------------------------------------------
  3148. dnl Verify if memrchr is available, prototyped, and
  3149. dnl can be compiled. If all of these are true, and
  3150. dnl usage has not been previously disallowed with
  3151. dnl shell variable curl_disallow_memrchr, then
  3152. dnl HAVE_MEMRCHR will be defined.
  3153. AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [
  3154. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3155. #
  3156. tst_links_memrchr="unknown"
  3157. tst_macro_memrchr="unknown"
  3158. tst_proto_memrchr="unknown"
  3159. tst_compi_memrchr="unknown"
  3160. tst_allow_memrchr="unknown"
  3161. #
  3162. AC_MSG_CHECKING([if memrchr can be linked])
  3163. AC_LINK_IFELSE([
  3164. AC_LANG_FUNC_LINK_TRY([memrchr])
  3165. ],[
  3166. AC_MSG_RESULT([yes])
  3167. tst_links_memrchr="yes"
  3168. ],[
  3169. AC_MSG_RESULT([no])
  3170. tst_links_memrchr="no"
  3171. ])
  3172. #
  3173. if test "$tst_links_memrchr" = "no"; then
  3174. AC_MSG_CHECKING([if memrchr seems a macro])
  3175. AC_LINK_IFELSE([
  3176. AC_LANG_PROGRAM([[
  3177. $curl_includes_string
  3178. ]],[[
  3179. if(0 != memrchr(0, 0, 0))
  3180. return 1;
  3181. ]])
  3182. ],[
  3183. AC_MSG_RESULT([yes])
  3184. tst_macro_memrchr="yes"
  3185. ],[
  3186. AC_MSG_RESULT([no])
  3187. tst_macro_memrchr="no"
  3188. ])
  3189. fi
  3190. #
  3191. if test "$tst_links_memrchr" = "yes"; then
  3192. AC_MSG_CHECKING([if memrchr is prototyped])
  3193. AC_EGREP_CPP([memrchr],[
  3194. $curl_includes_string
  3195. ],[
  3196. AC_MSG_RESULT([yes])
  3197. tst_proto_memrchr="yes"
  3198. ],[
  3199. AC_MSG_RESULT([no])
  3200. tst_proto_memrchr="no"
  3201. ])
  3202. fi
  3203. #
  3204. if test "$tst_proto_memrchr" = "yes" ||
  3205. test "$tst_macro_memrchr" = "yes"; then
  3206. AC_MSG_CHECKING([if memrchr is compilable])
  3207. AC_COMPILE_IFELSE([
  3208. AC_LANG_PROGRAM([[
  3209. $curl_includes_string
  3210. ]],[[
  3211. if(0 != memrchr(0, 0, 0))
  3212. return 1;
  3213. ]])
  3214. ],[
  3215. AC_MSG_RESULT([yes])
  3216. tst_compi_memrchr="yes"
  3217. ],[
  3218. AC_MSG_RESULT([no])
  3219. tst_compi_memrchr="no"
  3220. ])
  3221. fi
  3222. #
  3223. if test "$tst_compi_memrchr" = "yes"; then
  3224. AC_MSG_CHECKING([if memrchr usage allowed])
  3225. if test "x$curl_disallow_memrchr" != "xyes"; then
  3226. AC_MSG_RESULT([yes])
  3227. tst_allow_memrchr="yes"
  3228. else
  3229. AC_MSG_RESULT([no])
  3230. tst_allow_memrchr="no"
  3231. fi
  3232. fi
  3233. #
  3234. AC_MSG_CHECKING([if memrchr might be used])
  3235. if (test "$tst_proto_memrchr" = "yes" ||
  3236. test "$tst_macro_memrchr" = "yes") &&
  3237. test "$tst_compi_memrchr" = "yes" &&
  3238. test "$tst_allow_memrchr" = "yes"; then
  3239. AC_MSG_RESULT([yes])
  3240. AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1,
  3241. [Define to 1 if you have the memrchr function or macro.])
  3242. curl_cv_func_memrchr="yes"
  3243. else
  3244. AC_MSG_RESULT([no])
  3245. curl_cv_func_memrchr="no"
  3246. fi
  3247. ])
  3248. dnl CURL_CHECK_FUNC_POLL
  3249. dnl -------------------------------------------------
  3250. dnl Verify if poll is available, prototyped, can
  3251. dnl be compiled and seems to work.
  3252. AC_DEFUN([CURL_CHECK_FUNC_POLL], [
  3253. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  3254. AC_REQUIRE([CURL_INCLUDES_POLL])dnl
  3255. #
  3256. tst_links_poll="unknown"
  3257. tst_proto_poll="unknown"
  3258. tst_compi_poll="unknown"
  3259. tst_works_poll="unknown"
  3260. tst_allow_poll="unknown"
  3261. #
  3262. case $host in
  3263. *-apple-*|*-*-interix*)
  3264. dnl poll() does not work on these platforms
  3265. dnl Interix: "does provide poll(), but the implementing developer must
  3266. dnl have been in a bad mood, because poll() only works on the /proc
  3267. dnl filesystem here"
  3268. dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9
  3269. dnl only to break again in 10.12.
  3270. curl_disallow_poll="yes"
  3271. tst_compi_poll="no"
  3272. ;;
  3273. esac
  3274. #
  3275. AC_MSG_CHECKING([if poll can be linked])
  3276. AC_LINK_IFELSE([
  3277. AC_LANG_PROGRAM([[
  3278. $curl_includes_poll
  3279. ]],[[
  3280. if(0 != poll(0, 0, 0))
  3281. return 1;
  3282. ]])
  3283. ],[
  3284. AC_MSG_RESULT([yes])
  3285. tst_links_poll="yes"
  3286. ],[
  3287. AC_MSG_RESULT([no])
  3288. tst_links_poll="no"
  3289. ])
  3290. #
  3291. if test "$tst_links_poll" = "yes"; then
  3292. AC_MSG_CHECKING([if poll is prototyped])
  3293. AC_EGREP_CPP([poll],[
  3294. $curl_includes_poll
  3295. ],[
  3296. AC_MSG_RESULT([yes])
  3297. tst_proto_poll="yes"
  3298. ],[
  3299. AC_MSG_RESULT([no])
  3300. tst_proto_poll="no"
  3301. ])
  3302. fi
  3303. #
  3304. if test "$tst_proto_poll" = "yes"; then
  3305. AC_MSG_CHECKING([if poll is compilable])
  3306. AC_COMPILE_IFELSE([
  3307. AC_LANG_PROGRAM([[
  3308. $curl_includes_poll
  3309. ]],[[
  3310. if(0 != poll(0, 0, 0))
  3311. return 1;
  3312. ]])
  3313. ],[
  3314. AC_MSG_RESULT([yes])
  3315. tst_compi_poll="yes"
  3316. ],[
  3317. AC_MSG_RESULT([no])
  3318. tst_compi_poll="no"
  3319. ])
  3320. fi
  3321. #
  3322. dnl only do runtime verification when not cross-compiling
  3323. if test "$tst_compi_poll" = "yes"; then
  3324. if test "x$cross_compiling" != "xyes"; then
  3325. AC_MSG_CHECKING([if poll seems to work])
  3326. CURL_RUN_IFELSE([
  3327. AC_LANG_PROGRAM([[
  3328. $curl_includes_stdlib
  3329. $curl_includes_poll
  3330. ]],[[
  3331. /* detect the original poll() breakage */
  3332. if(0 != poll(0, 0, 10)) {
  3333. return 1; /* fail */
  3334. }
  3335. ]])
  3336. ],[
  3337. AC_MSG_RESULT([yes])
  3338. tst_works_poll="yes"
  3339. ],[
  3340. AC_MSG_RESULT([no])
  3341. tst_works_poll="no"
  3342. ])
  3343. else
  3344. AC_MSG_CHECKING([if native poll seems to be supported])
  3345. AC_COMPILE_IFELSE([
  3346. AC_LANG_PROGRAM([[
  3347. $curl_includes_stdlib
  3348. ]],[[
  3349. #if defined(__BIONIC__) || \
  3350. (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)
  3351. return 0;
  3352. #else
  3353. #error force compilation error
  3354. #endif
  3355. ]])
  3356. ],[
  3357. AC_MSG_RESULT([yes])
  3358. tst_works_poll="yes"
  3359. ],[
  3360. AC_MSG_RESULT([no])
  3361. tst_works_poll="no"
  3362. ])
  3363. fi
  3364. fi
  3365. #
  3366. if test "$tst_compi_poll" = "yes" &&
  3367. test "$tst_works_poll" != "no"; then
  3368. AC_MSG_CHECKING([if poll usage allowed])
  3369. if test "x$curl_disallow_poll" != "xyes"; then
  3370. AC_MSG_RESULT([yes])
  3371. tst_allow_poll="yes"
  3372. else
  3373. AC_MSG_RESULT([no])
  3374. tst_allow_poll="no"
  3375. fi
  3376. fi
  3377. #
  3378. AC_MSG_CHECKING([if poll might be used])
  3379. if test "$tst_links_poll" = "yes" &&
  3380. test "$tst_proto_poll" = "yes" &&
  3381. test "$tst_compi_poll" = "yes" &&
  3382. test "$tst_allow_poll" = "yes" &&
  3383. test "$tst_works_poll" != "no"; then
  3384. AC_MSG_RESULT([yes])
  3385. AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1,
  3386. [If you have a fine poll])
  3387. curl_cv_func_poll="yes"
  3388. else
  3389. AC_MSG_RESULT([no])
  3390. curl_cv_func_poll="no"
  3391. fi
  3392. ])
  3393. fi
  3394. ])
  3395. dnl CURL_CHECK_FUNC_SIGACTION
  3396. dnl -------------------------------------------------
  3397. dnl Verify if sigaction is available, prototyped, and
  3398. dnl can be compiled. If all of these are true, and
  3399. dnl usage has not been previously disallowed with
  3400. dnl shell variable curl_disallow_sigaction, then
  3401. dnl HAVE_SIGACTION will be defined.
  3402. AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
  3403. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3404. #
  3405. tst_links_sigaction="unknown"
  3406. tst_proto_sigaction="unknown"
  3407. tst_compi_sigaction="unknown"
  3408. tst_allow_sigaction="unknown"
  3409. #
  3410. AC_MSG_CHECKING([if sigaction can be linked])
  3411. AC_LINK_IFELSE([
  3412. AC_LANG_FUNC_LINK_TRY([sigaction])
  3413. ],[
  3414. AC_MSG_RESULT([yes])
  3415. tst_links_sigaction="yes"
  3416. ],[
  3417. AC_MSG_RESULT([no])
  3418. tst_links_sigaction="no"
  3419. ])
  3420. #
  3421. if test "$tst_links_sigaction" = "yes"; then
  3422. AC_MSG_CHECKING([if sigaction is prototyped])
  3423. AC_EGREP_CPP([sigaction],[
  3424. $curl_includes_signal
  3425. ],[
  3426. AC_MSG_RESULT([yes])
  3427. tst_proto_sigaction="yes"
  3428. ],[
  3429. AC_MSG_RESULT([no])
  3430. tst_proto_sigaction="no"
  3431. ])
  3432. fi
  3433. #
  3434. if test "$tst_proto_sigaction" = "yes"; then
  3435. AC_MSG_CHECKING([if sigaction is compilable])
  3436. AC_COMPILE_IFELSE([
  3437. AC_LANG_PROGRAM([[
  3438. $curl_includes_signal
  3439. ]],[[
  3440. if(0 != sigaction(0, 0, 0))
  3441. return 1;
  3442. ]])
  3443. ],[
  3444. AC_MSG_RESULT([yes])
  3445. tst_compi_sigaction="yes"
  3446. ],[
  3447. AC_MSG_RESULT([no])
  3448. tst_compi_sigaction="no"
  3449. ])
  3450. fi
  3451. #
  3452. if test "$tst_compi_sigaction" = "yes"; then
  3453. AC_MSG_CHECKING([if sigaction usage allowed])
  3454. if test "x$curl_disallow_sigaction" != "xyes"; then
  3455. AC_MSG_RESULT([yes])
  3456. tst_allow_sigaction="yes"
  3457. else
  3458. AC_MSG_RESULT([no])
  3459. tst_allow_sigaction="no"
  3460. fi
  3461. fi
  3462. #
  3463. AC_MSG_CHECKING([if sigaction might be used])
  3464. if test "$tst_links_sigaction" = "yes" &&
  3465. test "$tst_proto_sigaction" = "yes" &&
  3466. test "$tst_compi_sigaction" = "yes" &&
  3467. test "$tst_allow_sigaction" = "yes"; then
  3468. AC_MSG_RESULT([yes])
  3469. AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
  3470. [Define to 1 if you have the sigaction function.])
  3471. curl_cv_func_sigaction="yes"
  3472. else
  3473. AC_MSG_RESULT([no])
  3474. curl_cv_func_sigaction="no"
  3475. fi
  3476. ])
  3477. dnl CURL_CHECK_FUNC_SIGINTERRUPT
  3478. dnl -------------------------------------------------
  3479. dnl Verify if siginterrupt is available, prototyped, and
  3480. dnl can be compiled. If all of these are true, and
  3481. dnl usage has not been previously disallowed with
  3482. dnl shell variable curl_disallow_siginterrupt, then
  3483. dnl HAVE_SIGINTERRUPT will be defined.
  3484. AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [
  3485. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3486. #
  3487. tst_links_siginterrupt="unknown"
  3488. tst_proto_siginterrupt="unknown"
  3489. tst_compi_siginterrupt="unknown"
  3490. tst_allow_siginterrupt="unknown"
  3491. #
  3492. AC_MSG_CHECKING([if siginterrupt can be linked])
  3493. AC_LINK_IFELSE([
  3494. AC_LANG_FUNC_LINK_TRY([siginterrupt])
  3495. ],[
  3496. AC_MSG_RESULT([yes])
  3497. tst_links_siginterrupt="yes"
  3498. ],[
  3499. AC_MSG_RESULT([no])
  3500. tst_links_siginterrupt="no"
  3501. ])
  3502. #
  3503. if test "$tst_links_siginterrupt" = "yes"; then
  3504. AC_MSG_CHECKING([if siginterrupt is prototyped])
  3505. AC_EGREP_CPP([siginterrupt],[
  3506. $curl_includes_signal
  3507. ],[
  3508. AC_MSG_RESULT([yes])
  3509. tst_proto_siginterrupt="yes"
  3510. ],[
  3511. AC_MSG_RESULT([no])
  3512. tst_proto_siginterrupt="no"
  3513. ])
  3514. fi
  3515. #
  3516. if test "$tst_proto_siginterrupt" = "yes"; then
  3517. AC_MSG_CHECKING([if siginterrupt is compilable])
  3518. AC_COMPILE_IFELSE([
  3519. AC_LANG_PROGRAM([[
  3520. $curl_includes_signal
  3521. ]],[[
  3522. if(0 != siginterrupt(0, 0))
  3523. return 1;
  3524. ]])
  3525. ],[
  3526. AC_MSG_RESULT([yes])
  3527. tst_compi_siginterrupt="yes"
  3528. ],[
  3529. AC_MSG_RESULT([no])
  3530. tst_compi_siginterrupt="no"
  3531. ])
  3532. fi
  3533. #
  3534. if test "$tst_compi_siginterrupt" = "yes"; then
  3535. AC_MSG_CHECKING([if siginterrupt usage allowed])
  3536. if test "x$curl_disallow_siginterrupt" != "xyes"; then
  3537. AC_MSG_RESULT([yes])
  3538. tst_allow_siginterrupt="yes"
  3539. else
  3540. AC_MSG_RESULT([no])
  3541. tst_allow_siginterrupt="no"
  3542. fi
  3543. fi
  3544. #
  3545. AC_MSG_CHECKING([if siginterrupt might be used])
  3546. if test "$tst_links_siginterrupt" = "yes" &&
  3547. test "$tst_proto_siginterrupt" = "yes" &&
  3548. test "$tst_compi_siginterrupt" = "yes" &&
  3549. test "$tst_allow_siginterrupt" = "yes"; then
  3550. AC_MSG_RESULT([yes])
  3551. AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1,
  3552. [Define to 1 if you have the siginterrupt function.])
  3553. curl_cv_func_siginterrupt="yes"
  3554. else
  3555. AC_MSG_RESULT([no])
  3556. curl_cv_func_siginterrupt="no"
  3557. fi
  3558. ])
  3559. dnl CURL_CHECK_FUNC_SIGNAL
  3560. dnl -------------------------------------------------
  3561. dnl Verify if signal is available, prototyped, and
  3562. dnl can be compiled. If all of these are true, and
  3563. dnl usage has not been previously disallowed with
  3564. dnl shell variable curl_disallow_signal, then
  3565. dnl HAVE_SIGNAL will be defined.
  3566. AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [
  3567. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  3568. #
  3569. tst_links_signal="unknown"
  3570. tst_proto_signal="unknown"
  3571. tst_compi_signal="unknown"
  3572. tst_allow_signal="unknown"
  3573. #
  3574. AC_MSG_CHECKING([if signal can be linked])
  3575. AC_LINK_IFELSE([
  3576. AC_LANG_FUNC_LINK_TRY([signal])
  3577. ],[
  3578. AC_MSG_RESULT([yes])
  3579. tst_links_signal="yes"
  3580. ],[
  3581. AC_MSG_RESULT([no])
  3582. tst_links_signal="no"
  3583. ])
  3584. #
  3585. if test "$tst_links_signal" = "yes"; then
  3586. AC_MSG_CHECKING([if signal is prototyped])
  3587. AC_EGREP_CPP([signal],[
  3588. $curl_includes_signal
  3589. ],[
  3590. AC_MSG_RESULT([yes])
  3591. tst_proto_signal="yes"
  3592. ],[
  3593. AC_MSG_RESULT([no])
  3594. tst_proto_signal="no"
  3595. ])
  3596. fi
  3597. #
  3598. if test "$tst_proto_signal" = "yes"; then
  3599. AC_MSG_CHECKING([if signal is compilable])
  3600. AC_COMPILE_IFELSE([
  3601. AC_LANG_PROGRAM([[
  3602. $curl_includes_signal
  3603. ]],[[
  3604. if(0 != signal(0, 0))
  3605. return 1;
  3606. ]])
  3607. ],[
  3608. AC_MSG_RESULT([yes])
  3609. tst_compi_signal="yes"
  3610. ],[
  3611. AC_MSG_RESULT([no])
  3612. tst_compi_signal="no"
  3613. ])
  3614. fi
  3615. #
  3616. if test "$tst_compi_signal" = "yes"; then
  3617. AC_MSG_CHECKING([if signal usage allowed])
  3618. if test "x$curl_disallow_signal" != "xyes"; then
  3619. AC_MSG_RESULT([yes])
  3620. tst_allow_signal="yes"
  3621. else
  3622. AC_MSG_RESULT([no])
  3623. tst_allow_signal="no"
  3624. fi
  3625. fi
  3626. #
  3627. AC_MSG_CHECKING([if signal might be used])
  3628. if test "$tst_links_signal" = "yes" &&
  3629. test "$tst_proto_signal" = "yes" &&
  3630. test "$tst_compi_signal" = "yes" &&
  3631. test "$tst_allow_signal" = "yes"; then
  3632. AC_MSG_RESULT([yes])
  3633. AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1,
  3634. [Define to 1 if you have the signal function.])
  3635. curl_cv_func_signal="yes"
  3636. else
  3637. AC_MSG_RESULT([no])
  3638. curl_cv_func_signal="no"
  3639. fi
  3640. ])
  3641. dnl CURL_CHECK_FUNC_SIGSETJMP
  3642. dnl -------------------------------------------------
  3643. dnl Verify if sigsetjmp is available, prototyped, and
  3644. dnl can be compiled. If all of these are true, and
  3645. dnl usage has not been previously disallowed with
  3646. dnl shell variable curl_disallow_sigsetjmp, then
  3647. dnl HAVE_SIGSETJMP will be defined.
  3648. AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [
  3649. AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl
  3650. #
  3651. tst_links_sigsetjmp="unknown"
  3652. tst_macro_sigsetjmp="unknown"
  3653. tst_proto_sigsetjmp="unknown"
  3654. tst_compi_sigsetjmp="unknown"
  3655. tst_allow_sigsetjmp="unknown"
  3656. #
  3657. AC_MSG_CHECKING([if sigsetjmp can be linked])
  3658. AC_LINK_IFELSE([
  3659. AC_LANG_FUNC_LINK_TRY([sigsetjmp])
  3660. ],[
  3661. AC_MSG_RESULT([yes])
  3662. tst_links_sigsetjmp="yes"
  3663. ],[
  3664. AC_MSG_RESULT([no])
  3665. tst_links_sigsetjmp="no"
  3666. ])
  3667. #
  3668. if test "$tst_links_sigsetjmp" = "no"; then
  3669. AC_MSG_CHECKING([if sigsetjmp seems a macro])
  3670. AC_LINK_IFELSE([
  3671. AC_LANG_PROGRAM([[
  3672. $curl_includes_setjmp
  3673. ]],[[
  3674. sigjmp_buf env;
  3675. if(0 != sigsetjmp(env, 0))
  3676. return 1;
  3677. ]])
  3678. ],[
  3679. AC_MSG_RESULT([yes])
  3680. tst_macro_sigsetjmp="yes"
  3681. ],[
  3682. AC_MSG_RESULT([no])
  3683. tst_macro_sigsetjmp="no"
  3684. ])
  3685. fi
  3686. #
  3687. if test "$tst_links_sigsetjmp" = "yes"; then
  3688. AC_MSG_CHECKING([if sigsetjmp is prototyped])
  3689. AC_EGREP_CPP([sigsetjmp],[
  3690. $curl_includes_setjmp
  3691. ],[
  3692. AC_MSG_RESULT([yes])
  3693. tst_proto_sigsetjmp="yes"
  3694. ],[
  3695. AC_MSG_RESULT([no])
  3696. tst_proto_sigsetjmp="no"
  3697. ])
  3698. fi
  3699. #
  3700. if test "$tst_proto_sigsetjmp" = "yes" ||
  3701. test "$tst_macro_sigsetjmp" = "yes"; then
  3702. AC_MSG_CHECKING([if sigsetjmp is compilable])
  3703. AC_COMPILE_IFELSE([
  3704. AC_LANG_PROGRAM([[
  3705. $curl_includes_setjmp
  3706. ]],[[
  3707. sigjmp_buf env;
  3708. if(0 != sigsetjmp(env, 0))
  3709. return 1;
  3710. ]])
  3711. ],[
  3712. AC_MSG_RESULT([yes])
  3713. tst_compi_sigsetjmp="yes"
  3714. ],[
  3715. AC_MSG_RESULT([no])
  3716. tst_compi_sigsetjmp="no"
  3717. ])
  3718. fi
  3719. #
  3720. if test "$tst_compi_sigsetjmp" = "yes"; then
  3721. AC_MSG_CHECKING([if sigsetjmp usage allowed])
  3722. if test "x$curl_disallow_sigsetjmp" != "xyes"; then
  3723. AC_MSG_RESULT([yes])
  3724. tst_allow_sigsetjmp="yes"
  3725. else
  3726. AC_MSG_RESULT([no])
  3727. tst_allow_sigsetjmp="no"
  3728. fi
  3729. fi
  3730. #
  3731. AC_MSG_CHECKING([if sigsetjmp might be used])
  3732. if (test "$tst_proto_sigsetjmp" = "yes" ||
  3733. test "$tst_macro_sigsetjmp" = "yes") &&
  3734. test "$tst_compi_sigsetjmp" = "yes" &&
  3735. test "$tst_allow_sigsetjmp" = "yes"; then
  3736. AC_MSG_RESULT([yes])
  3737. AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1,
  3738. [Define to 1 if you have the sigsetjmp function or macro.])
  3739. curl_cv_func_sigsetjmp="yes"
  3740. else
  3741. AC_MSG_RESULT([no])
  3742. curl_cv_func_sigsetjmp="no"
  3743. fi
  3744. ])
  3745. dnl CURL_CHECK_FUNC_SOCKET
  3746. dnl -------------------------------------------------
  3747. dnl Verify if socket is available, prototyped, and
  3748. dnl can be compiled. If all of these are true, and
  3749. dnl usage has not been previously disallowed with
  3750. dnl shell variable curl_disallow_socket, then
  3751. dnl HAVE_SOCKET will be defined.
  3752. AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [
  3753. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  3754. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  3755. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  3756. #
  3757. tst_links_socket="unknown"
  3758. tst_proto_socket="unknown"
  3759. tst_compi_socket="unknown"
  3760. tst_allow_socket="unknown"
  3761. #
  3762. AC_MSG_CHECKING([if socket can be linked])
  3763. AC_LINK_IFELSE([
  3764. AC_LANG_PROGRAM([[
  3765. $curl_includes_winsock2
  3766. $curl_includes_bsdsocket
  3767. $curl_includes_sys_socket
  3768. $curl_includes_socket
  3769. ]],[[
  3770. if(0 != socket(0, 0, 0))
  3771. return 1;
  3772. ]])
  3773. ],[
  3774. AC_MSG_RESULT([yes])
  3775. tst_links_socket="yes"
  3776. ],[
  3777. AC_MSG_RESULT([no])
  3778. tst_links_socket="no"
  3779. ])
  3780. #
  3781. if test "$tst_links_socket" = "yes"; then
  3782. AC_MSG_CHECKING([if socket is prototyped])
  3783. AC_EGREP_CPP([socket],[
  3784. $curl_includes_winsock2
  3785. $curl_includes_bsdsocket
  3786. $curl_includes_sys_socket
  3787. $curl_includes_socket
  3788. ],[
  3789. AC_MSG_RESULT([yes])
  3790. tst_proto_socket="yes"
  3791. ],[
  3792. AC_MSG_RESULT([no])
  3793. tst_proto_socket="no"
  3794. ])
  3795. fi
  3796. #
  3797. if test "$tst_proto_socket" = "yes"; then
  3798. AC_MSG_CHECKING([if socket is compilable])
  3799. AC_COMPILE_IFELSE([
  3800. AC_LANG_PROGRAM([[
  3801. $curl_includes_winsock2
  3802. $curl_includes_bsdsocket
  3803. $curl_includes_sys_socket
  3804. $curl_includes_socket
  3805. ]],[[
  3806. if(0 != socket(0, 0, 0))
  3807. return 1;
  3808. ]])
  3809. ],[
  3810. AC_MSG_RESULT([yes])
  3811. tst_compi_socket="yes"
  3812. ],[
  3813. AC_MSG_RESULT([no])
  3814. tst_compi_socket="no"
  3815. ])
  3816. fi
  3817. #
  3818. if test "$tst_compi_socket" = "yes"; then
  3819. AC_MSG_CHECKING([if socket usage allowed])
  3820. if test "x$curl_disallow_socket" != "xyes"; then
  3821. AC_MSG_RESULT([yes])
  3822. tst_allow_socket="yes"
  3823. else
  3824. AC_MSG_RESULT([no])
  3825. tst_allow_socket="no"
  3826. fi
  3827. fi
  3828. #
  3829. AC_MSG_CHECKING([if socket might be used])
  3830. if test "$tst_links_socket" = "yes" &&
  3831. test "$tst_proto_socket" = "yes" &&
  3832. test "$tst_compi_socket" = "yes" &&
  3833. test "$tst_allow_socket" = "yes"; then
  3834. AC_MSG_RESULT([yes])
  3835. AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1,
  3836. [Define to 1 if you have the socket function.])
  3837. curl_cv_func_socket="yes"
  3838. else
  3839. AC_MSG_RESULT([no])
  3840. curl_cv_func_socket="no"
  3841. fi
  3842. ])
  3843. dnl CURL_CHECK_FUNC_SOCKETPAIR
  3844. dnl -------------------------------------------------
  3845. dnl Verify if socketpair is available, prototyped, and
  3846. dnl can be compiled. If all of these are true, and
  3847. dnl usage has not been previously disallowed with
  3848. dnl shell variable curl_disallow_socketpair, then
  3849. dnl HAVE_SOCKETPAIR will be defined.
  3850. AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [
  3851. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  3852. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  3853. #
  3854. tst_links_socketpair="unknown"
  3855. tst_proto_socketpair="unknown"
  3856. tst_compi_socketpair="unknown"
  3857. tst_allow_socketpair="unknown"
  3858. #
  3859. AC_MSG_CHECKING([if socketpair can be linked])
  3860. AC_LINK_IFELSE([
  3861. AC_LANG_FUNC_LINK_TRY([socketpair])
  3862. ],[
  3863. AC_MSG_RESULT([yes])
  3864. tst_links_socketpair="yes"
  3865. ],[
  3866. AC_MSG_RESULT([no])
  3867. tst_links_socketpair="no"
  3868. ])
  3869. #
  3870. if test "$tst_links_socketpair" = "yes"; then
  3871. AC_MSG_CHECKING([if socketpair is prototyped])
  3872. AC_EGREP_CPP([socketpair],[
  3873. $curl_includes_sys_socket
  3874. $curl_includes_socket
  3875. ],[
  3876. AC_MSG_RESULT([yes])
  3877. tst_proto_socketpair="yes"
  3878. ],[
  3879. AC_MSG_RESULT([no])
  3880. tst_proto_socketpair="no"
  3881. ])
  3882. fi
  3883. #
  3884. if test "$tst_proto_socketpair" = "yes"; then
  3885. AC_MSG_CHECKING([if socketpair is compilable])
  3886. AC_COMPILE_IFELSE([
  3887. AC_LANG_PROGRAM([[
  3888. $curl_includes_sys_socket
  3889. $curl_includes_socket
  3890. ]],[[
  3891. int sv[2];
  3892. if(0 != socketpair(0, 0, 0, sv))
  3893. return 1;
  3894. ]])
  3895. ],[
  3896. AC_MSG_RESULT([yes])
  3897. tst_compi_socketpair="yes"
  3898. ],[
  3899. AC_MSG_RESULT([no])
  3900. tst_compi_socketpair="no"
  3901. ])
  3902. fi
  3903. #
  3904. if test "$tst_compi_socketpair" = "yes"; then
  3905. AC_MSG_CHECKING([if socketpair usage allowed])
  3906. if test "x$curl_disallow_socketpair" != "xyes"; then
  3907. AC_MSG_RESULT([yes])
  3908. tst_allow_socketpair="yes"
  3909. else
  3910. AC_MSG_RESULT([no])
  3911. tst_allow_socketpair="no"
  3912. fi
  3913. fi
  3914. #
  3915. AC_MSG_CHECKING([if socketpair might be used])
  3916. if test "$tst_links_socketpair" = "yes" &&
  3917. test "$tst_proto_socketpair" = "yes" &&
  3918. test "$tst_compi_socketpair" = "yes" &&
  3919. test "$tst_allow_socketpair" = "yes"; then
  3920. AC_MSG_RESULT([yes])
  3921. AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1,
  3922. [Define to 1 if you have the socketpair function.])
  3923. curl_cv_func_socketpair="yes"
  3924. else
  3925. AC_MSG_RESULT([no])
  3926. curl_cv_func_socketpair="no"
  3927. fi
  3928. ])
  3929. dnl CURL_CHECK_FUNC_STRCASECMP
  3930. dnl -------------------------------------------------
  3931. dnl Verify if strcasecmp is available, prototyped, and
  3932. dnl can be compiled. If all of these are true, and
  3933. dnl usage has not been previously disallowed with
  3934. dnl shell variable curl_disallow_strcasecmp, then
  3935. dnl HAVE_STRCASECMP will be defined.
  3936. AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
  3937. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3938. #
  3939. tst_links_strcasecmp="unknown"
  3940. tst_proto_strcasecmp="unknown"
  3941. tst_compi_strcasecmp="unknown"
  3942. tst_allow_strcasecmp="unknown"
  3943. #
  3944. AC_MSG_CHECKING([if strcasecmp can be linked])
  3945. AC_LINK_IFELSE([
  3946. AC_LANG_FUNC_LINK_TRY([strcasecmp])
  3947. ],[
  3948. AC_MSG_RESULT([yes])
  3949. tst_links_strcasecmp="yes"
  3950. ],[
  3951. AC_MSG_RESULT([no])
  3952. tst_links_strcasecmp="no"
  3953. ])
  3954. #
  3955. if test "$tst_links_strcasecmp" = "yes"; then
  3956. AC_MSG_CHECKING([if strcasecmp is prototyped])
  3957. AC_EGREP_CPP([strcasecmp],[
  3958. $curl_includes_string
  3959. ],[
  3960. AC_MSG_RESULT([yes])
  3961. tst_proto_strcasecmp="yes"
  3962. ],[
  3963. AC_MSG_RESULT([no])
  3964. tst_proto_strcasecmp="no"
  3965. ])
  3966. fi
  3967. #
  3968. if test "$tst_proto_strcasecmp" = "yes"; then
  3969. AC_MSG_CHECKING([if strcasecmp is compilable])
  3970. AC_COMPILE_IFELSE([
  3971. AC_LANG_PROGRAM([[
  3972. $curl_includes_string
  3973. ]],[[
  3974. if(0 != strcasecmp(0, 0))
  3975. return 1;
  3976. ]])
  3977. ],[
  3978. AC_MSG_RESULT([yes])
  3979. tst_compi_strcasecmp="yes"
  3980. ],[
  3981. AC_MSG_RESULT([no])
  3982. tst_compi_strcasecmp="no"
  3983. ])
  3984. fi
  3985. #
  3986. if test "$tst_compi_strcasecmp" = "yes"; then
  3987. AC_MSG_CHECKING([if strcasecmp usage allowed])
  3988. if test "x$curl_disallow_strcasecmp" != "xyes"; then
  3989. AC_MSG_RESULT([yes])
  3990. tst_allow_strcasecmp="yes"
  3991. else
  3992. AC_MSG_RESULT([no])
  3993. tst_allow_strcasecmp="no"
  3994. fi
  3995. fi
  3996. #
  3997. AC_MSG_CHECKING([if strcasecmp might be used])
  3998. if test "$tst_links_strcasecmp" = "yes" &&
  3999. test "$tst_proto_strcasecmp" = "yes" &&
  4000. test "$tst_compi_strcasecmp" = "yes" &&
  4001. test "$tst_allow_strcasecmp" = "yes"; then
  4002. AC_MSG_RESULT([yes])
  4003. AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
  4004. [Define to 1 if you have the strcasecmp function.])
  4005. curl_cv_func_strcasecmp="yes"
  4006. else
  4007. AC_MSG_RESULT([no])
  4008. curl_cv_func_strcasecmp="no"
  4009. fi
  4010. ])
  4011. dnl CURL_CHECK_FUNC_STRCMPI
  4012. dnl -------------------------------------------------
  4013. dnl Verify if strcmpi is available, prototyped, and
  4014. dnl can be compiled. If all of these are true, and
  4015. dnl usage has not been previously disallowed with
  4016. dnl shell variable curl_disallow_strcmpi, then
  4017. dnl HAVE_STRCMPI will be defined.
  4018. AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
  4019. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4020. #
  4021. tst_links_strcmpi="unknown"
  4022. tst_proto_strcmpi="unknown"
  4023. tst_compi_strcmpi="unknown"
  4024. tst_allow_strcmpi="unknown"
  4025. #
  4026. AC_MSG_CHECKING([if strcmpi can be linked])
  4027. AC_LINK_IFELSE([
  4028. AC_LANG_FUNC_LINK_TRY([strcmpi])
  4029. ],[
  4030. AC_MSG_RESULT([yes])
  4031. tst_links_strcmpi="yes"
  4032. ],[
  4033. AC_MSG_RESULT([no])
  4034. tst_links_strcmpi="no"
  4035. ])
  4036. #
  4037. if test "$tst_links_strcmpi" = "yes"; then
  4038. AC_MSG_CHECKING([if strcmpi is prototyped])
  4039. AC_EGREP_CPP([strcmpi],[
  4040. $curl_includes_string
  4041. ],[
  4042. AC_MSG_RESULT([yes])
  4043. tst_proto_strcmpi="yes"
  4044. ],[
  4045. AC_MSG_RESULT([no])
  4046. tst_proto_strcmpi="no"
  4047. ])
  4048. fi
  4049. #
  4050. if test "$tst_proto_strcmpi" = "yes"; then
  4051. AC_MSG_CHECKING([if strcmpi is compilable])
  4052. AC_COMPILE_IFELSE([
  4053. AC_LANG_PROGRAM([[
  4054. $curl_includes_string
  4055. ]],[[
  4056. if(0 != strcmpi(0, 0))
  4057. return 1;
  4058. ]])
  4059. ],[
  4060. AC_MSG_RESULT([yes])
  4061. tst_compi_strcmpi="yes"
  4062. ],[
  4063. AC_MSG_RESULT([no])
  4064. tst_compi_strcmpi="no"
  4065. ])
  4066. fi
  4067. #
  4068. if test "$tst_compi_strcmpi" = "yes"; then
  4069. AC_MSG_CHECKING([if strcmpi usage allowed])
  4070. if test "x$curl_disallow_strcmpi" != "xyes"; then
  4071. AC_MSG_RESULT([yes])
  4072. tst_allow_strcmpi="yes"
  4073. else
  4074. AC_MSG_RESULT([no])
  4075. tst_allow_strcmpi="no"
  4076. fi
  4077. fi
  4078. #
  4079. AC_MSG_CHECKING([if strcmpi might be used])
  4080. if test "$tst_links_strcmpi" = "yes" &&
  4081. test "$tst_proto_strcmpi" = "yes" &&
  4082. test "$tst_compi_strcmpi" = "yes" &&
  4083. test "$tst_allow_strcmpi" = "yes"; then
  4084. AC_MSG_RESULT([yes])
  4085. AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
  4086. [Define to 1 if you have the strcmpi function.])
  4087. curl_cv_func_strcmpi="yes"
  4088. else
  4089. AC_MSG_RESULT([no])
  4090. curl_cv_func_strcmpi="no"
  4091. fi
  4092. ])
  4093. dnl CURL_CHECK_FUNC_STRDUP
  4094. dnl -------------------------------------------------
  4095. dnl Verify if strdup is available, prototyped, and
  4096. dnl can be compiled. If all of these are true, and
  4097. dnl usage has not been previously disallowed with
  4098. dnl shell variable curl_disallow_strdup, then
  4099. dnl HAVE_STRDUP will be defined.
  4100. AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
  4101. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4102. #
  4103. tst_links_strdup="unknown"
  4104. tst_proto_strdup="unknown"
  4105. tst_compi_strdup="unknown"
  4106. tst_allow_strdup="unknown"
  4107. #
  4108. AC_MSG_CHECKING([if strdup can be linked])
  4109. AC_LINK_IFELSE([
  4110. AC_LANG_FUNC_LINK_TRY([strdup])
  4111. ],[
  4112. AC_MSG_RESULT([yes])
  4113. tst_links_strdup="yes"
  4114. ],[
  4115. AC_MSG_RESULT([no])
  4116. tst_links_strdup="no"
  4117. ])
  4118. #
  4119. if test "$tst_links_strdup" = "yes"; then
  4120. AC_MSG_CHECKING([if strdup is prototyped])
  4121. AC_EGREP_CPP([strdup],[
  4122. $curl_includes_string
  4123. ],[
  4124. AC_MSG_RESULT([yes])
  4125. tst_proto_strdup="yes"
  4126. ],[
  4127. AC_MSG_RESULT([no])
  4128. tst_proto_strdup="no"
  4129. ])
  4130. fi
  4131. #
  4132. if test "$tst_proto_strdup" = "yes"; then
  4133. AC_MSG_CHECKING([if strdup is compilable])
  4134. AC_COMPILE_IFELSE([
  4135. AC_LANG_PROGRAM([[
  4136. $curl_includes_string
  4137. ]],[[
  4138. if(0 != strdup(0))
  4139. return 1;
  4140. ]])
  4141. ],[
  4142. AC_MSG_RESULT([yes])
  4143. tst_compi_strdup="yes"
  4144. ],[
  4145. AC_MSG_RESULT([no])
  4146. tst_compi_strdup="no"
  4147. ])
  4148. fi
  4149. #
  4150. if test "$tst_compi_strdup" = "yes"; then
  4151. AC_MSG_CHECKING([if strdup usage allowed])
  4152. if test "x$curl_disallow_strdup" != "xyes"; then
  4153. AC_MSG_RESULT([yes])
  4154. tst_allow_strdup="yes"
  4155. else
  4156. AC_MSG_RESULT([no])
  4157. tst_allow_strdup="no"
  4158. fi
  4159. fi
  4160. #
  4161. AC_MSG_CHECKING([if strdup might be used])
  4162. if test "$tst_links_strdup" = "yes" &&
  4163. test "$tst_proto_strdup" = "yes" &&
  4164. test "$tst_compi_strdup" = "yes" &&
  4165. test "$tst_allow_strdup" = "yes"; then
  4166. AC_MSG_RESULT([yes])
  4167. AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
  4168. [Define to 1 if you have the strdup function.])
  4169. curl_cv_func_strdup="yes"
  4170. else
  4171. AC_MSG_RESULT([no])
  4172. curl_cv_func_strdup="no"
  4173. fi
  4174. ])
  4175. dnl CURL_CHECK_FUNC_STRERROR_R
  4176. dnl -------------------------------------------------
  4177. dnl Verify if strerror_r is available, prototyped, can be compiled and
  4178. dnl seems to work. If all of these are true, and usage has not been
  4179. dnl previously disallowed with shell variable curl_disallow_strerror_r,
  4180. dnl then HAVE_STRERROR_R will be defined, as well as one of
  4181. dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
  4182. dnl
  4183. dnl glibc-style strerror_r:
  4184. dnl
  4185. dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
  4186. dnl
  4187. dnl glibc-style strerror_r returns a pointer to the error string,
  4188. dnl and might use the provided workbuf as a scratch area if needed. A
  4189. dnl quick test on a few systems shows that it's usually not used at all.
  4190. dnl
  4191. dnl POSIX-style strerror_r:
  4192. dnl
  4193. dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
  4194. dnl
  4195. dnl POSIX-style strerror_r returns 0 upon successful completion and the
  4196. dnl error string in the provided resultbuf.
  4197. dnl
  4198. AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
  4199. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  4200. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4201. #
  4202. tst_links_strerror_r="unknown"
  4203. tst_proto_strerror_r="unknown"
  4204. tst_compi_strerror_r="unknown"
  4205. tst_glibc_strerror_r="unknown"
  4206. tst_posix_strerror_r="unknown"
  4207. tst_allow_strerror_r="unknown"
  4208. tst_works_glibc_strerror_r="unknown"
  4209. tst_works_posix_strerror_r="unknown"
  4210. tst_glibc_strerror_r_type_arg3="unknown"
  4211. tst_posix_strerror_r_type_arg3="unknown"
  4212. #
  4213. AC_MSG_CHECKING([if strerror_r can be linked])
  4214. AC_LINK_IFELSE([
  4215. AC_LANG_FUNC_LINK_TRY([strerror_r])
  4216. ],[
  4217. AC_MSG_RESULT([yes])
  4218. tst_links_strerror_r="yes"
  4219. ],[
  4220. AC_MSG_RESULT([no])
  4221. tst_links_strerror_r="no"
  4222. ])
  4223. #
  4224. if test "$tst_links_strerror_r" = "yes"; then
  4225. AC_MSG_CHECKING([if strerror_r is prototyped])
  4226. AC_EGREP_CPP([strerror_r],[
  4227. $curl_includes_string
  4228. ],[
  4229. AC_MSG_RESULT([yes])
  4230. tst_proto_strerror_r="yes"
  4231. ],[
  4232. AC_MSG_RESULT([no])
  4233. tst_proto_strerror_r="no"
  4234. ])
  4235. fi
  4236. #
  4237. if test "$tst_proto_strerror_r" = "yes"; then
  4238. AC_MSG_CHECKING([if strerror_r is compilable])
  4239. AC_COMPILE_IFELSE([
  4240. AC_LANG_PROGRAM([[
  4241. $curl_includes_string
  4242. ]],[[
  4243. if(0 != strerror_r(0, 0, 0))
  4244. return 1;
  4245. ]])
  4246. ],[
  4247. AC_MSG_RESULT([yes])
  4248. tst_compi_strerror_r="yes"
  4249. ],[
  4250. AC_MSG_RESULT([no])
  4251. tst_compi_strerror_r="no"
  4252. ])
  4253. fi
  4254. #
  4255. if test "$tst_compi_strerror_r" = "yes"; then
  4256. AC_MSG_CHECKING([if strerror_r is glibc like])
  4257. tst_glibc_strerror_r_type_arg3="unknown"
  4258. for arg3 in 'size_t' 'int' 'unsigned int'; do
  4259. if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
  4260. AC_COMPILE_IFELSE([
  4261. AC_LANG_PROGRAM([[
  4262. $curl_includes_string
  4263. char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
  4264. ]],[[
  4265. if(0 != strerror_r(0, 0, 0))
  4266. return 1;
  4267. ]])
  4268. ],[
  4269. tst_glibc_strerror_r_type_arg3="$arg3"
  4270. ])
  4271. fi
  4272. done
  4273. case "$tst_glibc_strerror_r_type_arg3" in
  4274. unknown)
  4275. AC_MSG_RESULT([no])
  4276. tst_glibc_strerror_r="no"
  4277. ;;
  4278. *)
  4279. AC_MSG_RESULT([yes])
  4280. tst_glibc_strerror_r="yes"
  4281. ;;
  4282. esac
  4283. fi
  4284. #
  4285. dnl only do runtime verification when not cross-compiling
  4286. if test "x$cross_compiling" != "xyes" &&
  4287. test "$tst_glibc_strerror_r" = "yes"; then
  4288. AC_MSG_CHECKING([if strerror_r seems to work])
  4289. CURL_RUN_IFELSE([
  4290. AC_LANG_PROGRAM([[
  4291. $curl_includes_stdlib
  4292. $curl_includes_string
  4293. # include <errno.h>
  4294. ]],[[
  4295. char buffer[1024];
  4296. char *string = 0;
  4297. buffer[0] = '\0';
  4298. string = strerror_r(EACCES, buffer, sizeof(buffer));
  4299. if(!string)
  4300. exit(1); /* fail */
  4301. if(!string[0])
  4302. exit(1); /* fail */
  4303. else
  4304. exit(0);
  4305. ]])
  4306. ],[
  4307. AC_MSG_RESULT([yes])
  4308. tst_works_glibc_strerror_r="yes"
  4309. ],[
  4310. AC_MSG_RESULT([no])
  4311. tst_works_glibc_strerror_r="no"
  4312. ])
  4313. fi
  4314. #
  4315. if test "$tst_compi_strerror_r" = "yes" &&
  4316. test "$tst_works_glibc_strerror_r" != "yes"; then
  4317. AC_MSG_CHECKING([if strerror_r is POSIX like])
  4318. tst_posix_strerror_r_type_arg3="unknown"
  4319. for arg3 in 'size_t' 'int' 'unsigned int'; do
  4320. if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
  4321. AC_COMPILE_IFELSE([
  4322. AC_LANG_PROGRAM([[
  4323. $curl_includes_string
  4324. int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
  4325. ]],[[
  4326. if(0 != strerror_r(0, 0, 0))
  4327. return 1;
  4328. ]])
  4329. ],[
  4330. tst_posix_strerror_r_type_arg3="$arg3"
  4331. ])
  4332. fi
  4333. done
  4334. case "$tst_posix_strerror_r_type_arg3" in
  4335. unknown)
  4336. AC_MSG_RESULT([no])
  4337. tst_posix_strerror_r="no"
  4338. ;;
  4339. *)
  4340. AC_MSG_RESULT([yes])
  4341. tst_posix_strerror_r="yes"
  4342. ;;
  4343. esac
  4344. fi
  4345. #
  4346. dnl only do runtime verification when not cross-compiling
  4347. if test "x$cross_compiling" != "xyes" &&
  4348. test "$tst_posix_strerror_r" = "yes"; then
  4349. AC_MSG_CHECKING([if strerror_r seems to work])
  4350. CURL_RUN_IFELSE([
  4351. AC_LANG_PROGRAM([[
  4352. $curl_includes_stdlib
  4353. $curl_includes_string
  4354. # include <errno.h>
  4355. ]],[[
  4356. char buffer[1024];
  4357. int error = 1;
  4358. buffer[0] = '\0';
  4359. error = strerror_r(EACCES, buffer, sizeof(buffer));
  4360. if(error)
  4361. exit(1); /* fail */
  4362. if(buffer[0] == '\0')
  4363. exit(1); /* fail */
  4364. else
  4365. exit(0);
  4366. ]])
  4367. ],[
  4368. AC_MSG_RESULT([yes])
  4369. tst_works_posix_strerror_r="yes"
  4370. ],[
  4371. AC_MSG_RESULT([no])
  4372. tst_works_posix_strerror_r="no"
  4373. ])
  4374. fi
  4375. #
  4376. if test "$tst_works_glibc_strerror_r" = "yes"; then
  4377. tst_posix_strerror_r="no"
  4378. fi
  4379. if test "$tst_works_posix_strerror_r" = "yes"; then
  4380. tst_glibc_strerror_r="no"
  4381. fi
  4382. if test "$tst_glibc_strerror_r" = "yes" &&
  4383. test "$tst_works_glibc_strerror_r" != "no" &&
  4384. test "$tst_posix_strerror_r" != "yes"; then
  4385. tst_allow_strerror_r="check"
  4386. fi
  4387. if test "$tst_posix_strerror_r" = "yes" &&
  4388. test "$tst_works_posix_strerror_r" != "no" &&
  4389. test "$tst_glibc_strerror_r" != "yes"; then
  4390. tst_allow_strerror_r="check"
  4391. fi
  4392. if test "$tst_allow_strerror_r" = "check"; then
  4393. AC_MSG_CHECKING([if strerror_r usage allowed])
  4394. if test "x$curl_disallow_strerror_r" != "xyes"; then
  4395. AC_MSG_RESULT([yes])
  4396. tst_allow_strerror_r="yes"
  4397. else
  4398. AC_MSG_RESULT([no])
  4399. tst_allow_strerror_r="no"
  4400. fi
  4401. fi
  4402. #
  4403. AC_MSG_CHECKING([if strerror_r might be used])
  4404. if test "$tst_links_strerror_r" = "yes" &&
  4405. test "$tst_proto_strerror_r" = "yes" &&
  4406. test "$tst_compi_strerror_r" = "yes" &&
  4407. test "$tst_allow_strerror_r" = "yes"; then
  4408. AC_MSG_RESULT([yes])
  4409. if test "$tst_glibc_strerror_r" = "yes"; then
  4410. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  4411. [Define to 1 if you have the strerror_r function.])
  4412. AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
  4413. [Define to 1 if you have a working glibc-style strerror_r function.])
  4414. fi
  4415. if test "$tst_posix_strerror_r" = "yes"; then
  4416. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  4417. [Define to 1 if you have the strerror_r function.])
  4418. AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
  4419. [Define to 1 if you have a working POSIX-style strerror_r function.])
  4420. fi
  4421. curl_cv_func_strerror_r="yes"
  4422. else
  4423. AC_MSG_RESULT([no])
  4424. curl_cv_func_strerror_r="no"
  4425. fi
  4426. #
  4427. if test "$tst_compi_strerror_r" = "yes" &&
  4428. test "$tst_allow_strerror_r" = "unknown"; then
  4429. AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.])
  4430. fi
  4431. #
  4432. ])
  4433. dnl CURL_CHECK_FUNC_STRICMP
  4434. dnl -------------------------------------------------
  4435. dnl Verify if stricmp is available, prototyped, and
  4436. dnl can be compiled. If all of these are true, and
  4437. dnl usage has not been previously disallowed with
  4438. dnl shell variable curl_disallow_stricmp, then
  4439. dnl HAVE_STRICMP will be defined.
  4440. AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
  4441. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4442. #
  4443. tst_links_stricmp="unknown"
  4444. tst_proto_stricmp="unknown"
  4445. tst_compi_stricmp="unknown"
  4446. tst_allow_stricmp="unknown"
  4447. #
  4448. AC_MSG_CHECKING([if stricmp can be linked])
  4449. AC_LINK_IFELSE([
  4450. AC_LANG_FUNC_LINK_TRY([stricmp])
  4451. ],[
  4452. AC_MSG_RESULT([yes])
  4453. tst_links_stricmp="yes"
  4454. ],[
  4455. AC_MSG_RESULT([no])
  4456. tst_links_stricmp="no"
  4457. ])
  4458. #
  4459. if test "$tst_links_stricmp" = "yes"; then
  4460. AC_MSG_CHECKING([if stricmp is prototyped])
  4461. AC_EGREP_CPP([stricmp],[
  4462. $curl_includes_string
  4463. ],[
  4464. AC_MSG_RESULT([yes])
  4465. tst_proto_stricmp="yes"
  4466. ],[
  4467. AC_MSG_RESULT([no])
  4468. tst_proto_stricmp="no"
  4469. ])
  4470. fi
  4471. #
  4472. if test "$tst_proto_stricmp" = "yes"; then
  4473. AC_MSG_CHECKING([if stricmp is compilable])
  4474. AC_COMPILE_IFELSE([
  4475. AC_LANG_PROGRAM([[
  4476. $curl_includes_string
  4477. ]],[[
  4478. if(0 != stricmp(0, 0))
  4479. return 1;
  4480. ]])
  4481. ],[
  4482. AC_MSG_RESULT([yes])
  4483. tst_compi_stricmp="yes"
  4484. ],[
  4485. AC_MSG_RESULT([no])
  4486. tst_compi_stricmp="no"
  4487. ])
  4488. fi
  4489. #
  4490. if test "$tst_compi_stricmp" = "yes"; then
  4491. AC_MSG_CHECKING([if stricmp usage allowed])
  4492. if test "x$curl_disallow_stricmp" != "xyes"; then
  4493. AC_MSG_RESULT([yes])
  4494. tst_allow_stricmp="yes"
  4495. else
  4496. AC_MSG_RESULT([no])
  4497. tst_allow_stricmp="no"
  4498. fi
  4499. fi
  4500. #
  4501. AC_MSG_CHECKING([if stricmp might be used])
  4502. if test "$tst_links_stricmp" = "yes" &&
  4503. test "$tst_proto_stricmp" = "yes" &&
  4504. test "$tst_compi_stricmp" = "yes" &&
  4505. test "$tst_allow_stricmp" = "yes"; then
  4506. AC_MSG_RESULT([yes])
  4507. AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
  4508. [Define to 1 if you have the stricmp function.])
  4509. curl_cv_func_stricmp="yes"
  4510. else
  4511. AC_MSG_RESULT([no])
  4512. curl_cv_func_stricmp="no"
  4513. fi
  4514. ])
  4515. dnl CURL_CHECK_FUNC_STRTOK_R
  4516. dnl -------------------------------------------------
  4517. dnl Verify if strtok_r is available, prototyped, and
  4518. dnl can be compiled. If all of these are true, and
  4519. dnl usage has not been previously disallowed with
  4520. dnl shell variable curl_disallow_strtok_r, then
  4521. dnl HAVE_STRTOK_R will be defined.
  4522. AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
  4523. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4524. #
  4525. tst_links_strtok_r="unknown"
  4526. tst_proto_strtok_r="unknown"
  4527. tst_compi_strtok_r="unknown"
  4528. tst_allow_strtok_r="unknown"
  4529. #
  4530. AC_MSG_CHECKING([if strtok_r can be linked])
  4531. AC_LINK_IFELSE([
  4532. AC_LANG_FUNC_LINK_TRY([strtok_r])
  4533. ],[
  4534. AC_MSG_RESULT([yes])
  4535. tst_links_strtok_r="yes"
  4536. ],[
  4537. AC_MSG_RESULT([no])
  4538. tst_links_strtok_r="no"
  4539. ])
  4540. #
  4541. if test "$tst_links_strtok_r" = "yes"; then
  4542. AC_MSG_CHECKING([if strtok_r is prototyped])
  4543. AC_EGREP_CPP([strtok_r],[
  4544. $curl_includes_string
  4545. ],[
  4546. AC_MSG_RESULT([yes])
  4547. tst_proto_strtok_r="yes"
  4548. ],[
  4549. AC_MSG_RESULT([no])
  4550. tst_proto_strtok_r="no"
  4551. ])
  4552. fi
  4553. #
  4554. if test "$tst_proto_strtok_r" = "yes"; then
  4555. AC_MSG_CHECKING([if strtok_r is compilable])
  4556. AC_COMPILE_IFELSE([
  4557. AC_LANG_PROGRAM([[
  4558. $curl_includes_string
  4559. ]],[[
  4560. if(0 != strtok_r(0, 0, 0))
  4561. return 1;
  4562. ]])
  4563. ],[
  4564. AC_MSG_RESULT([yes])
  4565. tst_compi_strtok_r="yes"
  4566. ],[
  4567. AC_MSG_RESULT([no])
  4568. tst_compi_strtok_r="no"
  4569. ])
  4570. fi
  4571. #
  4572. if test "$tst_compi_strtok_r" = "yes"; then
  4573. AC_MSG_CHECKING([if strtok_r usage allowed])
  4574. if test "x$curl_disallow_strtok_r" != "xyes"; then
  4575. AC_MSG_RESULT([yes])
  4576. tst_allow_strtok_r="yes"
  4577. else
  4578. AC_MSG_RESULT([no])
  4579. tst_allow_strtok_r="no"
  4580. fi
  4581. fi
  4582. #
  4583. AC_MSG_CHECKING([if strtok_r might be used])
  4584. if test "$tst_links_strtok_r" = "yes" &&
  4585. test "$tst_proto_strtok_r" = "yes" &&
  4586. test "$tst_compi_strtok_r" = "yes" &&
  4587. test "$tst_allow_strtok_r" = "yes"; then
  4588. AC_MSG_RESULT([yes])
  4589. AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
  4590. [Define to 1 if you have the strtok_r function.])
  4591. curl_cv_func_strtok_r="yes"
  4592. else
  4593. AC_MSG_RESULT([no])
  4594. curl_cv_func_strtok_r="no"
  4595. fi
  4596. ])
  4597. dnl CURL_CHECK_FUNC_STRTOLL
  4598. dnl -------------------------------------------------
  4599. dnl Verify if strtoll is available, prototyped, and
  4600. dnl can be compiled. If all of these are true, and
  4601. dnl usage has not been previously disallowed with
  4602. dnl shell variable curl_disallow_strtoll, then
  4603. dnl HAVE_STRTOLL will be defined.
  4604. AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
  4605. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  4606. #
  4607. tst_links_strtoll="unknown"
  4608. tst_proto_strtoll="unknown"
  4609. tst_compi_strtoll="unknown"
  4610. tst_allow_strtoll="unknown"
  4611. #
  4612. AC_MSG_CHECKING([if strtoll can be linked])
  4613. AC_LINK_IFELSE([
  4614. AC_LANG_FUNC_LINK_TRY([strtoll])
  4615. ],[
  4616. AC_MSG_RESULT([yes])
  4617. tst_links_strtoll="yes"
  4618. ],[
  4619. AC_MSG_RESULT([no])
  4620. tst_links_strtoll="no"
  4621. ])
  4622. #
  4623. if test "$tst_links_strtoll" = "yes"; then
  4624. AC_MSG_CHECKING([if strtoll is prototyped])
  4625. AC_EGREP_CPP([strtoll],[
  4626. $curl_includes_stdlib
  4627. ],[
  4628. AC_MSG_RESULT([yes])
  4629. tst_proto_strtoll="yes"
  4630. ],[
  4631. AC_MSG_RESULT([no])
  4632. tst_proto_strtoll="no"
  4633. ])
  4634. fi
  4635. #
  4636. if test "$tst_proto_strtoll" = "yes"; then
  4637. AC_MSG_CHECKING([if strtoll is compilable])
  4638. AC_COMPILE_IFELSE([
  4639. AC_LANG_PROGRAM([[
  4640. $curl_includes_stdlib
  4641. ]],[[
  4642. if(0 != strtoll(0, 0, 0))
  4643. return 1;
  4644. ]])
  4645. ],[
  4646. AC_MSG_RESULT([yes])
  4647. tst_compi_strtoll="yes"
  4648. ],[
  4649. AC_MSG_RESULT([no])
  4650. tst_compi_strtoll="no"
  4651. ])
  4652. fi
  4653. #
  4654. if test "$tst_compi_strtoll" = "yes"; then
  4655. AC_MSG_CHECKING([if strtoll usage allowed])
  4656. if test "x$curl_disallow_strtoll" != "xyes"; then
  4657. AC_MSG_RESULT([yes])
  4658. tst_allow_strtoll="yes"
  4659. else
  4660. AC_MSG_RESULT([no])
  4661. tst_allow_strtoll="no"
  4662. fi
  4663. fi
  4664. #
  4665. AC_MSG_CHECKING([if strtoll might be used])
  4666. if test "$tst_links_strtoll" = "yes" &&
  4667. test "$tst_proto_strtoll" = "yes" &&
  4668. test "$tst_compi_strtoll" = "yes" &&
  4669. test "$tst_allow_strtoll" = "yes"; then
  4670. AC_MSG_RESULT([yes])
  4671. AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
  4672. [Define to 1 if you have the strtoll function.])
  4673. curl_cv_func_strtoll="yes"
  4674. else
  4675. AC_MSG_RESULT([no])
  4676. curl_cv_func_strtoll="no"
  4677. fi
  4678. ])
  4679. dnl CURL_RUN_IFELSE
  4680. dnl -------------------------------------------------
  4681. dnl Wrapper macro to use instead of AC_RUN_IFELSE. It
  4682. dnl sets LD_LIBRARY_PATH locally for this run only, from the
  4683. dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH
  4684. dnl changes contained within this macro.
  4685. AC_DEFUN([CURL_RUN_IFELSE], [
  4686. case $host in
  4687. *-apple-*)
  4688. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  4689. ;;
  4690. *)
  4691. oldcc=$CC
  4692. old=$LD_LIBRARY_PATH
  4693. CC="sh ./run-compiler"
  4694. LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old
  4695. export LD_LIBRARY_PATH
  4696. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  4697. LD_LIBRARY_PATH=$old # restore
  4698. CC=$oldcc
  4699. ;;
  4700. esac
  4701. ])
  4702. dnl CURL_COVERAGE
  4703. dnl --------------------------------------------------
  4704. dnl Switch on options and libs to build with gcc's code coverage.
  4705. dnl
  4706. AC_DEFUN([CURL_COVERAGE],[
  4707. AC_REQUIRE([AC_PROG_SED])
  4708. AC_REQUIRE([AC_ARG_ENABLE])
  4709. AC_MSG_CHECKING([for code coverage support])
  4710. coverage="no"
  4711. curl_coverage_msg="disabled"
  4712. dnl check if enabled by argument
  4713. AC_ARG_ENABLE(code-coverage,
  4714. AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]),
  4715. coverage="$enableval")
  4716. dnl if not gcc switch off again
  4717. AS_IF([ test "$GCC" != "yes" ], coverage="no" )
  4718. AC_MSG_RESULT($coverage)
  4719. if test "x$coverage" = "xyes"; then
  4720. curl_coverage_msg="enabled"
  4721. AC_CHECK_TOOL([GCOV], [gcov], [gcov])
  4722. if test -z "$GCOV"; then
  4723. AC_MSG_ERROR([needs gcov for code coverage])
  4724. fi
  4725. AC_CHECK_PROG([LCOV], [lcov], [lcov])
  4726. if test -z "$LCOV"; then
  4727. AC_MSG_ERROR([needs lcov for code coverage])
  4728. fi
  4729. CPPFLAGS="$CPPFLAGS -DNDEBUG"
  4730. CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
  4731. LIBS="$LIBS -lgcov"
  4732. fi
  4733. ])
  4734. dnl CURL_ATOMIC
  4735. dnl -------------------------------------------------------------
  4736. dnl Check if _Atomic works. But only check if stdatomic.h exists.
  4737. dnl
  4738. AC_DEFUN([CURL_ATOMIC],[
  4739. AC_CHECK_HEADERS(stdatomic.h, [
  4740. AC_MSG_CHECKING([if _Atomic is available])
  4741. AC_LINK_IFELSE([
  4742. AC_LANG_PROGRAM([[
  4743. $curl_includes_unistd
  4744. ]],[[
  4745. _Atomic int i = 0;
  4746. i = 4; // Force an atomic-write operation.
  4747. ]])
  4748. ],[
  4749. AC_MSG_RESULT([yes])
  4750. AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
  4751. [Define to 1 if you have _Atomic support.])
  4752. tst_atomic="yes"
  4753. ],[
  4754. AC_MSG_RESULT([no])
  4755. tst_atomic="no"
  4756. ])
  4757. ])
  4758. ])
  4759. # Rewrite inspired by the functionality once provided by
  4760. # AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the
  4761. # given type.
  4762. #
  4763. # This code fails to compile:
  4764. #
  4765. # switch() { case 0: case 0: }
  4766. #
  4767. # By making the second case number a boolean check, it fails to compile the
  4768. # test code when the boolean is false and thus creating a zero, making it a
  4769. # duplicated case label. If the boolean equals true, it becomes a one, the
  4770. # code compiles and we know it was a match.
  4771. #
  4772. # The check iterates over all possible sizes and stops as soon it compiles
  4773. # error-free.
  4774. #
  4775. # Usage:
  4776. #
  4777. # CURL_SIZEOF(TYPE, [HEADERS])
  4778. #
  4779. AC_DEFUN([CURL_SIZEOF], [
  4780. dnl The #define name to make autoheader put the name in curl_config.h.in
  4781. define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
  4782. AC_MSG_CHECKING(size of $1)
  4783. r=0
  4784. dnl Check the sizes in a reasonable order
  4785. for typesize in 8 4 2 16 1; do
  4786. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  4787. #include <sys/types.h>
  4788. $2
  4789. ]],
  4790. [switch(0) {
  4791. case 0:
  4792. case (sizeof($1) == $typesize):;
  4793. }
  4794. ]) ],
  4795. [
  4796. r=$typesize],
  4797. [
  4798. r=0])
  4799. dnl get out of the loop once matched
  4800. if test $r -gt 0; then
  4801. break;
  4802. fi
  4803. done
  4804. if test $r -eq 0; then
  4805. AC_MSG_ERROR([Failed to find size of $1])
  4806. fi
  4807. AC_MSG_RESULT($r)
  4808. dnl lowercase and underscore instead of space
  4809. tname=`echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_"`
  4810. eval "$tname=$r"
  4811. AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes])
  4812. ])