curl-functions.m4 124 KB

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