tcl.m4 97 KB

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