acinclude.m4 87 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. #***************************************************************************
  22. dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
  23. dnl -------------------------------------------------
  24. dnl Use the C preprocessor to find out if the given object-style symbol
  25. dnl is defined and get its expansion. This macro will not use default
  26. dnl includes even if no INCLUDES argument is given. This macro will run
  27. dnl silently when invoked with three arguments. If the expansion would
  28. dnl result in a set of double-quoted strings the returned expansion will
  29. dnl actually be a single double-quoted string concatenating all them.
  30. AC_DEFUN([CURL_CHECK_DEF], [
  31. AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
  32. AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
  33. if test -z "$SED"; then
  34. AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
  35. fi
  36. if test -z "$GREP"; then
  37. AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
  38. fi
  39. ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
  40. tmp_exp=""
  41. AC_PREPROC_IFELSE([
  42. AC_LANG_SOURCE(
  43. ifelse($2,,,[$2])[[
  44. #ifdef $1
  45. CURL_DEF_TOKEN $1
  46. #endif
  47. ]])
  48. ],[
  49. tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
  50. "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
  51. "$SED" 's/.*CURL_DEF_TOKEN[[ ]]//' 2>/dev/null | \
  52. "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
  53. if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
  54. tmp_exp=""
  55. fi
  56. ])
  57. if test -z "$tmp_exp"; then
  58. AS_VAR_SET(ac_HaveDef, no)
  59. ifelse($3,,[AC_MSG_RESULT([no])])
  60. else
  61. AS_VAR_SET(ac_HaveDef, yes)
  62. AS_VAR_SET(ac_Def, $tmp_exp)
  63. ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
  64. fi
  65. AS_VAR_POPDEF([ac_Def])dnl
  66. AS_VAR_POPDEF([ac_HaveDef])dnl
  67. ])
  68. dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
  69. dnl -------------------------------------------------
  70. dnl Use the C compiler to find out only if the given symbol is defined
  71. dnl or not, this can not find out its expansion. This macro will not use
  72. dnl default includes even if no INCLUDES argument is given. This macro
  73. dnl will run silently when invoked with three arguments.
  74. AC_DEFUN([CURL_CHECK_DEF_CC], [
  75. AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
  76. ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
  77. AC_COMPILE_IFELSE([
  78. AC_LANG_SOURCE(
  79. ifelse($2,,,[$2])[[
  80. int main (void)
  81. {
  82. #ifdef $1
  83. return 0;
  84. #else
  85. force compilation error
  86. #endif
  87. }
  88. ]])
  89. ],[
  90. tst_symbol_defined="yes"
  91. ],[
  92. tst_symbol_defined="no"
  93. ])
  94. if test "$tst_symbol_defined" = "yes"; then
  95. AS_VAR_SET(ac_HaveDef, yes)
  96. ifelse($3,,[AC_MSG_RESULT([yes])])
  97. else
  98. AS_VAR_SET(ac_HaveDef, no)
  99. ifelse($3,,[AC_MSG_RESULT([no])])
  100. fi
  101. AS_VAR_POPDEF([ac_HaveDef])dnl
  102. ])
  103. dnl CURL_CHECK_LIB_XNET
  104. dnl -------------------------------------------------
  105. dnl Verify if X/Open network library is required.
  106. AC_DEFUN([CURL_CHECK_LIB_XNET], [
  107. AC_MSG_CHECKING([if X/Open network library is required])
  108. tst_lib_xnet_required="no"
  109. AC_COMPILE_IFELSE([
  110. AC_LANG_SOURCE([[
  111. int main (void)
  112. {
  113. #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
  114. return 0;
  115. #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
  116. return 0;
  117. #else
  118. force compilation error
  119. #endif
  120. }
  121. ]])
  122. ],[
  123. tst_lib_xnet_required="yes"
  124. LIBS="$LIBS -lxnet"
  125. ])
  126. AC_MSG_RESULT([$tst_lib_xnet_required])
  127. ])
  128. dnl CURL_CHECK_AIX_ALL_SOURCE
  129. dnl -------------------------------------------------
  130. dnl Provides a replacement of traditional AC_AIX with
  131. dnl an uniform behaviour across all autoconf versions,
  132. dnl and with our own placement rules.
  133. AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
  134. AH_VERBATIM([_ALL_SOURCE],
  135. [/* Define to 1 if OS is AIX. */
  136. #ifndef _ALL_SOURCE
  137. # undef _ALL_SOURCE
  138. #endif])
  139. AC_BEFORE([$0], [AC_SYS_LARGEFILE])dnl
  140. AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
  141. AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
  142. AC_EGREP_CPP([yes_this_is_aix],[
  143. #ifdef _AIX
  144. yes_this_is_aix
  145. #endif
  146. ],[
  147. AC_MSG_RESULT([yes])
  148. AC_DEFINE(_ALL_SOURCE)
  149. ],[
  150. AC_MSG_RESULT([no])
  151. ])
  152. ])
  153. dnl CURL_CHECK_HEADER_WINDOWS
  154. dnl -------------------------------------------------
  155. dnl Check for compilable and valid windows.h header
  156. AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
  157. AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
  158. AC_COMPILE_IFELSE([
  159. AC_LANG_PROGRAM([[
  160. #undef inline
  161. #ifndef WIN32_LEAN_AND_MEAN
  162. #define WIN32_LEAN_AND_MEAN
  163. #endif
  164. #include <windows.h>
  165. ]],[[
  166. #if defined(__CYGWIN__) || defined(__CEGCC__)
  167. HAVE_WINDOWS_H shall not be defined.
  168. #else
  169. int dummy=2*WINVER;
  170. #endif
  171. ]])
  172. ],[
  173. ac_cv_header_windows_h="yes"
  174. ],[
  175. ac_cv_header_windows_h="no"
  176. ])
  177. ])
  178. case "$ac_cv_header_windows_h" in
  179. yes)
  180. AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
  181. [Define to 1 if you have the windows.h header file.])
  182. AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
  183. [Define to avoid automatic inclusion of winsock.h])
  184. ;;
  185. esac
  186. ])
  187. dnl CURL_CHECK_NATIVE_WINDOWS
  188. dnl -------------------------------------------------
  189. dnl Check if building a native Windows target
  190. AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
  191. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  192. AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
  193. if test "$ac_cv_header_windows_h" = "no"; then
  194. ac_cv_native_windows="no"
  195. else
  196. AC_COMPILE_IFELSE([
  197. AC_LANG_PROGRAM([[
  198. ]],[[
  199. #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
  200. (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
  201. int dummy=1;
  202. #else
  203. Not a native Windows build target.
  204. #endif
  205. ]])
  206. ],[
  207. ac_cv_native_windows="yes"
  208. ],[
  209. ac_cv_native_windows="no"
  210. ])
  211. fi
  212. ])
  213. case "$ac_cv_native_windows" in
  214. yes)
  215. AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1,
  216. [Define to 1 if you are building a native Windows target.])
  217. ;;
  218. esac
  219. ])
  220. dnl CURL_CHECK_HEADER_WINSOCK
  221. dnl -------------------------------------------------
  222. dnl Check for compilable and valid winsock.h header
  223. AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
  224. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  225. AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
  226. AC_COMPILE_IFELSE([
  227. AC_LANG_PROGRAM([[
  228. #undef inline
  229. #ifndef WIN32_LEAN_AND_MEAN
  230. #define WIN32_LEAN_AND_MEAN
  231. #endif
  232. #include <windows.h>
  233. #include <winsock.h>
  234. ]],[[
  235. #if defined(__CYGWIN__) || defined(__CEGCC__)
  236. HAVE_WINSOCK_H shall not be defined.
  237. #else
  238. int dummy=WSACleanup();
  239. #endif
  240. ]])
  241. ],[
  242. ac_cv_header_winsock_h="yes"
  243. ],[
  244. ac_cv_header_winsock_h="no"
  245. ])
  246. ])
  247. case "$ac_cv_header_winsock_h" in
  248. yes)
  249. AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
  250. [Define to 1 if you have the winsock.h header file.])
  251. ;;
  252. esac
  253. ])
  254. dnl CURL_CHECK_HEADER_WINSOCK2
  255. dnl -------------------------------------------------
  256. dnl Check for compilable and valid winsock2.h header
  257. AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
  258. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  259. AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
  260. AC_COMPILE_IFELSE([
  261. AC_LANG_PROGRAM([[
  262. #undef inline
  263. #ifndef WIN32_LEAN_AND_MEAN
  264. #define WIN32_LEAN_AND_MEAN
  265. #endif
  266. #include <windows.h>
  267. #include <winsock2.h>
  268. ]],[[
  269. #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
  270. HAVE_WINSOCK2_H shall not be defined.
  271. #else
  272. int dummy=2*IPPROTO_ESP;
  273. #endif
  274. ]])
  275. ],[
  276. ac_cv_header_winsock2_h="yes"
  277. ],[
  278. ac_cv_header_winsock2_h="no"
  279. ])
  280. ])
  281. case "$ac_cv_header_winsock2_h" in
  282. yes)
  283. AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
  284. [Define to 1 if you have the winsock2.h header file.])
  285. ;;
  286. esac
  287. ])
  288. dnl CURL_CHECK_HEADER_WS2TCPIP
  289. dnl -------------------------------------------------
  290. dnl Check for compilable and valid ws2tcpip.h header
  291. AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
  292. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  293. AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
  294. AC_COMPILE_IFELSE([
  295. AC_LANG_PROGRAM([[
  296. #undef inline
  297. #ifndef WIN32_LEAN_AND_MEAN
  298. #define WIN32_LEAN_AND_MEAN
  299. #endif
  300. #include <windows.h>
  301. #include <winsock2.h>
  302. #include <ws2tcpip.h>
  303. ]],[[
  304. #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
  305. HAVE_WS2TCPIP_H shall not be defined.
  306. #else
  307. int dummy=2*IP_PKTINFO;
  308. #endif
  309. ]])
  310. ],[
  311. ac_cv_header_ws2tcpip_h="yes"
  312. ],[
  313. ac_cv_header_ws2tcpip_h="no"
  314. ])
  315. ])
  316. case "$ac_cv_header_ws2tcpip_h" in
  317. yes)
  318. AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
  319. [Define to 1 if you have the ws2tcpip.h header file.])
  320. ;;
  321. esac
  322. ])
  323. dnl CURL_CHECK_HEADER_WINLDAP
  324. dnl -------------------------------------------------
  325. dnl Check for compilable and valid winldap.h header
  326. AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
  327. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  328. AC_CACHE_CHECK([for winldap.h], [ac_cv_header_winldap_h], [
  329. AC_COMPILE_IFELSE([
  330. AC_LANG_PROGRAM([[
  331. #undef inline
  332. #ifdef HAVE_WINDOWS_H
  333. #ifndef WIN32_LEAN_AND_MEAN
  334. #define WIN32_LEAN_AND_MEAN
  335. #endif
  336. #include <windows.h>
  337. #endif
  338. #include <winldap.h>
  339. ]],[[
  340. #if defined(__CYGWIN__) || defined(__CEGCC__)
  341. HAVE_WINLDAP_H shall not be defined.
  342. #else
  343. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  344. ULONG res = ldap_unbind(ldp);
  345. #endif
  346. ]])
  347. ],[
  348. ac_cv_header_winldap_h="yes"
  349. ],[
  350. ac_cv_header_winldap_h="no"
  351. ])
  352. ])
  353. case "$ac_cv_header_winldap_h" in
  354. yes)
  355. AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
  356. [Define to 1 if you have the winldap.h header file.])
  357. ;;
  358. esac
  359. ])
  360. dnl CURL_CHECK_HEADER_WINBER
  361. dnl -------------------------------------------------
  362. dnl Check for compilable and valid winber.h header
  363. AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
  364. AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
  365. AC_CACHE_CHECK([for winber.h], [ac_cv_header_winber_h], [
  366. AC_COMPILE_IFELSE([
  367. AC_LANG_PROGRAM([[
  368. #undef inline
  369. #ifdef HAVE_WINDOWS_H
  370. #ifndef WIN32_LEAN_AND_MEAN
  371. #define WIN32_LEAN_AND_MEAN
  372. #endif
  373. #include <windows.h>
  374. #endif
  375. #include <winldap.h>
  376. #include <winber.h>
  377. ]],[[
  378. #if defined(__CYGWIN__) || defined(__CEGCC__)
  379. HAVE_WINBER_H shall not be defined.
  380. #else
  381. BERVAL *bvp = NULL;
  382. BerElement *bep = ber_init(bvp);
  383. ber_free(bep, 1);
  384. #endif
  385. ]])
  386. ],[
  387. ac_cv_header_winber_h="yes"
  388. ],[
  389. ac_cv_header_winber_h="no"
  390. ])
  391. ])
  392. case "$ac_cv_header_winber_h" in
  393. yes)
  394. AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
  395. [Define to 1 if you have the winber.h header file.])
  396. ;;
  397. esac
  398. ])
  399. dnl CURL_CHECK_HEADER_LBER
  400. dnl -------------------------------------------------
  401. dnl Check for compilable and valid lber.h header,
  402. dnl and check if it is needed even with ldap.h
  403. AC_DEFUN([CURL_CHECK_HEADER_LBER], [
  404. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  405. AC_CACHE_CHECK([for lber.h], [ac_cv_header_lber_h], [
  406. AC_COMPILE_IFELSE([
  407. AC_LANG_PROGRAM([[
  408. #undef inline
  409. #ifdef HAVE_WINDOWS_H
  410. #ifndef WIN32_LEAN_AND_MEAN
  411. #define WIN32_LEAN_AND_MEAN
  412. #endif
  413. #include <windows.h>
  414. #else
  415. #ifdef HAVE_SYS_TYPES_H
  416. #include <sys/types.h>
  417. #endif
  418. #endif
  419. #ifndef NULL
  420. #define NULL (void *)0
  421. #endif
  422. #include <lber.h>
  423. ]],[[
  424. BerValue *bvp = NULL;
  425. BerElement *bep = ber_init(bvp);
  426. ber_free(bep, 1);
  427. ]])
  428. ],[
  429. ac_cv_header_lber_h="yes"
  430. ],[
  431. ac_cv_header_lber_h="no"
  432. ])
  433. ])
  434. if test "$ac_cv_header_lber_h" = "yes"; then
  435. AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
  436. [Define to 1 if you have the lber.h header file.])
  437. #
  438. AC_COMPILE_IFELSE([
  439. AC_LANG_PROGRAM([[
  440. #undef inline
  441. #ifdef HAVE_WINDOWS_H
  442. #ifndef WIN32_LEAN_AND_MEAN
  443. #define WIN32_LEAN_AND_MEAN
  444. #endif
  445. #include <windows.h>
  446. #else
  447. #ifdef HAVE_SYS_TYPES_H
  448. #include <sys/types.h>
  449. #endif
  450. #endif
  451. #ifndef NULL
  452. #define NULL (void *)0
  453. #endif
  454. #ifndef LDAP_DEPRECATED
  455. #define LDAP_DEPRECATED 1
  456. #endif
  457. #include <ldap.h>
  458. ]],[[
  459. BerValue *bvp = NULL;
  460. BerElement *bep = ber_init(bvp);
  461. ber_free(bep, 1);
  462. ]])
  463. ],[
  464. curl_cv_need_header_lber_h="no"
  465. ],[
  466. curl_cv_need_header_lber_h="yes"
  467. ])
  468. #
  469. case "$curl_cv_need_header_lber_h" in
  470. yes)
  471. AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
  472. [Define to 1 if you need the lber.h header file even with ldap.h])
  473. ;;
  474. esac
  475. fi
  476. ])
  477. dnl CURL_CHECK_HEADER_LDAP
  478. dnl -------------------------------------------------
  479. dnl Check for compilable and valid ldap.h header
  480. AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
  481. AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
  482. AC_CACHE_CHECK([for ldap.h], [ac_cv_header_ldap_h], [
  483. AC_COMPILE_IFELSE([
  484. AC_LANG_PROGRAM([[
  485. #undef inline
  486. #ifdef HAVE_WINDOWS_H
  487. #ifndef WIN32_LEAN_AND_MEAN
  488. #define WIN32_LEAN_AND_MEAN
  489. #endif
  490. #include <windows.h>
  491. #else
  492. #ifdef HAVE_SYS_TYPES_H
  493. #include <sys/types.h>
  494. #endif
  495. #endif
  496. #ifndef LDAP_DEPRECATED
  497. #define LDAP_DEPRECATED 1
  498. #endif
  499. #ifdef NEED_LBER_H
  500. #include <lber.h>
  501. #endif
  502. #include <ldap.h>
  503. ]],[[
  504. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  505. int res = ldap_unbind(ldp);
  506. ]])
  507. ],[
  508. ac_cv_header_ldap_h="yes"
  509. ],[
  510. ac_cv_header_ldap_h="no"
  511. ])
  512. ])
  513. case "$ac_cv_header_ldap_h" in
  514. yes)
  515. AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
  516. [Define to 1 if you have the ldap.h header file.])
  517. ;;
  518. esac
  519. ])
  520. dnl CURL_CHECK_HEADER_LDAP_SSL
  521. dnl -------------------------------------------------
  522. dnl Check for compilable and valid ldap_ssl.h header
  523. AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
  524. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  525. AC_CACHE_CHECK([for ldap_ssl.h], [ac_cv_header_ldap_ssl_h], [
  526. AC_COMPILE_IFELSE([
  527. AC_LANG_PROGRAM([[
  528. #undef inline
  529. #ifdef HAVE_WINDOWS_H
  530. #ifndef WIN32_LEAN_AND_MEAN
  531. #define WIN32_LEAN_AND_MEAN
  532. #endif
  533. #include <windows.h>
  534. #else
  535. #ifdef HAVE_SYS_TYPES_H
  536. #include <sys/types.h>
  537. #endif
  538. #endif
  539. #ifndef LDAP_DEPRECATED
  540. #define LDAP_DEPRECATED 1
  541. #endif
  542. #ifdef NEED_LBER_H
  543. #include <lber.h>
  544. #endif
  545. #ifdef HAVE_LDAP_H
  546. #include <ldap.h>
  547. #endif
  548. #include <ldap_ssl.h>
  549. ]],[[
  550. LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
  551. ]])
  552. ],[
  553. ac_cv_header_ldap_ssl_h="yes"
  554. ],[
  555. ac_cv_header_ldap_ssl_h="no"
  556. ])
  557. ])
  558. case "$ac_cv_header_ldap_ssl_h" in
  559. yes)
  560. AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
  561. [Define to 1 if you have the ldap_ssl.h header file.])
  562. ;;
  563. esac
  564. ])
  565. dnl CURL_CHECK_HEADER_LDAPSSL
  566. dnl -------------------------------------------------
  567. dnl Check for compilable and valid ldapssl.h header
  568. AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
  569. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  570. AC_CACHE_CHECK([for ldapssl.h], [ac_cv_header_ldapssl_h], [
  571. AC_COMPILE_IFELSE([
  572. AC_LANG_PROGRAM([[
  573. #undef inline
  574. #ifdef HAVE_WINDOWS_H
  575. #ifndef WIN32_LEAN_AND_MEAN
  576. #define WIN32_LEAN_AND_MEAN
  577. #endif
  578. #include <windows.h>
  579. #else
  580. #ifdef HAVE_SYS_TYPES_H
  581. #include <sys/types.h>
  582. #endif
  583. #endif
  584. #ifndef NULL
  585. #define NULL (void *)0
  586. #endif
  587. #ifndef LDAP_DEPRECATED
  588. #define LDAP_DEPRECATED 1
  589. #endif
  590. #ifdef NEED_LBER_H
  591. #include <lber.h>
  592. #endif
  593. #ifdef HAVE_LDAP_H
  594. #include <ldap.h>
  595. #endif
  596. #include <ldapssl.h>
  597. ]],[[
  598. char *cert_label = NULL;
  599. LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
  600. ]])
  601. ],[
  602. ac_cv_header_ldapssl_h="yes"
  603. ],[
  604. ac_cv_header_ldapssl_h="no"
  605. ])
  606. ])
  607. case "$ac_cv_header_ldapssl_h" in
  608. yes)
  609. AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
  610. [Define to 1 if you have the ldapssl.h header file.])
  611. ;;
  612. esac
  613. ])
  614. dnl CURL_CHECK_LIBS_WINLDAP
  615. dnl -------------------------------------------------
  616. dnl Check for libraries needed for WINLDAP support,
  617. dnl and prepended to LIBS any needed libraries.
  618. dnl This macro can take an optional parameter with a
  619. dnl white space separated list of libraries to check
  620. dnl before the WINLDAP default ones.
  621. AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
  622. AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
  623. #
  624. AC_MSG_CHECKING([for WINLDAP libraries])
  625. #
  626. u_libs=""
  627. #
  628. ifelse($1,,,[
  629. for x_lib in $1; do
  630. case "$x_lib" in
  631. -l*)
  632. l_lib="$x_lib"
  633. ;;
  634. *)
  635. l_lib="-l$x_lib"
  636. ;;
  637. esac
  638. if test -z "$u_libs"; then
  639. u_libs="$l_lib"
  640. else
  641. u_libs="$u_libs $l_lib"
  642. fi
  643. done
  644. ])
  645. #
  646. curl_cv_save_LIBS="$LIBS"
  647. curl_cv_ldap_LIBS="unknown"
  648. #
  649. for x_nlibs in '' "$u_libs" \
  650. '-lwldap32' ; do
  651. if test "$curl_cv_ldap_LIBS" = "unknown"; then
  652. if test -z "$x_nlibs"; then
  653. LIBS="$curl_cv_save_LIBS"
  654. else
  655. LIBS="$x_nlibs $curl_cv_save_LIBS"
  656. fi
  657. AC_LINK_IFELSE([
  658. AC_LANG_PROGRAM([[
  659. #undef inline
  660. #ifdef HAVE_WINDOWS_H
  661. #ifndef WIN32_LEAN_AND_MEAN
  662. #define WIN32_LEAN_AND_MEAN
  663. #endif
  664. #include <windows.h>
  665. #ifdef HAVE_WINLDAP_H
  666. #include <winldap.h>
  667. #endif
  668. #ifdef HAVE_WINBER_H
  669. #include <winber.h>
  670. #endif
  671. #endif
  672. ]],[[
  673. BERVAL *bvp = NULL;
  674. BerElement *bep = ber_init(bvp);
  675. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  676. ULONG res = ldap_unbind(ldp);
  677. ber_free(bep, 1);
  678. ]])
  679. ],[
  680. curl_cv_ldap_LIBS="$x_nlibs"
  681. ])
  682. fi
  683. done
  684. #
  685. LIBS="$curl_cv_save_LIBS"
  686. #
  687. case X-"$curl_cv_ldap_LIBS" in
  688. X-unknown)
  689. AC_MSG_RESULT([cannot find WINLDAP libraries])
  690. ;;
  691. X-)
  692. AC_MSG_RESULT([no additional lib required])
  693. ;;
  694. *)
  695. if test -z "$curl_cv_save_LIBS"; then
  696. LIBS="$curl_cv_ldap_LIBS"
  697. else
  698. LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
  699. fi
  700. AC_MSG_RESULT([$curl_cv_ldap_LIBS])
  701. ;;
  702. esac
  703. #
  704. ])
  705. dnl CURL_CHECK_LIBS_LDAP
  706. dnl -------------------------------------------------
  707. dnl Check for libraries needed for LDAP support,
  708. dnl and prepended to LIBS any needed libraries.
  709. dnl This macro can take an optional parameter with a
  710. dnl white space separated list of libraries to check
  711. dnl before the default ones.
  712. AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
  713. AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
  714. #
  715. AC_MSG_CHECKING([for LDAP libraries])
  716. #
  717. u_libs=""
  718. #
  719. ifelse($1,,,[
  720. for x_lib in $1; do
  721. case "$x_lib" in
  722. -l*)
  723. l_lib="$x_lib"
  724. ;;
  725. *)
  726. l_lib="-l$x_lib"
  727. ;;
  728. esac
  729. if test -z "$u_libs"; then
  730. u_libs="$l_lib"
  731. else
  732. u_libs="$u_libs $l_lib"
  733. fi
  734. done
  735. ])
  736. #
  737. curl_cv_save_LIBS="$LIBS"
  738. curl_cv_ldap_LIBS="unknown"
  739. #
  740. for x_nlibs in '' "$u_libs" \
  741. '-lldap' \
  742. '-llber -lldap' \
  743. '-lldap -llber' \
  744. '-lldapssl -lldapx -lldapsdk' \
  745. '-lldapsdk -lldapx -lldapssl' ; do
  746. if test "$curl_cv_ldap_LIBS" = "unknown"; then
  747. if test -z "$x_nlibs"; then
  748. LIBS="$curl_cv_save_LIBS"
  749. else
  750. LIBS="$x_nlibs $curl_cv_save_LIBS"
  751. fi
  752. AC_LINK_IFELSE([
  753. AC_LANG_PROGRAM([[
  754. #undef inline
  755. #ifdef HAVE_WINDOWS_H
  756. #ifndef WIN32_LEAN_AND_MEAN
  757. #define WIN32_LEAN_AND_MEAN
  758. #endif
  759. #include <windows.h>
  760. #else
  761. #ifdef HAVE_SYS_TYPES_H
  762. #include <sys/types.h>
  763. #endif
  764. #endif
  765. #ifndef NULL
  766. #define NULL (void *)0
  767. #endif
  768. #ifndef LDAP_DEPRECATED
  769. #define LDAP_DEPRECATED 1
  770. #endif
  771. #ifdef NEED_LBER_H
  772. #include <lber.h>
  773. #endif
  774. #ifdef HAVE_LDAP_H
  775. #include <ldap.h>
  776. #endif
  777. ]],[[
  778. BerValue *bvp = NULL;
  779. BerElement *bep = ber_init(bvp);
  780. LDAP *ldp = ldap_init("dummy", LDAP_PORT);
  781. int res = ldap_unbind(ldp);
  782. ber_free(bep, 1);
  783. ]])
  784. ],[
  785. curl_cv_ldap_LIBS="$x_nlibs"
  786. ])
  787. fi
  788. done
  789. #
  790. LIBS="$curl_cv_save_LIBS"
  791. #
  792. case X-"$curl_cv_ldap_LIBS" in
  793. X-unknown)
  794. AC_MSG_RESULT([cannot find LDAP libraries])
  795. ;;
  796. X-)
  797. AC_MSG_RESULT([no additional lib required])
  798. ;;
  799. *)
  800. if test -z "$curl_cv_save_LIBS"; then
  801. LIBS="$curl_cv_ldap_LIBS"
  802. else
  803. LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
  804. fi
  805. AC_MSG_RESULT([$curl_cv_ldap_LIBS])
  806. ;;
  807. esac
  808. #
  809. ])
  810. dnl CURL_CHECK_HEADER_MALLOC
  811. dnl -------------------------------------------------
  812. dnl Check for compilable and valid malloc.h header,
  813. dnl and check if it is needed even with stdlib.h
  814. AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
  815. AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
  816. AC_COMPILE_IFELSE([
  817. AC_LANG_PROGRAM([[
  818. #include <malloc.h>
  819. ]],[[
  820. void *p = malloc(10);
  821. void *q = calloc(10,10);
  822. free(p);
  823. free(q);
  824. ]])
  825. ],[
  826. ac_cv_header_malloc_h="yes"
  827. ],[
  828. ac_cv_header_malloc_h="no"
  829. ])
  830. ])
  831. if test "$ac_cv_header_malloc_h" = "yes"; then
  832. AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
  833. [Define to 1 if you have the malloc.h header file.])
  834. #
  835. AC_COMPILE_IFELSE([
  836. AC_LANG_PROGRAM([[
  837. #include <stdlib.h>
  838. ]],[[
  839. void *p = malloc(10);
  840. void *q = calloc(10,10);
  841. free(p);
  842. free(q);
  843. ]])
  844. ],[
  845. curl_cv_need_header_malloc_h="no"
  846. ],[
  847. curl_cv_need_header_malloc_h="yes"
  848. ])
  849. #
  850. case "$curl_cv_need_header_malloc_h" in
  851. yes)
  852. AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
  853. [Define to 1 if you need the malloc.h header file even with stdlib.h])
  854. ;;
  855. esac
  856. fi
  857. ])
  858. dnl CURL_CHECK_HEADER_MEMORY
  859. dnl -------------------------------------------------
  860. dnl Check for compilable and valid memory.h header,
  861. dnl and check if it is needed even with stdlib.h for
  862. dnl memory related functions.
  863. AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
  864. AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [
  865. AC_COMPILE_IFELSE([
  866. AC_LANG_PROGRAM([[
  867. #include <memory.h>
  868. ]],[[
  869. void *p = malloc(10);
  870. void *q = calloc(10,10);
  871. free(p);
  872. free(q);
  873. ]])
  874. ],[
  875. ac_cv_header_memory_h="yes"
  876. ],[
  877. ac_cv_header_memory_h="no"
  878. ])
  879. ])
  880. if test "$ac_cv_header_memory_h" = "yes"; then
  881. AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
  882. [Define to 1 if you have the memory.h header file.])
  883. #
  884. AC_COMPILE_IFELSE([
  885. AC_LANG_PROGRAM([[
  886. #include <stdlib.h>
  887. ]],[[
  888. void *p = malloc(10);
  889. void *q = calloc(10,10);
  890. free(p);
  891. free(q);
  892. ]])
  893. ],[
  894. curl_cv_need_header_memory_h="no"
  895. ],[
  896. curl_cv_need_header_memory_h="yes"
  897. ])
  898. #
  899. case "$curl_cv_need_header_memory_h" in
  900. yes)
  901. AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
  902. [Define to 1 if you need the memory.h header file even with stdlib.h])
  903. ;;
  904. esac
  905. fi
  906. ])
  907. dnl CURL_CHECK_FUNC_GETNAMEINFO
  908. dnl -------------------------------------------------
  909. dnl Test if the getnameinfo function is available,
  910. dnl and check the types of five of its arguments.
  911. dnl If the function succeeds HAVE_GETNAMEINFO will be
  912. dnl defined, defining the types of the arguments in
  913. dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
  914. dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
  915. dnl and also defining the type qualifier of first
  916. dnl argument in GETNAMEINFO_QUAL_ARG1.
  917. AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
  918. AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
  919. AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
  920. #
  921. AC_MSG_CHECKING([for getnameinfo])
  922. AC_LINK_IFELSE([
  923. AC_LANG_FUNC_LINK_TRY([getnameinfo])
  924. ],[
  925. AC_MSG_RESULT([yes])
  926. curl_cv_getnameinfo="yes"
  927. ],[
  928. AC_MSG_RESULT([no])
  929. curl_cv_getnameinfo="no"
  930. ])
  931. #
  932. if test "$curl_cv_getnameinfo" != "yes"; then
  933. AC_MSG_CHECKING([deeper for getnameinfo])
  934. AC_LINK_IFELSE([
  935. AC_LANG_PROGRAM([[
  936. ]],[[
  937. getnameinfo();
  938. ]])
  939. ],[
  940. AC_MSG_RESULT([yes])
  941. curl_cv_getnameinfo="yes"
  942. ],[
  943. AC_MSG_RESULT([but still no])
  944. curl_cv_getnameinfo="no"
  945. ])
  946. fi
  947. #
  948. if test "$curl_cv_getnameinfo" != "yes"; then
  949. AC_MSG_CHECKING([deeper and deeper for getnameinfo])
  950. AC_LINK_IFELSE([
  951. AC_LANG_PROGRAM([[
  952. #undef inline
  953. #ifdef HAVE_WINDOWS_H
  954. #ifndef WIN32_LEAN_AND_MEAN
  955. #define WIN32_LEAN_AND_MEAN
  956. #endif
  957. #include <windows.h>
  958. #ifdef HAVE_WINSOCK2_H
  959. #include <winsock2.h>
  960. #ifdef HAVE_WS2TCPIP_H
  961. #include <ws2tcpip.h>
  962. #endif
  963. #endif
  964. #else
  965. #ifdef HAVE_SYS_TYPES_H
  966. #include <sys/types.h>
  967. #endif
  968. #ifdef HAVE_SYS_SOCKET_H
  969. #include <sys/socket.h>
  970. #endif
  971. #ifdef HAVE_NETDB_H
  972. #include <netdb.h>
  973. #endif
  974. #endif
  975. ]],[[
  976. getnameinfo(0, 0, 0, 0, 0, 0, 0);
  977. ]])
  978. ],[
  979. AC_MSG_RESULT([yes])
  980. curl_cv_getnameinfo="yes"
  981. ],[
  982. AC_MSG_RESULT([but still no])
  983. curl_cv_getnameinfo="no"
  984. ])
  985. fi
  986. #
  987. if test "$curl_cv_getnameinfo" = "yes"; then
  988. AC_CACHE_CHECK([types of arguments for getnameinfo],
  989. [curl_cv_func_getnameinfo_args], [
  990. curl_cv_func_getnameinfo_args="unknown"
  991. for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
  992. for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
  993. for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
  994. for gni_arg7 in 'int' 'unsigned int'; do
  995. if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
  996. AC_COMPILE_IFELSE([
  997. AC_LANG_PROGRAM([[
  998. #undef inline
  999. #ifdef HAVE_WINDOWS_H
  1000. #ifndef WIN32_LEAN_AND_MEAN
  1001. #define WIN32_LEAN_AND_MEAN
  1002. #endif
  1003. #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
  1004. #undef _WIN32_WINNT
  1005. #define _WIN32_WINNT 0x0501
  1006. #endif
  1007. #include <windows.h>
  1008. #ifdef HAVE_WINSOCK2_H
  1009. #include <winsock2.h>
  1010. #ifdef HAVE_WS2TCPIP_H
  1011. #include <ws2tcpip.h>
  1012. #endif
  1013. #endif
  1014. #define GNICALLCONV WSAAPI
  1015. #else
  1016. #ifdef HAVE_SYS_TYPES_H
  1017. #include <sys/types.h>
  1018. #endif
  1019. #ifdef HAVE_SYS_SOCKET_H
  1020. #include <sys/socket.h>
  1021. #endif
  1022. #ifdef HAVE_NETDB_H
  1023. #include <netdb.h>
  1024. #endif
  1025. #define GNICALLCONV
  1026. #endif
  1027. extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
  1028. char *, $gni_arg46,
  1029. char *, $gni_arg46,
  1030. $gni_arg7);
  1031. ]],[[
  1032. $gni_arg2 salen=0;
  1033. $gni_arg46 hostlen=0;
  1034. $gni_arg46 servlen=0;
  1035. $gni_arg7 flags=0;
  1036. int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
  1037. ]])
  1038. ],[
  1039. curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
  1040. ])
  1041. fi
  1042. done
  1043. done
  1044. done
  1045. done
  1046. ]) # AC-CACHE-CHECK
  1047. if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
  1048. AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
  1049. AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
  1050. else
  1051. gni_prev_IFS=$IFS; IFS=','
  1052. set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
  1053. IFS=$gni_prev_IFS
  1054. shift
  1055. #
  1056. gni_qual_type_arg1=$[1]
  1057. #
  1058. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
  1059. [Define to the type of arg 2 for getnameinfo.])
  1060. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
  1061. [Define to the type of args 4 and 6 for getnameinfo.])
  1062. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
  1063. [Define to the type of arg 7 for getnameinfo.])
  1064. #
  1065. prev_sh_opts=$-
  1066. #
  1067. case $prev_sh_opts in
  1068. *f*)
  1069. ;;
  1070. *)
  1071. set -f
  1072. ;;
  1073. esac
  1074. #
  1075. case "$gni_qual_type_arg1" in
  1076. const*)
  1077. gni_qual_arg1=const
  1078. gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
  1079. ;;
  1080. *)
  1081. gni_qual_arg1=
  1082. gni_type_arg1=$gni_qual_type_arg1
  1083. ;;
  1084. esac
  1085. #
  1086. AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
  1087. [Define to the type qualifier of arg 1 for getnameinfo.])
  1088. AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
  1089. [Define to the type of arg 1 for getnameinfo.])
  1090. #
  1091. case $prev_sh_opts in
  1092. *f*)
  1093. ;;
  1094. *)
  1095. set +f
  1096. ;;
  1097. esac
  1098. #
  1099. AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
  1100. [Define to 1 if you have the getnameinfo function.])
  1101. ac_cv_func_getnameinfo="yes"
  1102. fi
  1103. fi
  1104. ])
  1105. dnl TYPE_SOCKADDR_STORAGE
  1106. dnl -------------------------------------------------
  1107. dnl Check for struct sockaddr_storage. Most IPv6-enabled
  1108. dnl hosts have it, but AIX 4.3 is one known exception.
  1109. AC_DEFUN([TYPE_SOCKADDR_STORAGE],
  1110. [
  1111. AC_CHECK_TYPE([struct sockaddr_storage],
  1112. AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
  1113. [if struct sockaddr_storage is defined]), ,
  1114. [
  1115. #undef inline
  1116. #ifdef HAVE_WINDOWS_H
  1117. #ifndef WIN32_LEAN_AND_MEAN
  1118. #define WIN32_LEAN_AND_MEAN
  1119. #endif
  1120. #include <windows.h>
  1121. #ifdef HAVE_WINSOCK2_H
  1122. #include <winsock2.h>
  1123. #endif
  1124. #else
  1125. #ifdef HAVE_SYS_TYPES_H
  1126. #include <sys/types.h>
  1127. #endif
  1128. #ifdef HAVE_SYS_SOCKET_H
  1129. #include <sys/socket.h>
  1130. #endif
  1131. #ifdef HAVE_NETINET_IN_H
  1132. #include <netinet/in.h>
  1133. #endif
  1134. #ifdef HAVE_ARPA_INET_H
  1135. #include <arpa/inet.h>
  1136. #endif
  1137. #endif
  1138. ])
  1139. ])
  1140. dnl CURL_CHECK_NI_WITHSCOPEID
  1141. dnl -------------------------------------------------
  1142. dnl Check for working NI_WITHSCOPEID in getnameinfo()
  1143. AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
  1144. AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
  1145. AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
  1146. AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
  1147. netdb.h netinet/in.h arpa/inet.h)
  1148. #
  1149. AC_CACHE_CHECK([for working NI_WITHSCOPEID],
  1150. [ac_cv_working_ni_withscopeid], [
  1151. AC_RUN_IFELSE([
  1152. AC_LANG_PROGRAM([[
  1153. #ifdef HAVE_STDLIB_H
  1154. #include <stdlib.h>
  1155. #endif
  1156. #ifdef HAVE_STDIO_H
  1157. #include <stdio.h>
  1158. #endif
  1159. #ifdef HAVE_SYS_TYPES_H
  1160. #include <sys/types.h>
  1161. #endif
  1162. #ifdef HAVE_SYS_SOCKET_H
  1163. #include <sys/socket.h>
  1164. #endif
  1165. #ifdef HAVE_NETDB_H
  1166. #include <netdb.h>
  1167. #endif
  1168. #ifdef HAVE_NETINET_IN_H
  1169. #include <netinet/in.h>
  1170. #endif
  1171. #ifdef HAVE_ARPA_INET_H
  1172. #include <arpa/inet.h>
  1173. #endif
  1174. ]],[[
  1175. #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
  1176. #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
  1177. struct sockaddr_storage sa;
  1178. #else
  1179. unsigned char sa[256];
  1180. #endif
  1181. char hostbuf[NI_MAXHOST];
  1182. int rc;
  1183. GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
  1184. GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
  1185. GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
  1186. int fd = socket(AF_INET6, SOCK_STREAM, 0);
  1187. if(fd < 0) {
  1188. perror("socket()");
  1189. return 1; /* Error creating socket */
  1190. }
  1191. rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
  1192. if(rc) {
  1193. perror("getsockname()");
  1194. return 2; /* Error retrieving socket name */
  1195. }
  1196. rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
  1197. if(rc) {
  1198. printf("rc = %s\n", gai_strerror(rc));
  1199. return 3; /* Error translating socket address */
  1200. }
  1201. return 0; /* Ok, NI_WITHSCOPEID works */
  1202. #else
  1203. return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
  1204. #endif
  1205. ]]) # AC-LANG-PROGRAM
  1206. ],[
  1207. # Exit code == 0. Program worked.
  1208. ac_cv_working_ni_withscopeid="yes"
  1209. ],[
  1210. # Exit code != 0. Program failed.
  1211. ac_cv_working_ni_withscopeid="no"
  1212. ],[
  1213. # Program is not run when cross-compiling. So we assume
  1214. # NI_WITHSCOPEID will work if we are able to compile it.
  1215. AC_COMPILE_IFELSE([
  1216. AC_LANG_PROGRAM([[
  1217. #include <sys/types.h>
  1218. #include <sys/socket.h>
  1219. #include <netdb.h>
  1220. ]],[[
  1221. unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
  1222. ]])
  1223. ],[
  1224. ac_cv_working_ni_withscopeid="yes"
  1225. ],[
  1226. ac_cv_working_ni_withscopeid="no"
  1227. ]) # AC-COMPILE-IFELSE
  1228. ]) # AC-RUN-IFELSE
  1229. ]) # AC-CACHE-CHECK
  1230. case "$ac_cv_working_ni_withscopeid" in
  1231. yes)
  1232. AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
  1233. [Define to 1 if NI_WITHSCOPEID exists and works.])
  1234. ;;
  1235. esac
  1236. ])
  1237. dnl CURL_CHECK_FUNC_RECV
  1238. dnl -------------------------------------------------
  1239. dnl Test if the socket recv() function is available,
  1240. dnl and check its return type and the types of its
  1241. dnl arguments. If the function succeeds HAVE_RECV
  1242. dnl will be defined, defining the types of the arguments
  1243. dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
  1244. dnl and RECV_TYPE_ARG4, defining the type of the function
  1245. dnl return value in RECV_TYPE_RETV.
  1246. AC_DEFUN([CURL_CHECK_FUNC_RECV], [
  1247. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1248. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1249. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1250. #
  1251. AC_MSG_CHECKING([for recv])
  1252. AC_LINK_IFELSE([
  1253. AC_LANG_PROGRAM([[
  1254. #undef inline
  1255. #ifdef HAVE_WINDOWS_H
  1256. #ifndef WIN32_LEAN_AND_MEAN
  1257. #define WIN32_LEAN_AND_MEAN
  1258. #endif
  1259. #include <windows.h>
  1260. #ifdef HAVE_WINSOCK2_H
  1261. #include <winsock2.h>
  1262. #else
  1263. #ifdef HAVE_WINSOCK_H
  1264. #include <winsock.h>
  1265. #endif
  1266. #endif
  1267. #else
  1268. #ifdef HAVE_SYS_TYPES_H
  1269. #include <sys/types.h>
  1270. #endif
  1271. #ifdef HAVE_SYS_SOCKET_H
  1272. #include <sys/socket.h>
  1273. #endif
  1274. #endif
  1275. ]],[[
  1276. recv(0, 0, 0, 0);
  1277. ]])
  1278. ],[
  1279. AC_MSG_RESULT([yes])
  1280. curl_cv_recv="yes"
  1281. ],[
  1282. AC_MSG_RESULT([no])
  1283. curl_cv_recv="no"
  1284. ])
  1285. #
  1286. if test "$curl_cv_recv" = "yes"; then
  1287. AC_CACHE_CHECK([types of args and return type for recv],
  1288. [curl_cv_func_recv_args], [
  1289. curl_cv_func_recv_args="unknown"
  1290. for recv_retv in 'int' 'ssize_t'; do
  1291. for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  1292. for recv_arg2 in 'char *' 'void *'; do
  1293. for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  1294. for recv_arg4 in 'int' 'unsigned int'; do
  1295. if test "$curl_cv_func_recv_args" = "unknown"; then
  1296. AC_COMPILE_IFELSE([
  1297. AC_LANG_PROGRAM([[
  1298. #undef inline
  1299. #ifdef HAVE_WINDOWS_H
  1300. #ifndef WIN32_LEAN_AND_MEAN
  1301. #define WIN32_LEAN_AND_MEAN
  1302. #endif
  1303. #include <windows.h>
  1304. #ifdef HAVE_WINSOCK2_H
  1305. #include <winsock2.h>
  1306. #else
  1307. #ifdef HAVE_WINSOCK_H
  1308. #include <winsock.h>
  1309. #endif
  1310. #endif
  1311. #define RECVCALLCONV PASCAL
  1312. #else
  1313. #ifdef HAVE_SYS_TYPES_H
  1314. #include <sys/types.h>
  1315. #endif
  1316. #ifdef HAVE_SYS_SOCKET_H
  1317. #include <sys/socket.h>
  1318. #endif
  1319. #define RECVCALLCONV
  1320. #endif
  1321. extern $recv_retv RECVCALLCONV
  1322. recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
  1323. ]],[[
  1324. $recv_arg1 s=0;
  1325. $recv_arg2 buf=0;
  1326. $recv_arg3 len=0;
  1327. $recv_arg4 flags=0;
  1328. $recv_retv res = recv(s, buf, len, flags);
  1329. ]])
  1330. ],[
  1331. curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
  1332. ])
  1333. fi
  1334. done
  1335. done
  1336. done
  1337. done
  1338. done
  1339. ]) # AC-CACHE-CHECK
  1340. if test "$curl_cv_func_recv_args" = "unknown"; then
  1341. AC_MSG_ERROR([Cannot find proper types to use for recv args])
  1342. else
  1343. recv_prev_IFS=$IFS; IFS=','
  1344. set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
  1345. IFS=$recv_prev_IFS
  1346. shift
  1347. #
  1348. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
  1349. [Define to the type of arg 1 for recv.])
  1350. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
  1351. [Define to the type of arg 2 for recv.])
  1352. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
  1353. [Define to the type of arg 3 for recv.])
  1354. AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
  1355. [Define to the type of arg 4 for recv.])
  1356. AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
  1357. [Define to the function return type for recv.])
  1358. #
  1359. AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
  1360. [Define to 1 if you have the recv function.])
  1361. ac_cv_func_recv="yes"
  1362. fi
  1363. else
  1364. AC_MSG_ERROR([Unable to link function recv])
  1365. fi
  1366. ])
  1367. dnl CURL_CHECK_FUNC_SEND
  1368. dnl -------------------------------------------------
  1369. dnl Test if the socket send() function is available,
  1370. dnl and check its return type and the types of its
  1371. dnl arguments. If the function succeeds HAVE_SEND
  1372. dnl will be defined, defining the types of the arguments
  1373. dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
  1374. dnl and SEND_TYPE_ARG4, defining the type of the function
  1375. dnl return value in SEND_TYPE_RETV, and also defining the
  1376. dnl type qualifier of second argument in SEND_QUAL_ARG2.
  1377. AC_DEFUN([CURL_CHECK_FUNC_SEND], [
  1378. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1379. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1380. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1381. #
  1382. AC_MSG_CHECKING([for send])
  1383. AC_LINK_IFELSE([
  1384. AC_LANG_PROGRAM([[
  1385. #undef inline
  1386. #ifdef HAVE_WINDOWS_H
  1387. #ifndef WIN32_LEAN_AND_MEAN
  1388. #define WIN32_LEAN_AND_MEAN
  1389. #endif
  1390. #include <windows.h>
  1391. #ifdef HAVE_WINSOCK2_H
  1392. #include <winsock2.h>
  1393. #else
  1394. #ifdef HAVE_WINSOCK_H
  1395. #include <winsock.h>
  1396. #endif
  1397. #endif
  1398. #else
  1399. #ifdef HAVE_SYS_TYPES_H
  1400. #include <sys/types.h>
  1401. #endif
  1402. #ifdef HAVE_SYS_SOCKET_H
  1403. #include <sys/socket.h>
  1404. #endif
  1405. #endif
  1406. ]],[[
  1407. send(0, 0, 0, 0);
  1408. ]])
  1409. ],[
  1410. AC_MSG_RESULT([yes])
  1411. curl_cv_send="yes"
  1412. ],[
  1413. AC_MSG_RESULT([no])
  1414. curl_cv_send="no"
  1415. ])
  1416. #
  1417. if test "$curl_cv_send" = "yes"; then
  1418. AC_CACHE_CHECK([types of args and return type for send],
  1419. [curl_cv_func_send_args], [
  1420. curl_cv_func_send_args="unknown"
  1421. for send_retv in 'int' 'ssize_t'; do
  1422. for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  1423. for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
  1424. for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  1425. for send_arg4 in 'int' 'unsigned int'; do
  1426. if test "$curl_cv_func_send_args" = "unknown"; then
  1427. AC_COMPILE_IFELSE([
  1428. AC_LANG_PROGRAM([[
  1429. #undef inline
  1430. #ifdef HAVE_WINDOWS_H
  1431. #ifndef WIN32_LEAN_AND_MEAN
  1432. #define WIN32_LEAN_AND_MEAN
  1433. #endif
  1434. #include <windows.h>
  1435. #ifdef HAVE_WINSOCK2_H
  1436. #include <winsock2.h>
  1437. #else
  1438. #ifdef HAVE_WINSOCK_H
  1439. #include <winsock.h>
  1440. #endif
  1441. #endif
  1442. #define SENDCALLCONV PASCAL
  1443. #else
  1444. #ifdef HAVE_SYS_TYPES_H
  1445. #include <sys/types.h>
  1446. #endif
  1447. #ifdef HAVE_SYS_SOCKET_H
  1448. #include <sys/socket.h>
  1449. #endif
  1450. #define SENDCALLCONV
  1451. #endif
  1452. extern $send_retv SENDCALLCONV
  1453. send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
  1454. ]],[[
  1455. $send_arg1 s=0;
  1456. $send_arg3 len=0;
  1457. $send_arg4 flags=0;
  1458. $send_retv res = send(s, 0, len, flags);
  1459. ]])
  1460. ],[
  1461. curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
  1462. ])
  1463. fi
  1464. done
  1465. done
  1466. done
  1467. done
  1468. done
  1469. ]) # AC-CACHE-CHECK
  1470. if test "$curl_cv_func_send_args" = "unknown"; then
  1471. AC_MSG_ERROR([Cannot find proper types to use for send args])
  1472. else
  1473. send_prev_IFS=$IFS; IFS=','
  1474. set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
  1475. IFS=$send_prev_IFS
  1476. shift
  1477. #
  1478. send_qual_type_arg2=$[2]
  1479. #
  1480. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
  1481. [Define to the type of arg 1 for send.])
  1482. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
  1483. [Define to the type of arg 3 for send.])
  1484. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
  1485. [Define to the type of arg 4 for send.])
  1486. AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
  1487. [Define to the function return type for send.])
  1488. #
  1489. prev_sh_opts=$-
  1490. #
  1491. case $prev_sh_opts in
  1492. *f*)
  1493. ;;
  1494. *)
  1495. set -f
  1496. ;;
  1497. esac
  1498. #
  1499. case "$send_qual_type_arg2" in
  1500. const*)
  1501. send_qual_arg2=const
  1502. send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
  1503. ;;
  1504. *)
  1505. send_qual_arg2=
  1506. send_type_arg2=$send_qual_type_arg2
  1507. ;;
  1508. esac
  1509. #
  1510. AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
  1511. [Define to the type qualifier of arg 2 for send.])
  1512. AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
  1513. [Define to the type of arg 2 for send.])
  1514. #
  1515. case $prev_sh_opts in
  1516. *f*)
  1517. ;;
  1518. *)
  1519. set +f
  1520. ;;
  1521. esac
  1522. #
  1523. AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
  1524. [Define to 1 if you have the send function.])
  1525. ac_cv_func_send="yes"
  1526. fi
  1527. else
  1528. AC_MSG_ERROR([Unable to link function send])
  1529. fi
  1530. ])
  1531. dnl CURL_CHECK_FUNC_RECVFROM
  1532. dnl -------------------------------------------------
  1533. dnl Test if the socket recvfrom() function is available,
  1534. dnl and check its return type and the types of its
  1535. dnl arguments. If the function succeeds HAVE_RECVFROM
  1536. dnl will be defined, defining the types of the arguments
  1537. dnl in RECVFROM_TYPE_ARG1, RECVFROM_TYPE_ARG2, and so on
  1538. dnl to RECVFROM_TYPE_ARG6, defining also the type of the
  1539. dnl function return value in RECVFROM_TYPE_RETV.
  1540. dnl Notice that the types returned for pointer arguments
  1541. dnl will actually be the type pointed by the pointer.
  1542. AC_DEFUN([CURL_CHECK_FUNC_RECVFROM], [
  1543. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1544. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1545. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1546. #
  1547. AC_MSG_CHECKING([for recvfrom])
  1548. AC_LINK_IFELSE([
  1549. AC_LANG_PROGRAM([[
  1550. #undef inline
  1551. #ifdef HAVE_WINDOWS_H
  1552. #ifndef WIN32_LEAN_AND_MEAN
  1553. #define WIN32_LEAN_AND_MEAN
  1554. #endif
  1555. #include <windows.h>
  1556. #ifdef HAVE_WINSOCK2_H
  1557. #include <winsock2.h>
  1558. #else
  1559. #ifdef HAVE_WINSOCK_H
  1560. #include <winsock.h>
  1561. #endif
  1562. #endif
  1563. #else
  1564. #ifdef HAVE_SYS_TYPES_H
  1565. #include <sys/types.h>
  1566. #endif
  1567. #ifdef HAVE_SYS_SOCKET_H
  1568. #include <sys/socket.h>
  1569. #endif
  1570. #endif
  1571. ]],[[
  1572. recvfrom(0, 0, 0, 0, 0, 0);
  1573. ]])
  1574. ],[
  1575. AC_MSG_RESULT([yes])
  1576. curl_cv_recvfrom="yes"
  1577. ],[
  1578. AC_MSG_RESULT([no])
  1579. curl_cv_recvfrom="no"
  1580. ])
  1581. #
  1582. if test "$curl_cv_recvfrom" = "yes"; then
  1583. AC_CACHE_CHECK([types of args and return type for recvfrom],
  1584. [curl_cv_func_recvfrom_args], [
  1585. curl_cv_func_recvfrom_args="unknown"
  1586. for recvfrom_retv in 'int' 'ssize_t'; do
  1587. for recvfrom_arg1 in 'int' 'ssize_t' 'SOCKET'; do
  1588. for recvfrom_arg2 in 'char *' 'void *'; do
  1589. for recvfrom_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
  1590. for recvfrom_arg4 in 'int' 'unsigned int'; do
  1591. for recvfrom_arg5 in 'struct sockaddr *' 'void *'; do
  1592. for recvfrom_arg6 in 'socklen_t *' 'int *' 'unsigned int *' 'size_t *' 'void *'; do
  1593. if test "$curl_cv_func_recvfrom_args" = "unknown"; then
  1594. AC_COMPILE_IFELSE([
  1595. AC_LANG_PROGRAM([[
  1596. #undef inline
  1597. #ifdef HAVE_WINDOWS_H
  1598. #ifndef WIN32_LEAN_AND_MEAN
  1599. #define WIN32_LEAN_AND_MEAN
  1600. #endif
  1601. #include <windows.h>
  1602. #ifdef HAVE_WINSOCK2_H
  1603. #include <winsock2.h>
  1604. #else
  1605. #ifdef HAVE_WINSOCK_H
  1606. #include <winsock.h>
  1607. #endif
  1608. #endif
  1609. #define RECVFROMCALLCONV PASCAL
  1610. #else
  1611. #ifdef HAVE_SYS_TYPES_H
  1612. #include <sys/types.h>
  1613. #endif
  1614. #ifdef HAVE_SYS_SOCKET_H
  1615. #include <sys/socket.h>
  1616. #endif
  1617. #define RECVFROMCALLCONV
  1618. #endif
  1619. extern $recvfrom_retv RECVFROMCALLCONV
  1620. recvfrom($recvfrom_arg1, $recvfrom_arg2,
  1621. $recvfrom_arg3, $recvfrom_arg4,
  1622. $recvfrom_arg5, $recvfrom_arg6);
  1623. ]],[[
  1624. $recvfrom_arg1 s=0;
  1625. $recvfrom_arg2 buf=0;
  1626. $recvfrom_arg3 len=0;
  1627. $recvfrom_arg4 flags=0;
  1628. $recvfrom_arg5 addr=0;
  1629. $recvfrom_arg6 addrlen=0;
  1630. $recvfrom_retv res=0;
  1631. res = recvfrom(s, buf, len, flags, addr, addrlen);
  1632. ]])
  1633. ],[
  1634. curl_cv_func_recvfrom_args="$recvfrom_arg1,$recvfrom_arg2,$recvfrom_arg3,$recvfrom_arg4,$recvfrom_arg5,$recvfrom_arg6,$recvfrom_retv"
  1635. ])
  1636. fi
  1637. done
  1638. done
  1639. done
  1640. done
  1641. done
  1642. done
  1643. done
  1644. ]) # AC-CACHE-CHECK
  1645. # Nearly last minute change for this release starts here
  1646. AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
  1647. [Define to 1 if you have the recvfrom function.])
  1648. ac_cv_func_recvfrom="yes"
  1649. # Nearly last minute change for this release ends here
  1650. if test "$curl_cv_func_recvfrom_args" = "unknown"; then
  1651. AC_MSG_WARN([Cannot find proper types to use for recvfrom args])
  1652. else
  1653. recvfrom_prev_IFS=$IFS; IFS=','
  1654. set dummy `echo "$curl_cv_func_recvfrom_args" | sed 's/\*/\*/g'`
  1655. IFS=$recvfrom_prev_IFS
  1656. shift
  1657. #
  1658. recvfrom_ptrt_arg2=$[2]
  1659. recvfrom_ptrt_arg5=$[5]
  1660. recvfrom_ptrt_arg6=$[6]
  1661. #
  1662. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG1, $[1],
  1663. [Define to the type of arg 1 for recvfrom.])
  1664. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG3, $[3],
  1665. [Define to the type of arg 3 for recvfrom.])
  1666. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG4, $[4],
  1667. [Define to the type of arg 4 for recvfrom.])
  1668. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_RETV, $[7],
  1669. [Define to the function return type for recvfrom.])
  1670. #
  1671. prev_sh_opts=$-
  1672. #
  1673. case $prev_sh_opts in
  1674. *f*)
  1675. ;;
  1676. *)
  1677. set -f
  1678. ;;
  1679. esac
  1680. #
  1681. recvfrom_type_arg2=`echo $recvfrom_ptrt_arg2 | sed 's/ \*//'`
  1682. recvfrom_type_arg5=`echo $recvfrom_ptrt_arg5 | sed 's/ \*//'`
  1683. recvfrom_type_arg6=`echo $recvfrom_ptrt_arg6 | sed 's/ \*//'`
  1684. #
  1685. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2, $recvfrom_type_arg2,
  1686. [Define to the type pointed by arg 2 for recvfrom.])
  1687. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5, $recvfrom_type_arg5,
  1688. [Define to the type pointed by arg 5 for recvfrom.])
  1689. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6, $recvfrom_type_arg6,
  1690. [Define to the type pointed by arg 6 for recvfrom.])
  1691. #
  1692. if test "$recvfrom_type_arg2" = "void"; then
  1693. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG2_IS_VOID, 1,
  1694. [Define to 1 if the type pointed by arg 2 for recvfrom is void.])
  1695. fi
  1696. if test "$recvfrom_type_arg5" = "void"; then
  1697. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG5_IS_VOID, 1,
  1698. [Define to 1 if the type pointed by arg 5 for recvfrom is void.])
  1699. fi
  1700. if test "$recvfrom_type_arg6" = "void"; then
  1701. AC_DEFINE_UNQUOTED(RECVFROM_TYPE_ARG6_IS_VOID, 1,
  1702. [Define to 1 if the type pointed by arg 6 for recvfrom is void.])
  1703. fi
  1704. #
  1705. case $prev_sh_opts in
  1706. *f*)
  1707. ;;
  1708. *)
  1709. set +f
  1710. ;;
  1711. esac
  1712. #
  1713. AC_DEFINE_UNQUOTED(HAVE_RECVFROM, 1,
  1714. [Define to 1 if you have the recvfrom function.])
  1715. ac_cv_func_recvfrom="yes"
  1716. fi
  1717. else
  1718. AC_MSG_WARN([Unable to link function recvfrom])
  1719. fi
  1720. ])
  1721. dnl CURL_CHECK_MSG_NOSIGNAL
  1722. dnl -------------------------------------------------
  1723. dnl Check for MSG_NOSIGNAL
  1724. AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
  1725. AC_CHECK_HEADERS(sys/types.h sys/socket.h)
  1726. AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
  1727. AC_COMPILE_IFELSE([
  1728. AC_LANG_PROGRAM([[
  1729. #undef inline
  1730. #ifdef HAVE_WINDOWS_H
  1731. #ifndef WIN32_LEAN_AND_MEAN
  1732. #define WIN32_LEAN_AND_MEAN
  1733. #endif
  1734. #include <windows.h>
  1735. #ifdef HAVE_WINSOCK2_H
  1736. #include <winsock2.h>
  1737. #else
  1738. #ifdef HAVE_WINSOCK_H
  1739. #include <winsock.h>
  1740. #endif
  1741. #endif
  1742. #else
  1743. #ifdef HAVE_SYS_TYPES_H
  1744. #include <sys/types.h>
  1745. #endif
  1746. #ifdef HAVE_SYS_SOCKET_H
  1747. #include <sys/socket.h>
  1748. #endif
  1749. #endif
  1750. ]],[[
  1751. int flag=MSG_NOSIGNAL;
  1752. ]])
  1753. ],[
  1754. ac_cv_msg_nosignal="yes"
  1755. ],[
  1756. ac_cv_msg_nosignal="no"
  1757. ])
  1758. ])
  1759. case "$ac_cv_msg_nosignal" in
  1760. yes)
  1761. AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
  1762. [Define to 1 if you have the MSG_NOSIGNAL flag.])
  1763. ;;
  1764. esac
  1765. ])
  1766. dnl CURL_CHECK_STRUCT_TIMEVAL
  1767. dnl -------------------------------------------------
  1768. dnl Check for timeval struct
  1769. AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
  1770. AC_REQUIRE([AC_HEADER_TIME])dnl
  1771. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
  1772. AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
  1773. AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
  1774. AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
  1775. AC_COMPILE_IFELSE([
  1776. AC_LANG_PROGRAM([[
  1777. #undef inline
  1778. #ifdef HAVE_WINDOWS_H
  1779. #ifndef WIN32_LEAN_AND_MEAN
  1780. #define WIN32_LEAN_AND_MEAN
  1781. #endif
  1782. #include <windows.h>
  1783. #ifdef HAVE_WINSOCK2_H
  1784. #include <winsock2.h>
  1785. #else
  1786. #ifdef HAVE_WINSOCK_H
  1787. #include <winsock.h>
  1788. #endif
  1789. #endif
  1790. #endif
  1791. #ifdef HAVE_SYS_TYPES_H
  1792. #include <sys/types.h>
  1793. #endif
  1794. #ifdef HAVE_SYS_TIME_H
  1795. #include <sys/time.h>
  1796. #ifdef TIME_WITH_SYS_TIME
  1797. #include <time.h>
  1798. #endif
  1799. #else
  1800. #ifdef HAVE_TIME_H
  1801. #include <time.h>
  1802. #endif
  1803. #endif
  1804. #ifdef HAVE_SYS_SOCKET_H
  1805. #include <sys/socket.h>
  1806. #endif
  1807. ]],[[
  1808. struct timeval ts;
  1809. ts.tv_sec = 0;
  1810. ts.tv_usec = 0;
  1811. ]])
  1812. ],[
  1813. ac_cv_struct_timeval="yes"
  1814. ],[
  1815. ac_cv_struct_timeval="no"
  1816. ])
  1817. ])
  1818. case "$ac_cv_struct_timeval" in
  1819. yes)
  1820. AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
  1821. [Define to 1 if you have the timeval struct.])
  1822. ;;
  1823. esac
  1824. ])
  1825. dnl TYPE_SIG_ATOMIC_T
  1826. dnl -------------------------------------------------
  1827. dnl Check if the sig_atomic_t type is available, and
  1828. dnl verify if it is already defined as volatile.
  1829. AC_DEFUN([TYPE_SIG_ATOMIC_T], [
  1830. AC_CHECK_HEADERS(signal.h)
  1831. AC_CHECK_TYPE([sig_atomic_t],[
  1832. AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
  1833. [Define to 1 if sig_atomic_t is an available typedef.])
  1834. ], ,[
  1835. #ifdef HAVE_SIGNAL_H
  1836. #include <signal.h>
  1837. #endif
  1838. ])
  1839. case "$ac_cv_type_sig_atomic_t" in
  1840. yes)
  1841. #
  1842. AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
  1843. AC_LINK_IFELSE([
  1844. AC_LANG_PROGRAM([[
  1845. #ifdef HAVE_SIGNAL_H
  1846. #include <signal.h>
  1847. #endif
  1848. ]],[[
  1849. static volatile sig_atomic_t dummy = 0;
  1850. ]])
  1851. ],[
  1852. AC_MSG_RESULT([no])
  1853. ac_cv_sig_atomic_t_volatile="no"
  1854. ],[
  1855. AC_MSG_RESULT([yes])
  1856. ac_cv_sig_atomic_t_volatile="yes"
  1857. ])
  1858. #
  1859. if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
  1860. AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
  1861. [Define to 1 if sig_atomic_t is already defined as volatile.])
  1862. fi
  1863. ;;
  1864. esac
  1865. ])
  1866. dnl TYPE_IN_ADDR_T
  1867. dnl -------------------------------------------------
  1868. dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
  1869. dnl and a few other things.
  1870. AC_DEFUN([TYPE_IN_ADDR_T], [
  1871. AC_CHECK_TYPE([in_addr_t], ,[
  1872. dnl in_addr_t not available
  1873. AC_CACHE_CHECK([for in_addr_t equivalent],
  1874. [curl_cv_in_addr_t_equiv], [
  1875. curl_cv_in_addr_t_equiv="unknown"
  1876. for t in "unsigned long" int size_t unsigned long; do
  1877. if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
  1878. AC_LINK_IFELSE([
  1879. AC_LANG_PROGRAM([[
  1880. #undef inline
  1881. #ifdef HAVE_WINDOWS_H
  1882. #ifndef WIN32_LEAN_AND_MEAN
  1883. #define WIN32_LEAN_AND_MEAN
  1884. #endif
  1885. #include <windows.h>
  1886. #ifdef HAVE_WINSOCK2_H
  1887. #include <winsock2.h>
  1888. #else
  1889. #ifdef HAVE_WINSOCK_H
  1890. #include <winsock.h>
  1891. #endif
  1892. #endif
  1893. #else
  1894. #ifdef HAVE_SYS_TYPES_H
  1895. #include <sys/types.h>
  1896. #endif
  1897. #ifdef HAVE_SYS_SOCKET_H
  1898. #include <sys/socket.h>
  1899. #endif
  1900. #ifdef HAVE_NETINET_IN_H
  1901. #include <netinet/in.h>
  1902. #endif
  1903. #ifdef HAVE_ARPA_INET_H
  1904. #include <arpa/inet.h>
  1905. #endif
  1906. #endif
  1907. ]],[[
  1908. $t data = inet_addr ("1.2.3.4");
  1909. ]])
  1910. ],[
  1911. curl_cv_in_addr_t_equiv="$t"
  1912. ])
  1913. fi
  1914. done
  1915. ])
  1916. case "$curl_cv_in_addr_t_equiv" in
  1917. unknown)
  1918. AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
  1919. ;;
  1920. *)
  1921. AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
  1922. [Type to use in place of in_addr_t when system does not provide it.])
  1923. ;;
  1924. esac
  1925. ],[
  1926. #undef inline
  1927. #ifdef HAVE_WINDOWS_H
  1928. #ifndef WIN32_LEAN_AND_MEAN
  1929. #define WIN32_LEAN_AND_MEAN
  1930. #endif
  1931. #include <windows.h>
  1932. #ifdef HAVE_WINSOCK2_H
  1933. #include <winsock2.h>
  1934. #else
  1935. #ifdef HAVE_WINSOCK_H
  1936. #include <winsock.h>
  1937. #endif
  1938. #endif
  1939. #else
  1940. #ifdef HAVE_SYS_TYPES_H
  1941. #include <sys/types.h>
  1942. #endif
  1943. #ifdef HAVE_SYS_SOCKET_H
  1944. #include <sys/socket.h>
  1945. #endif
  1946. #ifdef HAVE_NETINET_IN_H
  1947. #include <netinet/in.h>
  1948. #endif
  1949. #ifdef HAVE_ARPA_INET_H
  1950. #include <arpa/inet.h>
  1951. #endif
  1952. #endif
  1953. ])
  1954. ])
  1955. dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
  1956. dnl -------------------------------------------------
  1957. dnl Check if monotonic clock_gettime is available.
  1958. AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
  1959. AC_REQUIRE([AC_HEADER_TIME])dnl
  1960. AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
  1961. AC_MSG_CHECKING([for monotonic clock_gettime])
  1962. AC_COMPILE_IFELSE([
  1963. AC_LANG_PROGRAM([[
  1964. #ifdef HAVE_SYS_TYPES_H
  1965. #include <sys/types.h>
  1966. #endif
  1967. #ifdef HAVE_SYS_TIME_H
  1968. #include <sys/time.h>
  1969. #ifdef TIME_WITH_SYS_TIME
  1970. #include <time.h>
  1971. #endif
  1972. #else
  1973. #ifdef HAVE_TIME_H
  1974. #include <time.h>
  1975. #endif
  1976. #endif
  1977. ]],[[
  1978. struct timespec ts;
  1979. (void)clock_gettime(CLOCK_MONOTONIC, &ts);
  1980. ]])
  1981. ],[
  1982. AC_MSG_RESULT([yes])
  1983. ac_cv_func_clock_gettime="yes"
  1984. ],[
  1985. AC_MSG_RESULT([no])
  1986. ac_cv_func_clock_gettime="no"
  1987. ])
  1988. dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
  1989. dnl until library linking and run-time checks for clock_gettime succeed.
  1990. ])
  1991. dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
  1992. dnl -------------------------------------------------
  1993. dnl If monotonic clock_gettime is available then,
  1994. dnl check and prepended to LIBS any needed libraries.
  1995. AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
  1996. AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
  1997. #
  1998. if test "$ac_cv_func_clock_gettime" = "yes"; then
  1999. #
  2000. AC_MSG_CHECKING([for clock_gettime in libraries])
  2001. #
  2002. curl_cv_save_LIBS="$LIBS"
  2003. curl_cv_gclk_LIBS="unknown"
  2004. #
  2005. for x_xlibs in '' '-lrt' '-lposix4' ; do
  2006. if test "$curl_cv_gclk_LIBS" = "unknown"; then
  2007. if test -z "$x_xlibs"; then
  2008. LIBS="$curl_cv_save_LIBS"
  2009. else
  2010. LIBS="$x_xlibs $curl_cv_save_LIBS"
  2011. fi
  2012. AC_LINK_IFELSE([
  2013. AC_LANG_PROGRAM([[
  2014. #ifdef HAVE_SYS_TYPES_H
  2015. #include <sys/types.h>
  2016. #endif
  2017. #ifdef HAVE_SYS_TIME_H
  2018. #include <sys/time.h>
  2019. #ifdef TIME_WITH_SYS_TIME
  2020. #include <time.h>
  2021. #endif
  2022. #else
  2023. #ifdef HAVE_TIME_H
  2024. #include <time.h>
  2025. #endif
  2026. #endif
  2027. ]],[[
  2028. struct timespec ts;
  2029. (void)clock_gettime(CLOCK_MONOTONIC, &ts);
  2030. ]])
  2031. ],[
  2032. curl_cv_gclk_LIBS="$x_xlibs"
  2033. ])
  2034. fi
  2035. done
  2036. #
  2037. LIBS="$curl_cv_save_LIBS"
  2038. #
  2039. case X-"$curl_cv_gclk_LIBS" in
  2040. X-unknown)
  2041. AC_MSG_RESULT([cannot find clock_gettime])
  2042. AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
  2043. ac_cv_func_clock_gettime="no"
  2044. ;;
  2045. X-)
  2046. AC_MSG_RESULT([no additional lib required])
  2047. ac_cv_func_clock_gettime="yes"
  2048. ;;
  2049. *)
  2050. if test -z "$curl_cv_save_LIBS"; then
  2051. LIBS="$curl_cv_gclk_LIBS"
  2052. else
  2053. LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
  2054. fi
  2055. CURL_LIBS="$CURL_LIBS $curl_cv_gclk_LIBS"
  2056. AC_MSG_RESULT([$curl_cv_gclk_LIBS])
  2057. ac_cv_func_clock_gettime="yes"
  2058. ;;
  2059. esac
  2060. #
  2061. dnl only do runtime verification when not cross-compiling
  2062. if test "x$cross_compiling" != "xyes" &&
  2063. test "$ac_cv_func_clock_gettime" = "yes"; then
  2064. AC_MSG_CHECKING([if monotonic clock_gettime works])
  2065. AC_RUN_IFELSE([
  2066. AC_LANG_PROGRAM([[
  2067. #ifdef HAVE_STDLIB_H
  2068. #include <stdlib.h>
  2069. #endif
  2070. #ifdef HAVE_SYS_TYPES_H
  2071. #include <sys/types.h>
  2072. #endif
  2073. #ifdef HAVE_SYS_TIME_H
  2074. #include <sys/time.h>
  2075. #ifdef TIME_WITH_SYS_TIME
  2076. #include <time.h>
  2077. #endif
  2078. #else
  2079. #ifdef HAVE_TIME_H
  2080. #include <time.h>
  2081. #endif
  2082. #endif
  2083. ]],[[
  2084. struct timespec ts;
  2085. if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
  2086. exit(0);
  2087. else
  2088. exit(1);
  2089. ]])
  2090. ],[
  2091. AC_MSG_RESULT([yes])
  2092. ],[
  2093. AC_MSG_RESULT([no])
  2094. AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
  2095. ac_cv_func_clock_gettime="no"
  2096. LIBS="$curl_cv_save_LIBS"
  2097. ])
  2098. fi
  2099. #
  2100. case "$ac_cv_func_clock_gettime" in
  2101. yes)
  2102. AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
  2103. [Define to 1 if you have the clock_gettime function and monotonic timer.])
  2104. ;;
  2105. esac
  2106. #
  2107. fi
  2108. #
  2109. ])
  2110. dnl CURL_CHECK_LIBS_CONNECT
  2111. dnl -------------------------------------------------
  2112. dnl Verify if network connect function is already available
  2113. dnl using current libraries or if another one is required.
  2114. AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
  2115. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2116. AC_MSG_CHECKING([for connect in libraries])
  2117. tst_connect_save_LIBS="$LIBS"
  2118. tst_connect_need_LIBS="unknown"
  2119. for tst_lib in '' '-lsocket' ; do
  2120. if test "$tst_connect_need_LIBS" = "unknown"; then
  2121. LIBS="$tst_lib $tst_connect_save_LIBS"
  2122. AC_LINK_IFELSE([
  2123. AC_LANG_PROGRAM([[
  2124. $curl_includes_winsock2
  2125. #ifndef HAVE_WINDOWS_H
  2126. int connect(int, void*, int);
  2127. #endif
  2128. ]],[[
  2129. if(0 != connect(0, 0, 0))
  2130. return 1;
  2131. ]])
  2132. ],[
  2133. tst_connect_need_LIBS="$tst_lib"
  2134. ])
  2135. fi
  2136. done
  2137. LIBS="$tst_connect_save_LIBS"
  2138. #
  2139. case X-"$tst_connect_need_LIBS" in
  2140. X-unknown)
  2141. AC_MSG_RESULT([cannot find connect])
  2142. AC_MSG_ERROR([cannot find connect function in libraries.])
  2143. ;;
  2144. X-)
  2145. AC_MSG_RESULT([yes])
  2146. ;;
  2147. *)
  2148. AC_MSG_RESULT([$tst_connect_need_LIBS])
  2149. LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
  2150. ;;
  2151. esac
  2152. ])
  2153. dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
  2154. dnl -------------------------------------------------
  2155. dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
  2156. dnl symbol that can be further used in custom template configuration
  2157. dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
  2158. dnl argument for the description. Symbol definitions done with this
  2159. dnl macro are intended to be exclusively used in handcrafted *.h.in
  2160. dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
  2161. dnl prevents autoheader generation and insertion of symbol template
  2162. dnl stub and definition into the first configuration header file. Do
  2163. dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
  2164. dnl one serves different functional needs.
  2165. AC_DEFUN([CURL_DEFINE_UNQUOTED], [
  2166. cat >>confdefs.h <<_EOF
  2167. [@%:@define] $1 ifelse($#, 2, [$2], 1)
  2168. _EOF
  2169. ])
  2170. dnl CURL_CONFIGURE_LONG
  2171. dnl -------------------------------------------------
  2172. dnl Find out the size of long as reported by sizeof() and define
  2173. dnl CURL_SIZEOF_LONG as appropriate to be used in template file
  2174. dnl include/curl/curlbuild.h.in to properly configure the library.
  2175. dnl The size of long is a build time characteristic and as such
  2176. dnl must be recorded in curlbuild.h
  2177. AC_DEFUN([CURL_CONFIGURE_LONG], [
  2178. if test -z "$ac_cv_sizeof_long" ||
  2179. test "$ac_cv_sizeof_long" -eq "0"; then
  2180. AC_MSG_ERROR([cannot find out size of long.])
  2181. fi
  2182. CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long])
  2183. ])
  2184. dnl CURL_CONFIGURE_CURL_SOCKLEN_T
  2185. dnl -------------------------------------------------
  2186. dnl Find out suitable curl_socklen_t data type definition and size, making
  2187. dnl appropriate definitions for template file include/curl/curlbuild.h.in
  2188. dnl to properly configure and use the library.
  2189. dnl
  2190. dnl The need for the curl_socklen_t definition arises mainly to properly
  2191. dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t
  2192. dnl data type which is 32 or 64-Bit wide depending on the data model being
  2193. dnl used, and that on the other hand is only actually used when interfacing
  2194. dnl the X/Open sockets provided in the xnet library.
  2195. AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [
  2196. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  2197. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  2198. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2199. #
  2200. AC_MSG_CHECKING([for curl_socklen_t data type])
  2201. curl_typeof_curl_socklen_t="unknown"
  2202. for arg1 in int SOCKET; do
  2203. for arg2 in 'struct sockaddr' void; do
  2204. for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do
  2205. if test "$curl_typeof_curl_socklen_t" = "unknown"; then
  2206. AC_COMPILE_IFELSE([
  2207. AC_LANG_PROGRAM([[
  2208. $curl_includes_ws2tcpip
  2209. $curl_includes_sys_socket
  2210. $curl_preprocess_callconv
  2211. extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *);
  2212. ]],[[
  2213. $t *lenptr = 0;
  2214. if(0 != getpeername(0, 0, lenptr))
  2215. return 1;
  2216. ]])
  2217. ],[
  2218. curl_typeof_curl_socklen_t="$t"
  2219. ])
  2220. fi
  2221. done
  2222. done
  2223. done
  2224. for t in socklen_t int; do
  2225. if test "$curl_typeof_curl_socklen_t" = "void"; then
  2226. AC_COMPILE_IFELSE([
  2227. AC_LANG_PROGRAM([[
  2228. $curl_includes_sys_socket
  2229. typedef $t curl_socklen_t;
  2230. ]],[[
  2231. curl_socklen_t dummy;
  2232. ]])
  2233. ],[
  2234. curl_typeof_curl_socklen_t="$t"
  2235. ])
  2236. fi
  2237. done
  2238. AC_MSG_RESULT([$curl_typeof_curl_socklen_t])
  2239. if test "$curl_typeof_curl_socklen_t" = "void" ||
  2240. test "$curl_typeof_curl_socklen_t" = "unknown"; then
  2241. AC_MSG_ERROR([cannot find data type for curl_socklen_t.])
  2242. fi
  2243. #
  2244. AC_MSG_CHECKING([size of curl_socklen_t])
  2245. curl_sizeof_curl_socklen_t="unknown"
  2246. curl_pull_headers_socklen_t="unknown"
  2247. if test "$ac_cv_header_ws2tcpip_h" = "yes"; then
  2248. tst_pull_header_checks='none ws2tcpip'
  2249. tst_size_checks='4'
  2250. else
  2251. tst_pull_header_checks='none systypes syssocket'
  2252. tst_size_checks='4 8 2'
  2253. fi
  2254. for tst_size in $tst_size_checks; do
  2255. for tst_pull_headers in $tst_pull_header_checks; do
  2256. if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
  2257. case $tst_pull_headers in
  2258. ws2tcpip)
  2259. tmp_includes="$curl_includes_ws2tcpip"
  2260. ;;
  2261. systypes)
  2262. tmp_includes="$curl_includes_sys_types"
  2263. ;;
  2264. syssocket)
  2265. tmp_includes="$curl_includes_sys_socket"
  2266. ;;
  2267. *)
  2268. tmp_includes=""
  2269. ;;
  2270. esac
  2271. AC_COMPILE_IFELSE([
  2272. AC_LANG_PROGRAM([[
  2273. $tmp_includes
  2274. typedef $curl_typeof_curl_socklen_t curl_socklen_t;
  2275. typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1];
  2276. ]],[[
  2277. curl_socklen_t dummy;
  2278. ]])
  2279. ],[
  2280. curl_sizeof_curl_socklen_t="$tst_size"
  2281. curl_pull_headers_socklen_t="$tst_pull_headers"
  2282. ])
  2283. fi
  2284. done
  2285. done
  2286. AC_MSG_RESULT([$curl_sizeof_curl_socklen_t])
  2287. if test "$curl_sizeof_curl_socklen_t" = "unknown"; then
  2288. AC_MSG_ERROR([cannot find out size of curl_socklen_t.])
  2289. fi
  2290. #
  2291. case $curl_pull_headers_socklen_t in
  2292. ws2tcpip)
  2293. CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H])
  2294. ;;
  2295. systypes)
  2296. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
  2297. ;;
  2298. syssocket)
  2299. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
  2300. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H])
  2301. ;;
  2302. esac
  2303. CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t])
  2304. CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t])
  2305. ])
  2306. dnl CURL_CHECK_FUNC_SELECT
  2307. dnl -------------------------------------------------
  2308. dnl Test if the socket select() function is available,
  2309. dnl and check its return type and the types of its
  2310. dnl arguments. If the function succeeds HAVE_SELECT
  2311. dnl will be defined, defining the types of the
  2312. dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
  2313. dnl and SELECT_TYPE_ARG5, defining the type of the
  2314. dnl function return value in SELECT_TYPE_RETV, and
  2315. dnl also defining the type qualifier of fifth argument
  2316. dnl in SELECT_QUAL_ARG5.
  2317. AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
  2318. AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
  2319. AC_CHECK_HEADERS(sys/select.h sys/socket.h)
  2320. #
  2321. AC_MSG_CHECKING([for select])
  2322. AC_LINK_IFELSE([
  2323. AC_LANG_PROGRAM([[
  2324. #undef inline
  2325. #ifdef HAVE_WINDOWS_H
  2326. #ifndef WIN32_LEAN_AND_MEAN
  2327. #define WIN32_LEAN_AND_MEAN
  2328. #endif
  2329. #include <windows.h>
  2330. #ifdef HAVE_WINSOCK2_H
  2331. #include <winsock2.h>
  2332. #else
  2333. #ifdef HAVE_WINSOCK_H
  2334. #include <winsock.h>
  2335. #endif
  2336. #endif
  2337. #endif
  2338. #ifdef HAVE_SYS_TYPES_H
  2339. #include <sys/types.h>
  2340. #endif
  2341. #ifdef HAVE_SYS_TIME_H
  2342. #include <sys/time.h>
  2343. #ifdef TIME_WITH_SYS_TIME
  2344. #include <time.h>
  2345. #endif
  2346. #else
  2347. #ifdef HAVE_TIME_H
  2348. #include <time.h>
  2349. #endif
  2350. #endif
  2351. #ifndef HAVE_WINDOWS_H
  2352. #ifdef HAVE_SYS_SELECT_H
  2353. #include <sys/select.h>
  2354. #endif
  2355. #ifdef HAVE_SYS_SOCKET_H
  2356. #include <sys/socket.h>
  2357. #endif
  2358. #endif
  2359. ]],[[
  2360. select(0, 0, 0, 0, 0);
  2361. ]])
  2362. ],[
  2363. AC_MSG_RESULT([yes])
  2364. curl_cv_select="yes"
  2365. ],[
  2366. AC_MSG_RESULT([no])
  2367. curl_cv_select="no"
  2368. ])
  2369. #
  2370. if test "$curl_cv_select" = "yes"; then
  2371. AC_CACHE_CHECK([types of args and return type for select],
  2372. [curl_cv_func_select_args], [
  2373. curl_cv_func_select_args="unknown"
  2374. for sel_retv in 'int' 'ssize_t'; do
  2375. for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
  2376. for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
  2377. for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
  2378. if test "$curl_cv_func_select_args" = "unknown"; then
  2379. AC_COMPILE_IFELSE([
  2380. AC_LANG_PROGRAM([[
  2381. #undef inline
  2382. #ifdef HAVE_WINDOWS_H
  2383. #ifndef WIN32_LEAN_AND_MEAN
  2384. #define WIN32_LEAN_AND_MEAN
  2385. #endif
  2386. #include <windows.h>
  2387. #ifdef HAVE_WINSOCK2_H
  2388. #include <winsock2.h>
  2389. #else
  2390. #ifdef HAVE_WINSOCK_H
  2391. #include <winsock.h>
  2392. #endif
  2393. #endif
  2394. #define SELECTCALLCONV PASCAL
  2395. #endif
  2396. #ifdef HAVE_SYS_TYPES_H
  2397. #include <sys/types.h>
  2398. #endif
  2399. #ifdef HAVE_SYS_TIME_H
  2400. #include <sys/time.h>
  2401. #ifdef TIME_WITH_SYS_TIME
  2402. #include <time.h>
  2403. #endif
  2404. #else
  2405. #ifdef HAVE_TIME_H
  2406. #include <time.h>
  2407. #endif
  2408. #endif
  2409. #ifndef HAVE_WINDOWS_H
  2410. #ifdef HAVE_SYS_SELECT_H
  2411. #include <sys/select.h>
  2412. #endif
  2413. #ifdef HAVE_SYS_SOCKET_H
  2414. #include <sys/socket.h>
  2415. #endif
  2416. #define SELECTCALLCONV
  2417. #endif
  2418. #ifndef HAVE_STRUCT_TIMEVAL
  2419. struct timeval {
  2420. long tv_sec;
  2421. long tv_usec;
  2422. };
  2423. #endif
  2424. extern $sel_retv SELECTCALLCONV select($sel_arg1,
  2425. $sel_arg234,
  2426. $sel_arg234,
  2427. $sel_arg234,
  2428. $sel_arg5);
  2429. ]],[[
  2430. $sel_arg1 nfds=0;
  2431. $sel_arg234 rfds=0;
  2432. $sel_arg234 wfds=0;
  2433. $sel_arg234 efds=0;
  2434. $sel_retv res = select(nfds, rfds, wfds, efds, 0);
  2435. ]])
  2436. ],[
  2437. curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
  2438. ])
  2439. fi
  2440. done
  2441. done
  2442. done
  2443. done
  2444. ]) # AC-CACHE-CHECK
  2445. if test "$curl_cv_func_select_args" = "unknown"; then
  2446. AC_MSG_WARN([Cannot find proper types to use for select args])
  2447. AC_MSG_WARN([HAVE_SELECT will not be defined])
  2448. else
  2449. select_prev_IFS=$IFS; IFS=','
  2450. set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
  2451. IFS=$select_prev_IFS
  2452. shift
  2453. #
  2454. sel_qual_type_arg5=$[3]
  2455. #
  2456. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
  2457. [Define to the type of arg 1 for select.])
  2458. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
  2459. [Define to the type of args 2, 3 and 4 for select.])
  2460. AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
  2461. [Define to the function return type for select.])
  2462. #
  2463. prev_sh_opts=$-
  2464. #
  2465. case $prev_sh_opts in
  2466. *f*)
  2467. ;;
  2468. *)
  2469. set -f
  2470. ;;
  2471. esac
  2472. #
  2473. case "$sel_qual_type_arg5" in
  2474. const*)
  2475. sel_qual_arg5=const
  2476. sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
  2477. ;;
  2478. *)
  2479. sel_qual_arg5=
  2480. sel_type_arg5=$sel_qual_type_arg5
  2481. ;;
  2482. esac
  2483. #
  2484. AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
  2485. [Define to the type qualifier of arg 5 for select.])
  2486. AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
  2487. [Define to the type of arg 5 for select.])
  2488. #
  2489. case $prev_sh_opts in
  2490. *f*)
  2491. ;;
  2492. *)
  2493. set +f
  2494. ;;
  2495. esac
  2496. #
  2497. AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
  2498. [Define to 1 if you have the select function.])
  2499. ac_cv_func_select="yes"
  2500. fi
  2501. fi
  2502. ])
  2503. # This is only a temporary fix. This macro is here to replace the broken one
  2504. # delivered by the automake project (including the 1.9.6 release). As soon as
  2505. # they ship a working version we SHOULD remove this work-around.
  2506. AC_DEFUN([AM_MISSING_HAS_RUN],
  2507. [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
  2508. test x"${MISSING+set}" = xset || MISSING="\${SHELL} \"$am_aux_dir/missing\""
  2509. # Use eval to expand $SHELL
  2510. if eval "$MISSING --run true"; then
  2511. am_missing_run="$MISSING --run "
  2512. else
  2513. am_missing_run=
  2514. AC_MSG_WARN([`missing' script is too old or missing])
  2515. fi
  2516. ])
  2517. dnl CURL_VERIFY_RUNTIMELIBS
  2518. dnl -------------------------------------------------
  2519. dnl Verify that the shared libs found so far can be used when running
  2520. dnl programs, since otherwise the situation will create odd configure errors
  2521. dnl that are misleading people.
  2522. dnl
  2523. dnl Make sure this test is run BEFORE the first test in the script that
  2524. dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
  2525. dnl macro. It must also run AFTER all lib-checking macros are complete.
  2526. AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
  2527. dnl this test is of course not sensible if we are cross-compiling!
  2528. if test "x$cross_compiling" != xyes; then
  2529. dnl just run a program to verify that the libs checked for previous to this
  2530. dnl point also is available run-time!
  2531. AC_MSG_CHECKING([run-time libs availability])
  2532. AC_TRY_RUN([
  2533. main()
  2534. {
  2535. return 0;
  2536. }
  2537. ],
  2538. AC_MSG_RESULT([fine]),
  2539. AC_MSG_RESULT([failed])
  2540. AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
  2541. )
  2542. dnl if this test fails, configure has already stopped
  2543. fi
  2544. ])
  2545. dnl CURL_CHECK_VARIADIC_MACROS
  2546. dnl -------------------------------------------------
  2547. dnl Check compiler support of variadic macros
  2548. AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
  2549. AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
  2550. [curl_cv_variadic_macros_c99], [
  2551. AC_COMPILE_IFELSE([
  2552. AC_LANG_PROGRAM([[
  2553. #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
  2554. #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
  2555. int fun3(int arg1, int arg2, int arg3);
  2556. int fun2(int arg1, int arg2);
  2557. int fun3(int arg1, int arg2, int arg3)
  2558. { return arg1 + arg2 + arg3; }
  2559. int fun2(int arg1, int arg2)
  2560. { return arg1 + arg2; }
  2561. ]],[[
  2562. int res3 = c99_vmacro3(1, 2, 3);
  2563. int res2 = c99_vmacro2(1, 2);
  2564. ]])
  2565. ],[
  2566. curl_cv_variadic_macros_c99="yes"
  2567. ],[
  2568. curl_cv_variadic_macros_c99="no"
  2569. ])
  2570. ])
  2571. case "$curl_cv_variadic_macros_c99" in
  2572. yes)
  2573. AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
  2574. [Define to 1 if compiler supports C99 variadic macro style.])
  2575. ;;
  2576. esac
  2577. AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
  2578. [curl_cv_variadic_macros_gcc], [
  2579. AC_COMPILE_IFELSE([
  2580. AC_LANG_PROGRAM([[
  2581. #define gcc_vmacro3(first, args...) fun3(first, args)
  2582. #define gcc_vmacro2(first, args...) fun2(first, args)
  2583. int fun3(int arg1, int arg2, int arg3);
  2584. int fun2(int arg1, int arg2);
  2585. int fun3(int arg1, int arg2, int arg3)
  2586. { return arg1 + arg2 + arg3; }
  2587. int fun2(int arg1, int arg2)
  2588. { return arg1 + arg2; }
  2589. ]],[[
  2590. int res3 = gcc_vmacro3(1, 2, 3);
  2591. int res2 = gcc_vmacro2(1, 2);
  2592. ]])
  2593. ],[
  2594. curl_cv_variadic_macros_gcc="yes"
  2595. ],[
  2596. curl_cv_variadic_macros_gcc="no"
  2597. ])
  2598. ])
  2599. case "$curl_cv_variadic_macros_gcc" in
  2600. yes)
  2601. AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
  2602. [Define to 1 if compiler supports old gcc variadic macro style.])
  2603. ;;
  2604. esac
  2605. ])
  2606. dnl CURL_CHECK_CA_BUNDLE
  2607. dnl -------------------------------------------------
  2608. dnl Check if a default ca-bundle should be used
  2609. dnl
  2610. dnl regarding the paths this will scan:
  2611. dnl /etc/ssl/certs/ca-certificates.crt Debian systems
  2612. dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
  2613. dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
  2614. dnl /usr/local/share/certs/ca-root.crt FreeBSD
  2615. dnl /etc/ssl/cert.pem OpenBSD
  2616. dnl /etc/ssl/certs/ (ca path) SUSE
  2617. AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
  2618. AC_MSG_CHECKING([default CA cert bundle/path])
  2619. AC_ARG_WITH(ca-bundle,
  2620. AC_HELP_STRING([--with-ca-bundle=FILE], [File name to use as CA bundle])
  2621. AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
  2622. [
  2623. want_ca="$withval"
  2624. if test "x$want_ca" = "xyes"; then
  2625. AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
  2626. fi
  2627. ],
  2628. [ want_ca="unset" ])
  2629. AC_ARG_WITH(ca-path,
  2630. AC_HELP_STRING([--with-ca-path=DIRECTORY], [Directory to use as CA path])
  2631. AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
  2632. [
  2633. want_capath="$withval"
  2634. if test "x$want_capath" = "xyes"; then
  2635. AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
  2636. fi
  2637. ],
  2638. [ want_capath="unset"])
  2639. if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
  2640. "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
  2641. dnl both given
  2642. AC_MSG_ERROR([Can't specify both --with-ca-bundle and --with-ca-path.])
  2643. elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
  2644. dnl --with-ca-bundle given
  2645. ca="$want_ca"
  2646. capath="no"
  2647. elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
  2648. dnl --with-ca-path given
  2649. if test "x$OPENSSL_ENABLED" != "x1"; then
  2650. AC_MSG_ERROR([--with-ca-path only works with openSSL])
  2651. fi
  2652. capath="$want_capath"
  2653. ca="no"
  2654. else
  2655. dnl neither of --with-ca-* given
  2656. dnl first try autodetecting a CA bundle , then a CA path
  2657. dnl both autodetections can be skipped by --without-ca-*
  2658. ca="no"
  2659. capath="no"
  2660. if test "x$want_ca" = "xunset"; then
  2661. dnl the path we previously would have installed the curl ca bundle
  2662. dnl to, and thus we now check for an already existing cert in that place
  2663. dnl in case we find no other
  2664. if test "x$prefix" != xNONE; then
  2665. cac="${prefix}/share/curl/curl-ca-bundle.crt"
  2666. else
  2667. cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
  2668. fi
  2669. for a in /etc/ssl/certs/ca-certificates.crt \
  2670. /etc/pki/tls/certs/ca-bundle.crt \
  2671. /usr/share/ssl/certs/ca-bundle.crt \
  2672. /usr/local/share/certs/ca-root.crt \
  2673. /etc/ssl/cert.pem \
  2674. "$cac"; do
  2675. if test -f "$a"; then
  2676. ca="$a"
  2677. break
  2678. fi
  2679. done
  2680. fi
  2681. if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
  2682. "x$OPENSSL_ENABLED" = "x1"; then
  2683. for a in /etc/ssl/certs/; do
  2684. if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
  2685. capath="$a"
  2686. break
  2687. fi
  2688. done
  2689. fi
  2690. fi
  2691. if test "x$ca" != "xno"; then
  2692. CURL_CA_BUNDLE='"'$ca'"'
  2693. AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
  2694. AC_SUBST(CURL_CA_BUNDLE)
  2695. AC_MSG_RESULT([$ca])
  2696. elif test "x$capath" != "xno"; then
  2697. CURL_CA_PATH="\"$capath\""
  2698. AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
  2699. AC_MSG_RESULT([$capath (capath)])
  2700. else
  2701. AC_MSG_RESULT([no])
  2702. fi
  2703. ])
  2704. dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE)
  2705. dnl -------------------------------------------------
  2706. dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
  2707. AC_DEFUN([DO_CURL_OFF_T_CHECK], [
  2708. AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
  2709. if test "$curl_typeof_curl_off_t" = "unknown" && test ! -z "$1"; then
  2710. tmp_includes=""
  2711. tmp_source=""
  2712. tmp_fmt=""
  2713. case AS_TR_SH([$1]) in
  2714. int64_t)
  2715. tmp_includes="$curl_includes_inttypes"
  2716. tmp_source="char f@<:@@:>@ = PRId64;"
  2717. tmp_fmt="PRId64"
  2718. ;;
  2719. int32_t)
  2720. tmp_includes="$curl_includes_inttypes"
  2721. tmp_source="char f@<:@@:>@ = PRId32;"
  2722. tmp_fmt="PRId32"
  2723. ;;
  2724. int16_t)
  2725. tmp_includes="$curl_includes_inttypes"
  2726. tmp_source="char f@<:@@:>@ = PRId16;"
  2727. tmp_fmt="PRId16"
  2728. ;;
  2729. esac
  2730. AC_COMPILE_IFELSE([
  2731. AC_LANG_PROGRAM([[
  2732. $tmp_includes
  2733. typedef $1 curl_off_t;
  2734. typedef char dummy_arr[sizeof(curl_off_t) == $2 ? 1 : -1];
  2735. ]],[[
  2736. $tmp_source
  2737. curl_off_t dummy;
  2738. ]])
  2739. ],[
  2740. if test -z "$tmp_fmt"; then
  2741. curl_typeof_curl_off_t="$1"
  2742. curl_sizeof_curl_off_t="$2"
  2743. else
  2744. CURL_CHECK_DEF([$tmp_fmt], [$curl_includes_inttypes], [silent])
  2745. AS_VAR_PUSHDEF([tmp_HaveFmtDef], [curl_cv_have_def_$tmp_fmt])dnl
  2746. AS_VAR_PUSHDEF([tmp_FmtDef], [curl_cv_def_$tmp_fmt])dnl
  2747. if test AS_VAR_GET(tmp_HaveFmtDef) = "yes"; then
  2748. curl_format_curl_off_t=AS_VAR_GET(tmp_FmtDef)
  2749. curl_typeof_curl_off_t="$1"
  2750. curl_sizeof_curl_off_t="$2"
  2751. fi
  2752. AS_VAR_POPDEF([tmp_FmtDef])dnl
  2753. AS_VAR_POPDEF([tmp_HaveFmtDef])dnl
  2754. fi
  2755. ])
  2756. fi
  2757. ])
  2758. dnl DO_CURL_OFF_T_SUFFIX_CHECK (TYPE)
  2759. dnl -------------------------------------------------
  2760. dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T
  2761. AC_DEFUN([DO_CURL_OFF_T_SUFFIX_CHECK], [
  2762. AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
  2763. AC_MSG_CHECKING([constant suffix string for curl_off_t])
  2764. #
  2765. curl_suffix_curl_off_t="unknown"
  2766. curl_suffix_curl_off_tu="unknown"
  2767. #
  2768. case AS_TR_SH([$1]) in
  2769. long_long | __longlong | __longlong_t)
  2770. tst_suffixes="LL::"
  2771. ;;
  2772. long)
  2773. tst_suffixes="L::"
  2774. ;;
  2775. int)
  2776. tst_suffixes="::"
  2777. ;;
  2778. __int64 | int64_t)
  2779. tst_suffixes="LL:i64::"
  2780. ;;
  2781. __int32 | int32_t)
  2782. tst_suffixes="L:i32::"
  2783. ;;
  2784. __int16 | int16_t)
  2785. tst_suffixes="L:i16::"
  2786. ;;
  2787. *)
  2788. AC_MSG_ERROR([unexpected data type $1])
  2789. ;;
  2790. esac
  2791. #
  2792. old_IFS=$IFS; IFS=':'
  2793. for tmp_ssuf in $tst_suffixes ; do
  2794. IFS=$old_IFS
  2795. if test "x$curl_suffix_curl_off_t" = "xunknown"; then
  2796. case $tmp_ssuf in
  2797. i64 | i32 | i16)
  2798. tmp_usuf="u$tmp_ssuf"
  2799. ;;
  2800. LL | L)
  2801. tmp_usuf="U$tmp_ssuf"
  2802. ;;
  2803. *)
  2804. tmp_usuf=""
  2805. ;;
  2806. esac
  2807. AC_COMPILE_IFELSE([
  2808. AC_LANG_PROGRAM([[
  2809. $curl_includes_inttypes
  2810. typedef $1 new_t;
  2811. ]],[[
  2812. new_t s1;
  2813. new_t s2;
  2814. s1 = -10$tmp_ssuf ;
  2815. s2 = 20$tmp_ssuf ;
  2816. if(s1 > s2)
  2817. return 1;
  2818. ]])
  2819. ],[
  2820. curl_suffix_curl_off_t="$tmp_ssuf"
  2821. curl_suffix_curl_off_tu="$tmp_usuf"
  2822. ])
  2823. fi
  2824. done
  2825. IFS=$old_IFS
  2826. #
  2827. if test "x$curl_suffix_curl_off_t" = "xunknown"; then
  2828. AC_MSG_ERROR([cannot find constant suffix string for curl_off_t.])
  2829. else
  2830. AC_MSG_RESULT([$curl_suffix_curl_off_t])
  2831. AC_MSG_CHECKING([constant suffix string for unsigned curl_off_t])
  2832. AC_MSG_RESULT([$curl_suffix_curl_off_tu])
  2833. fi
  2834. #
  2835. ])
  2836. dnl CURL_CONFIGURE_CURL_OFF_T
  2837. dnl -------------------------------------------------
  2838. dnl Find out suitable curl_off_t data type definition and associated
  2839. dnl items, and make the appropriate definitions used in template file
  2840. dnl include/curl/curlbuild.h.in to properly configure the library.
  2841. AC_DEFUN([CURL_CONFIGURE_CURL_OFF_T], [
  2842. AC_REQUIRE([CURL_INCLUDES_INTTYPES])dnl
  2843. #
  2844. AC_BEFORE([$0],[AC_SYS_LARGEFILE])dnl
  2845. AC_BEFORE([$0],[CURL_CONFIGURE_REENTRANT])dnl
  2846. AC_BEFORE([$0],[CURL_CHECK_AIX_ALL_SOURCE])dnl
  2847. #
  2848. if test -z "$SED"; then
  2849. AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
  2850. fi
  2851. #
  2852. AC_CHECK_SIZEOF(long)
  2853. AC_CHECK_SIZEOF(void*)
  2854. #
  2855. if test -z "$ac_cv_sizeof_long" ||
  2856. test "$ac_cv_sizeof_long" -eq "0"; then
  2857. AC_MSG_ERROR([cannot find out size of long.])
  2858. fi
  2859. if test -z "$ac_cv_sizeof_voidp" ||
  2860. test "$ac_cv_sizeof_voidp" -eq "0"; then
  2861. AC_MSG_ERROR([cannot find out size of void*.])
  2862. fi
  2863. #
  2864. x_LP64_long=""
  2865. x_LP32_long=""
  2866. x_LP16_long=""
  2867. #
  2868. if test "$ac_cv_sizeof_long" -eq "8" &&
  2869. test "$ac_cv_sizeof_voidp" -ge "8"; then
  2870. x_LP64_long="long"
  2871. elif test "$ac_cv_sizeof_long" -eq "4" &&
  2872. test "$ac_cv_sizeof_voidp" -ge "4"; then
  2873. x_LP32_long="long"
  2874. elif test "$ac_cv_sizeof_long" -eq "2" &&
  2875. test "$ac_cv_sizeof_voidp" -ge "2"; then
  2876. x_LP16_long="long"
  2877. fi
  2878. #
  2879. dnl DO_CURL_OFF_T_CHECK results are stored in next 3 vars
  2880. #
  2881. curl_typeof_curl_off_t="unknown"
  2882. curl_sizeof_curl_off_t="unknown"
  2883. curl_format_curl_off_t="unknown"
  2884. curl_format_curl_off_tu="unknown"
  2885. #
  2886. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2887. AC_MSG_CHECKING([for 64-bit curl_off_t data type])
  2888. for t8 in \
  2889. "$x_LP64_long" \
  2890. 'int64_t' \
  2891. '__int64' \
  2892. 'long long' \
  2893. '__longlong' \
  2894. '__longlong_t' ; do
  2895. DO_CURL_OFF_T_CHECK([$t8], [8])
  2896. done
  2897. AC_MSG_RESULT([$curl_typeof_curl_off_t])
  2898. fi
  2899. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2900. AC_MSG_CHECKING([for 32-bit curl_off_t data type])
  2901. for t4 in \
  2902. "$x_LP32_long" \
  2903. 'int32_t' \
  2904. '__int32' \
  2905. 'int' ; do
  2906. DO_CURL_OFF_T_CHECK([$t4], [4])
  2907. done
  2908. AC_MSG_RESULT([$curl_typeof_curl_off_t])
  2909. fi
  2910. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2911. AC_MSG_CHECKING([for 16-bit curl_off_t data type])
  2912. for t2 in \
  2913. "$x_LP16_long" \
  2914. 'int16_t' \
  2915. '__int16' \
  2916. 'int' ; do
  2917. DO_CURL_OFF_T_CHECK([$t2], [2])
  2918. done
  2919. AC_MSG_RESULT([$curl_typeof_curl_off_t])
  2920. fi
  2921. if test "$curl_typeof_curl_off_t" = "unknown"; then
  2922. AC_MSG_ERROR([cannot find data type for curl_off_t.])
  2923. fi
  2924. #
  2925. AC_MSG_CHECKING([size of curl_off_t])
  2926. AC_MSG_RESULT([$curl_sizeof_curl_off_t])
  2927. #
  2928. AC_MSG_CHECKING([formatting string directive for curl_off_t])
  2929. if test "$curl_format_curl_off_t" != "unknown"; then
  2930. x_pull_headers="yes"
  2931. curl_format_curl_off_t=`echo "$curl_format_curl_off_t" | "$SED" 's/[["]]//g'`
  2932. curl_format_curl_off_tu=`echo "$curl_format_curl_off_t" | "$SED" 's/i$/u/'`
  2933. curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/d$/u/'`
  2934. curl_format_curl_off_tu=`echo "$curl_format_curl_off_tu" | "$SED" 's/D$/U/'`
  2935. else
  2936. x_pull_headers="no"
  2937. case AS_TR_SH([$curl_typeof_curl_off_t]) in
  2938. long_long | __longlong | __longlong_t)
  2939. curl_format_curl_off_t="lld"
  2940. curl_format_curl_off_tu="llu"
  2941. ;;
  2942. long)
  2943. curl_format_curl_off_t="ld"
  2944. curl_format_curl_off_tu="lu"
  2945. ;;
  2946. int)
  2947. curl_format_curl_off_t="d"
  2948. curl_format_curl_off_tu="u"
  2949. ;;
  2950. __int64)
  2951. curl_format_curl_off_t="I64d"
  2952. curl_format_curl_off_tu="I64u"
  2953. ;;
  2954. __int32)
  2955. curl_format_curl_off_t="I32d"
  2956. curl_format_curl_off_tu="I32u"
  2957. ;;
  2958. __int16)
  2959. curl_format_curl_off_t="I16d"
  2960. curl_format_curl_off_tu="I16u"
  2961. ;;
  2962. *)
  2963. AC_MSG_ERROR([cannot find print format string for curl_off_t.])
  2964. ;;
  2965. esac
  2966. fi
  2967. AC_MSG_RESULT(["$curl_format_curl_off_t"])
  2968. #
  2969. AC_MSG_CHECKING([formatting string directive for unsigned curl_off_t])
  2970. AC_MSG_RESULT(["$curl_format_curl_off_tu"])
  2971. #
  2972. DO_CURL_OFF_T_SUFFIX_CHECK([$curl_typeof_curl_off_t])
  2973. #
  2974. if test "$x_pull_headers" = "yes"; then
  2975. if test "x$ac_cv_header_sys_types_h" = "xyes"; then
  2976. CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H])
  2977. fi
  2978. if test "x$ac_cv_header_stdint_h" = "xyes"; then
  2979. CURL_DEFINE_UNQUOTED([CURL_PULL_STDINT_H])
  2980. fi
  2981. if test "x$ac_cv_header_inttypes_h" = "xyes"; then
  2982. CURL_DEFINE_UNQUOTED([CURL_PULL_INTTYPES_H])
  2983. fi
  2984. fi
  2985. #
  2986. CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_OFF_T], [$curl_typeof_curl_off_t])
  2987. CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_T], ["$curl_format_curl_off_t"])
  2988. CURL_DEFINE_UNQUOTED([CURL_FORMAT_CURL_OFF_TU], ["$curl_format_curl_off_tu"])
  2989. CURL_DEFINE_UNQUOTED([CURL_FORMAT_OFF_T], ["%$curl_format_curl_off_t"])
  2990. CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_OFF_T], [$curl_sizeof_curl_off_t])
  2991. CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_T], [$curl_suffix_curl_off_t])
  2992. CURL_DEFINE_UNQUOTED([CURL_SUFFIX_CURL_OFF_TU], [$curl_suffix_curl_off_tu])
  2993. #
  2994. ])
  2995. dnl CURL_CHECK_WIN32_LARGEFILE
  2996. dnl -------------------------------------------------
  2997. dnl Check if curl's WIN32 large file will be used
  2998. AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
  2999. AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
  3000. AC_MSG_CHECKING([whether build target supports WIN32 file API])
  3001. curl_win32_file_api="no"
  3002. if test "$ac_cv_header_windows_h" = "yes"; then
  3003. if test x"$enable_largefile" != "xno"; then
  3004. AC_COMPILE_IFELSE([
  3005. AC_LANG_PROGRAM([[
  3006. ]],[[
  3007. #if !defined(_WIN32_WCE) && \
  3008. (defined(__MINGW32__) || \
  3009. (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
  3010. int dummy=1;
  3011. #else
  3012. WIN32 large file API not supported.
  3013. #endif
  3014. ]])
  3015. ],[
  3016. curl_win32_file_api="win32_large_files"
  3017. ])
  3018. fi
  3019. if test "$curl_win32_file_api" = "no"; then
  3020. AC_COMPILE_IFELSE([
  3021. AC_LANG_PROGRAM([[
  3022. ]],[[
  3023. #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
  3024. int dummy=1;
  3025. #else
  3026. WIN32 small file API not supported.
  3027. #endif
  3028. ]])
  3029. ],[
  3030. curl_win32_file_api="win32_small_files"
  3031. ])
  3032. fi
  3033. fi
  3034. case "$curl_win32_file_api" in
  3035. win32_large_files)
  3036. AC_MSG_RESULT([yes (large file enabled)])
  3037. AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
  3038. [Define to 1 if you are building a Windows target with large file support.])
  3039. ;;
  3040. win32_small_files)
  3041. AC_MSG_RESULT([yes (large file disabled)])
  3042. AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
  3043. [Define to 1 if you are building a Windows target without large file support.])
  3044. ;;
  3045. *)
  3046. AC_MSG_RESULT([no])
  3047. ;;
  3048. esac
  3049. ])
  3050. dnl CURL_EXPORT_PCDIR ($pcdir)
  3051. dnl ------------------------
  3052. dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
  3053. dnl
  3054. dnl we need this macro since pkg-config distinguishes among empty and unset
  3055. dnl variable while checking PKG_CONFIG_LIBDIR
  3056. dnl
  3057. AC_DEFUN([CURL_EXPORT_PCDIR], [
  3058. if test -n "$1"; then
  3059. PKG_CONFIG_LIBDIR="$1"
  3060. export PKG_CONFIG_LIBDIR
  3061. fi
  3062. ])
  3063. dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
  3064. dnl ------------------------
  3065. dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG
  3066. dnl variable to hold the path to it, or 'no' if not found/present.
  3067. dnl
  3068. dnl If pkg-config is present, check that it has info about the $module or
  3069. dnl return "no" anyway!
  3070. dnl
  3071. dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
  3072. dnl
  3073. AC_DEFUN([CURL_CHECK_PKGCONFIG], [
  3074. PKGCONFIG="no"
  3075. if test x$cross_compiling = xyes; then
  3076. dnl see if there's a pkg-specific for this host setup
  3077. AC_PATH_PROG( PKGCONFIG, ${host}-pkg-config, no,
  3078. $PATH:/usr/bin:/usr/local/bin)
  3079. fi
  3080. if test x$PKGCONFIG = xno; then
  3081. AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
  3082. fi
  3083. if test x$PKGCONFIG != xno; then
  3084. AC_MSG_CHECKING([for $1 options with pkg-config])
  3085. dnl ask pkg-config about $1
  3086. itexists=`CURL_EXPORT_PCDIR([$2]) dnl
  3087. $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
  3088. if test -z "$itexists"; then
  3089. dnl pkg-config does not have info about the given module! set the
  3090. dnl variable to 'no'
  3091. PKGCONFIG="no"
  3092. AC_MSG_RESULT([no])
  3093. else
  3094. AC_MSG_RESULT([found])
  3095. fi
  3096. fi
  3097. ])
  3098. dnl CURL_GENERATE_CONFIGUREHELP_PM
  3099. dnl -------------------------------------------------
  3100. dnl Generate test harness configurehelp.pm module, defining and
  3101. dnl initializing some perl variables with values which are known
  3102. dnl when the configure script runs. For portability reasons, test
  3103. dnl harness needs information on how to run the C preprocessor.
  3104. AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
  3105. AC_REQUIRE([AC_PROG_CPP])dnl
  3106. tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
  3107. if test -z "$tmp_cpp"; then
  3108. tmp_cpp='cpp'
  3109. fi
  3110. cat >./tests/configurehelp.pm <<_EOF
  3111. [@%:@] This is a generated file. Do not edit.
  3112. package configurehelp;
  3113. use strict;
  3114. use warnings;
  3115. use Exporter;
  3116. use vars qw(
  3117. @ISA
  3118. @EXPORT_OK
  3119. \$Cpreprocessor
  3120. );
  3121. @ISA = qw(Exporter);
  3122. @EXPORT_OK = qw(
  3123. \$Cpreprocessor
  3124. );
  3125. \$Cpreprocessor = '$tmp_cpp';
  3126. 1;
  3127. _EOF
  3128. ])