tcl.m4 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121
  1. #------------------------------------------------------------------------
  2. # SC_PATH_TCLCONFIG --
  3. #
  4. # Locate the tclConfig.sh file and perform a sanity check on
  5. # the Tcl compile flags
  6. #
  7. # Arguments:
  8. # none
  9. #
  10. # Results:
  11. #
  12. # Adds the following arguments to configure:
  13. # --with-tcl=...
  14. #
  15. # Defines the following vars:
  16. # TCL_BIN_DIR Full path to the directory containing
  17. # the tclConfig.sh file
  18. #------------------------------------------------------------------------
  19. AC_DEFUN([SC_PATH_TCLCONFIG], [
  20. #
  21. # Ok, lets find the tcl configuration
  22. # First, look for one uninstalled.
  23. # the alternative search directory is invoked by --with-tcl
  24. #
  25. if test x"${no_tcl}" = x ; then
  26. # we reset no_tcl in case something fails here
  27. no_tcl=true
  28. AC_ARG_WITH(tcl,
  29. AS_HELP_STRING([--with-tcl],
  30. [directory containing tcl configuration (tclConfig.sh)]),
  31. with_tclconfig="${withval}")
  32. AC_MSG_CHECKING([for Tcl configuration])
  33. AC_CACHE_VAL(ac_cv_c_tclconfig,[
  34. # First check to see if --with-tcl was specified.
  35. if test x"${with_tclconfig}" != x ; then
  36. case "${with_tclconfig}" in
  37. */tclConfig.sh )
  38. if test -f "${with_tclconfig}"; then
  39. AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
  40. with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`"
  41. fi ;;
  42. esac
  43. if test -f "${with_tclconfig}/tclConfig.sh" ; then
  44. ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`"
  45. else
  46. AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
  47. fi
  48. fi
  49. # then check for a private Tcl installation
  50. if test x"${ac_cv_c_tclconfig}" = x ; then
  51. for i in \
  52. ../tcl \
  53. `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  54. `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  55. `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  56. ../../tcl \
  57. `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  58. `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  59. `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  60. ../../../tcl \
  61. `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  62. `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  63. `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
  64. if test -f "$i/unix/tclConfig.sh" ; then
  65. ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
  66. break
  67. fi
  68. done
  69. fi
  70. # on Darwin, check in Framework installation locations
  71. if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
  72. for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
  73. `ls -d /Library/Frameworks 2>/dev/null` \
  74. `ls -d /Network/Library/Frameworks 2>/dev/null` \
  75. `ls -d /System/Library/Frameworks 2>/dev/null` \
  76. ; do
  77. if test -f "$i/Tcl.framework/tclConfig.sh" ; then
  78. ac_cv_c_tclconfig="`(cd $i/Tcl.framework; pwd)`"
  79. break
  80. fi
  81. done
  82. fi
  83. # check in a few common install locations
  84. if test x"${ac_cv_c_tclconfig}" = x ; then
  85. for i in `ls -d ${libdir} 2>/dev/null` \
  86. `ls -d ${exec_prefix}/lib 2>/dev/null` \
  87. `ls -d ${prefix}/lib 2>/dev/null` \
  88. `ls -d /usr/contrib/lib 2>/dev/null` \
  89. `ls -d /usr/local/lib 2>/dev/null` \
  90. `ls -d /usr/pkg/lib 2>/dev/null` \
  91. `ls -d /usr/lib 2>/dev/null` \
  92. `ls -d /usr/lib64 2>/dev/null` \
  93. ; do
  94. if test -f "$i/tclConfig.sh" ; then
  95. ac_cv_c_tclconfig="`(cd $i; pwd)`"
  96. break
  97. fi
  98. done
  99. fi
  100. # check in a few other private locations
  101. if test x"${ac_cv_c_tclconfig}" = x ; then
  102. for i in \
  103. ${srcdir}/../tcl \
  104. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  105. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
  106. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
  107. if test -f "$i/unix/tclConfig.sh" ; then
  108. ac_cv_c_tclconfig="`(cd $i/unix; pwd)`"
  109. break
  110. fi
  111. done
  112. fi
  113. ])
  114. if test x"${ac_cv_c_tclconfig}" = x ; then
  115. TCL_BIN_DIR="# no Tcl configs found"
  116. AC_MSG_ERROR([Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh])
  117. else
  118. no_tcl=
  119. TCL_BIN_DIR="${ac_cv_c_tclconfig}"
  120. AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
  121. fi
  122. fi
  123. ])
  124. #------------------------------------------------------------------------
  125. # SC_PATH_TKCONFIG --
  126. #
  127. # Locate the tkConfig.sh file
  128. #
  129. # Arguments:
  130. # none
  131. #
  132. # Results:
  133. #
  134. # Adds the following arguments to configure:
  135. # --with-tk=...
  136. #
  137. # Defines the following vars:
  138. # TK_BIN_DIR Full path to the directory containing
  139. # the tkConfig.sh file
  140. #------------------------------------------------------------------------
  141. AC_DEFUN([SC_PATH_TKCONFIG], [
  142. #
  143. # Ok, lets find the tk configuration
  144. # First, look for one uninstalled.
  145. # the alternative search directory is invoked by --with-tk
  146. #
  147. if test x"${no_tk}" = x ; then
  148. # we reset no_tk in case something fails here
  149. no_tk=true
  150. AC_ARG_WITH(tk,
  151. AS_HELP_STRING([--with-tk],
  152. [directory containing tk configuration (tkConfig.sh)]),
  153. with_tkconfig="${withval}")
  154. AC_MSG_CHECKING([for Tk configuration])
  155. AC_CACHE_VAL(ac_cv_c_tkconfig,[
  156. # First check to see if --with-tkconfig was specified.
  157. if test x"${with_tkconfig}" != x ; then
  158. case "${with_tkconfig}" in
  159. */tkConfig.sh )
  160. if test -f "${with_tkconfig}"; then
  161. AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
  162. with_tkconfig="`echo "${with_tkconfig}" | sed 's!/tkConfig\.sh$!!'`"
  163. fi ;;
  164. esac
  165. if test -f "${with_tkconfig}/tkConfig.sh" ; then
  166. ac_cv_c_tkconfig="`(cd "${with_tkconfig}"; pwd)`"
  167. else
  168. AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
  169. fi
  170. fi
  171. # then check for a private Tk library
  172. if test x"${ac_cv_c_tkconfig}" = x ; then
  173. for i in \
  174. ../tk \
  175. `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  176. `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
  177. `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
  178. ../../tk \
  179. `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  180. `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
  181. `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
  182. ../../../tk \
  183. `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  184. `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
  185. `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
  186. if test -f "$i/unix/tkConfig.sh" ; then
  187. ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
  188. break
  189. fi
  190. done
  191. fi
  192. # on Darwin, check in Framework installation locations
  193. if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
  194. for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
  195. `ls -d /Library/Frameworks 2>/dev/null` \
  196. `ls -d /Network/Library/Frameworks 2>/dev/null` \
  197. `ls -d /System/Library/Frameworks 2>/dev/null` \
  198. ; do
  199. if test -f "$i/Tk.framework/tkConfig.sh" ; then
  200. ac_cv_c_tkconfig="`(cd $i/Tk.framework; pwd)`"
  201. break
  202. fi
  203. done
  204. fi
  205. # check in a few common install locations
  206. if test x"${ac_cv_c_tkconfig}" = x ; then
  207. for i in `ls -d ${libdir} 2>/dev/null` \
  208. `ls -d ${exec_prefix}/lib 2>/dev/null` \
  209. `ls -d ${prefix}/lib 2>/dev/null` \
  210. `ls -d /usr/local/lib 2>/dev/null` \
  211. `ls -d /usr/contrib/lib 2>/dev/null` \
  212. `ls -d /usr/lib/tcl8.6 2>/dev/null` \
  213. `ls -d /usr/lib/tk8.6 2>/dev/null` \
  214. `ls -d /usr/lib 2>/dev/null` \
  215. `ls -d /usr/lib64 2>/dev/null` \
  216. ; do
  217. if test -f "$i/tkConfig.sh" ; then
  218. ac_cv_c_tkconfig="`(cd $i; pwd)`"
  219. break
  220. fi
  221. done
  222. fi
  223. # check in a few other private locations
  224. if test x"${ac_cv_c_tkconfig}" = x ; then
  225. for i in \
  226. ${srcdir}/../tk \
  227. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
  228. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
  229. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
  230. if test -f "$i/unix/tkConfig.sh" ; then
  231. ac_cv_c_tkconfig="`(cd $i/unix; pwd)`"
  232. break
  233. fi
  234. done
  235. fi
  236. ])
  237. if test x"${ac_cv_c_tkconfig}" = x ; then
  238. TK_BIN_DIR="# no Tk configs found"
  239. AC_MSG_ERROR([Can't find Tk configuration definitions. Use --with-tk to specify a directory containing tkConfig.sh])
  240. else
  241. no_tk=
  242. TK_BIN_DIR="${ac_cv_c_tkconfig}"
  243. AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
  244. fi
  245. fi
  246. ])
  247. #------------------------------------------------------------------------
  248. # SC_LOAD_TCLCONFIG --
  249. #
  250. # Load the tclConfig.sh file
  251. #
  252. # Arguments:
  253. #
  254. # Requires the following vars to be set:
  255. # TCL_BIN_DIR
  256. #
  257. # Results:
  258. #
  259. # Substitutes the following vars:
  260. # TCL_BIN_DIR
  261. # TCL_SRC_DIR
  262. # TCL_LIB_FILE
  263. #------------------------------------------------------------------------
  264. AC_DEFUN([SC_LOAD_TCLCONFIG], [
  265. AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
  266. if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
  267. AC_MSG_RESULT([loading])
  268. . "${TCL_BIN_DIR}/tclConfig.sh"
  269. else
  270. AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
  271. fi
  272. # eval is required to do the TCL_DBGX substitution
  273. eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
  274. eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
  275. # If the TCL_BIN_DIR is the build directory (not the install directory),
  276. # then set the common variable name to the value of the build variables.
  277. # For example, the variable TCL_LIB_SPEC will be set to the value
  278. # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
  279. # instead of TCL_BUILD_LIB_SPEC since it will work with both an
  280. # installed and uninstalled version of Tcl.
  281. if test -f "${TCL_BIN_DIR}/Makefile" ; then
  282. TCL_LIB_SPEC="${TCL_BUILD_LIB_SPEC}"
  283. TCL_STUB_LIB_SPEC="${TCL_BUILD_STUB_LIB_SPEC}"
  284. TCL_STUB_LIB_PATH="${TCL_BUILD_STUB_LIB_PATH}"
  285. elif test "`uname -s`" = "Darwin"; then
  286. # If Tcl was built as a framework, attempt to use the libraries
  287. # from the framework at the given location so that linking works
  288. # against Tcl.framework installed in an arbitrary location.
  289. case ${TCL_DEFS} in
  290. *TCL_FRAMEWORK*)
  291. if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
  292. for i in "`cd "${TCL_BIN_DIR}"; pwd`" \
  293. "`cd "${TCL_BIN_DIR}"/../..; pwd`"; do
  294. if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
  295. TCL_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TCL_LIB_FILE}"
  296. break
  297. fi
  298. done
  299. fi
  300. if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
  301. TCL_STUB_LIB_SPEC="-L`echo "${TCL_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
  302. TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
  303. fi
  304. ;;
  305. esac
  306. fi
  307. # eval is required to do the TCL_DBGX substitution
  308. eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
  309. eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
  310. eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
  311. eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
  312. eval "TCL_INCLUDE_SPEC=\"${TCL_INCLUDE_SPEC}\""
  313. AC_SUBST(TCL_VERSION)
  314. AC_SUBST(TCL_PATCH_LEVEL)
  315. AC_SUBST(TCL_BIN_DIR)
  316. AC_SUBST(TCL_SRC_DIR)
  317. AC_SUBST(TCL_LIB_FILE)
  318. AC_SUBST(TCL_LIB_FLAG)
  319. AC_SUBST(TCL_LIB_SPEC)
  320. AC_SUBST(TCL_INCLUDE_SPEC)
  321. AC_SUBST(TCL_STUB_LIB_FILE)
  322. AC_SUBST(TCL_STUB_LIB_FLAG)
  323. AC_SUBST(TCL_STUB_LIB_SPEC)
  324. ])
  325. #------------------------------------------------------------------------
  326. # SC_LOAD_TKCONFIG --
  327. #
  328. # Load the tkConfig.sh file
  329. #
  330. # Arguments:
  331. #
  332. # Requires the following vars to be set:
  333. # TK_BIN_DIR
  334. #
  335. # Results:
  336. #
  337. # Sets the following vars that should be in tkConfig.sh:
  338. # TK_BIN_DIR
  339. #------------------------------------------------------------------------
  340. AC_DEFUN([SC_LOAD_TKCONFIG], [
  341. AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
  342. if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
  343. AC_MSG_RESULT([loading])
  344. . "${TK_BIN_DIR}/tkConfig.sh"
  345. else
  346. AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
  347. fi
  348. # eval is required to do the TK_DBGX substitution
  349. eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
  350. eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
  351. # If the TK_BIN_DIR is the build directory (not the install directory),
  352. # then set the common variable name to the value of the build variables.
  353. # For example, the variable TK_LIB_SPEC will be set to the value
  354. # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
  355. # instead of TK_BUILD_LIB_SPEC since it will work with both an
  356. # installed and uninstalled version of Tcl.
  357. if test -f "${TK_BIN_DIR}/Makefile" ; then
  358. TK_LIB_SPEC="${TK_BUILD_LIB_SPEC}"
  359. TK_STUB_LIB_SPEC="${TK_BUILD_STUB_LIB_SPEC}"
  360. TK_STUB_LIB_PATH="${TK_BUILD_STUB_LIB_PATH}"
  361. elif test "`uname -s`" = "Darwin"; then
  362. # If Tk was built as a framework, attempt to use the libraries
  363. # from the framework at the given location so that linking works
  364. # against Tk.framework installed in an arbitrary location.
  365. case ${TK_DEFS} in
  366. *TK_FRAMEWORK*)
  367. if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
  368. for i in "`cd "${TK_BIN_DIR}"; pwd`" \
  369. "`cd "${TK_BIN_DIR}"/../..; pwd`"; do
  370. if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
  371. TK_LIB_SPEC="-F`dirname "$i" | sed -e 's/ /\\\\ /g'` -framework ${TK_LIB_FILE}"
  372. break
  373. fi
  374. done
  375. fi
  376. if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
  377. TK_STUB_LIB_SPEC="-L` echo "${TK_BIN_DIR}" | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}"
  378. TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
  379. fi
  380. ;;
  381. esac
  382. fi
  383. # eval is required to do the TK_DBGX substitution
  384. eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
  385. eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
  386. eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
  387. eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
  388. AC_SUBST(TK_VERSION)
  389. AC_SUBST(TK_BIN_DIR)
  390. AC_SUBST(TK_SRC_DIR)
  391. AC_SUBST(TK_LIB_FILE)
  392. AC_SUBST(TK_LIB_FLAG)
  393. AC_SUBST(TK_LIB_SPEC)
  394. AC_SUBST(TK_STUB_LIB_FILE)
  395. AC_SUBST(TK_STUB_LIB_FLAG)
  396. AC_SUBST(TK_STUB_LIB_SPEC)
  397. ])
  398. #------------------------------------------------------------------------
  399. # SC_PROG_TCLSH
  400. # Locate a tclsh shell installed on the system path. This macro
  401. # will only find a Tcl shell that already exists on the system.
  402. # It will not find a Tcl shell in the Tcl build directory or
  403. # a Tcl shell that has been installed from the Tcl build directory.
  404. # If a Tcl shell can't be located on the PATH, then TCLSH_PROG will
  405. # be set to "". Extensions should take care not to create Makefile
  406. # rules that are run by default and depend on TCLSH_PROG. An
  407. # extension can't assume that an executable Tcl shell exists at
  408. # build time.
  409. #
  410. # Arguments:
  411. # none
  412. #
  413. # Results:
  414. # Substitutes the following vars:
  415. # TCLSH_PROG
  416. #------------------------------------------------------------------------
  417. AC_DEFUN([SC_PROG_TCLSH], [
  418. AC_MSG_CHECKING([for tclsh])
  419. AC_CACHE_VAL(ac_cv_path_tclsh, [
  420. search_path=`echo ${PATH} | sed -e 's/:/ /g'`
  421. for dir in $search_path ; do
  422. for j in `ls -r $dir/tclsh[[8-9]]* 2> /dev/null` \
  423. `ls -r $dir/tclsh* 2> /dev/null` ; do
  424. if test x"$ac_cv_path_tclsh" = x ; then
  425. if test -f "$j" ; then
  426. ac_cv_path_tclsh=$j
  427. break
  428. fi
  429. fi
  430. done
  431. done
  432. ])
  433. if test -f "$ac_cv_path_tclsh" ; then
  434. TCLSH_PROG="$ac_cv_path_tclsh"
  435. AC_MSG_RESULT([$TCLSH_PROG])
  436. else
  437. # It is not an error if an installed version of Tcl can't be located.
  438. TCLSH_PROG=""
  439. AC_MSG_RESULT([No tclsh found on PATH])
  440. fi
  441. AC_SUBST(TCLSH_PROG)
  442. ])
  443. #------------------------------------------------------------------------
  444. # SC_BUILD_TCLSH
  445. # Determine the fully qualified path name of the tclsh executable
  446. # in the Tcl build directory. This macro will correctly determine
  447. # the name of the tclsh executable even if tclsh has not yet
  448. # been built in the build directory. The build tclsh must be used
  449. # when running tests from an extension build directory. It is not
  450. # correct to use the TCLSH_PROG in cases like this.
  451. #
  452. # Arguments:
  453. # none
  454. #
  455. # Results:
  456. # Substitutes the following values:
  457. # BUILD_TCLSH
  458. #------------------------------------------------------------------------
  459. AC_DEFUN([SC_BUILD_TCLSH], [
  460. AC_MSG_CHECKING([for tclsh in Tcl build directory])
  461. BUILD_TCLSH="${TCL_BIN_DIR}"/tclsh
  462. AC_MSG_RESULT([$BUILD_TCLSH])
  463. AC_SUBST(BUILD_TCLSH)
  464. ])
  465. #------------------------------------------------------------------------
  466. # SC_ENABLE_SHARED --
  467. #
  468. # Allows the building of shared libraries
  469. #
  470. # Arguments:
  471. # none
  472. #
  473. # Results:
  474. #
  475. # Adds the following arguments to configure:
  476. # --enable-shared=yes|no
  477. #
  478. # Defines the following vars:
  479. # STATIC_BUILD Used for building import/export libraries
  480. # on Windows.
  481. #
  482. # Sets the following vars:
  483. # SHARED_BUILD Value of 1 or 0
  484. #------------------------------------------------------------------------
  485. AC_DEFUN([SC_ENABLE_SHARED], [
  486. AC_MSG_CHECKING([how to build libraries])
  487. AC_ARG_ENABLE(shared,
  488. AS_HELP_STRING([--enable-shared],
  489. [build and link with shared libraries (default: on)]),
  490. [tcl_ok=$enableval], [tcl_ok=yes])
  491. if test "${enable_shared+set}" = set; then
  492. enableval="$enable_shared"
  493. tcl_ok=$enableval
  494. else
  495. tcl_ok=yes
  496. fi
  497. if test "$tcl_ok" = "yes" ; then
  498. AC_MSG_RESULT([shared])
  499. SHARED_BUILD=1
  500. else
  501. AC_MSG_RESULT([static])
  502. SHARED_BUILD=0
  503. AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
  504. fi
  505. ])
  506. #------------------------------------------------------------------------
  507. # SC_ENABLE_FRAMEWORK --
  508. #
  509. # Allows the building of shared libraries into frameworks
  510. #
  511. # Arguments:
  512. # none
  513. #
  514. # Results:
  515. #
  516. # Adds the following arguments to configure:
  517. # --enable-framework=yes|no
  518. #
  519. # Sets the following vars:
  520. # FRAMEWORK_BUILD Value of 1 or 0
  521. #------------------------------------------------------------------------
  522. AC_DEFUN([SC_ENABLE_FRAMEWORK], [
  523. if test "`uname -s`" = "Darwin" ; then
  524. AC_MSG_CHECKING([how to package libraries])
  525. AC_ARG_ENABLE(framework,
  526. AS_HELP_STRING([--enable-framework],
  527. [package shared libraries in MacOSX frameworks (default: off)]),
  528. [enable_framework=$enableval], [enable_framework=no])
  529. if test $enable_framework = yes; then
  530. if test $SHARED_BUILD = 0; then
  531. AC_MSG_WARN([Frameworks can only be built if --enable-shared is yes])
  532. enable_framework=no
  533. fi
  534. if test $tcl_corefoundation = no; then
  535. AC_MSG_WARN([Frameworks can only be used when CoreFoundation is available])
  536. enable_framework=no
  537. fi
  538. fi
  539. if test $enable_framework = yes; then
  540. AC_MSG_RESULT([framework])
  541. FRAMEWORK_BUILD=1
  542. else
  543. if test $SHARED_BUILD = 1; then
  544. AC_MSG_RESULT([shared library])
  545. else
  546. AC_MSG_RESULT([static library])
  547. fi
  548. FRAMEWORK_BUILD=0
  549. fi
  550. fi
  551. ])
  552. #------------------------------------------------------------------------
  553. # SC_ENABLE_THREADS --
  554. #
  555. # Specify if thread support should be enabled
  556. #
  557. # Arguments:
  558. # none
  559. #
  560. # Results:
  561. #
  562. # Adds the following arguments to configure:
  563. # --enable-threads
  564. #
  565. # Sets the following vars:
  566. # THREADS_LIBS Thread library(s)
  567. #
  568. # Defines the following vars:
  569. # TCL_THREADS
  570. # _REENTRANT
  571. # _THREAD_SAFE
  572. #------------------------------------------------------------------------
  573. AC_DEFUN([SC_ENABLE_THREADS], [
  574. AC_ARG_ENABLE(threads,
  575. AS_HELP_STRING([--enable-threads],
  576. [build with threads (default: on)]),
  577. [tcl_ok=$enableval], [tcl_ok=yes])
  578. if test "${TCL_THREADS}" = 1; then
  579. tcl_threaded_core=1;
  580. fi
  581. if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
  582. TCL_THREADS=1
  583. # USE_THREAD_ALLOC tells us to try the special thread-based
  584. # allocator that significantly reduces lock contention
  585. AC_DEFINE(USE_THREAD_ALLOC, 1,
  586. [Do we want to use the threaded memory allocator?])
  587. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
  588. if test "`uname -s`" = "SunOS" ; then
  589. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
  590. [Do we really want to follow the standard? Yes we do!])
  591. fi
  592. AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
  593. AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  594. if test "$tcl_ok" = "no"; then
  595. # Check a little harder for __pthread_mutex_init in the same
  596. # library, as some systems hide it there until pthread.h is
  597. # defined. We could alternatively do an AC_TRY_COMPILE with
  598. # pthread.h, but that will work with libpthread really doesn't
  599. # exist, like AIX 4.2. [Bug: 4359]
  600. AC_CHECK_LIB(pthread, __pthread_mutex_init,
  601. tcl_ok=yes, tcl_ok=no)
  602. fi
  603. if test "$tcl_ok" = "yes"; then
  604. # The space is needed
  605. THREADS_LIBS=" -lpthread"
  606. else
  607. AC_CHECK_LIB(pthreads, pthread_mutex_init,
  608. tcl_ok=yes, tcl_ok=no)
  609. if test "$tcl_ok" = "yes"; then
  610. # The space is needed
  611. THREADS_LIBS=" -lpthreads"
  612. else
  613. AC_CHECK_LIB(c, pthread_mutex_init,
  614. tcl_ok=yes, tcl_ok=no)
  615. if test "$tcl_ok" = "no"; then
  616. AC_CHECK_LIB(c_r, pthread_mutex_init,
  617. tcl_ok=yes, tcl_ok=no)
  618. if test "$tcl_ok" = "yes"; then
  619. # The space is needed
  620. THREADS_LIBS=" -pthread"
  621. else
  622. TCL_THREADS=0
  623. AC_MSG_WARN([Don't know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...])
  624. fi
  625. fi
  626. fi
  627. fi
  628. # Does the pthread-implementation provide
  629. # 'pthread_attr_setstacksize' ?
  630. ac_saved_libs=$LIBS
  631. LIBS="$LIBS $THREADS_LIBS"
  632. AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork)
  633. LIBS=$ac_saved_libs
  634. else
  635. TCL_THREADS=0
  636. fi
  637. # Do checking message here to not mess up interleaved configure output
  638. AC_MSG_CHECKING([for building with threads])
  639. if test "${TCL_THREADS}" = 1; then
  640. AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
  641. if test "${tcl_threaded_core}" = 1; then
  642. AC_MSG_RESULT([yes (threaded core)])
  643. else
  644. AC_MSG_RESULT([yes])
  645. fi
  646. else
  647. AC_MSG_RESULT([no])
  648. fi
  649. AC_SUBST(TCL_THREADS)
  650. ])
  651. #------------------------------------------------------------------------
  652. # SC_ENABLE_SYMBOLS --
  653. #
  654. # Specify if debugging symbols should be used.
  655. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
  656. # can also be enabled.
  657. #
  658. # Arguments:
  659. # none
  660. #
  661. # Requires the following vars to be set in the Makefile:
  662. # CFLAGS_DEBUG
  663. # CFLAGS_OPTIMIZE
  664. # LDFLAGS_DEBUG
  665. # LDFLAGS_OPTIMIZE
  666. #
  667. # Results:
  668. #
  669. # Adds the following arguments to configure:
  670. # --enable-symbols
  671. #
  672. # Defines the following vars:
  673. # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
  674. # Sets to $(CFLAGS_OPTIMIZE) if false
  675. # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
  676. # Sets to $(LDFLAGS_OPTIMIZE) if false
  677. # DBGX Formerly used as debug library extension;
  678. # always blank now.
  679. #------------------------------------------------------------------------
  680. AC_DEFUN([SC_ENABLE_SYMBOLS], [
  681. AC_MSG_CHECKING([for build with symbols])
  682. AC_ARG_ENABLE(symbols,
  683. AS_HELP_STRING([--enable-symbols],
  684. [build with debugging symbols (default: off)]),
  685. [tcl_ok=$enableval], [tcl_ok=no])
  686. # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
  687. DBGX=""
  688. if test "$tcl_ok" = "no"; then
  689. CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
  690. LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
  691. AC_DEFINE(NDEBUG, 1, [Is no debugging enabled?])
  692. AC_MSG_RESULT([no])
  693. AC_DEFINE(TCL_CFG_OPTIMIZED, 1, [Is this an optimized build?])
  694. else
  695. CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
  696. LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
  697. if test "$tcl_ok" = "yes"; then
  698. AC_MSG_RESULT([yes (standard debugging)])
  699. fi
  700. fi
  701. AC_SUBST(CFLAGS_DEFAULT)
  702. AC_SUBST(LDFLAGS_DEFAULT)
  703. if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
  704. AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
  705. fi
  706. ifelse($1,bccdebug,dnl Only enable 'compile' for the Tcl core itself
  707. if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
  708. AC_DEFINE(TCL_COMPILE_DEBUG, 1, [Is bytecode debugging enabled?])
  709. AC_DEFINE(TCL_COMPILE_STATS, 1, [Are bytecode statistics enabled?])
  710. fi)
  711. if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
  712. if test "$tcl_ok" = "all"; then
  713. AC_MSG_RESULT([enabled symbols mem ]ifelse($1,bccdebug,[compile ])[debugging])
  714. else
  715. AC_MSG_RESULT([enabled $tcl_ok debugging])
  716. fi
  717. fi
  718. ])
  719. #------------------------------------------------------------------------
  720. # SC_ENABLE_LANGINFO --
  721. #
  722. # Allows use of modern nl_langinfo check for better l10n.
  723. # This is only relevant for Unix.
  724. #
  725. # Arguments:
  726. # none
  727. #
  728. # Results:
  729. #
  730. # Adds the following arguments to configure:
  731. # --enable-langinfo=yes|no (default is yes)
  732. #
  733. # Defines the following vars:
  734. # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
  735. #------------------------------------------------------------------------
  736. AC_DEFUN([SC_ENABLE_LANGINFO], [
  737. AC_ARG_ENABLE(langinfo,
  738. AS_HELP_STRING([--enable-langinfo],
  739. [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
  740. [langinfo_ok=$enableval], [langinfo_ok=yes])
  741. HAVE_LANGINFO=0
  742. if test "$langinfo_ok" = "yes"; then
  743. AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
  744. fi
  745. AC_MSG_CHECKING([whether to use nl_langinfo])
  746. if test "$langinfo_ok" = "yes"; then
  747. AC_CACHE_VAL(tcl_cv_langinfo_h, [
  748. AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
  749. [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no])])
  750. AC_MSG_RESULT([$tcl_cv_langinfo_h])
  751. if test $tcl_cv_langinfo_h = yes; then
  752. AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
  753. fi
  754. else
  755. AC_MSG_RESULT([$langinfo_ok])
  756. fi
  757. ])
  758. #--------------------------------------------------------------------
  759. # SC_CONFIG_MANPAGES
  760. #
  761. # Decide whether to use symlinks for linking the manpages,
  762. # whether to compress the manpages after installation, and
  763. # whether to add a package name suffix to the installed
  764. # manpages to avoidfile name clashes.
  765. # If compression is enabled also find out what file name suffix
  766. # the given compression program is using.
  767. #
  768. # Arguments:
  769. # none
  770. #
  771. # Results:
  772. #
  773. # Adds the following arguments to configure:
  774. # --enable-man-symlinks
  775. # --enable-man-compression=PROG
  776. # --enable-man-suffix[=STRING]
  777. #
  778. # Defines the following variable:
  779. #
  780. # MAN_FLAGS - The apropriate flags for installManPage
  781. # according to the user's selection.
  782. #
  783. #--------------------------------------------------------------------
  784. AC_DEFUN([SC_CONFIG_MANPAGES], [
  785. AC_MSG_CHECKING([whether to use symlinks for manpages])
  786. AC_ARG_ENABLE(man-symlinks,
  787. AS_HELP_STRING([--enable-man-symlinks],
  788. [use symlinks for the manpages (default: off)]),
  789. test "$enableval" != "no" && MAN_FLAGS="$MAN_FLAGS --symlinks",
  790. enableval="no")
  791. AC_MSG_RESULT([$enableval])
  792. AC_MSG_CHECKING([whether to compress the manpages])
  793. AC_ARG_ENABLE(man-compression,
  794. AS_HELP_STRING([--enable-man-compression=PROG],
  795. [compress the manpages with PROG (default: off)]),
  796. [case $enableval in
  797. yes) AC_MSG_ERROR([missing argument to --enable-man-compression]);;
  798. no) ;;
  799. *) MAN_FLAGS="$MAN_FLAGS --compress $enableval";;
  800. esac],
  801. enableval="no")
  802. AC_MSG_RESULT([$enableval])
  803. if test "$enableval" != "no"; then
  804. AC_MSG_CHECKING([for compressed file suffix])
  805. touch TeST
  806. $enableval TeST
  807. Z=`ls TeST* | sed 's/^....//'`
  808. rm -f TeST*
  809. MAN_FLAGS="$MAN_FLAGS --extension $Z"
  810. AC_MSG_RESULT([$Z])
  811. fi
  812. AC_MSG_CHECKING([whether to add a package name suffix for the manpages])
  813. AC_ARG_ENABLE(man-suffix,
  814. AS_HELP_STRING([--enable-man-suffix=STRING],
  815. [use STRING as a suffix to manpage file names (default: no, AC_PACKAGE_NAME if enabled without specifying STRING)]),
  816. [case $enableval in
  817. yes) enableval="AC_PACKAGE_NAME" MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
  818. no) ;;
  819. *) MAN_FLAGS="$MAN_FLAGS --suffix $enableval";;
  820. esac],
  821. enableval="no")
  822. AC_MSG_RESULT([$enableval])
  823. AC_SUBST(MAN_FLAGS)
  824. ])
  825. #--------------------------------------------------------------------
  826. # SC_CONFIG_SYSTEM
  827. #
  828. # Determine what the system is (some things cannot be easily checked
  829. # on a feature-driven basis, alas). This can usually be done via the
  830. # "uname" command, but there are a few systems, like Next, where
  831. # this doesn't work.
  832. #
  833. # Arguments:
  834. # none
  835. #
  836. # Results:
  837. # Defines the following var:
  838. #
  839. # system - System/platform/version identification code.
  840. #
  841. #--------------------------------------------------------------------
  842. AC_DEFUN([SC_CONFIG_SYSTEM], [
  843. AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
  844. if test -f /usr/lib/NextStep/software_version; then
  845. tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  846. else
  847. tcl_cv_sys_version=`uname -s`-`uname -r`
  848. if test "$?" -ne 0 ; then
  849. AC_MSG_WARN([can't find uname command])
  850. tcl_cv_sys_version=unknown
  851. else
  852. # Special check for weird MP-RAS system (uname returns weird
  853. # results, and the version is kept in special file).
  854. if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  855. tcl_cv_sys_version=MP-RAS-`awk '{print $[3]}' /etc/.relid`
  856. fi
  857. if test "`uname -s`" = "AIX" ; then
  858. tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
  859. fi
  860. if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
  861. tcl_cv_sys_version=NetBSD-Debian
  862. fi
  863. fi
  864. fi
  865. ])
  866. system=$tcl_cv_sys_version
  867. ])
  868. #--------------------------------------------------------------------
  869. # SC_CONFIG_CFLAGS
  870. #
  871. # Try to determine the proper flags to pass to the compiler
  872. # for building shared libraries and other such nonsense.
  873. #
  874. # Arguments:
  875. # none
  876. #
  877. # Results:
  878. #
  879. # Defines and substitutes the following vars:
  880. #
  881. # DL_OBJS - Name of the object file that implements dynamic
  882. # loading for Tcl on this system.
  883. # DL_LIBS - Library file(s) to include in tclsh and other base
  884. # applications in order for the "load" command to work.
  885. # LDFLAGS - Flags to pass to the compiler when linking object
  886. # files into an executable application binary such
  887. # as tclsh.
  888. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
  889. # that tell the run-time dynamic linker where to look
  890. # for shared libraries such as libtcl.so. Depends on
  891. # the variable LIB_RUNTIME_DIR in the Makefile. Could
  892. # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
  893. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
  894. # that tell the run-time dynamic linker where to look
  895. # for shared libraries such as libtcl.so. Depends on
  896. # the variable LIB_RUNTIME_DIR in the Makefile.
  897. # MAKE_LIB - Command to execute to build the a library;
  898. # differs when building shared or static.
  899. # MAKE_STUB_LIB -
  900. # Command to execute to build a stub library.
  901. # INSTALL_LIB - Command to execute to install a library;
  902. # differs when building shared or static.
  903. # INSTALL_STUB_LIB -
  904. # Command to execute to install a stub library.
  905. # STLIB_LD - Base command to use for combining object files
  906. # into a static library.
  907. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
  908. # of a shared library (may request position-independent
  909. # code, among other things).
  910. # SHLIB_LD - Base command to use for combining object files
  911. # into a shared library.
  912. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
  913. # creating shared libraries. This symbol typically
  914. # goes at the end of the "ld" commands that build
  915. # shared libraries. The value of the symbol defaults to
  916. # "${LIBS}" if all of the dependent libraries should
  917. # be specified when creating a shared library. If
  918. # dependent libraries should not be specified (as on
  919. # SunOS 4.x, where they cause the link to fail, or in
  920. # general if Tcl and Tk aren't themselves shared
  921. # libraries), then this symbol has an empty string
  922. # as its value.
  923. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
  924. # extensions. An empty string means we don't know how
  925. # to use shared libraries on this platform.
  926. # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
  927. # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
  928. # tclConfig.sh, since they are only used for the build
  929. # of Tcl and Tk.
  930. # Examples: MacOS X records the library version and
  931. # compatibility version in the shared library. But
  932. # of course the Tcl version of this is only used for Tcl.
  933. # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
  934. # in a static or shared library name, using the $VERSION variable
  935. # to put the version in the right place. This is used
  936. # by platforms that need non-standard library names.
  937. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
  938. # to have a version after the .so, and ${VERSION}.a
  939. # on AIX, since a shared library needs to have
  940. # a .a extension whereas shared objects for loadable
  941. # extensions have a .so extension. Defaults to
  942. # ${VERSION}${SHLIB_SUFFIX}.
  943. # TCL_LIBS -
  944. # Libs to use when linking Tcl shell or some other
  945. # shell that includes Tcl libs.
  946. # CFLAGS_DEBUG -
  947. # Flags used when running the compiler in debug mode
  948. # CFLAGS_OPTIMIZE -
  949. # Flags used when running the compiler in optimize mode
  950. # CFLAGS - Additional CFLAGS added as necessary (usually 64-bit)
  951. #
  952. #--------------------------------------------------------------------
  953. AC_DEFUN([SC_CONFIG_CFLAGS], [
  954. # Step 0.a: Enable 64 bit support?
  955. AC_MSG_CHECKING([if 64bit support is requested])
  956. AC_ARG_ENABLE(64bit,
  957. AS_HELP_STRING([--enable-64bit],
  958. [enable 64bit support (default: off)]),
  959. [do64bit=$enableval], [do64bit=no])
  960. AC_MSG_RESULT([$do64bit])
  961. # Step 0.b: Enable Solaris 64 bit VIS support?
  962. AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
  963. AC_ARG_ENABLE(64bit-vis,
  964. AS_HELP_STRING([--enable-64bit-vis],
  965. [enable 64bit Sparc VIS support (default: off)]),
  966. [do64bitVIS=$enableval], [do64bitVIS=no])
  967. AC_MSG_RESULT([$do64bitVIS])
  968. # Force 64bit on with VIS
  969. AS_IF([test "$do64bitVIS" = "yes"], [do64bit=yes])
  970. # Step 0.c: Check if visibility support is available. Do this here so
  971. # that platform specific alternatives can be used below if this fails.
  972. AC_CACHE_CHECK([if compiler supports visibility "hidden"],
  973. tcl_cv_cc_visibility_hidden, [
  974. hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
  975. AC_TRY_LINK([
  976. extern __attribute__((__visibility__("hidden"))) void f(void);
  977. void f(void) {}], [f();], tcl_cv_cc_visibility_hidden=yes,
  978. tcl_cv_cc_visibility_hidden=no)
  979. CFLAGS=$hold_cflags])
  980. AS_IF([test $tcl_cv_cc_visibility_hidden = yes], [
  981. AC_DEFINE(MODULE_SCOPE,
  982. [extern __attribute__((__visibility__("hidden")))],
  983. [Compiler support for module scope symbols])
  984. AC_DEFINE(HAVE_HIDDEN, [1], [Compiler support for module scope symbols])
  985. ])
  986. # Step 0.d: Disable -rpath support?
  987. AC_MSG_CHECKING([if rpath support is requested])
  988. AC_ARG_ENABLE(rpath,
  989. AS_HELP_STRING([--disable-rpath],
  990. [disable rpath support (default: on)]),
  991. [doRpath=$enableval], [doRpath=yes])
  992. AC_MSG_RESULT([$doRpath])
  993. # Step 1: set the variable "system" to hold the name and version number
  994. # for the system.
  995. SC_CONFIG_SYSTEM
  996. # Step 2: check for existence of -ldl library. This is needed because
  997. # Linux can use either -ldl or -ldld for dynamic loading.
  998. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
  999. # Require ranlib early so we can override it in special cases below.
  1000. AC_REQUIRE([AC_PROG_RANLIB])
  1001. # Step 3: set configuration options based on system name and version.
  1002. do64bit_ok=no
  1003. # default to '{$LIBS}' and set to "" on per-platform necessary basis
  1004. SHLIB_LD_LIBS='${LIBS}'
  1005. LDFLAGS_ORIG="$LDFLAGS"
  1006. # When ld needs options to work in 64-bit mode, put them in
  1007. # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
  1008. # is disabled by the user. [Bug 1016796]
  1009. LDFLAGS_ARCH=""
  1010. UNSHARED_LIB_SUFFIX=""
  1011. TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
  1012. ECHO_VERSION='`echo ${VERSION}`'
  1013. TCL_LIB_VERSIONS_OK=ok
  1014. CFLAGS_DEBUG=-g
  1015. AS_IF([test "$GCC" = yes], [
  1016. CFLAGS_OPTIMIZE=-O2
  1017. CFLAGS_WARNING="-Wall"
  1018. ], [
  1019. CFLAGS_OPTIMIZE=-O
  1020. CFLAGS_WARNING=""
  1021. ])
  1022. AC_CHECK_TOOL(AR, ar)
  1023. STLIB_LD='${AR} cr'
  1024. LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  1025. PLAT_OBJS=""
  1026. PLAT_SRCS=""
  1027. LDAIX_SRC=""
  1028. AS_IF([test "x${SHLIB_VERSION}" = x],[SHLIB_VERSION=".1.0"],[SHLIB_VERSION=".${SHLIB_VERSION}"])
  1029. case $system in
  1030. AIX-*)
  1031. AS_IF([test "${TCL_THREADS}" = "1" -a "$GCC" != "yes"], [
  1032. # AIX requires the _r compiler when gcc isn't being used
  1033. case "${CC}" in
  1034. *_r|*_r\ *)
  1035. # ok ...
  1036. ;;
  1037. *)
  1038. # Make sure only first arg gets _r
  1039. CC=`echo "$CC" | sed -e 's/^\([[^ ]]*\)/\1_r/'`
  1040. ;;
  1041. esac
  1042. AC_MSG_RESULT([Using $CC for compiling with threads])
  1043. ])
  1044. LIBS="$LIBS -lc"
  1045. SHLIB_CFLAGS=""
  1046. SHLIB_SUFFIX=".so"
  1047. DL_OBJS="tclLoadDl.o"
  1048. LD_LIBRARY_PATH_VAR="LIBPATH"
  1049. # ldAix No longer needed with use of -bexpall/-brtl
  1050. # but some extensions may still reference it
  1051. LDAIX_SRC='$(UNIX_DIR)/ldAix'
  1052. # Check to enable 64-bit flags for compiler/linker
  1053. AS_IF([test "$do64bit" = yes], [
  1054. AS_IF([test "$GCC" = yes], [
  1055. AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1056. ], [
  1057. do64bit_ok=yes
  1058. CFLAGS="$CFLAGS -q64"
  1059. LDFLAGS_ARCH="-q64"
  1060. RANLIB="${RANLIB} -X64"
  1061. AR="${AR} -X64"
  1062. SHLIB_LD_FLAGS="-b64"
  1063. ])
  1064. ])
  1065. AS_IF([test "`uname -m`" = ia64], [
  1066. # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
  1067. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1068. # AIX-5 has dl* in libc.so
  1069. DL_LIBS=""
  1070. AS_IF([test "$GCC" = yes], [
  1071. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1072. ], [
  1073. CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
  1074. ])
  1075. LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1076. ], [
  1077. AS_IF([test "$GCC" = yes], [
  1078. SHLIB_LD='${CC} -shared -Wl,-bexpall'
  1079. ], [
  1080. SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bexpall -H512 -T512 -bnoentry"
  1081. LDFLAGS="$LDFLAGS -brtl"
  1082. ])
  1083. SHLIB_LD="${SHLIB_LD} ${SHLIB_LD_FLAGS}"
  1084. DL_LIBS="-ldl"
  1085. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1086. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1087. ])
  1088. ;;
  1089. BeOS*)
  1090. SHLIB_CFLAGS="-fPIC"
  1091. SHLIB_LD='${CC} -nostart'
  1092. SHLIB_SUFFIX=".so"
  1093. DL_OBJS="tclLoadDl.o"
  1094. DL_LIBS="-ldl"
  1095. #-----------------------------------------------------------
  1096. # Check for inet_ntoa in -lbind, for BeOS (which also needs
  1097. # -lsocket, even if the network functions are in -lnet which
  1098. # is always linked to, for compatibility.
  1099. #-----------------------------------------------------------
  1100. AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
  1101. ;;
  1102. BSD/OS-2.1*|BSD/OS-3*)
  1103. SHLIB_CFLAGS=""
  1104. SHLIB_LD="shlicc -r"
  1105. SHLIB_SUFFIX=".so"
  1106. DL_OBJS="tclLoadDl.o"
  1107. DL_LIBS="-ldl"
  1108. CC_SEARCH_FLAGS=""
  1109. LD_SEARCH_FLAGS=""
  1110. ;;
  1111. BSD/OS-4.*)
  1112. SHLIB_CFLAGS="-export-dynamic -fPIC"
  1113. SHLIB_LD='${CC} -shared'
  1114. SHLIB_SUFFIX=".so"
  1115. DL_OBJS="tclLoadDl.o"
  1116. DL_LIBS="-ldl"
  1117. LDFLAGS="$LDFLAGS -export-dynamic"
  1118. CC_SEARCH_FLAGS=""
  1119. LD_SEARCH_FLAGS=""
  1120. ;;
  1121. CYGWIN_*|MINGW32*)
  1122. SHLIB_CFLAGS=""
  1123. SHLIB_LD='${CC} -shared'
  1124. SHLIB_SUFFIX=".dll"
  1125. DL_OBJS="tclLoadDl.o"
  1126. PLAT_OBJS='${CYGWIN_OBJS}'
  1127. PLAT_SRCS='${CYGWIN_SRCS}'
  1128. DL_LIBS="-ldl"
  1129. CC_SEARCH_FLAGS=""
  1130. LD_SEARCH_FLAGS=""
  1131. TCL_NEEDS_EXP_FILE=1
  1132. TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a'
  1133. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,--out-implib,\$[@].a"
  1134. AC_CACHE_CHECK(for Cygwin version of gcc,
  1135. ac_cv_cygwin,
  1136. AC_TRY_COMPILE([
  1137. #ifdef __CYGWIN__
  1138. #error cygwin
  1139. #endif
  1140. ], [],
  1141. ac_cv_cygwin=no,
  1142. ac_cv_cygwin=yes)
  1143. )
  1144. if test "$ac_cv_cygwin" = "no"; then
  1145. AC_MSG_ERROR([${CC} is not a cygwin compiler.])
  1146. fi
  1147. if test "x${TCL_THREADS}" = "x0"; then
  1148. AC_MSG_ERROR([CYGWIN compile is only supported with --enable-threads])
  1149. fi
  1150. do64bit_ok=yes
  1151. if test "x${SHARED_BUILD}" = "x1"; then
  1152. echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args"
  1153. # The eval makes quoting arguments work.
  1154. if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix
  1155. then :
  1156. else
  1157. { echo "configure: error: configure failed for ../win" 1>&2; exit 1; }
  1158. fi
  1159. fi
  1160. ;;
  1161. dgux*)
  1162. SHLIB_CFLAGS="-K PIC"
  1163. SHLIB_LD='${CC} -G'
  1164. SHLIB_LD_LIBS=""
  1165. SHLIB_SUFFIX=".so"
  1166. DL_OBJS="tclLoadDl.o"
  1167. DL_LIBS="-ldl"
  1168. CC_SEARCH_FLAGS=""
  1169. LD_SEARCH_FLAGS=""
  1170. ;;
  1171. Haiku*)
  1172. LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1173. SHLIB_CFLAGS="-fPIC"
  1174. SHLIB_SUFFIX=".so"
  1175. SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
  1176. DL_OBJS="tclLoadDl.o"
  1177. DL_LIBS="-lroot"
  1178. AC_CHECK_LIB(network, inet_ntoa, [LIBS="$LIBS -lnetwork"])
  1179. ;;
  1180. HP-UX-*.11.*)
  1181. # Use updated header definitions where possible
  1182. AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
  1183. AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
  1184. LIBS="$LIBS -lxnet" # Use the XOPEN network library
  1185. AS_IF([test "`uname -m`" = ia64], [
  1186. SHLIB_SUFFIX=".so"
  1187. ], [
  1188. SHLIB_SUFFIX=".sl"
  1189. ])
  1190. AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1191. AS_IF([test "$tcl_ok" = yes], [
  1192. SHLIB_CFLAGS="+z"
  1193. SHLIB_LD="ld -b"
  1194. DL_OBJS="tclLoadShl.o"
  1195. DL_LIBS="-ldld"
  1196. LDFLAGS="$LDFLAGS -Wl,-E"
  1197. CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
  1198. LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  1199. LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1200. ])
  1201. AS_IF([test "$GCC" = yes], [
  1202. SHLIB_LD='${CC} -shared'
  1203. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1204. ], [
  1205. CFLAGS="$CFLAGS -z"
  1206. ])
  1207. # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
  1208. #CFLAGS="$CFLAGS +DAportable"
  1209. # Check to enable 64-bit flags for compiler/linker
  1210. AS_IF([test "$do64bit" = "yes"], [
  1211. AS_IF([test "$GCC" = yes], [
  1212. case `${CC} -dumpmachine` in
  1213. hppa64*)
  1214. # 64-bit gcc in use. Fix flags for GNU ld.
  1215. do64bit_ok=yes
  1216. SHLIB_LD='${CC} -shared'
  1217. AS_IF([test $doRpath = yes], [
  1218. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
  1219. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1220. ;;
  1221. *)
  1222. AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1223. ;;
  1224. esac
  1225. ], [
  1226. do64bit_ok=yes
  1227. CFLAGS="$CFLAGS +DD64"
  1228. LDFLAGS_ARCH="+DD64"
  1229. ])
  1230. ]) ;;
  1231. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  1232. SHLIB_SUFFIX=".sl"
  1233. AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1234. AS_IF([test "$tcl_ok" = yes], [
  1235. SHLIB_CFLAGS="+z"
  1236. SHLIB_LD="ld -b"
  1237. SHLIB_LD_LIBS=""
  1238. DL_OBJS="tclLoadShl.o"
  1239. DL_LIBS="-ldld"
  1240. LDFLAGS="$LDFLAGS -Wl,-E"
  1241. CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
  1242. LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  1243. LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1244. ]) ;;
  1245. IRIX-5.*)
  1246. SHLIB_CFLAGS=""
  1247. SHLIB_LD="ld -shared -rdata_shared"
  1248. SHLIB_SUFFIX=".so"
  1249. DL_OBJS="tclLoadDl.o"
  1250. DL_LIBS=""
  1251. AC_LIBOBJ(mkstemp)
  1252. AS_IF([test $doRpath = yes], [
  1253. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1254. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
  1255. ;;
  1256. IRIX-6.*)
  1257. SHLIB_CFLAGS=""
  1258. SHLIB_LD="ld -n32 -shared -rdata_shared"
  1259. SHLIB_SUFFIX=".so"
  1260. DL_OBJS="tclLoadDl.o"
  1261. DL_LIBS=""
  1262. AC_LIBOBJ(mkstemp)
  1263. AS_IF([test $doRpath = yes], [
  1264. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1265. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
  1266. AS_IF([test "$GCC" = yes], [
  1267. CFLAGS="$CFLAGS -mabi=n32"
  1268. LDFLAGS="$LDFLAGS -mabi=n32"
  1269. ], [
  1270. case $system in
  1271. IRIX-6.3)
  1272. # Use to build 6.2 compatible binaries on 6.3.
  1273. CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS"
  1274. ;;
  1275. *)
  1276. CFLAGS="$CFLAGS -n32"
  1277. ;;
  1278. esac
  1279. LDFLAGS="$LDFLAGS -n32"
  1280. ])
  1281. ;;
  1282. IRIX64-6.*)
  1283. SHLIB_CFLAGS=""
  1284. SHLIB_LD="ld -n32 -shared -rdata_shared"
  1285. SHLIB_SUFFIX=".so"
  1286. DL_OBJS="tclLoadDl.o"
  1287. DL_LIBS=""
  1288. AC_LIBOBJ(mkstemp)
  1289. AS_IF([test $doRpath = yes], [
  1290. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1291. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
  1292. # Check to enable 64-bit flags for compiler/linker
  1293. AS_IF([test "$do64bit" = yes], [
  1294. AS_IF([test "$GCC" = yes], [
  1295. AC_MSG_WARN([64bit mode not supported by gcc])
  1296. ], [
  1297. do64bit_ok=yes
  1298. SHLIB_LD="ld -64 -shared -rdata_shared"
  1299. CFLAGS="$CFLAGS -64"
  1300. LDFLAGS_ARCH="-64"
  1301. ])
  1302. ])
  1303. ;;
  1304. Linux*|GNU*|NetBSD-Debian)
  1305. SHLIB_CFLAGS="-fPIC"
  1306. SHLIB_SUFFIX=".so"
  1307. CFLAGS_OPTIMIZE="-O2"
  1308. # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
  1309. # when you inline the string and math operations. Turn this off to
  1310. # get rid of the warnings.
  1311. #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
  1312. SHLIB_LD='${CC} ${CFLAGS} ${LDFLAGS} -shared'
  1313. DL_OBJS="tclLoadDl.o"
  1314. DL_LIBS="-ldl"
  1315. LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1316. AS_IF([test $doRpath = yes], [
  1317. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
  1318. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1319. AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
  1320. AS_IF([test $do64bit = yes], [
  1321. AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
  1322. hold_cflags=$CFLAGS
  1323. CFLAGS="$CFLAGS -m64"
  1324. AC_TRY_LINK(,, tcl_cv_cc_m64=yes, tcl_cv_cc_m64=no)
  1325. CFLAGS=$hold_cflags])
  1326. AS_IF([test $tcl_cv_cc_m64 = yes], [
  1327. CFLAGS="$CFLAGS -m64"
  1328. do64bit_ok=yes
  1329. ])
  1330. ])
  1331. # The combo of gcc + glibc has a bug related to inlining of
  1332. # functions like strtod(). The -fno-builtin flag should address
  1333. # this problem but it does not work. The -fno-inline flag is kind
  1334. # of overkill but it works. Disable inlining only when one of the
  1335. # files in compat/*.c is being linked in.
  1336. AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"])
  1337. ;;
  1338. Lynx*)
  1339. SHLIB_CFLAGS="-fPIC"
  1340. SHLIB_SUFFIX=".so"
  1341. CFLAGS_OPTIMIZE=-02
  1342. SHLIB_LD='${CC} -shared'
  1343. DL_OBJS="tclLoadDl.o"
  1344. DL_LIBS="-mshared -ldl"
  1345. LD_FLAGS="-Wl,--export-dynamic"
  1346. AS_IF([test $doRpath = yes], [
  1347. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1348. LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
  1349. ;;
  1350. MP-RAS-02*)
  1351. SHLIB_CFLAGS="-K PIC"
  1352. SHLIB_LD='${CC} -G'
  1353. SHLIB_LD_LIBS=""
  1354. SHLIB_SUFFIX=".so"
  1355. DL_OBJS="tclLoadDl.o"
  1356. DL_LIBS="-ldl"
  1357. CC_SEARCH_FLAGS=""
  1358. LD_SEARCH_FLAGS=""
  1359. ;;
  1360. MP-RAS-*)
  1361. SHLIB_CFLAGS="-K PIC"
  1362. SHLIB_LD='${CC} -G'
  1363. SHLIB_LD_LIBS=""
  1364. SHLIB_SUFFIX=".so"
  1365. DL_OBJS="tclLoadDl.o"
  1366. DL_LIBS="-ldl"
  1367. LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1368. CC_SEARCH_FLAGS=""
  1369. LD_SEARCH_FLAGS=""
  1370. ;;
  1371. OpenBSD-*)
  1372. arch=`arch -s`
  1373. case "$arch" in
  1374. alpha|sparc64)
  1375. SHLIB_CFLAGS="-fPIC"
  1376. ;;
  1377. *)
  1378. SHLIB_CFLAGS="-fpic"
  1379. ;;
  1380. esac
  1381. SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
  1382. SHLIB_SUFFIX=".so"
  1383. DL_OBJS="tclLoadDl.o"
  1384. DL_LIBS=""
  1385. AS_IF([test $doRpath = yes], [
  1386. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
  1387. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1388. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
  1389. LDFLAGS="-Wl,-export-dynamic"
  1390. CFLAGS_OPTIMIZE="-O2"
  1391. AS_IF([test "${TCL_THREADS}" = "1"], [
  1392. # On OpenBSD: Compile with -pthread
  1393. # Don't link with -lpthread
  1394. LIBS=`echo $LIBS | sed s/-lpthread//`
  1395. CFLAGS="$CFLAGS -pthread"
  1396. ])
  1397. # OpenBSD doesn't do version numbers with dots.
  1398. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1399. TCL_LIB_VERSIONS_OK=nodots
  1400. ;;
  1401. NetBSD-*)
  1402. # NetBSD has ELF and can use 'cc -shared' to build shared libs
  1403. SHLIB_CFLAGS="-fPIC"
  1404. SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared'
  1405. SHLIB_SUFFIX=".so"
  1406. DL_OBJS="tclLoadDl.o"
  1407. DL_LIBS=""
  1408. LDFLAGS="$LDFLAGS -export-dynamic"
  1409. AS_IF([test $doRpath = yes], [
  1410. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
  1411. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1412. AS_IF([test "${TCL_THREADS}" = "1"], [
  1413. # The -pthread needs to go in the CFLAGS, not LIBS
  1414. LIBS=`echo $LIBS | sed s/-pthread//`
  1415. CFLAGS="$CFLAGS -pthread"
  1416. LDFLAGS="$LDFLAGS -pthread"
  1417. ])
  1418. ;;
  1419. FreeBSD-*)
  1420. # This configuration from FreeBSD Ports.
  1421. SHLIB_CFLAGS="-fPIC"
  1422. SHLIB_LD="${CC} -shared"
  1423. SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]"
  1424. SHLIB_SUFFIX=".so"
  1425. DL_OBJS="tclLoadDl.o"
  1426. DL_LIBS=""
  1427. LDFLAGS=""
  1428. AS_IF([test $doRpath = yes], [
  1429. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1430. LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
  1431. AS_IF([test "${TCL_THREADS}" = "1"], [
  1432. # The -pthread needs to go in the LDFLAGS, not LIBS
  1433. LIBS=`echo $LIBS | sed s/-pthread//`
  1434. CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
  1435. LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
  1436. case $system in
  1437. FreeBSD-3.*)
  1438. # Version numbers are dot-stripped by system policy.
  1439. TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
  1440. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1441. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
  1442. TCL_LIB_VERSIONS_OK=nodots
  1443. ;;
  1444. esac
  1445. ;;
  1446. Darwin-*)
  1447. CFLAGS_OPTIMIZE="-Os"
  1448. SHLIB_CFLAGS="-fno-common"
  1449. # To avoid discrepancies between what headers configure sees during
  1450. # preprocessing tests and compiling tests, move any -isysroot and
  1451. # -mmacosx-version-min flags from CFLAGS to CPPFLAGS:
  1452. CPPFLAGS="${CPPFLAGS} `echo " ${CFLAGS}" | \
  1453. awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
  1454. if ([$]i~/^(isysroot|mmacosx-version-min)/) print "-"[$]i}'`"
  1455. CFLAGS="`echo " ${CFLAGS}" | \
  1456. awk 'BEGIN {FS=" +-";ORS=" "}; {for (i=2;i<=NF;i++) \
  1457. if (!([$]i~/^(isysroot|mmacosx-version-min)/)) print "-"[$]i}'`"
  1458. AS_IF([test $do64bit = yes], [
  1459. case `arch` in
  1460. ppc)
  1461. AC_CACHE_CHECK([if compiler accepts -arch ppc64 flag],
  1462. tcl_cv_cc_arch_ppc64, [
  1463. hold_cflags=$CFLAGS
  1464. CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
  1465. AC_TRY_LINK(,, tcl_cv_cc_arch_ppc64=yes,
  1466. tcl_cv_cc_arch_ppc64=no)
  1467. CFLAGS=$hold_cflags])
  1468. AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
  1469. CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
  1470. do64bit_ok=yes
  1471. ]);;
  1472. i386)
  1473. AC_CACHE_CHECK([if compiler accepts -arch x86_64 flag],
  1474. tcl_cv_cc_arch_x86_64, [
  1475. hold_cflags=$CFLAGS
  1476. CFLAGS="$CFLAGS -arch x86_64"
  1477. AC_TRY_LINK(,, tcl_cv_cc_arch_x86_64=yes,
  1478. tcl_cv_cc_arch_x86_64=no)
  1479. CFLAGS=$hold_cflags])
  1480. AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
  1481. CFLAGS="$CFLAGS -arch x86_64"
  1482. do64bit_ok=yes
  1483. ]);;
  1484. *)
  1485. AC_MSG_WARN([Don't know how enable 64-bit on architecture `arch`]);;
  1486. esac
  1487. ], [
  1488. # Check for combined 32-bit and 64-bit fat build
  1489. AS_IF([echo "$CFLAGS " |grep -E -q -- '-arch (ppc64|x86_64) ' \
  1490. && echo "$CFLAGS " |grep -E -q -- '-arch (ppc|i386) '], [
  1491. fat_32_64=yes])
  1492. ])
  1493. SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS}'
  1494. AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
  1495. hold_ldflags=$LDFLAGS
  1496. LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
  1497. AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
  1498. LDFLAGS=$hold_ldflags])
  1499. AS_IF([test $tcl_cv_ld_single_module = yes], [
  1500. SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
  1501. ])
  1502. SHLIB_SUFFIX=".dylib"
  1503. DL_OBJS="tclLoadDyld.o"
  1504. DL_LIBS=""
  1505. # Don't use -prebind when building for Mac OS X 10.4 or later only:
  1506. AS_IF([test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F '10\\.' '{print int([$]2)}'`" -lt 4 -a \
  1507. "`echo "${CPPFLAGS}" | awk -F '-mmacosx-version-min=10\\.' '{print int([$]2)}'`" -lt 4], [
  1508. LDFLAGS="$LDFLAGS -prebind"])
  1509. LDFLAGS="$LDFLAGS -headerpad_max_install_names"
  1510. AC_CACHE_CHECK([if ld accepts -search_paths_first flag],
  1511. tcl_cv_ld_search_paths_first, [
  1512. hold_ldflags=$LDFLAGS
  1513. LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  1514. AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes,
  1515. tcl_cv_ld_search_paths_first=no)
  1516. LDFLAGS=$hold_ldflags])
  1517. AS_IF([test $tcl_cv_ld_search_paths_first = yes], [
  1518. LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  1519. ])
  1520. AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
  1521. AC_DEFINE(MODULE_SCOPE, [__private_extern__],
  1522. [Compiler support for module scope symbols])
  1523. ])
  1524. CC_SEARCH_FLAGS=""
  1525. LD_SEARCH_FLAGS=""
  1526. LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  1527. AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?])
  1528. PLAT_OBJS='${MAC_OSX_OBJS}'
  1529. PLAT_SRCS='${MAC_OSX_SRCS}'
  1530. AC_MSG_CHECKING([whether to use CoreFoundation])
  1531. AC_ARG_ENABLE(corefoundation,
  1532. AS_HELP_STRING([--enable-corefoundation],
  1533. [use CoreFoundation API on MacOSX (default: on)]),
  1534. [tcl_corefoundation=$enableval], [tcl_corefoundation=yes])
  1535. AC_MSG_RESULT([$tcl_corefoundation])
  1536. AS_IF([test $tcl_corefoundation = yes], [
  1537. AC_CACHE_CHECK([for CoreFoundation.framework],
  1538. tcl_cv_lib_corefoundation, [
  1539. hold_libs=$LIBS
  1540. AS_IF([test "$fat_32_64" = yes], [
  1541. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1542. # On Tiger there is no 64-bit CF, so remove 64-bit
  1543. # archs from CFLAGS et al. while testing for
  1544. # presence of CF. 64-bit CF is disabled in
  1545. # tclUnixPort.h if necessary.
  1546. eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"'
  1547. done])
  1548. LIBS="$LIBS -framework CoreFoundation"
  1549. AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
  1550. [CFBundleRef b = CFBundleGetMainBundle();],
  1551. tcl_cv_lib_corefoundation=yes,
  1552. tcl_cv_lib_corefoundation=no)
  1553. AS_IF([test "$fat_32_64" = yes], [
  1554. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1555. eval $v'="$hold_'$v'"'
  1556. done])
  1557. LIBS=$hold_libs])
  1558. AS_IF([test $tcl_cv_lib_corefoundation = yes], [
  1559. LIBS="$LIBS -framework CoreFoundation"
  1560. AC_DEFINE(HAVE_COREFOUNDATION, 1,
  1561. [Do we have access to Darwin CoreFoundation.framework?])
  1562. ], [tcl_corefoundation=no])
  1563. AS_IF([test "$fat_32_64" = yes -a $tcl_corefoundation = yes],[
  1564. AC_CACHE_CHECK([for 64-bit CoreFoundation],
  1565. tcl_cv_lib_corefoundation_64, [
  1566. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1567. eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"'
  1568. done
  1569. AC_TRY_LINK([#include <CoreFoundation/CoreFoundation.h>],
  1570. [CFBundleRef b = CFBundleGetMainBundle();],
  1571. tcl_cv_lib_corefoundation_64=yes,
  1572. tcl_cv_lib_corefoundation_64=no)
  1573. for v in CFLAGS CPPFLAGS LDFLAGS; do
  1574. eval $v'="$hold_'$v'"'
  1575. done])
  1576. AS_IF([test $tcl_cv_lib_corefoundation_64 = no], [
  1577. AC_DEFINE(NO_COREFOUNDATION_64, 1,
  1578. [Is Darwin CoreFoundation unavailable for 64-bit?])
  1579. LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings"
  1580. ])
  1581. ])
  1582. ])
  1583. ;;
  1584. NEXTSTEP-*)
  1585. SHLIB_CFLAGS=""
  1586. SHLIB_LD='${CC} -nostdlib -r'
  1587. SHLIB_LD_LIBS=""
  1588. SHLIB_SUFFIX=".so"
  1589. DL_OBJS="tclLoadNext.o"
  1590. DL_LIBS=""
  1591. CC_SEARCH_FLAGS=""
  1592. LD_SEARCH_FLAGS=""
  1593. ;;
  1594. OS/390-*)
  1595. SHLIB_LD_LIBS=""
  1596. CFLAGS_OPTIMIZE="" # Optimizer is buggy
  1597. AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h
  1598. [Should OS/390 do the right thing with sockets?])
  1599. ;;
  1600. OSF1-1.0|OSF1-1.1|OSF1-1.2)
  1601. # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
  1602. SHLIB_CFLAGS=""
  1603. # Hack: make package name same as library name
  1604. SHLIB_LD='ld -R -export $@:'
  1605. SHLIB_LD_LIBS=""
  1606. SHLIB_SUFFIX=".so"
  1607. DL_OBJS="tclLoadOSF.o"
  1608. DL_LIBS=""
  1609. CC_SEARCH_FLAGS=""
  1610. LD_SEARCH_FLAGS=""
  1611. ;;
  1612. OSF1-1.*)
  1613. # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
  1614. SHLIB_CFLAGS="-fPIC"
  1615. AS_IF([test "$SHARED_BUILD" = 1], [SHLIB_LD="ld -shared"], [
  1616. SHLIB_LD="ld -non_shared"
  1617. ])
  1618. SHLIB_LD_LIBS=""
  1619. SHLIB_SUFFIX=".so"
  1620. DL_OBJS="tclLoadDl.o"
  1621. DL_LIBS=""
  1622. CC_SEARCH_FLAGS=""
  1623. LD_SEARCH_FLAGS=""
  1624. ;;
  1625. OSF1-V*)
  1626. # Digital OSF/1
  1627. SHLIB_CFLAGS=""
  1628. AS_IF([test "$SHARED_BUILD" = 1], [
  1629. SHLIB_LD='ld -shared -expect_unresolved "*"'
  1630. ], [
  1631. SHLIB_LD='ld -non_shared -expect_unresolved "*"'
  1632. ])
  1633. SHLIB_SUFFIX=".so"
  1634. DL_OBJS="tclLoadDl.o"
  1635. DL_LIBS=""
  1636. AS_IF([test $doRpath = yes], [
  1637. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1638. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
  1639. AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
  1640. CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
  1641. # see pthread_intro(3) for pthread support on osf1, k.furukawa
  1642. AS_IF([test "${TCL_THREADS}" = 1], [
  1643. CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
  1644. CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
  1645. LIBS=`echo $LIBS | sed s/-lpthreads//`
  1646. AS_IF([test "$GCC" = yes], [
  1647. LIBS="$LIBS -lpthread -lmach -lexc"
  1648. ], [
  1649. CFLAGS="$CFLAGS -pthread"
  1650. LDFLAGS="$LDFLAGS -pthread"
  1651. ])
  1652. ])
  1653. ;;
  1654. QNX-6*)
  1655. # QNX RTP
  1656. # This may work for all QNX, but it was only reported for v6.
  1657. SHLIB_CFLAGS="-fPIC"
  1658. SHLIB_LD="ld -Bshareable -x"
  1659. SHLIB_LD_LIBS=""
  1660. SHLIB_SUFFIX=".so"
  1661. DL_OBJS="tclLoadDl.o"
  1662. # dlopen is in -lc on QNX
  1663. DL_LIBS=""
  1664. CC_SEARCH_FLAGS=""
  1665. LD_SEARCH_FLAGS=""
  1666. ;;
  1667. SCO_SV-3.2*)
  1668. # Note, dlopen is available only on SCO 3.2.5 and greater. However,
  1669. # this test works, since "uname -s" was non-standard in 3.2.4 and
  1670. # below.
  1671. AS_IF([test "$GCC" = yes], [
  1672. SHLIB_CFLAGS="-fPIC -melf"
  1673. LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
  1674. ], [
  1675. SHLIB_CFLAGS="-Kpic -belf"
  1676. LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
  1677. ])
  1678. SHLIB_LD="ld -G"
  1679. SHLIB_LD_LIBS=""
  1680. SHLIB_SUFFIX=".so"
  1681. DL_OBJS="tclLoadDl.o"
  1682. DL_LIBS=""
  1683. CC_SEARCH_FLAGS=""
  1684. LD_SEARCH_FLAGS=""
  1685. ;;
  1686. SINIX*5.4*)
  1687. SHLIB_CFLAGS="-K PIC"
  1688. SHLIB_LD='${CC} -G'
  1689. SHLIB_LD_LIBS=""
  1690. SHLIB_SUFFIX=".so"
  1691. DL_OBJS="tclLoadDl.o"
  1692. DL_LIBS="-ldl"
  1693. CC_SEARCH_FLAGS=""
  1694. LD_SEARCH_FLAGS=""
  1695. ;;
  1696. SunOS-4*)
  1697. SHLIB_CFLAGS="-PIC"
  1698. SHLIB_LD="ld"
  1699. SHLIB_LD_LIBS=""
  1700. SHLIB_SUFFIX=".so"
  1701. DL_OBJS="tclLoadDl.o"
  1702. DL_LIBS="-ldl"
  1703. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1704. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1705. # SunOS can't handle version numbers with dots in them in library
  1706. # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
  1707. # requires an extra version number at the end of .so file names.
  1708. # So, the library has to have a name like libtcl75.so.1.0
  1709. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so${SHLIB_VERSION}'
  1710. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1711. TCL_LIB_VERSIONS_OK=nodots
  1712. ;;
  1713. SunOS-5.[[0-6]])
  1714. # Careful to not let 5.10+ fall into this case
  1715. # Note: If _REENTRANT isn't defined, then Solaris
  1716. # won't define thread-safe library routines.
  1717. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
  1718. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
  1719. [Do we really want to follow the standard? Yes we do!])
  1720. SHLIB_CFLAGS="-KPIC"
  1721. SHLIB_SUFFIX=".so"
  1722. DL_OBJS="tclLoadDl.o"
  1723. DL_LIBS="-ldl"
  1724. AS_IF([test "$GCC" = yes], [
  1725. SHLIB_LD='${CC} -shared'
  1726. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1727. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1728. ], [
  1729. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1730. CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1731. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1732. ])
  1733. ;;
  1734. SunOS-5*)
  1735. # Note: If _REENTRANT isn't defined, then Solaris
  1736. # won't define thread-safe library routines.
  1737. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
  1738. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
  1739. [Do we really want to follow the standard? Yes we do!])
  1740. SHLIB_CFLAGS="-KPIC"
  1741. # Check to enable 64-bit flags for compiler/linker
  1742. AS_IF([test "$do64bit" = yes], [
  1743. arch=`isainfo`
  1744. AS_IF([test "$arch" = "sparcv9 sparc"], [
  1745. AS_IF([test "$GCC" = yes], [
  1746. AS_IF([test "`${CC} -dumpversion | awk -F. '{print [$]1}'`" -lt 3], [
  1747. AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
  1748. ], [
  1749. do64bit_ok=yes
  1750. CFLAGS="$CFLAGS -m64 -mcpu=v9"
  1751. LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
  1752. SHLIB_CFLAGS="-fPIC"
  1753. ])
  1754. ], [
  1755. do64bit_ok=yes
  1756. AS_IF([test "$do64bitVIS" = yes], [
  1757. CFLAGS="$CFLAGS -xarch=v9a"
  1758. LDFLAGS_ARCH="-xarch=v9a"
  1759. ], [
  1760. CFLAGS="$CFLAGS -xarch=v9"
  1761. LDFLAGS_ARCH="-xarch=v9"
  1762. ])
  1763. # Solaris 64 uses this as well
  1764. #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
  1765. ])
  1766. ], [AS_IF([test "$arch" = "amd64 i386"], [
  1767. AS_IF([test "$GCC" = yes], [
  1768. case $system in
  1769. SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
  1770. do64bit_ok=yes
  1771. CFLAGS="$CFLAGS -m64"
  1772. LDFLAGS="$LDFLAGS -m64";;
  1773. *)
  1774. AC_MSG_WARN([64bit mode not supported with GCC on $system]);;
  1775. esac
  1776. ], [
  1777. do64bit_ok=yes
  1778. case $system in
  1779. SunOS-5.1[[1-9]]*|SunOS-5.[[2-9]][[0-9]]*)
  1780. CFLAGS="$CFLAGS -m64"
  1781. LDFLAGS="$LDFLAGS -m64";;
  1782. *)
  1783. CFLAGS="$CFLAGS -xarch=amd64"
  1784. LDFLAGS="$LDFLAGS -xarch=amd64";;
  1785. esac
  1786. ])
  1787. ], [AC_MSG_WARN([64bit mode not supported for $arch])])])
  1788. ])
  1789. #--------------------------------------------------------------------
  1790. # On Solaris 5.x i386 with the sunpro compiler we need to link
  1791. # with sunmath to get floating point rounding control
  1792. #--------------------------------------------------------------------
  1793. AS_IF([test "$GCC" = yes],[use_sunmath=no],[
  1794. arch=`isainfo`
  1795. AC_MSG_CHECKING([whether to use -lsunmath for fp rounding control])
  1796. AS_IF([test "$arch" = "amd64 i386" -o "$arch" = "i386"], [
  1797. AC_MSG_RESULT([yes])
  1798. MATH_LIBS="-lsunmath $MATH_LIBS"
  1799. AC_CHECK_HEADER(sunmath.h)
  1800. use_sunmath=yes
  1801. ], [
  1802. AC_MSG_RESULT([no])
  1803. use_sunmath=no
  1804. ])
  1805. ])
  1806. SHLIB_SUFFIX=".so"
  1807. DL_OBJS="tclLoadDl.o"
  1808. DL_LIBS="-ldl"
  1809. AS_IF([test "$GCC" = yes], [
  1810. SHLIB_LD='${CC} -shared'
  1811. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1812. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1813. AS_IF([test "$do64bit_ok" = yes], [
  1814. AS_IF([test "$arch" = "sparcv9 sparc"], [
  1815. # We need to specify -static-libgcc or we need to
  1816. # add the path to the sparv9 libgcc.
  1817. SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
  1818. # for finding sparcv9 libgcc, get the regular libgcc
  1819. # path, remove so name and append 'sparcv9'
  1820. #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
  1821. #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
  1822. ], [AS_IF([test "$arch" = "amd64 i386"], [
  1823. SHLIB_LD="$SHLIB_LD -m64 -static-libgcc"
  1824. ])])
  1825. ])
  1826. ], [
  1827. AS_IF([test "$use_sunmath" = yes], [textmode=textoff],[textmode=text])
  1828. case $system in
  1829. SunOS-5.[[1-9]][[0-9]]*|SunOS-5.[[7-9]])
  1830. SHLIB_LD="\${CC} -G -z $textmode \${LDFLAGS}";;
  1831. *)
  1832. SHLIB_LD="/usr/ccs/bin/ld -G -z $textmode";;
  1833. esac
  1834. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1835. LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1836. ])
  1837. ;;
  1838. UNIX_SV* | UnixWare-5*)
  1839. SHLIB_CFLAGS="-KPIC"
  1840. SHLIB_LD='${CC} -G'
  1841. SHLIB_LD_LIBS=""
  1842. SHLIB_SUFFIX=".so"
  1843. DL_OBJS="tclLoadDl.o"
  1844. DL_LIBS="-ldl"
  1845. # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  1846. # that don't grok the -Bexport option. Test that it does.
  1847. AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
  1848. hold_ldflags=$LDFLAGS
  1849. LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1850. AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
  1851. LDFLAGS=$hold_ldflags])
  1852. AS_IF([test $tcl_cv_ld_Bexport = yes], [
  1853. LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1854. ])
  1855. CC_SEARCH_FLAGS=""
  1856. LD_SEARCH_FLAGS=""
  1857. ;;
  1858. esac
  1859. AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = no], [
  1860. AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
  1861. ])
  1862. AS_IF([test "$do64bit" = yes -a "$do64bit_ok" = yes], [
  1863. AC_DEFINE(TCL_CFG_DO64BIT, 1, [Is this a 64-bit build?])
  1864. ])
  1865. dnl # Add any CPPFLAGS set in the environment to our CFLAGS, but delay doing so
  1866. dnl # until the end of configure, as configure's compile and link tests use
  1867. dnl # both CPPFLAGS and CFLAGS (unlike our compile and link) but configure's
  1868. dnl # preprocessing tests use only CPPFLAGS.
  1869. AC_CONFIG_COMMANDS_PRE([CFLAGS="${CFLAGS} ${CPPFLAGS}"; CPPFLAGS=""])
  1870. # Step 4: disable dynamic loading if requested via a command-line switch.
  1871. AC_ARG_ENABLE(load,
  1872. AS_HELP_STRING([--enable-load],
  1873. [allow dynamic loading and "load" command (default: on)]),
  1874. [tcl_ok=$enableval], [tcl_ok=yes])
  1875. AS_IF([test "$tcl_ok" = no], [DL_OBJS=""])
  1876. AS_IF([test "x$DL_OBJS" != x], [BUILD_DLTEST="\$(DLTEST_TARGETS)"], [
  1877. AC_MSG_WARN([Can't figure out how to do dynamic loading or shared libraries on this system.])
  1878. SHLIB_CFLAGS=""
  1879. SHLIB_LD=""
  1880. SHLIB_SUFFIX=""
  1881. DL_OBJS="tclLoadNone.o"
  1882. DL_LIBS=""
  1883. LDFLAGS="$LDFLAGS_ORIG"
  1884. CC_SEARCH_FLAGS=""
  1885. LD_SEARCH_FLAGS=""
  1886. BUILD_DLTEST=""
  1887. ])
  1888. LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
  1889. # If we're running gcc, then change the C flags for compiling shared
  1890. # libraries to the right flags for gcc, instead of those for the
  1891. # standard manufacturer compiler.
  1892. AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [
  1893. case $system in
  1894. AIX-*) ;;
  1895. BSD/OS*) ;;
  1896. CYGWIN_*|MINGW32_*) ;;
  1897. IRIX*) ;;
  1898. NetBSD-*|FreeBSD-*|OpenBSD-*) ;;
  1899. Darwin-*) ;;
  1900. SCO_SV-3.2*) ;;
  1901. *) SHLIB_CFLAGS="-fPIC" ;;
  1902. esac])
  1903. AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [
  1904. AC_DEFINE(MODULE_SCOPE, [extern],
  1905. [No Compiler support for module scope symbols])
  1906. ])
  1907. AS_IF([test "$SHARED_LIB_SUFFIX" = ""], [
  1908. SHARED_LIB_SUFFIX='${VERSION}${SHLIB_SUFFIX}'])
  1909. AS_IF([test "$UNSHARED_LIB_SUFFIX" = ""], [
  1910. UNSHARED_LIB_SUFFIX='${VERSION}.a'])
  1911. DLL_INSTALL_DIR="\$(LIB_INSTALL_DIR)"
  1912. AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
  1913. LIB_SUFFIX=${SHARED_LIB_SUFFIX}
  1914. MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
  1915. AS_IF([test "${SHLIB_SUFFIX}" = ".dll"], [
  1916. INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(BIN_INSTALL_DIR)/$(LIB_FILE)";if test -f $(LIB_FILE).a; then $(INSTALL_DATA) $(LIB_FILE).a "$(LIB_INSTALL_DIR)"; fi;'
  1917. DLL_INSTALL_DIR="\$(BIN_INSTALL_DIR)"
  1918. ], [
  1919. INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
  1920. ])
  1921. ], [
  1922. LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
  1923. AS_IF([test "$RANLIB" = ""], [
  1924. MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
  1925. ], [
  1926. MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
  1927. ])
  1928. INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)/$(LIB_FILE)"'
  1929. ])
  1930. # Stub lib does not depend on shared/static configuration
  1931. AS_IF([test "$RANLIB" = ""], [
  1932. MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
  1933. ], [
  1934. MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
  1935. ])
  1936. INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) "$(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)"'
  1937. # Define TCL_LIBS now that we know what DL_LIBS is.
  1938. # The trick here is that we don't want to change the value of TCL_LIBS if
  1939. # it is already set when tclConfig.sh had been loaded by Tk.
  1940. AS_IF([test "x${TCL_LIBS}" = x], [
  1941. TCL_LIBS="${DL_LIBS} ${LIBS} ${MATH_LIBS}"])
  1942. AC_SUBST(TCL_LIBS)
  1943. # See if the compiler supports casting to a union type.
  1944. # This is used to stop gcc from printing a compiler
  1945. # warning when initializing a union member.
  1946. AC_CACHE_CHECK(for cast to union support,
  1947. tcl_cv_cast_to_union,
  1948. AC_TRY_COMPILE([],
  1949. [
  1950. union foo { int i; double d; };
  1951. union foo f = (union foo) (int) 0;
  1952. ],
  1953. tcl_cv_cast_to_union=yes,
  1954. tcl_cv_cast_to_union=no)
  1955. )
  1956. if test "$tcl_cv_cast_to_union" = "yes"; then
  1957. AC_DEFINE(HAVE_CAST_TO_UNION, 1,
  1958. [Defined when compiler supports casting to union type.])
  1959. fi
  1960. # FIXME: This subst was left in only because the TCL_DL_LIBS
  1961. # entry in tclConfig.sh uses it. It is not clear why someone
  1962. # would use TCL_DL_LIBS instead of TCL_LIBS.
  1963. AC_SUBST(DL_LIBS)
  1964. AC_SUBST(DL_OBJS)
  1965. AC_SUBST(PLAT_OBJS)
  1966. AC_SUBST(PLAT_SRCS)
  1967. AC_SUBST(LDAIX_SRC)
  1968. AC_SUBST(CFLAGS)
  1969. AC_SUBST(CFLAGS_DEBUG)
  1970. AC_SUBST(CFLAGS_OPTIMIZE)
  1971. AC_SUBST(CFLAGS_WARNING)
  1972. AC_SUBST(LDFLAGS)
  1973. AC_SUBST(LDFLAGS_DEBUG)
  1974. AC_SUBST(LDFLAGS_OPTIMIZE)
  1975. AC_SUBST(CC_SEARCH_FLAGS)
  1976. AC_SUBST(LD_SEARCH_FLAGS)
  1977. AC_SUBST(STLIB_LD)
  1978. AC_SUBST(SHLIB_LD)
  1979. AC_SUBST(TCL_SHLIB_LD_EXTRAS)
  1980. AC_SUBST(TK_SHLIB_LD_EXTRAS)
  1981. AC_SUBST(SHLIB_LD_LIBS)
  1982. AC_SUBST(SHLIB_CFLAGS)
  1983. AC_SUBST(SHLIB_SUFFIX)
  1984. AC_DEFINE_UNQUOTED(TCL_SHLIB_EXT,"${SHLIB_SUFFIX}",
  1985. [What is the default extension for shared libraries?])
  1986. AC_SUBST(MAKE_LIB)
  1987. AC_SUBST(MAKE_STUB_LIB)
  1988. AC_SUBST(INSTALL_LIB)
  1989. AC_SUBST(DLL_INSTALL_DIR)
  1990. AC_SUBST(INSTALL_STUB_LIB)
  1991. AC_SUBST(RANLIB)
  1992. ])
  1993. #--------------------------------------------------------------------
  1994. # SC_MISSING_POSIX_HEADERS
  1995. #
  1996. # Supply substitutes for missing POSIX header files. Special
  1997. # notes:
  1998. # - stdlib.h doesn't define strtol, strtoul, or
  1999. # strtod insome versions of SunOS
  2000. # - some versions of string.h don't declare procedures such
  2001. # as strstr
  2002. #
  2003. # Arguments:
  2004. # none
  2005. #
  2006. # Results:
  2007. #
  2008. # Defines some of the following vars:
  2009. # NO_DIRENT_H
  2010. # NO_VALUES_H
  2011. # NO_STDLIB_H
  2012. # NO_STRING_H
  2013. # NO_SYS_WAIT_H
  2014. # NO_DLFCN_H
  2015. # HAVE_SYS_PARAM_H
  2016. #
  2017. # HAVE_STRING_H ?
  2018. #
  2019. #--------------------------------------------------------------------
  2020. AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
  2021. AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h, [
  2022. AC_TRY_LINK([#include <sys/types.h>
  2023. #include <dirent.h>], [
  2024. #ifndef _POSIX_SOURCE
  2025. # ifdef __Lynx__
  2026. /*
  2027. * Generate compilation error to make the test fail: Lynx headers
  2028. * are only valid if really in the POSIX environment.
  2029. */
  2030. missing_procedure();
  2031. # endif
  2032. #endif
  2033. DIR *d;
  2034. struct dirent *entryPtr;
  2035. char *p;
  2036. d = opendir("foobar");
  2037. entryPtr = readdir(d);
  2038. p = entryPtr->d_name;
  2039. closedir(d);
  2040. ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)])
  2041. if test $tcl_cv_dirent_h = no; then
  2042. AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
  2043. fi
  2044. AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
  2045. AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
  2046. AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
  2047. AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
  2048. AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
  2049. AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
  2050. if test $tcl_ok = 0; then
  2051. AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
  2052. fi
  2053. AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
  2054. AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
  2055. AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
  2056. # See also memmove check below for a place where NO_STRING_H can be
  2057. # set and why.
  2058. if test $tcl_ok = 0; then
  2059. AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
  2060. fi
  2061. AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
  2062. AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
  2063. # OS/390 lacks sys/param.h (and doesn't need it, by chance).
  2064. AC_HAVE_HEADERS(sys/param.h)
  2065. ])
  2066. #--------------------------------------------------------------------
  2067. # SC_PATH_X
  2068. #
  2069. # Locate the X11 header files and the X11 library archive. Try
  2070. # the ac_path_x macro first, but if it doesn't find the X stuff
  2071. # (e.g. because there's no xmkmf program) then check through
  2072. # a list of possible directories. Under some conditions the
  2073. # autoconf macro will return an include directory that contains
  2074. # no include files, so double-check its result just to be safe.
  2075. #
  2076. # Arguments:
  2077. # none
  2078. #
  2079. # Results:
  2080. #
  2081. # Sets the following vars:
  2082. # XINCLUDES
  2083. # XLIBSW
  2084. #
  2085. #--------------------------------------------------------------------
  2086. AC_DEFUN([SC_PATH_X], [
  2087. AC_PATH_X
  2088. not_really_there=""
  2089. if test "$no_x" = ""; then
  2090. if test "$x_includes" = ""; then
  2091. AC_TRY_CPP([#include <X11/Xlib.h>], , not_really_there="yes")
  2092. else
  2093. if test ! -r $x_includes/X11/Xlib.h; then
  2094. not_really_there="yes"
  2095. fi
  2096. fi
  2097. fi
  2098. if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  2099. AC_MSG_CHECKING([for X11 header files])
  2100. found_xincludes="no"
  2101. AC_TRY_CPP([#include <X11/Xlib.h>], found_xincludes="yes", found_xincludes="no")
  2102. if test "$found_xincludes" = "no"; then
  2103. dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
  2104. for i in $dirs ; do
  2105. if test -r $i/X11/Xlib.h; then
  2106. AC_MSG_RESULT([$i])
  2107. XINCLUDES=" -I$i"
  2108. found_xincludes="yes"
  2109. break
  2110. fi
  2111. done
  2112. fi
  2113. else
  2114. if test "$x_includes" != ""; then
  2115. XINCLUDES="-I$x_includes"
  2116. found_xincludes="yes"
  2117. fi
  2118. fi
  2119. if test "$found_xincludes" = "no"; then
  2120. AC_MSG_RESULT([couldn't find any!])
  2121. fi
  2122. if test "$no_x" = yes; then
  2123. AC_MSG_CHECKING([for X11 libraries])
  2124. XLIBSW=nope
  2125. dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
  2126. for i in $dirs ; do
  2127. if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl -o -r $i/libX11.dylib; then
  2128. AC_MSG_RESULT([$i])
  2129. XLIBSW="-L$i -lX11"
  2130. x_libraries="$i"
  2131. break
  2132. fi
  2133. done
  2134. else
  2135. if test "$x_libraries" = ""; then
  2136. XLIBSW=-lX11
  2137. else
  2138. XLIBSW="-L$x_libraries -lX11"
  2139. fi
  2140. fi
  2141. if test "$XLIBSW" = nope ; then
  2142. AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
  2143. fi
  2144. if test "$XLIBSW" = nope ; then
  2145. AC_MSG_RESULT([could not find any! Using -lX11.])
  2146. XLIBSW=-lX11
  2147. fi
  2148. ])
  2149. #--------------------------------------------------------------------
  2150. # SC_BLOCKING_STYLE
  2151. #
  2152. # The statements below check for systems where POSIX-style
  2153. # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
  2154. # On these systems (mostly older ones), use the old BSD-style
  2155. # FIONBIO approach instead.
  2156. #
  2157. # Arguments:
  2158. # none
  2159. #
  2160. # Results:
  2161. #
  2162. # Defines some of the following vars:
  2163. # HAVE_SYS_IOCTL_H
  2164. # HAVE_SYS_FILIO_H
  2165. # USE_FIONBIO
  2166. # O_NONBLOCK
  2167. #
  2168. #--------------------------------------------------------------------
  2169. AC_DEFUN([SC_BLOCKING_STYLE], [
  2170. AC_CHECK_HEADERS(sys/ioctl.h)
  2171. AC_CHECK_HEADERS(sys/filio.h)
  2172. SC_CONFIG_SYSTEM
  2173. AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
  2174. case $system in
  2175. OSF*)
  2176. AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
  2177. AC_MSG_RESULT([FIONBIO])
  2178. ;;
  2179. SunOS-4*)
  2180. AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
  2181. AC_MSG_RESULT([FIONBIO])
  2182. ;;
  2183. *)
  2184. AC_MSG_RESULT([O_NONBLOCK])
  2185. ;;
  2186. esac
  2187. ])
  2188. #--------------------------------------------------------------------
  2189. # SC_TIME_HANLDER
  2190. #
  2191. # Checks how the system deals with time.h, what time structures
  2192. # are used on the system, and what fields the structures have.
  2193. #
  2194. # Arguments:
  2195. # none
  2196. #
  2197. # Results:
  2198. #
  2199. # Defines some of the following vars:
  2200. # USE_DELTA_FOR_TZ
  2201. # HAVE_TM_GMTOFF
  2202. # HAVE_TM_TZADJ
  2203. # HAVE_TIMEZONE_VAR
  2204. #
  2205. #--------------------------------------------------------------------
  2206. AC_DEFUN([SC_TIME_HANDLER], [
  2207. AC_CHECK_HEADERS(sys/time.h)
  2208. AC_HEADER_TIME
  2209. AC_CHECK_FUNCS(gmtime_r localtime_r mktime)
  2210. AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj, [
  2211. AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
  2212. tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)])
  2213. if test $tcl_cv_member_tm_tzadj = yes ; then
  2214. AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
  2215. fi
  2216. AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff, [
  2217. AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
  2218. tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)])
  2219. if test $tcl_cv_member_tm_gmtoff = yes ; then
  2220. AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
  2221. fi
  2222. #
  2223. # Its important to include time.h in this check, as some systems
  2224. # (like convex) have timezone functions, etc.
  2225. #
  2226. AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
  2227. AC_TRY_COMPILE([#include <time.h>],
  2228. [extern long timezone;
  2229. timezone += 1;
  2230. exit (0);],
  2231. tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)])
  2232. if test $tcl_cv_timezone_long = yes ; then
  2233. AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
  2234. else
  2235. #
  2236. # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
  2237. #
  2238. AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
  2239. AC_TRY_COMPILE([#include <time.h>],
  2240. [extern time_t timezone;
  2241. timezone += 1;
  2242. exit (0);],
  2243. tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)])
  2244. if test $tcl_cv_timezone_time = yes ; then
  2245. AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
  2246. fi
  2247. fi
  2248. ])
  2249. #--------------------------------------------------------------------
  2250. # SC_BUGGY_STRTOD
  2251. #
  2252. # Under Solaris 2.4, strtod returns the wrong value for the
  2253. # terminating character under some conditions. Check for this
  2254. # and if the problem exists use a substitute procedure
  2255. # "fixstrtod" (provided by Tcl) that corrects the error.
  2256. # Also, on Compaq's Tru64 Unix 5.0,
  2257. # strtod(" ") returns 0.0 instead of a failure to convert.
  2258. #
  2259. # Arguments:
  2260. # none
  2261. #
  2262. # Results:
  2263. #
  2264. # Might defines some of the following vars:
  2265. # strtod (=fixstrtod)
  2266. #
  2267. #--------------------------------------------------------------------
  2268. AC_DEFUN([SC_BUGGY_STRTOD], [
  2269. AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
  2270. if test "$tcl_strtod" = 1; then
  2271. AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
  2272. AC_TRY_RUN([
  2273. extern double strtod();
  2274. int main() {
  2275. char *infString="Inf", *nanString="NaN", *spaceString=" ";
  2276. char *term;
  2277. double value;
  2278. value = strtod(infString, &term);
  2279. if ((term != infString) && (term[-1] == 0)) {
  2280. exit(1);
  2281. }
  2282. value = strtod(nanString, &term);
  2283. if ((term != nanString) && (term[-1] == 0)) {
  2284. exit(1);
  2285. }
  2286. value = strtod(spaceString, &term);
  2287. if (term == (spaceString+1)) {
  2288. exit(1);
  2289. }
  2290. exit(0);
  2291. }], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
  2292. tcl_cv_strtod_buggy=buggy)])
  2293. if test "$tcl_cv_strtod_buggy" = buggy; then
  2294. AC_LIBOBJ([fixstrtod])
  2295. USE_COMPAT=1
  2296. AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
  2297. fi
  2298. fi
  2299. ])
  2300. #--------------------------------------------------------------------
  2301. # SC_TCL_LINK_LIBS
  2302. #
  2303. # Search for the libraries needed to link the Tcl shell.
  2304. # Things like the math library (-lm) and socket stuff (-lsocket vs.
  2305. # -lnsl) are dealt with here.
  2306. #
  2307. # Arguments:
  2308. # None.
  2309. #
  2310. # Results:
  2311. #
  2312. # Might append to the following vars:
  2313. # LIBS
  2314. # MATH_LIBS
  2315. #
  2316. # Might define the following vars:
  2317. # HAVE_NET_ERRNO_H
  2318. #
  2319. #--------------------------------------------------------------------
  2320. AC_DEFUN([SC_TCL_LINK_LIBS], [
  2321. #--------------------------------------------------------------------
  2322. # On a few very rare systems, all of the libm.a stuff is
  2323. # already in libc.a. Set compiler flags accordingly.
  2324. #--------------------------------------------------------------------
  2325. AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
  2326. #--------------------------------------------------------------------
  2327. # Interactive UNIX requires -linet instead of -lsocket, plus it
  2328. # needs net/errno.h to define the socket-related error codes.
  2329. #--------------------------------------------------------------------
  2330. AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
  2331. AC_CHECK_HEADER(net/errno.h, [
  2332. AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
  2333. #--------------------------------------------------------------------
  2334. # Check for the existence of the -lsocket and -lnsl libraries.
  2335. # The order here is important, so that they end up in the right
  2336. # order in the command line generated by make. Here are some
  2337. # special considerations:
  2338. # 1. Use "connect" and "accept" to check for -lsocket, and
  2339. # "gethostbyname" to check for -lnsl.
  2340. # 2. Use each function name only once: can't redo a check because
  2341. # autoconf caches the results of the last check and won't redo it.
  2342. # 3. Use -lnsl and -lsocket only if they supply procedures that
  2343. # aren't already present in the normal libraries. This is because
  2344. # IRIX 5.2 has libraries, but they aren't needed and they're
  2345. # bogus: they goof up name resolution if used.
  2346. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  2347. # To get around this problem, check for both libraries together
  2348. # if -lsocket doesn't work by itself.
  2349. #--------------------------------------------------------------------
  2350. tcl_checkBoth=0
  2351. AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
  2352. if test "$tcl_checkSocket" = 1; then
  2353. AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
  2354. LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
  2355. fi
  2356. if test "$tcl_checkBoth" = 1; then
  2357. tk_oldLibs=$LIBS
  2358. LIBS="$LIBS -lsocket -lnsl"
  2359. AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
  2360. fi
  2361. AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
  2362. [LIBS="$LIBS -lnsl"])])
  2363. ])
  2364. #--------------------------------------------------------------------
  2365. # SC_TCL_EARLY_FLAGS
  2366. #
  2367. # Check for what flags are needed to be passed so the correct OS
  2368. # features are available.
  2369. #
  2370. # Arguments:
  2371. # None
  2372. #
  2373. # Results:
  2374. #
  2375. # Might define the following vars:
  2376. # _ISOC99_SOURCE
  2377. # _LARGEFILE64_SOURCE
  2378. # _LARGEFILE_SOURCE64
  2379. #
  2380. #--------------------------------------------------------------------
  2381. AC_DEFUN([SC_TCL_EARLY_FLAG],[
  2382. AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
  2383. AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
  2384. AC_TRY_COMPILE([[#define ]$1[ 1
  2385. ]$2], $3,
  2386. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
  2387. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
  2388. if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
  2389. AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
  2390. tcl_flags="$tcl_flags $1"
  2391. fi
  2392. ])
  2393. AC_DEFUN([SC_TCL_EARLY_FLAGS],[
  2394. AC_MSG_CHECKING([for required early compiler flags])
  2395. tcl_flags=""
  2396. SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
  2397. [char *p = (char *)strtoll; char *q = (char *)strtoull;])
  2398. SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
  2399. [struct stat64 buf; int i = stat64("/", &buf);])
  2400. SC_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
  2401. [char *p = (char *)open64;])
  2402. if test "x${tcl_flags}" = "x" ; then
  2403. AC_MSG_RESULT([none])
  2404. else
  2405. AC_MSG_RESULT([${tcl_flags}])
  2406. fi
  2407. ])
  2408. #--------------------------------------------------------------------
  2409. # SC_TCL_64BIT_FLAGS
  2410. #
  2411. # Check for what is defined in the way of 64-bit features.
  2412. #
  2413. # Arguments:
  2414. # None
  2415. #
  2416. # Results:
  2417. #
  2418. # Might define the following vars:
  2419. # TCL_WIDE_INT_IS_LONG
  2420. # TCL_WIDE_INT_TYPE
  2421. # HAVE_STRUCT_DIRENT64
  2422. # HAVE_STRUCT_STAT64
  2423. # HAVE_TYPE_OFF64_T
  2424. #
  2425. #--------------------------------------------------------------------
  2426. AC_DEFUN([SC_TCL_64BIT_FLAGS], [
  2427. AC_MSG_CHECKING([for 64-bit integer type])
  2428. AC_CACHE_VAL(tcl_cv_type_64bit,[
  2429. tcl_cv_type_64bit=none
  2430. # See if the compiler knows natively about __int64
  2431. AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
  2432. tcl_type_64bit=__int64, tcl_type_64bit="long long")
  2433. # See if we should use long anyway Note that we substitute in the
  2434. # type that is our current guess for a 64-bit type inside this check
  2435. # program, so it should be modified only carefully...
  2436. AC_TRY_COMPILE(,[switch (0) {
  2437. case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ;
  2438. }],tcl_cv_type_64bit=${tcl_type_64bit})])
  2439. if test "${tcl_cv_type_64bit}" = none ; then
  2440. AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
  2441. AC_MSG_RESULT([using long])
  2442. else
  2443. AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
  2444. [What type should be used to define wide integers?])
  2445. AC_MSG_RESULT([${tcl_cv_type_64bit}])
  2446. # Now check for auxiliary declarations
  2447. AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
  2448. AC_TRY_COMPILE([#include <sys/types.h>
  2449. #include <dirent.h>],[struct dirent64 p;],
  2450. tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
  2451. if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
  2452. AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
  2453. fi
  2454. AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
  2455. AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
  2456. ],
  2457. tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
  2458. if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
  2459. AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
  2460. fi
  2461. AC_CHECK_FUNCS(open64 lseek64)
  2462. AC_MSG_CHECKING([for off64_t])
  2463. AC_CACHE_VAL(tcl_cv_type_off64_t,[
  2464. AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
  2465. ],
  2466. tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
  2467. dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
  2468. dnl functions lseek64 and open64 are defined.
  2469. if test "x${tcl_cv_type_off64_t}" = "xyes" && \
  2470. test "x${ac_cv_func_lseek64}" = "xyes" && \
  2471. test "x${ac_cv_func_open64}" = "xyes" ; then
  2472. AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
  2473. AC_MSG_RESULT([yes])
  2474. else
  2475. AC_MSG_RESULT([no])
  2476. fi
  2477. fi
  2478. ])
  2479. #--------------------------------------------------------------------
  2480. # SC_TCL_CFG_ENCODING TIP #59
  2481. #
  2482. # Declare the encoding to use for embedded configuration information.
  2483. #
  2484. # Arguments:
  2485. # None.
  2486. #
  2487. # Results:
  2488. # Might append to the following vars:
  2489. # DEFS (implicit)
  2490. #
  2491. # Will define the following vars:
  2492. # TCL_CFGVAL_ENCODING
  2493. #
  2494. #--------------------------------------------------------------------
  2495. AC_DEFUN([SC_TCL_CFG_ENCODING], [
  2496. AC_ARG_WITH(encoding,
  2497. AS_HELP_STRING([--with-encoding],
  2498. [encoding for configuration values (default: iso8859-1)]),
  2499. with_tcencoding=${withval})
  2500. if test x"${with_tcencoding}" != x ; then
  2501. AC_DEFINE_UNQUOTED(TCL_CFGVAL_ENCODING,"${with_tcencoding}",
  2502. [What encoding should be used for embedded configuration info?])
  2503. else
  2504. AC_DEFINE(TCL_CFGVAL_ENCODING,"iso8859-1",
  2505. [What encoding should be used for embedded configuration info?])
  2506. fi
  2507. ])
  2508. #--------------------------------------------------------------------
  2509. # SC_TCL_CHECK_BROKEN_FUNC
  2510. #
  2511. # Check for broken function.
  2512. #
  2513. # Arguments:
  2514. # funcName - function to test for
  2515. # advancedTest - the advanced test to run if the function is present
  2516. #
  2517. # Results:
  2518. # Might cause compatibility versions of the function to be used.
  2519. # Might affect the following vars:
  2520. # USE_COMPAT (implicit)
  2521. #
  2522. #--------------------------------------------------------------------
  2523. AC_DEFUN([SC_TCL_CHECK_BROKEN_FUNC],[
  2524. AC_CHECK_FUNC($1, tcl_ok=1, tcl_ok=0)
  2525. if test ["$tcl_ok"] = 1; then
  2526. AC_CACHE_CHECK([proper ]$1[ implementation], [tcl_cv_]$1[_unbroken],
  2527. AC_TRY_RUN([[int main() {]$2[}]],[tcl_cv_]$1[_unbroken]=ok,
  2528. [tcl_cv_]$1[_unbroken]=broken,[tcl_cv_]$1[_unbroken]=unknown))
  2529. if test ["$tcl_cv_]$1[_unbroken"] = "ok"; then
  2530. tcl_ok=1
  2531. else
  2532. tcl_ok=0
  2533. fi
  2534. fi
  2535. if test ["$tcl_ok"] = 0; then
  2536. AC_LIBOBJ($1)
  2537. USE_COMPAT=1
  2538. fi
  2539. ])
  2540. #--------------------------------------------------------------------
  2541. # SC_TCL_GETHOSTBYADDR_R
  2542. #
  2543. # Check if we have MT-safe variant of gethostbyaddr().
  2544. #
  2545. # Arguments:
  2546. # None
  2547. #
  2548. # Results:
  2549. #
  2550. # Might define the following vars:
  2551. # HAVE_GETHOSTBYADDR_R
  2552. # HAVE_GETHOSTBYADDR_R_7
  2553. # HAVE_GETHOSTBYADDR_R_8
  2554. #
  2555. #--------------------------------------------------------------------
  2556. AC_DEFUN([SC_TCL_GETHOSTBYADDR_R], [AC_CHECK_FUNC(gethostbyaddr_r, [
  2557. AC_CACHE_CHECK([for gethostbyaddr_r with 7 args], tcl_cv_api_gethostbyaddr_r_7, [
  2558. AC_TRY_COMPILE([
  2559. #include <netdb.h>
  2560. ], [
  2561. char *addr;
  2562. int length;
  2563. int type;
  2564. struct hostent *result;
  2565. char buffer[2048];
  2566. int buflen = 2048;
  2567. int h_errnop;
  2568. (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
  2569. &h_errnop);
  2570. ], tcl_cv_api_gethostbyaddr_r_7=yes, tcl_cv_api_gethostbyaddr_r_7=no)])
  2571. tcl_ok=$tcl_cv_api_gethostbyaddr_r_7
  2572. if test "$tcl_ok" = yes; then
  2573. AC_DEFINE(HAVE_GETHOSTBYADDR_R_7, 1,
  2574. [Define to 1 if gethostbyaddr_r takes 7 args.])
  2575. else
  2576. AC_CACHE_CHECK([for gethostbyaddr_r with 8 args], tcl_cv_api_gethostbyaddr_r_8, [
  2577. AC_TRY_COMPILE([
  2578. #include <netdb.h>
  2579. ], [
  2580. char *addr;
  2581. int length;
  2582. int type;
  2583. struct hostent *result, *resultp;
  2584. char buffer[2048];
  2585. int buflen = 2048;
  2586. int h_errnop;
  2587. (void) gethostbyaddr_r(addr, length, type, result, buffer, buflen,
  2588. &resultp, &h_errnop);
  2589. ], tcl_cv_api_gethostbyaddr_r_8=yes, tcl_cv_api_gethostbyaddr_r_8=no)])
  2590. tcl_ok=$tcl_cv_api_gethostbyaddr_r_8
  2591. if test "$tcl_ok" = yes; then
  2592. AC_DEFINE(HAVE_GETHOSTBYADDR_R_8, 1,
  2593. [Define to 1 if gethostbyaddr_r takes 8 args.])
  2594. fi
  2595. fi
  2596. if test "$tcl_ok" = yes; then
  2597. AC_DEFINE(HAVE_GETHOSTBYADDR_R, 1,
  2598. [Define to 1 if gethostbyaddr_r is available.])
  2599. fi
  2600. ])])
  2601. #--------------------------------------------------------------------
  2602. # SC_TCL_GETHOSTBYNAME_R
  2603. #
  2604. # Check to see what variant of gethostbyname_r() we have.
  2605. # Based on David Arnold's example from the comp.programming.threads
  2606. # FAQ Q213
  2607. #
  2608. # Arguments:
  2609. # None
  2610. #
  2611. # Results:
  2612. #
  2613. # Might define the following vars:
  2614. # HAVE_GETHOSTBYADDR_R
  2615. # HAVE_GETHOSTBYADDR_R_3
  2616. # HAVE_GETHOSTBYADDR_R_5
  2617. # HAVE_GETHOSTBYADDR_R_6
  2618. #
  2619. #--------------------------------------------------------------------
  2620. AC_DEFUN([SC_TCL_GETHOSTBYNAME_R], [AC_CHECK_FUNC(gethostbyname_r, [
  2621. AC_CACHE_CHECK([for gethostbyname_r with 6 args], tcl_cv_api_gethostbyname_r_6, [
  2622. AC_TRY_COMPILE([
  2623. #include <netdb.h>
  2624. ], [
  2625. char *name;
  2626. struct hostent *he, *res;
  2627. char buffer[2048];
  2628. int buflen = 2048;
  2629. int h_errnop;
  2630. (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop);
  2631. ], tcl_cv_api_gethostbyname_r_6=yes, tcl_cv_api_gethostbyname_r_6=no)])
  2632. tcl_ok=$tcl_cv_api_gethostbyname_r_6
  2633. if test "$tcl_ok" = yes; then
  2634. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1,
  2635. [Define to 1 if gethostbyname_r takes 6 args.])
  2636. else
  2637. AC_CACHE_CHECK([for gethostbyname_r with 5 args], tcl_cv_api_gethostbyname_r_5, [
  2638. AC_TRY_COMPILE([
  2639. #include <netdb.h>
  2640. ], [
  2641. char *name;
  2642. struct hostent *he;
  2643. char buffer[2048];
  2644. int buflen = 2048;
  2645. int h_errnop;
  2646. (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop);
  2647. ], tcl_cv_api_gethostbyname_r_5=yes, tcl_cv_api_gethostbyname_r_5=no)])
  2648. tcl_ok=$tcl_cv_api_gethostbyname_r_5
  2649. if test "$tcl_ok" = yes; then
  2650. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1,
  2651. [Define to 1 if gethostbyname_r takes 5 args.])
  2652. else
  2653. AC_CACHE_CHECK([for gethostbyname_r with 3 args], tcl_cv_api_gethostbyname_r_3, [
  2654. AC_TRY_COMPILE([
  2655. #include <netdb.h>
  2656. ], [
  2657. char *name;
  2658. struct hostent *he;
  2659. struct hostent_data data;
  2660. (void) gethostbyname_r(name, he, &data);
  2661. ], tcl_cv_api_gethostbyname_r_3=yes, tcl_cv_api_gethostbyname_r_3=no)])
  2662. tcl_ok=$tcl_cv_api_gethostbyname_r_3
  2663. if test "$tcl_ok" = yes; then
  2664. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1,
  2665. [Define to 1 if gethostbyname_r takes 3 args.])
  2666. fi
  2667. fi
  2668. fi
  2669. if test "$tcl_ok" = yes; then
  2670. AC_DEFINE(HAVE_GETHOSTBYNAME_R, 1,
  2671. [Define to 1 if gethostbyname_r is available.])
  2672. fi
  2673. ])])
  2674. #--------------------------------------------------------------------
  2675. # SC_TCL_GETPWUID_R
  2676. #
  2677. # Check if we have MT-safe variant of getpwuid() and if yes,
  2678. # which one exactly.
  2679. #
  2680. # Arguments:
  2681. # None
  2682. #
  2683. # Results:
  2684. #
  2685. # Might define the following vars:
  2686. # HAVE_GETPWUID_R
  2687. # HAVE_GETPWUID_R_4
  2688. # HAVE_GETPWUID_R_5
  2689. #
  2690. #--------------------------------------------------------------------
  2691. AC_DEFUN([SC_TCL_GETPWUID_R], [AC_CHECK_FUNC(getpwuid_r, [
  2692. AC_CACHE_CHECK([for getpwuid_r with 5 args], tcl_cv_api_getpwuid_r_5, [
  2693. AC_TRY_COMPILE([
  2694. #include <sys/types.h>
  2695. #include <pwd.h>
  2696. ], [
  2697. uid_t uid;
  2698. struct passwd pw, *pwp;
  2699. char buf[512];
  2700. int buflen = 512;
  2701. (void) getpwuid_r(uid, &pw, buf, buflen, &pwp);
  2702. ], tcl_cv_api_getpwuid_r_5=yes, tcl_cv_api_getpwuid_r_5=no)])
  2703. tcl_ok=$tcl_cv_api_getpwuid_r_5
  2704. if test "$tcl_ok" = yes; then
  2705. AC_DEFINE(HAVE_GETPWUID_R_5, 1,
  2706. [Define to 1 if getpwuid_r takes 5 args.])
  2707. else
  2708. AC_CACHE_CHECK([for getpwuid_r with 4 args], tcl_cv_api_getpwuid_r_4, [
  2709. AC_TRY_COMPILE([
  2710. #include <sys/types.h>
  2711. #include <pwd.h>
  2712. ], [
  2713. uid_t uid;
  2714. struct passwd pw;
  2715. char buf[512];
  2716. int buflen = 512;
  2717. (void)getpwnam_r(uid, &pw, buf, buflen);
  2718. ], tcl_cv_api_getpwuid_r_4=yes, tcl_cv_api_getpwuid_r_4=no)])
  2719. tcl_ok=$tcl_cv_api_getpwuid_r_4
  2720. if test "$tcl_ok" = yes; then
  2721. AC_DEFINE(HAVE_GETPWUID_R_4, 1,
  2722. [Define to 1 if getpwuid_r takes 4 args.])
  2723. fi
  2724. fi
  2725. if test "$tcl_ok" = yes; then
  2726. AC_DEFINE(HAVE_GETPWUID_R, 1,
  2727. [Define to 1 if getpwuid_r is available.])
  2728. fi
  2729. ])])
  2730. #--------------------------------------------------------------------
  2731. # SC_TCL_GETPWNAM_R
  2732. #
  2733. # Check if we have MT-safe variant of getpwnam() and if yes,
  2734. # which one exactly.
  2735. #
  2736. # Arguments:
  2737. # None
  2738. #
  2739. # Results:
  2740. #
  2741. # Might define the following vars:
  2742. # HAVE_GETPWNAM_R
  2743. # HAVE_GETPWNAM_R_4
  2744. # HAVE_GETPWNAM_R_5
  2745. #
  2746. #--------------------------------------------------------------------
  2747. AC_DEFUN([SC_TCL_GETPWNAM_R], [AC_CHECK_FUNC(getpwnam_r, [
  2748. AC_CACHE_CHECK([for getpwnam_r with 5 args], tcl_cv_api_getpwnam_r_5, [
  2749. AC_TRY_COMPILE([
  2750. #include <sys/types.h>
  2751. #include <pwd.h>
  2752. ], [
  2753. char *name;
  2754. struct passwd pw, *pwp;
  2755. char buf[512];
  2756. int buflen = 512;
  2757. (void) getpwnam_r(name, &pw, buf, buflen, &pwp);
  2758. ], tcl_cv_api_getpwnam_r_5=yes, tcl_cv_api_getpwnam_r_5=no)])
  2759. tcl_ok=$tcl_cv_api_getpwnam_r_5
  2760. if test "$tcl_ok" = yes; then
  2761. AC_DEFINE(HAVE_GETPWNAM_R_5, 1,
  2762. [Define to 1 if getpwnam_r takes 5 args.])
  2763. else
  2764. AC_CACHE_CHECK([for getpwnam_r with 4 args], tcl_cv_api_getpwnam_r_4, [
  2765. AC_TRY_COMPILE([
  2766. #include <sys/types.h>
  2767. #include <pwd.h>
  2768. ], [
  2769. char *name;
  2770. struct passwd pw;
  2771. char buf[512];
  2772. int buflen = 512;
  2773. (void)getpwnam_r(name, &pw, buf, buflen);
  2774. ], tcl_cv_api_getpwnam_r_4=yes, tcl_cv_api_getpwnam_r_4=no)])
  2775. tcl_ok=$tcl_cv_api_getpwnam_r_4
  2776. if test "$tcl_ok" = yes; then
  2777. AC_DEFINE(HAVE_GETPWNAM_R_4, 1,
  2778. [Define to 1 if getpwnam_r takes 4 args.])
  2779. fi
  2780. fi
  2781. if test "$tcl_ok" = yes; then
  2782. AC_DEFINE(HAVE_GETPWNAM_R, 1,
  2783. [Define to 1 if getpwnam_r is available.])
  2784. fi
  2785. ])])
  2786. #--------------------------------------------------------------------
  2787. # SC_TCL_GETGRGID_R
  2788. #
  2789. # Check if we have MT-safe variant of getgrgid() and if yes,
  2790. # which one exactly.
  2791. #
  2792. # Arguments:
  2793. # None
  2794. #
  2795. # Results:
  2796. #
  2797. # Might define the following vars:
  2798. # HAVE_GETGRGID_R
  2799. # HAVE_GETGRGID_R_4
  2800. # HAVE_GETGRGID_R_5
  2801. #
  2802. #--------------------------------------------------------------------
  2803. AC_DEFUN([SC_TCL_GETGRGID_R], [AC_CHECK_FUNC(getgrgid_r, [
  2804. AC_CACHE_CHECK([for getgrgid_r with 5 args], tcl_cv_api_getgrgid_r_5, [
  2805. AC_TRY_COMPILE([
  2806. #include <sys/types.h>
  2807. #include <grp.h>
  2808. ], [
  2809. gid_t gid;
  2810. struct group gr, *grp;
  2811. char buf[512];
  2812. int buflen = 512;
  2813. (void) getgrgid_r(gid, &gr, buf, buflen, &grp);
  2814. ], tcl_cv_api_getgrgid_r_5=yes, tcl_cv_api_getgrgid_r_5=no)])
  2815. tcl_ok=$tcl_cv_api_getgrgid_r_5
  2816. if test "$tcl_ok" = yes; then
  2817. AC_DEFINE(HAVE_GETGRGID_R_5, 1,
  2818. [Define to 1 if getgrgid_r takes 5 args.])
  2819. else
  2820. AC_CACHE_CHECK([for getgrgid_r with 4 args], tcl_cv_api_getgrgid_r_4, [
  2821. AC_TRY_COMPILE([
  2822. #include <sys/types.h>
  2823. #include <grp.h>
  2824. ], [
  2825. gid_t gid;
  2826. struct group gr;
  2827. char buf[512];
  2828. int buflen = 512;
  2829. (void)getgrgid_r(gid, &gr, buf, buflen);
  2830. ], tcl_cv_api_getgrgid_r_4=yes, tcl_cv_api_getgrgid_r_4=no)])
  2831. tcl_ok=$tcl_cv_api_getgrgid_r_4
  2832. if test "$tcl_ok" = yes; then
  2833. AC_DEFINE(HAVE_GETGRGID_R_4, 1,
  2834. [Define to 1 if getgrgid_r takes 4 args.])
  2835. fi
  2836. fi
  2837. if test "$tcl_ok" = yes; then
  2838. AC_DEFINE(HAVE_GETGRGID_R, 1,
  2839. [Define to 1 if getgrgid_r is available.])
  2840. fi
  2841. ])])
  2842. #--------------------------------------------------------------------
  2843. # SC_TCL_GETGRNAM_R
  2844. #
  2845. # Check if we have MT-safe variant of getgrnam() and if yes,
  2846. # which one exactly.
  2847. #
  2848. # Arguments:
  2849. # None
  2850. #
  2851. # Results:
  2852. #
  2853. # Might define the following vars:
  2854. # HAVE_GETGRNAM_R
  2855. # HAVE_GETGRNAM_R_4
  2856. # HAVE_GETGRNAM_R_5
  2857. #
  2858. #--------------------------------------------------------------------
  2859. AC_DEFUN([SC_TCL_GETGRNAM_R], [AC_CHECK_FUNC(getgrnam_r, [
  2860. AC_CACHE_CHECK([for getgrnam_r with 5 args], tcl_cv_api_getgrnam_r_5, [
  2861. AC_TRY_COMPILE([
  2862. #include <sys/types.h>
  2863. #include <grp.h>
  2864. ], [
  2865. char *name;
  2866. struct group gr, *grp;
  2867. char buf[512];
  2868. int buflen = 512;
  2869. (void) getgrnam_r(name, &gr, buf, buflen, &grp);
  2870. ], tcl_cv_api_getgrnam_r_5=yes, tcl_cv_api_getgrnam_r_5=no)])
  2871. tcl_ok=$tcl_cv_api_getgrnam_r_5
  2872. if test "$tcl_ok" = yes; then
  2873. AC_DEFINE(HAVE_GETGRNAM_R_5, 1,
  2874. [Define to 1 if getgrnam_r takes 5 args.])
  2875. else
  2876. AC_CACHE_CHECK([for getgrnam_r with 4 args], tcl_cv_api_getgrnam_r_4, [
  2877. AC_TRY_COMPILE([
  2878. #include <sys/types.h>
  2879. #include <grp.h>
  2880. ], [
  2881. char *name;
  2882. struct group gr;
  2883. char buf[512];
  2884. int buflen = 512;
  2885. (void)getgrnam_r(name, &gr, buf, buflen);
  2886. ], tcl_cv_api_getgrnam_r_4=yes, tcl_cv_api_getgrnam_r_4=no)])
  2887. tcl_ok=$tcl_cv_api_getgrnam_r_4
  2888. if test "$tcl_ok" = yes; then
  2889. AC_DEFINE(HAVE_GETGRNAM_R_4, 1,
  2890. [Define to 1 if getgrnam_r takes 4 args.])
  2891. fi
  2892. fi
  2893. if test "$tcl_ok" = yes; then
  2894. AC_DEFINE(HAVE_GETGRNAM_R, 1,
  2895. [Define to 1 if getgrnam_r is available.])
  2896. fi
  2897. ])])
  2898. AC_DEFUN([SC_TCL_IPV6],[
  2899. NEED_FAKE_RFC2553=0
  2900. AC_CHECK_FUNCS(getnameinfo getaddrinfo freeaddrinfo gai_strerror,,[NEED_FAKE_RFC2553=1])
  2901. AC_CHECK_TYPES([
  2902. struct addrinfo,
  2903. struct in6_addr,
  2904. struct sockaddr_in6,
  2905. struct sockaddr_storage],,[NEED_FAKE_RFC2553=1],[[
  2906. #include <sys/types.h>
  2907. #include <sys/socket.h>
  2908. #include <netinet/in.h>
  2909. #include <netdb.h>
  2910. ]])
  2911. if test "x$NEED_FAKE_RFC2553" = "x1"; then
  2912. AC_DEFINE([NEED_FAKE_RFC2553], 1,
  2913. [Use compat implementation of getaddrinfo() and friends])
  2914. AC_LIBOBJ([fake-rfc2553])
  2915. AC_CHECK_FUNC(strlcpy)
  2916. fi
  2917. ])
  2918. # Local Variables:
  2919. # mode: autoconf
  2920. # End: