tcl.m4 72 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474
  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=DIR 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]]* 2>/dev/null` \
  44. ../../tcl \
  45. `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  46. ../../../tcl \
  47. `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
  48. if test -f "$i/unix/tclConfig.sh" ; then
  49. ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
  50. break
  51. fi
  52. done
  53. fi
  54. # check in a few common install locations
  55. if test x"${ac_cv_c_tclconfig}" = x ; then
  56. for i in `ls -d ${libdir} 2>/dev/null` \
  57. `ls -d /usr/local/lib 2>/dev/null` \
  58. `ls -d /usr/contrib/lib 2>/dev/null` \
  59. `ls -d /usr/lib 2>/dev/null` \
  60. `ls -dr /usr/lib/tcl[[8-9]].[[0-9]]* 2>/dev/null` \
  61. ; do
  62. if test -f "$i/tclConfig.sh" ; then
  63. ac_cv_c_tclconfig=`(cd $i; pwd)`
  64. break
  65. fi
  66. done
  67. fi
  68. # check in a few other private locations
  69. if test x"${ac_cv_c_tclconfig}" = x ; then
  70. for i in \
  71. ${srcdir}/../tcl \
  72. `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
  73. if test -f "$i/unix/tclConfig.sh" ; then
  74. ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
  75. break
  76. fi
  77. done
  78. fi
  79. ])
  80. if test x"${ac_cv_c_tclconfig}" = x ; then
  81. TCL_BIN_DIR="# no Tcl configs found"
  82. AC_MSG_WARN([
  83. Can't find Tcl configuration definitions, use --with-tcl to specify
  84. a directory.])
  85. else
  86. no_tcl=
  87. TCL_BIN_DIR=${ac_cv_c_tclconfig}
  88. AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
  89. fi
  90. fi
  91. ])
  92. #------------------------------------------------------------------------
  93. # SC_PATH_TKCONFIG --
  94. #
  95. # Locate the tkConfig.sh file
  96. #
  97. # Arguments:
  98. # none
  99. #
  100. # Results:
  101. #
  102. # Adds the following arguments to configure:
  103. # --with-tk=...
  104. #
  105. # Defines the following vars:
  106. # TK_BIN_DIR Full path to the directory containing
  107. # the tkConfig.sh file
  108. #------------------------------------------------------------------------
  109. AC_DEFUN([SC_PATH_TKCONFIG], [
  110. #
  111. # Ok, lets find the tk configuration
  112. # First, look for one uninstalled.
  113. # the alternative search directory is invoked by --with-tk
  114. #
  115. if test x"${no_tk}" = x ; then
  116. # we reset no_tk in case something fails here
  117. no_tk=true
  118. AC_ARG_WITH(tk, [ --with-tk directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
  119. AC_MSG_CHECKING([for Tk configuration])
  120. AC_CACHE_VAL(ac_cv_c_tkconfig,[
  121. # First check to see if --with-tkconfig was specified.
  122. if test x"${with_tkconfig}" != x ; then
  123. if test -f "${with_tkconfig}/tkConfig.sh" ; then
  124. ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
  125. else
  126. AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
  127. fi
  128. fi
  129. # then check for a private Tk library
  130. if test x"${ac_cv_c_tkconfig}" = x ; then
  131. for i in \
  132. ../tk \
  133. `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
  134. ../../tk \
  135. `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
  136. ../../../tk \
  137. `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
  138. if test -f "$i/unix/tkConfig.sh" ; then
  139. ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
  140. break
  141. fi
  142. done
  143. fi
  144. # check in a few common install locations
  145. if test x"${ac_cv_c_tkconfig}" = x ; then
  146. for i in `ls -d ${libdir} 2>/dev/null` \
  147. `ls -d /usr/local/lib 2>/dev/null` \
  148. `ls -d /usr/contrib/lib 2>/dev/null` \
  149. `ls -d /usr/lib 2>/dev/null` \
  150. ; do
  151. if test -f "$i/tkConfig.sh" ; then
  152. ac_cv_c_tkconfig=`(cd $i; pwd)`
  153. break
  154. fi
  155. done
  156. fi
  157. # check in a few other private locations
  158. if test x"${ac_cv_c_tkconfig}" = x ; then
  159. for i in \
  160. ${srcdir}/../tk \
  161. `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
  162. if test -f "$i/unix/tkConfig.sh" ; then
  163. ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
  164. break
  165. fi
  166. done
  167. fi
  168. ])
  169. if test x"${ac_cv_c_tkconfig}" = x ; then
  170. TK_BIN_DIR="# no Tk configs found"
  171. AC_MSG_WARN(Can't find Tk configuration definitions)
  172. exit 0
  173. else
  174. no_tk=
  175. TK_BIN_DIR=${ac_cv_c_tkconfig}
  176. AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
  177. fi
  178. fi
  179. ])
  180. #------------------------------------------------------------------------
  181. # SC_LOAD_TCLCONFIG --
  182. #
  183. # Load the tclConfig.sh file
  184. #
  185. # Arguments:
  186. #
  187. # Requires the following vars to be set:
  188. # TCL_BIN_DIR
  189. #
  190. # Results:
  191. #
  192. # Subst the following vars:
  193. # TCL_BIN_DIR
  194. # TCL_SRC_DIR
  195. # TCL_INC_DIR
  196. # TCL_LIB_FILE
  197. #
  198. #------------------------------------------------------------------------
  199. AC_DEFUN([SC_LOAD_TCLCONFIG], [
  200. AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
  201. if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
  202. AC_MSG_RESULT([loading])
  203. . $TCL_BIN_DIR/tclConfig.sh
  204. else
  205. AC_MSG_RESULT([file not found])
  206. fi
  207. #
  208. # If the TCL_BIN_DIR is the build directory (not the install directory),
  209. # then set the common variable name to the value of the build variables.
  210. # For example, the variable TCL_LIB_SPEC will be set to the value
  211. # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
  212. # instead of TCL_BUILD_LIB_SPEC since it will work with both an
  213. # installed and uninstalled version of Tcl.
  214. #
  215. if test -f $TCL_BIN_DIR/Makefile ; then
  216. TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
  217. TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
  218. TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
  219. fi
  220. #
  221. # eval is required to do the TCL_DBGX substitution
  222. #
  223. eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
  224. eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
  225. eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
  226. eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
  227. eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
  228. eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
  229. AC_SUBST(TCL_VERSION)
  230. AC_SUBST(TCL_BIN_DIR)
  231. if [[ ! $TCL_INC_DIR ]]; then
  232. TCL_INC_DIR=${TCL_PREFIX}/include
  233. fi
  234. AC_SUBST(TCL_INC_DIR)
  235. AC_SUBST(TCL_SRC_DIR)
  236. AC_SUBST(TCL_LIB_FILE)
  237. AC_SUBST(TCL_LIB_FLAG)
  238. AC_SUBST(TCL_LIB_SPEC)
  239. AC_SUBST(TCL_STUB_LIB_FILE)
  240. AC_SUBST(TCL_STUB_LIB_FLAG)
  241. AC_SUBST(TCL_STUB_LIB_SPEC)
  242. ])
  243. #------------------------------------------------------------------------
  244. # SC_LOAD_TKCONFIG --
  245. #
  246. # Load the tkConfig.sh file
  247. #
  248. # Arguments:
  249. #
  250. # Requires the following vars to be set:
  251. # TK_BIN_DIR
  252. #
  253. # Results:
  254. #
  255. # Sets the following vars that should be in tkConfig.sh:
  256. # TK_BIN_DIR
  257. #------------------------------------------------------------------------
  258. AC_DEFUN([SC_LOAD_TKCONFIG], [
  259. AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
  260. if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
  261. AC_MSG_RESULT([loading])
  262. . $TK_BIN_DIR/tkConfig.sh
  263. else
  264. AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
  265. fi
  266. AC_SUBST(TK_VERSION)
  267. AC_SUBST(TK_BIN_DIR)
  268. AC_SUBST(TK_SRC_DIR)
  269. AC_SUBST(TK_LIB_DIR)
  270. AC_SUBST(TK_LIB_FILE)
  271. ])
  272. #------------------------------------------------------------------------
  273. # SC_ENABLE_SHARED --
  274. #
  275. # Allows the building of shared libraries
  276. #
  277. # Arguments:
  278. # none
  279. #
  280. # Results:
  281. #
  282. # Adds the following arguments to configure:
  283. # --enable-shared=yes|no
  284. #
  285. # Defines the following vars:
  286. # STATIC_BUILD Used for building import/export libraries
  287. # on Windows.
  288. #
  289. # Sets the following vars:
  290. # SHARED_BUILD Value of 1 or 0
  291. #------------------------------------------------------------------------
  292. AC_DEFUN([SC_ENABLE_SHARED], [
  293. AC_MSG_CHECKING([how to build libraries])
  294. AC_ARG_ENABLE(shared,
  295. [ --enable-shared build and link with shared libraries [--enable-shared]],
  296. [tcl_ok=$enableval], [tcl_ok=yes])
  297. if test "${enable_shared+set}" = set; then
  298. enableval="$enable_shared"
  299. tcl_ok=$enableval
  300. else
  301. tcl_ok=yes
  302. fi
  303. if test "$tcl_ok" = "yes" ; then
  304. AC_MSG_RESULT([shared])
  305. SHARED_BUILD=1
  306. else
  307. AC_MSG_RESULT([static])
  308. SHARED_BUILD=0
  309. AC_DEFINE(STATIC_BUILD)
  310. fi
  311. ])
  312. #------------------------------------------------------------------------
  313. # SC_ENABLE_FRAMEWORK --
  314. #
  315. # Allows the building of shared libraries into frameworks
  316. #
  317. # Arguments:
  318. # none
  319. #
  320. # Results:
  321. #
  322. # Adds the following arguments to configure:
  323. # --enable-framework=yes|no
  324. #
  325. # Sets the following vars:
  326. # FRAMEWORK_BUILD Value of 1 or 0
  327. #------------------------------------------------------------------------
  328. AC_DEFUN([SC_ENABLE_FRAMEWORK], [
  329. AC_MSG_CHECKING([how to package libraries])
  330. AC_ARG_ENABLE(framework,
  331. [ --enable-framework package shared libraries in frameworks [--disable-framework]],
  332. [tcl_ok=$enableval], [tcl_ok=no])
  333. if test "${enable_framework+set}" = set; then
  334. enableval="$enable_framework"
  335. tcl_ok=$enableval
  336. else
  337. tcl_ok=no
  338. fi
  339. if test "$tcl_ok" = "yes" ; then
  340. AC_MSG_RESULT([framework])
  341. FRAMEWORK_BUILD=1
  342. if test "${SHARED_BUILD}" = "0" ; then
  343. AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes")
  344. FRAMEWORK_BUILD=0
  345. fi
  346. else
  347. AC_MSG_RESULT([standard shared library])
  348. FRAMEWORK_BUILD=0
  349. fi
  350. ])
  351. #------------------------------------------------------------------------
  352. # SC_ENABLE_THREADS --
  353. #
  354. # Specify if thread support should be enabled
  355. #
  356. # Arguments:
  357. # none
  358. #
  359. # Results:
  360. #
  361. # Adds the following arguments to configure:
  362. # --enable-threads
  363. #
  364. # Sets the following vars:
  365. # THREADS_LIBS Thread library(s)
  366. #
  367. # Defines the following vars:
  368. # TCL_THREADS
  369. # _REENTRANT
  370. # _THREAD_SAFE
  371. #
  372. #------------------------------------------------------------------------
  373. AC_DEFUN([SC_ENABLE_THREADS], [
  374. AC_MSG_CHECKING(for building with threads)
  375. AC_ARG_ENABLE(threads, [ --enable-threads build with threads],
  376. [tcl_ok=$enableval], [tcl_ok=no])
  377. if test "$tcl_ok" = "yes"; then
  378. AC_MSG_RESULT(yes)
  379. TCL_THREADS=1
  380. AC_DEFINE(TCL_THREADS)
  381. # USE_THREAD_ALLOC tells us to try the special thread-based
  382. # allocator that significantly reduces lock contention
  383. AC_DEFINE(USE_THREAD_ALLOC)
  384. AC_DEFINE(_REENTRANT)
  385. AC_DEFINE(_THREAD_SAFE)
  386. AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  387. if test "$tcl_ok" = "no"; then
  388. # Check a little harder for __pthread_mutex_init in the same
  389. # library, as some systems hide it there until pthread.h is
  390. # defined. We could alternatively do an AC_TRY_COMPILE with
  391. # pthread.h, but that will work with libpthread really doesn't
  392. # exist, like AIX 4.2. [Bug: 4359]
  393. AC_CHECK_LIB(pthread,__pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  394. fi
  395. if test "$tcl_ok" = "yes"; then
  396. # The space is needed
  397. THREADS_LIBS=" -lpthread"
  398. else
  399. AC_CHECK_LIB(pthreads,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  400. if test "$tcl_ok" = "yes"; then
  401. # The space is needed
  402. THREADS_LIBS=" -lpthreads"
  403. else
  404. AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  405. if test "$tcl_ok" = "no"; then
  406. AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
  407. if test "$tcl_ok" = "yes"; then
  408. # The space is needed
  409. THREADS_LIBS=" -pthread"
  410. else
  411. TCL_THREADS=0
  412. 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...")
  413. fi
  414. fi
  415. fi
  416. fi
  417. # Does the pthread-implementation provide
  418. # 'pthread_attr_setstacksize' ?
  419. ac_saved_libs=$LIBS
  420. LIBS="$LIBS $THREADS_LIBS"
  421. AC_CHECK_FUNCS(pthread_attr_setstacksize)
  422. LIBS=$ac_saved_libs
  423. AC_CHECK_FUNCS(readdir_r)
  424. else
  425. TCL_THREADS=0
  426. AC_MSG_RESULT([no (default)])
  427. fi
  428. AC_SUBST(TCL_THREADS)
  429. ])
  430. #------------------------------------------------------------------------
  431. # SC_ENABLE_SYMBOLS --
  432. #
  433. # Specify if debugging symbols should be used.
  434. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging
  435. # can also be enabled.
  436. #
  437. # Arguments:
  438. # none
  439. #
  440. # Requires the following vars to be set in the Makefile:
  441. # CFLAGS_DEBUG
  442. # CFLAGS_OPTIMIZE
  443. # LDFLAGS_DEBUG
  444. # LDFLAGS_OPTIMIZE
  445. #
  446. # Results:
  447. #
  448. # Adds the following arguments to configure:
  449. # --enable-symbols
  450. #
  451. # Defines the following vars:
  452. # CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
  453. # Sets to $(CFLAGS_OPTIMIZE) if false
  454. # LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
  455. # Sets to $(LDFLAGS_OPTIMIZE) if false
  456. # DBGX Debug library extension
  457. #
  458. #------------------------------------------------------------------------
  459. AC_DEFUN([SC_ENABLE_SYMBOLS], [
  460. AC_MSG_CHECKING([for build with symbols])
  461. AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
  462. # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT.
  463. if test "$tcl_ok" = "no"; then
  464. CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
  465. LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
  466. DBGX=""
  467. AC_MSG_RESULT([no])
  468. else
  469. CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
  470. LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
  471. DBGX=g
  472. if test "$tcl_ok" = "yes"; then
  473. AC_MSG_RESULT([yes (standard debugging)])
  474. fi
  475. fi
  476. AC_SUBST(CFLAGS_DEFAULT)
  477. AC_SUBST(LDFLAGS_DEFAULT)
  478. if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
  479. AC_DEFINE(TCL_MEM_DEBUG)
  480. fi
  481. if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then
  482. AC_DEFINE(TCL_COMPILE_DEBUG)
  483. AC_DEFINE(TCL_COMPILE_STATS)
  484. fi
  485. if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
  486. if test "$tcl_ok" = "all"; then
  487. AC_MSG_RESULT([enabled symbols mem compile debugging])
  488. else
  489. AC_MSG_RESULT([enabled $tcl_ok debugging])
  490. fi
  491. fi
  492. ])
  493. #------------------------------------------------------------------------
  494. # SC_ENABLE_LANGINFO --
  495. #
  496. # Allows use of modern nl_langinfo check for better l10n.
  497. # This is only relevant for Unix.
  498. #
  499. # Arguments:
  500. # none
  501. #
  502. # Results:
  503. #
  504. # Adds the following arguments to configure:
  505. # --enable-langinfo=yes|no (default is yes)
  506. #
  507. # Defines the following vars:
  508. # HAVE_LANGINFO Triggers use of nl_langinfo if defined.
  509. #
  510. #------------------------------------------------------------------------
  511. AC_DEFUN([SC_ENABLE_LANGINFO], [
  512. AC_ARG_ENABLE(langinfo,
  513. [ --enable-langinfo use nl_langinfo if possible to determine
  514. encoding at startup, otherwise use old heuristic],
  515. [langinfo_ok=$enableval], [langinfo_ok=yes])
  516. HAVE_LANGINFO=0
  517. if test "$langinfo_ok" = "yes"; then
  518. if test "$langinfo_ok" = "yes"; then
  519. AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
  520. fi
  521. fi
  522. AC_MSG_CHECKING([whether to use nl_langinfo])
  523. if test "$langinfo_ok" = "yes"; then
  524. AC_TRY_COMPILE([#include <langinfo.h>],
  525. [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no])
  526. if test "$langinfo_ok" = "no"; then
  527. langinfo_ok="no (could not compile with nl_langinfo)";
  528. fi
  529. if test "$langinfo_ok" = "yes"; then
  530. AC_DEFINE(HAVE_LANGINFO)
  531. fi
  532. fi
  533. AC_MSG_RESULT([$langinfo_ok])
  534. ])
  535. #--------------------------------------------------------------------
  536. # SC_CONFIG_MANPAGES
  537. #
  538. # Decide whether to use symlinks for linking the manpages and
  539. # whether to compress the manpages after installation.
  540. #
  541. # Arguments:
  542. # none
  543. #
  544. # Results:
  545. #
  546. # Adds the following arguments to configure:
  547. # --enable-man-symlinks
  548. # --enable-man-compression=PROG
  549. #
  550. # Defines the following variable:
  551. #
  552. # MKLINKS_FLAGS - The apropriate flags for mkLinks
  553. # according to the user's selection.
  554. #
  555. #--------------------------------------------------------------------
  556. AC_DEFUN([SC_CONFIG_MANPAGES], [
  557. AC_MSG_CHECKING([whether to use symlinks for manpages])
  558. AC_ARG_ENABLE(man-symlinks,
  559. [ --enable-man-symlinks use symlinks for the manpages],
  560. test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --symlinks",
  561. enableval="no")
  562. AC_MSG_RESULT([$enableval])
  563. AC_MSG_CHECKING([compression for manpages])
  564. AC_ARG_ENABLE(man-compression,
  565. [ --enable-man-compression=PROG
  566. compress the manpages with PROG],
  567. test "$enableval" = "yes" && echo && AC_MSG_ERROR([missing argument to --enable-man-compression])
  568. test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --compress $enableval",
  569. enableval="no")
  570. AC_MSG_RESULT([$enableval])
  571. AC_SUBST(MKLINKS_FLAGS)
  572. ])
  573. #--------------------------------------------------------------------
  574. # SC_CONFIG_CFLAGS
  575. #
  576. # Try to determine the proper flags to pass to the compiler
  577. # for building shared libraries and other such nonsense.
  578. #
  579. # Arguments:
  580. # none
  581. #
  582. # Results:
  583. #
  584. # Defines and substitutes the following vars:
  585. #
  586. # DL_OBJS - Name of the object file that implements dynamic
  587. # loading for Tcl on this system.
  588. # DL_LIBS - Library file(s) to include in tclsh and other base
  589. # applications in order for the "load" command to work.
  590. # LDFLAGS - Flags to pass to the compiler when linking object
  591. # files into an executable application binary such
  592. # as tclsh.
  593. # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
  594. # that tell the run-time dynamic linker where to look
  595. # for shared libraries such as libtcl.so. Depends on
  596. # the variable LIB_RUNTIME_DIR in the Makefile. Could
  597. # be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
  598. # CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
  599. # that tell the run-time dynamic linker where to look
  600. # for shared libraries such as libtcl.so. Depends on
  601. # the variable LIB_RUNTIME_DIR in the Makefile.
  602. # MAKE_LIB - Command to execute to build the a library;
  603. # differs when building shared or static.
  604. # MAKE_STUB_LIB -
  605. # Command to execute to build a stub library.
  606. # INSTALL_LIB - Command to execute to install a library;
  607. # differs when building shared or static.
  608. # INSTALL_STUB_LIB -
  609. # Command to execute to install a stub library.
  610. # STLIB_LD - Base command to use for combining object files
  611. # into a static library.
  612. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components
  613. # of a shared library (may request position-independent
  614. # code, among other things).
  615. # SHLIB_LD - Base command to use for combining object files
  616. # into a shared library.
  617. # SHLIB_LD_FLAGS -Flags to pass when building a shared library. This
  618. # differes from the SHLIB_CFLAGS as it is not used
  619. # when building object files or executables.
  620. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
  621. # creating shared libraries. This symbol typically
  622. # goes at the end of the "ld" commands that build
  623. # shared libraries. The value of the symbol is
  624. # "${LIBS}" if all of the dependent libraries should
  625. # be specified when creating a shared library. If
  626. # dependent libraries should not be specified (as on
  627. # SunOS 4.x, where they cause the link to fail, or in
  628. # general if Tcl and Tk aren't themselves shared
  629. # libraries), then this symbol has an empty string
  630. # as its value.
  631. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
  632. # extensions. An empty string means we don't know how
  633. # to use shared libraries on this platform.
  634. # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
  635. # TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the
  636. # tclConfig.sh, since they are only used for the build
  637. # of Tcl and Tk.
  638. # Examples: MacOS X records the library version and
  639. # compatibility version in the shared library. But
  640. # of course the Tcl version of this is only used for Tcl.
  641. # LIB_SUFFIX - Specifies everything that comes after the "libfoo"
  642. # in a static or shared library name, using the $VERSION variable
  643. # to put the version in the right place. This is used
  644. # by platforms that need non-standard library names.
  645. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs
  646. # to have a version after the .so, and ${VERSION}.a
  647. # on AIX, since a shared library needs to have
  648. # a .a extension whereas shared objects for loadable
  649. # extensions have a .so extension. Defaults to
  650. # ${VERSION}${SHLIB_SUFFIX}.
  651. # TCL_NEEDS_EXP_FILE -
  652. # 1 means that an export file is needed to link to a
  653. # shared library.
  654. # TCL_EXP_FILE - The name of the installed export / import file which
  655. # should be used to link to the Tcl shared library.
  656. # Empty if Tcl is unshared.
  657. # TCL_BUILD_EXP_FILE -
  658. # The name of the built export / import file which
  659. # should be used to link to the Tcl shared library.
  660. # Empty if Tcl is unshared.
  661. # CFLAGS_DEBUG -
  662. # Flags used when running the compiler in debug mode
  663. # CFLAGS_OPTIMIZE -
  664. # Flags used when running the compiler in optimize mode
  665. # EXTRA_CFLAGS
  666. #
  667. #--------------------------------------------------------------------
  668. AC_DEFUN([SC_CONFIG_CFLAGS], [
  669. # Step 0.a: Enable 64 bit support?
  670. AC_MSG_CHECKING([if 64bit support is requested])
  671. AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
  672. if test "$enableval" = "yes"; then
  673. do64bit=yes
  674. else
  675. do64bit=no
  676. fi
  677. AC_MSG_RESULT($do64bit)
  678. # Step 0.b: Enable Solaris 64 bit VIS support?
  679. AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
  680. AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
  681. if test "$enableval" = "yes"; then
  682. # Force 64bit on with VIS
  683. do64bit=yes
  684. do64bitVIS=yes
  685. else
  686. do64bitVIS=no
  687. fi
  688. AC_MSG_RESULT($do64bitVIS)
  689. # Step 1: set the variable "system" to hold the name and version number
  690. # for the system. This can usually be done via the "uname" command, but
  691. # there are a few systems, like Next, where this doesn't work.
  692. AC_MSG_CHECKING([system version (for dynamic loading)])
  693. if test -f /usr/lib/NextStep/software_version; then
  694. system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  695. else
  696. system=`uname -s`-`uname -r`
  697. if test "$?" -ne 0 ; then
  698. AC_MSG_RESULT([unknown (can't find uname command)])
  699. system=unknown
  700. else
  701. # Special check for weird MP-RAS system (uname returns weird
  702. # results, and the version is kept in special file).
  703. if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  704. system=MP-RAS-`awk '{print $3}' /etc/.relid'`
  705. fi
  706. if test "`uname -s`" = "AIX" ; then
  707. system=AIX-`uname -v`.`uname -r`
  708. fi
  709. if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
  710. system=NetBSD-Debian
  711. fi
  712. AC_MSG_RESULT($system)
  713. fi
  714. fi
  715. # Step 2: check for existence of -ldl library. This is needed because
  716. # Linux can use either -ldl or -ldld for dynamic loading.
  717. AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
  718. # Require ranlib early so we can override it in special cases below.
  719. AC_REQUIRE([AC_PROG_RANLIB])
  720. # Step 3: set configuration options based on system name and version.
  721. do64bit_ok=no
  722. EXTRA_CFLAGS=""
  723. TCL_EXPORT_FILE_SUFFIX=""
  724. UNSHARED_LIB_SUFFIX=""
  725. TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
  726. ECHO_VERSION='`echo ${VERSION}`'
  727. TCL_LIB_VERSIONS_OK=ok
  728. CFLAGS_DEBUG=-g
  729. CFLAGS_OPTIMIZE=-O
  730. if test "$GCC" = "yes" ; then
  731. CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
  732. else
  733. CFLAGS_WARNING=""
  734. fi
  735. TCL_NEEDS_EXP_FILE=0
  736. TCL_BUILD_EXP_FILE=""
  737. TCL_EXP_FILE=""
  738. dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
  739. dnl AC_CHECK_TOOL(AR, ar)
  740. AC_CHECK_PROG(AR, ar, ar)
  741. if test "${AR}" = "" ; then
  742. AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
  743. fi
  744. STLIB_LD='${AR} cr'
  745. LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  746. PLAT_OBJS=""
  747. SHLIB_LD_FLAGS="-Wl,-soname,\${TCL_LIB_FILE}.0"
  748. case $system in
  749. AIX-5.*)
  750. if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
  751. # AIX requires the _r compiler when gcc isn't being used
  752. if test "${CC}" != "cc_r" ; then
  753. CC=${CC}_r
  754. fi
  755. AC_MSG_RESULT(Using $CC for compiling with threads)
  756. fi
  757. LIBS="$LIBS -lc"
  758. # AIX-5 uses ELF style dynamic libraries
  759. SHLIB_CFLAGS=""
  760. SHLIB_LD_LIBS='${LIBS}'
  761. SHLIB_SUFFIX=".so"
  762. if test "`uname -m`" = "ia64" ; then
  763. # AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
  764. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  765. # AIX-5 has dl* in libc.so
  766. DL_LIBS=""
  767. if test "$GCC" = "yes" ; then
  768. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  769. else
  770. CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
  771. fi
  772. LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  773. else
  774. SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  775. DL_LIBS="-ldl"
  776. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  777. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  778. TCL_NEEDS_EXP_FILE=1
  779. TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
  780. fi
  781. # Note: need the LIBS below, otherwise Tk won't find Tcl's
  782. # symbols when dynamically loaded into tclsh.
  783. DL_OBJS="tclLoadDl.o"
  784. LDFLAGS=""
  785. LD_LIBRARY_PATH_VAR="LIBPATH"
  786. # Check to enable 64-bit flags for compiler/linker
  787. if test "$do64bit" = "yes" ; then
  788. if test "$GCC" = "yes" ; then
  789. AC_MSG_WARN("64bit mode not supported with GCC on $system")
  790. else
  791. do64bit_ok=yes
  792. EXTRA_CFLAGS="-q64"
  793. LDFLAGS="-q64"
  794. RANLIB="${RANLIB} -X64"
  795. AR="${AR} -X64"
  796. SHLIB_LD_FLAGS="-b64"
  797. fi
  798. fi
  799. ;;
  800. AIX-*)
  801. if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
  802. # AIX requires the _r compiler when gcc isn't being used
  803. if test "${CC}" != "cc_r" ; then
  804. CC=${CC}_r
  805. fi
  806. AC_MSG_RESULT(Using $CC for compiling with threads)
  807. fi
  808. LIBS="$LIBS -lc"
  809. SHLIB_CFLAGS=""
  810. SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  811. SHLIB_LD_LIBS='${LIBS}'
  812. SHLIB_SUFFIX=".so"
  813. DL_OBJS="tclLoadDl.o"
  814. DL_LIBS="-ldl"
  815. LDFLAGS=""
  816. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  817. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  818. LD_LIBRARY_PATH_VAR="LIBPATH"
  819. TCL_NEEDS_EXP_FILE=1
  820. TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp'
  821. # AIX v<=4.1 has some different flags than 4.2+
  822. if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
  823. LIBOBJS="$LIBOBJS tclLoadAix.o"
  824. DL_LIBS="-lld"
  825. fi
  826. # On AIX <=v4 systems, libbsd.a has to be linked in to support
  827. # non-blocking file IO. This library has to be linked in after
  828. # the MATH_LIBS or it breaks the pow() function. The way to
  829. # insure proper sequencing, is to add it to the tail of MATH_LIBS.
  830. # This library also supplies gettimeofday.
  831. #
  832. # AIX does not have a timezone field in struct tm. When the AIX
  833. # bsd library is used, the timezone global and the gettimeofday
  834. # methods are to be avoided for timezone deduction instead, we
  835. # deduce the timezone by comparing the localtime result on a
  836. # known GMT value.
  837. AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
  838. if test $libbsd = yes; then
  839. MATH_LIBS="$MATH_LIBS -lbsd"
  840. AC_DEFINE(USE_DELTA_FOR_TZ)
  841. fi
  842. # Check to enable 64-bit flags for compiler/linker
  843. if test "$do64bit" = "yes" ; then
  844. if test "$GCC" = "yes" ; then
  845. AC_MSG_WARN("64bit mode not supported with GCC on $system")
  846. else
  847. do64bit_ok=yes
  848. EXTRA_CFLAGS="-q64"
  849. LDFLAGS="-q64"
  850. RANLIB="${RANLIB} -X64"
  851. AR="${AR} -X64"
  852. SHLIB_LD_FLAGS="-b64"
  853. fi
  854. fi
  855. ;;
  856. BSD/OS-2.1*|BSD/OS-3*)
  857. SHLIB_CFLAGS=""
  858. SHLIB_LD="shlicc -r"
  859. SHLIB_LD_LIBS='${LIBS}'
  860. SHLIB_SUFFIX=".so"
  861. DL_OBJS="tclLoadDl.o"
  862. DL_LIBS="-ldl"
  863. LDFLAGS=""
  864. CC_SEARCH_FLAGS=""
  865. LD_SEARCH_FLAGS=""
  866. ;;
  867. BSD/OS-4.*)
  868. SHLIB_CFLAGS="-export-dynamic -fPIC"
  869. SHLIB_LD="cc -shared"
  870. SHLIB_LD_LIBS='${LIBS}'
  871. SHLIB_SUFFIX=".so"
  872. DL_OBJS="tclLoadDl.o"
  873. DL_LIBS="-ldl"
  874. LDFLAGS="-export-dynamic"
  875. CC_SEARCH_FLAGS=""
  876. LD_SEARCH_FLAGS=""
  877. ;;
  878. dgux*)
  879. SHLIB_CFLAGS="-K PIC"
  880. SHLIB_LD="cc -G"
  881. SHLIB_LD_LIBS=""
  882. SHLIB_SUFFIX=".so"
  883. DL_OBJS="tclLoadDl.o"
  884. DL_LIBS="-ldl"
  885. LDFLAGS=""
  886. CC_SEARCH_FLAGS=""
  887. LD_SEARCH_FLAGS=""
  888. ;;
  889. HP-UX-*.11.*)
  890. # Use updated header definitions where possible
  891. AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
  892. AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
  893. LIBS="$LIBS -lxnet" # Use the XOPEN network library
  894. SHLIB_SUFFIX=".sl"
  895. AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  896. if test "$tcl_ok" = yes; then
  897. SHLIB_CFLAGS="+z"
  898. SHLIB_LD="ld -b"
  899. SHLIB_LD_LIBS='${LIBS}'
  900. DL_OBJS="tclLoadShl.o"
  901. DL_LIBS="-ldld"
  902. LDFLAGS="-Wl,-E"
  903. CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
  904. LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  905. LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  906. fi
  907. # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
  908. #EXTRA_CFLAGS="+DAportable"
  909. # Check to enable 64-bit flags for compiler/linker
  910. if test "$do64bit" = "yes" ; then
  911. if test "$GCC" = "yes" ; then
  912. hpux_arch=`gcc -dumpmachine`
  913. case $hpux_arch in
  914. hppa64*)
  915. # 64-bit gcc in use. Fix flags for GNU ld.
  916. do64bit_ok=yes
  917. SHLIB_LD="gcc -shared"
  918. SHLIB_LD_LIBS=""
  919. LD_SEARCH_FLAGS=''
  920. CC_SEARCH_FLAGS=''
  921. ;;
  922. *)
  923. AC_MSG_WARN("64bit mode not supported with GCC on $system")
  924. ;;
  925. esac
  926. else
  927. do64bit_ok=yes
  928. if test "`uname -m`" = "ia64" ; then
  929. EXTRA_CFLAGS="+DD64"
  930. LDFLAGS="+DD64 $LDFLAGS"
  931. else
  932. EXTRA_CFLAGS="+DA2.0W"
  933. LDFLAGS="+DA2.0W $LDFLAGS"
  934. fi
  935. fi
  936. fi
  937. ;;
  938. HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  939. SHLIB_SUFFIX=".sl"
  940. AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  941. if test "$tcl_ok" = yes; then
  942. SHLIB_CFLAGS="+z"
  943. SHLIB_LD="ld -b"
  944. SHLIB_LD_LIBS=""
  945. DL_OBJS="tclLoadShl.o"
  946. DL_LIBS="-ldld"
  947. LDFLAGS="-Wl,-E"
  948. CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
  949. LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  950. LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  951. fi
  952. ;;
  953. IRIX-4.*)
  954. SHLIB_CFLAGS="-G 0"
  955. SHLIB_SUFFIX=".a"
  956. SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  957. SHLIB_LD_LIBS='${LIBS}'
  958. DL_OBJS="tclLoadAout.o"
  959. DL_LIBS=""
  960. LDFLAGS="-Wl,-D,08000000"
  961. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  962. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  963. SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
  964. ;;
  965. IRIX-5.*)
  966. SHLIB_CFLAGS=""
  967. SHLIB_LD="ld -shared -rdata_shared"
  968. SHLIB_LD_LIBS='${LIBS}'
  969. SHLIB_SUFFIX=".so"
  970. DL_OBJS="tclLoadDl.o"
  971. DL_LIBS=""
  972. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  973. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  974. EXTRA_CFLAGS=""
  975. LDFLAGS=""
  976. ;;
  977. IRIX-6.*|IRIX64-6.5*)
  978. SHLIB_CFLAGS=""
  979. SHLIB_LD="ld -n32 -shared -rdata_shared"
  980. SHLIB_LD_LIBS='${LIBS}'
  981. SHLIB_SUFFIX=".so"
  982. DL_OBJS="tclLoadDl.o"
  983. DL_LIBS=""
  984. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  985. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  986. if test "$GCC" = "yes" ; then
  987. EXTRA_CFLAGS="-mabi=n32"
  988. LDFLAGS="-mabi=n32"
  989. else
  990. case $system in
  991. IRIX-6.3)
  992. # Use to build 6.2 compatible binaries on 6.3.
  993. EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
  994. ;;
  995. *)
  996. EXTRA_CFLAGS="-n32"
  997. ;;
  998. esac
  999. LDFLAGS="-n32"
  1000. fi
  1001. ;;
  1002. IRIX64-6.*)
  1003. SHLIB_CFLAGS=""
  1004. SHLIB_LD="ld -n32 -shared -rdata_shared"
  1005. SHLIB_LD_LIBS='${LIBS}'
  1006. SHLIB_SUFFIX=".so"
  1007. DL_OBJS="tclLoadDl.o"
  1008. DL_LIBS=""
  1009. LDFLAGS=""
  1010. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1011. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1012. # Check to enable 64-bit flags for compiler/linker
  1013. if test "$do64bit" = "yes" ; then
  1014. if test "$GCC" = "yes" ; then
  1015. AC_MSG_WARN([64bit mode not supported by gcc])
  1016. else
  1017. do64bit_ok=yes
  1018. SHLIB_LD="ld -64 -shared -rdata_shared"
  1019. EXTRA_CFLAGS="-64"
  1020. LDFLAGS="-64"
  1021. fi
  1022. fi
  1023. ;;
  1024. Linux*)
  1025. SHLIB_CFLAGS="-fPIC"
  1026. SHLIB_LD_LIBS='${LIBS}'
  1027. SHLIB_SUFFIX=".so"
  1028. # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
  1029. # when you inline the string and math operations. Turn this off to
  1030. # get rid of the warnings.
  1031. CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
  1032. if test "$have_dl" = yes; then
  1033. SHLIB_LD="${CC} -shared"
  1034. DL_OBJS="tclLoadDl.o"
  1035. DL_LIBS="-ldl"
  1036. LDFLAGS="-rdynamic"
  1037. CC_SEARCH_FLAGS=""
  1038. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1039. else
  1040. AC_CHECK_HEADER(dld.h, [
  1041. SHLIB_LD="ld -shared"
  1042. DL_OBJS="tclLoadDld.o"
  1043. DL_LIBS="-ldld"
  1044. LDFLAGS=""
  1045. CC_SEARCH_FLAGS=""
  1046. LD_SEARCH_FLAGS=""])
  1047. fi
  1048. if test "`uname -m`" = "alpha" ; then
  1049. EXTRA_CFLAGS="-mieee"
  1050. fi
  1051. # The combo of gcc + glibc has a bug related
  1052. # to inlining of functions like strtod(). The
  1053. # -fno-builtin flag should address this problem
  1054. # but it does not work. The -fno-inline flag
  1055. # is kind of overkill but it works.
  1056. # Disable inlining only when one of the
  1057. # files in compat/*.c is being linked in.
  1058. if test x"${LIBOBJS}" != x ; then
  1059. EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline"
  1060. fi
  1061. # XIM peeking works under XFree86.
  1062. # No it doesn't, at least not with newer versions, CW 2003
  1063. # AC_DEFINE(PEEK_XCLOSEIM)
  1064. ;;
  1065. GNU*)
  1066. SHLIB_CFLAGS="-fPIC"
  1067. SHLIB_LD_LIBS='${LIBS}'
  1068. SHLIB_SUFFIX=".so"
  1069. if test "$have_dl" = yes; then
  1070. SHLIB_LD="${CC} -shared"
  1071. DL_OBJS="tclLoadDl.o"
  1072. DL_LIBS="-ldl"
  1073. LDFLAGS="-rdynamic"
  1074. CC_SEARCH_FLAGS=""
  1075. LD_SEARCH_FLAGS="${CC_SEARCH_FLAGS}"
  1076. else
  1077. AC_CHECK_HEADER(dld.h, [
  1078. SHLIB_LD="ld -shared"
  1079. DL_OBJS="tclLoadDld.o"
  1080. DL_LIBS="-ldld"
  1081. LDFLAGS=""
  1082. CC_SEARCH_FLAGS=""
  1083. LD_SEARCH_FLAGS=""])
  1084. fi
  1085. if test "`uname -m`" = "alpha" ; then
  1086. EXTRA_CFLAGS="-mieee"
  1087. fi
  1088. ;;
  1089. MP-RAS-02*)
  1090. SHLIB_CFLAGS="-K PIC"
  1091. SHLIB_LD="cc -G"
  1092. SHLIB_LD_LIBS=""
  1093. SHLIB_SUFFIX=".so"
  1094. DL_OBJS="tclLoadDl.o"
  1095. DL_LIBS="-ldl"
  1096. LDFLAGS=""
  1097. CC_SEARCH_FLAGS=""
  1098. LD_SEARCH_FLAGS=""
  1099. ;;
  1100. MP-RAS-*)
  1101. SHLIB_CFLAGS="-K PIC"
  1102. SHLIB_LD="cc -G"
  1103. SHLIB_LD_LIBS=""
  1104. SHLIB_SUFFIX=".so"
  1105. DL_OBJS="tclLoadDl.o"
  1106. DL_LIBS="-ldl"
  1107. LDFLAGS="-Wl,-Bexport"
  1108. CC_SEARCH_FLAGS=""
  1109. LD_SEARCH_FLAGS=""
  1110. ;;
  1111. NetBSD-Debian)
  1112. SHLIB_CFLAGS="-fPIC"
  1113. SHLIB_LD_LIBS='${LIBS}'
  1114. SHLIB_SUFFIX=".so"
  1115. SHLIB_LD="${CC} -shared"
  1116. DL_OBJS="tclLoadDl.o"
  1117. DL_LIBS=""
  1118. LDFLAGS="-rdynamic"
  1119. LD_SEARCH_FLAGS=""
  1120. ;;
  1121. NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*)
  1122. # Not available on all versions: check for include file.
  1123. AC_CHECK_HEADER(dlfcn.h, [
  1124. # NetBSD/SPARC needs -fPIC, -fpic will not do.
  1125. SHLIB_CFLAGS="-fPIC"
  1126. SHLIB_LD="ld -Bshareable -x"
  1127. SHLIB_LD_LIBS=""
  1128. SHLIB_SUFFIX=".so"
  1129. DL_OBJS="tclLoadDl.o"
  1130. DL_LIBS=""
  1131. LDFLAGS=""
  1132. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1133. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1134. AC_MSG_CHECKING(for ELF)
  1135. AC_EGREP_CPP(yes, [
  1136. #ifdef __ELF__
  1137. yes
  1138. #endif
  1139. ],
  1140. AC_MSG_RESULT(yes)
  1141. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so',
  1142. AC_MSG_RESULT(no)
  1143. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
  1144. )
  1145. ], [
  1146. SHLIB_CFLAGS=""
  1147. SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
  1148. SHLIB_LD_LIBS='${LIBS}'
  1149. SHLIB_SUFFIX=".a"
  1150. DL_OBJS="tclLoadAout.o"
  1151. DL_LIBS=""
  1152. LDFLAGS=""
  1153. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1154. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1155. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1156. ])
  1157. # FreeBSD doesn't handle version numbers with dots.
  1158. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1159. TCL_LIB_VERSIONS_OK=nodots
  1160. ;;
  1161. FreeBSD-*)
  1162. # FreeBSD 3.* and greater have ELF.
  1163. SHLIB_CFLAGS="-fPIC"
  1164. SHLIB_LD="ld -Bshareable -x"
  1165. SHLIB_LD_LIBS='${LIBS}'
  1166. SHLIB_SUFFIX=".so"
  1167. DL_OBJS="tclLoadDl.o"
  1168. DL_LIBS=""
  1169. LDFLAGS="-export-dynamic"
  1170. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1171. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1172. if test "${TCL_THREADS}" = "1" ; then
  1173. # The -pthread needs to go in the CFLAGS, not LIBS
  1174. LIBS=`echo $LIBS | sed s/-pthread//`
  1175. EXTRA_CFLAGS="-pthread"
  1176. LDFLAGS="$LDFLAGS -pthread"
  1177. fi
  1178. case $system in
  1179. FreeBSD-3.*)
  1180. # FreeBSD-3 doesn't handle version numbers with dots.
  1181. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1182. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so'
  1183. TCL_LIB_VERSIONS_OK=nodots
  1184. ;;
  1185. esac
  1186. ;;
  1187. Rhapsody-*|Darwin-*)
  1188. SHLIB_CFLAGS="-fno-common"
  1189. SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
  1190. TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000"
  1191. TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000"
  1192. SHLIB_LD_LIBS='${LIBS}'
  1193. SHLIB_SUFFIX=".dylib"
  1194. DL_OBJS="tclLoadDyld.o"
  1195. PLAT_OBJS="tclMacOSXBundle.o"
  1196. DL_LIBS=""
  1197. LDFLAGS="-prebind"
  1198. CC_SEARCH_FLAGS=""
  1199. LD_SEARCH_FLAGS=""
  1200. CFLAGS_OPTIMIZE="-Os"
  1201. LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  1202. # for compatibility with autoconf vers 2.13 :
  1203. HACK=""
  1204. EXTRA_CFLAGS="-DMA${HACK}C_OSX_TCL -DHAVE_CFBUNDLE -DUSE_VFORK -DTCL_DEFAULT_ENCODING=\\\"utf-8\\\""
  1205. LIBS="$LIBS -framework CoreFoundation"
  1206. ;;
  1207. NEXTSTEP-*)
  1208. SHLIB_CFLAGS=""
  1209. SHLIB_LD="cc -nostdlib -r"
  1210. SHLIB_LD_LIBS=""
  1211. SHLIB_SUFFIX=".so"
  1212. DL_OBJS="tclLoadNext.o"
  1213. DL_LIBS=""
  1214. LDFLAGS=""
  1215. CC_SEARCH_FLAGS=""
  1216. LD_SEARCH_FLAGS=""
  1217. ;;
  1218. OS/390-*)
  1219. CFLAGS_OPTIMIZE="" # Optimizer is buggy
  1220. AC_DEFINE(_OE_SOCKETS) # needed in sys/socket.h
  1221. ;;
  1222. OSF1-1.0|OSF1-1.1|OSF1-1.2)
  1223. # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
  1224. SHLIB_CFLAGS=""
  1225. # Hack: make package name same as library name
  1226. SHLIB_LD='ld -R -export $@:'
  1227. SHLIB_LD_LIBS=""
  1228. SHLIB_SUFFIX=".so"
  1229. DL_OBJS="tclLoadOSF.o"
  1230. DL_LIBS=""
  1231. LDFLAGS=""
  1232. CC_SEARCH_FLAGS=""
  1233. LD_SEARCH_FLAGS=""
  1234. ;;
  1235. OSF1-1.*)
  1236. # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
  1237. SHLIB_CFLAGS="-fPIC"
  1238. if test "$SHARED_BUILD" = "1" ; then
  1239. SHLIB_LD="ld -shared"
  1240. else
  1241. SHLIB_LD="ld -non_shared"
  1242. fi
  1243. SHLIB_LD_LIBS=""
  1244. SHLIB_SUFFIX=".so"
  1245. DL_OBJS="tclLoadDl.o"
  1246. DL_LIBS=""
  1247. LDFLAGS=""
  1248. CC_SEARCH_FLAGS=""
  1249. LD_SEARCH_FLAGS=""
  1250. ;;
  1251. OSF1-V*)
  1252. # Digital OSF/1
  1253. SHLIB_CFLAGS=""
  1254. if test "$SHARED_BUILD" = "1" ; then
  1255. SHLIB_LD='ld -shared -expect_unresolved "*"'
  1256. else
  1257. SHLIB_LD='ld -non_shared -expect_unresolved "*"'
  1258. fi
  1259. SHLIB_LD_LIBS=""
  1260. SHLIB_SUFFIX=".so"
  1261. DL_OBJS="tclLoadDl.o"
  1262. DL_LIBS=""
  1263. LDFLAGS=""
  1264. CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1265. LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1266. if test "$GCC" != "yes" ; then
  1267. EXTRA_CFLAGS="-DHAVE_TZSET -std1"
  1268. fi
  1269. # see pthread_intro(3) for pthread support on osf1, k.furukawa
  1270. if test "${TCL_THREADS}" = "1" ; then
  1271. EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE"
  1272. EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64"
  1273. LIBS=`echo $LIBS | sed s/-lpthreads//`
  1274. if test "$GCC" = "yes" ; then
  1275. LIBS="$LIBS -lpthread -lmach -lexc"
  1276. else
  1277. EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread"
  1278. LDFLAGS="-pthread"
  1279. fi
  1280. fi
  1281. ;;
  1282. QNX-6*)
  1283. # QNX RTP
  1284. # This may work for all QNX, but it was only reported for v6.
  1285. SHLIB_CFLAGS="-fPIC"
  1286. SHLIB_LD="ld -Bshareable -x"
  1287. SHLIB_LD_LIBS=""
  1288. SHLIB_SUFFIX=".so"
  1289. DL_OBJS="tclLoadDl.o"
  1290. # dlopen is in -lc on QNX
  1291. DL_LIBS=""
  1292. LDFLAGS=""
  1293. CC_SEARCH_FLAGS=""
  1294. LD_SEARCH_FLAGS=""
  1295. ;;
  1296. RISCos-*)
  1297. SHLIB_CFLAGS="-G 0"
  1298. SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1299. SHLIB_LD_LIBS='${LIBS}'
  1300. SHLIB_SUFFIX=".a"
  1301. DL_OBJS="tclLoadAout.o"
  1302. DL_LIBS=""
  1303. LDFLAGS="-Wl,-D,08000000"
  1304. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1305. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1306. ;;
  1307. SCO_SV-3.2*)
  1308. # Note, dlopen is available only on SCO 3.2.5 and greater. However,
  1309. # this test works, since "uname -s" was non-standard in 3.2.4 and
  1310. # below.
  1311. if test "$GCC" = "yes" ; then
  1312. SHLIB_CFLAGS="-fPIC -melf"
  1313. LDFLAGS="-melf -Wl,-Bexport"
  1314. else
  1315. SHLIB_CFLAGS="-Kpic -belf"
  1316. LDFLAGS="-belf -Wl,-Bexport"
  1317. fi
  1318. SHLIB_LD="ld -G"
  1319. SHLIB_LD_LIBS=""
  1320. SHLIB_SUFFIX=".so"
  1321. DL_OBJS="tclLoadDl.o"
  1322. DL_LIBS=""
  1323. CC_SEARCH_FLAGS=""
  1324. LD_SEARCH_FLAGS=""
  1325. ;;
  1326. SINIX*5.4*)
  1327. SHLIB_CFLAGS="-K PIC"
  1328. SHLIB_LD="cc -G"
  1329. SHLIB_LD_LIBS=""
  1330. SHLIB_SUFFIX=".so"
  1331. DL_OBJS="tclLoadDl.o"
  1332. DL_LIBS="-ldl"
  1333. LDFLAGS=""
  1334. CC_SEARCH_FLAGS=""
  1335. LD_SEARCH_FLAGS=""
  1336. ;;
  1337. SunOS-4*)
  1338. SHLIB_CFLAGS="-PIC"
  1339. SHLIB_LD="ld"
  1340. SHLIB_LD_LIBS=""
  1341. SHLIB_SUFFIX=".so"
  1342. DL_OBJS="tclLoadDl.o"
  1343. DL_LIBS="-ldl"
  1344. LDFLAGS=""
  1345. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1346. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1347. # SunOS can't handle version numbers with dots in them in library
  1348. # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it
  1349. # requires an extra version number at the end of .so file names.
  1350. # So, the library has to have a name like libtcl75.so.1.0
  1351. SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'
  1352. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a'
  1353. TCL_LIB_VERSIONS_OK=nodots
  1354. ;;
  1355. SunOS-5.[[0-6]]*)
  1356. # Note: If _REENTRANT isn't defined, then Solaris
  1357. # won't define thread-safe library routines.
  1358. AC_DEFINE(_REENTRANT)
  1359. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
  1360. SHLIB_CFLAGS="-KPIC"
  1361. # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1362. # symbols when dynamically loaded into tclsh.
  1363. SHLIB_LD_LIBS='${LIBS}'
  1364. SHLIB_SUFFIX=".so"
  1365. DL_OBJS="tclLoadDl.o"
  1366. DL_LIBS="-ldl"
  1367. LDFLAGS=""
  1368. if test "$GCC" = "yes" ; then
  1369. SHLIB_LD="$CC -shared"
  1370. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1371. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1372. else
  1373. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1374. CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1375. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1376. fi
  1377. ;;
  1378. SunOS-5*)
  1379. # Note: If _REENTRANT isn't defined, then Solaris
  1380. # won't define thread-safe library routines.
  1381. AC_DEFINE(_REENTRANT)
  1382. AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
  1383. SHLIB_CFLAGS="-KPIC"
  1384. LDFLAGS=""
  1385. # Check to enable 64-bit flags for compiler/linker
  1386. if test "$do64bit" = "yes" ; then
  1387. arch=`isainfo`
  1388. if test "$arch" = "sparcv9 sparc" ; then
  1389. if test "$GCC" = "yes" ; then
  1390. AC_MSG_WARN("64bit mode not supported with GCC on $system")
  1391. else
  1392. do64bit_ok=yes
  1393. if test "$do64bitVIS" = "yes" ; then
  1394. EXTRA_CFLAGS="-xarch=v9a"
  1395. LDFLAGS="-xarch=v9a"
  1396. else
  1397. EXTRA_CFLAGS="-xarch=v9"
  1398. LDFLAGS="-xarch=v9"
  1399. fi
  1400. fi
  1401. else
  1402. AC_MSG_WARN("64bit mode only supported sparcv9 system")
  1403. fi
  1404. fi
  1405. # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1406. # symbols when dynamically loaded into tclsh.
  1407. SHLIB_LD_LIBS='${LIBS}'
  1408. SHLIB_SUFFIX=".so"
  1409. DL_OBJS="tclLoadDl.o"
  1410. DL_LIBS="-ldl"
  1411. if test "$GCC" = "yes" ; then
  1412. SHLIB_LD="$CC -shared"
  1413. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1414. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1415. else
  1416. SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1417. CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1418. LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1419. fi
  1420. ;;
  1421. ULTRIX-4.*)
  1422. SHLIB_CFLAGS="-G 0"
  1423. SHLIB_SUFFIX=".a"
  1424. SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1425. SHLIB_LD_LIBS='${LIBS}'
  1426. DL_OBJS="tclLoadAout.o"
  1427. DL_LIBS=""
  1428. LDFLAGS="-Wl,-D,08000000"
  1429. CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1430. LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1431. if test "$GCC" != "yes" ; then
  1432. EXTRA_CFLAGS="-DHAVE_TZSET -std1"
  1433. fi
  1434. ;;
  1435. UNIX_SV* | UnixWare-5*)
  1436. SHLIB_CFLAGS="-KPIC"
  1437. SHLIB_LD="cc -G"
  1438. SHLIB_LD_LIBS=""
  1439. SHLIB_SUFFIX=".so"
  1440. DL_OBJS="tclLoadDl.o"
  1441. DL_LIBS="-ldl"
  1442. # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  1443. # that don't grok the -Bexport option. Test that it does.
  1444. hold_ldflags=$LDFLAGS
  1445. AC_MSG_CHECKING(for ld accepts -Bexport flag)
  1446. LDFLAGS="${LDFLAGS} -Wl,-Bexport"
  1447. AC_TRY_LINK(, [int i;], found=yes, found=no)
  1448. LDFLAGS=$hold_ldflags
  1449. AC_MSG_RESULT($found)
  1450. if test $found = yes; then
  1451. LDFLAGS="-Wl,-Bexport"
  1452. else
  1453. LDFLAGS=""
  1454. fi
  1455. CC_SEARCH_FLAGS=""
  1456. LD_SEARCH_FLAGS=""
  1457. ;;
  1458. esac
  1459. if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
  1460. AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
  1461. fi
  1462. # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
  1463. # Loading for Tcl -- What Became of It?". Proc. 2nd Tcl/Tk Workshop,
  1464. # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
  1465. # to determine which of several header files defines the a.out file
  1466. # format (a.out.h, sys/exec.h, or sys/exec_aout.h). At present, we
  1467. # support only a file format that is more or less version-7-compatible.
  1468. # In particular,
  1469. # - a.out files must begin with `struct exec'.
  1470. # - the N_TXTOFF on the `struct exec' must compute the seek address
  1471. # of the text segment
  1472. # - The `struct exec' must contain a_magic, a_text, a_data, a_bss
  1473. # and a_entry fields.
  1474. # The following compilation should succeed if and only if either sys/exec.h
  1475. # or a.out.h is usable for the purpose.
  1476. #
  1477. # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
  1478. # `struct exec' includes a second header that contains information that
  1479. # duplicates the v7 fields that are needed.
  1480. if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
  1481. AC_MSG_CHECKING(sys/exec.h)
  1482. AC_TRY_COMPILE([#include <sys/exec.h>],[
  1483. struct exec foo;
  1484. unsigned long seek;
  1485. int flag;
  1486. #if defined(__mips) || defined(mips)
  1487. seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1488. #else
  1489. seek = N_TXTOFF (foo);
  1490. #endif
  1491. flag = (foo.a_magic == OMAGIC);
  1492. return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1493. ], tcl_ok=usable, tcl_ok=unusable)
  1494. AC_MSG_RESULT($tcl_ok)
  1495. if test $tcl_ok = usable; then
  1496. AC_DEFINE(USE_SYS_EXEC_H)
  1497. else
  1498. AC_MSG_CHECKING(a.out.h)
  1499. AC_TRY_COMPILE([#include <a.out.h>],[
  1500. struct exec foo;
  1501. unsigned long seek;
  1502. int flag;
  1503. #if defined(__mips) || defined(mips)
  1504. seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1505. #else
  1506. seek = N_TXTOFF (foo);
  1507. #endif
  1508. flag = (foo.a_magic == OMAGIC);
  1509. return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1510. ], tcl_ok=usable, tcl_ok=unusable)
  1511. AC_MSG_RESULT($tcl_ok)
  1512. if test $tcl_ok = usable; then
  1513. AC_DEFINE(USE_A_OUT_H)
  1514. else
  1515. AC_MSG_CHECKING(sys/exec_aout.h)
  1516. AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
  1517. struct exec foo;
  1518. unsigned long seek;
  1519. int flag;
  1520. #if defined(__mips) || defined(mips)
  1521. seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1522. #else
  1523. seek = N_TXTOFF (foo);
  1524. #endif
  1525. flag = (foo.a_midmag == OMAGIC);
  1526. return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1527. ], tcl_ok=usable, tcl_ok=unusable)
  1528. AC_MSG_RESULT($tcl_ok)
  1529. if test $tcl_ok = usable; then
  1530. AC_DEFINE(USE_SYS_EXEC_AOUT_H)
  1531. else
  1532. DL_OBJS=""
  1533. fi
  1534. fi
  1535. fi
  1536. fi
  1537. # Step 5: disable dynamic loading if requested via a command-line switch.
  1538. AC_ARG_ENABLE(load, [ --disable-load disallow dynamic loading and "load" command],
  1539. [tcl_ok=$enableval], [tcl_ok=yes])
  1540. if test "$tcl_ok" = "no"; then
  1541. DL_OBJS=""
  1542. fi
  1543. if test "x$DL_OBJS" != "x" ; then
  1544. BUILD_DLTEST="\$(DLTEST_TARGETS)"
  1545. else
  1546. echo "Can't figure out how to do dynamic loading or shared libraries"
  1547. echo "on this system."
  1548. SHLIB_CFLAGS=""
  1549. SHLIB_LD=""
  1550. SHLIB_SUFFIX=""
  1551. DL_OBJS="tclLoadNone.o"
  1552. DL_LIBS=""
  1553. LDFLAGS=""
  1554. CC_SEARCH_FLAGS=""
  1555. LD_SEARCH_FLAGS=""
  1556. BUILD_DLTEST=""
  1557. fi
  1558. # If we're running gcc, then change the C flags for compiling shared
  1559. # libraries to the right flags for gcc, instead of those for the
  1560. # standard manufacturer compiler.
  1561. if test "$DL_OBJS" != "tclLoadNone.o" ; then
  1562. if test "$GCC" = "yes" ; then
  1563. case $system in
  1564. AIX-*)
  1565. ;;
  1566. BSD/OS*)
  1567. ;;
  1568. IRIX*)
  1569. ;;
  1570. NetBSD-*|FreeBSD-*|OpenBSD-*)
  1571. ;;
  1572. Rhapsody-*|Darwin-*)
  1573. ;;
  1574. RISCos-*)
  1575. ;;
  1576. SCO_SV-3.2*)
  1577. ;;
  1578. ULTRIX-4.*)
  1579. ;;
  1580. *)
  1581. SHLIB_CFLAGS="-fPIC"
  1582. ;;
  1583. esac
  1584. fi
  1585. fi
  1586. if test "$SHARED_LIB_SUFFIX" = "" ; then
  1587. SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}${SHLIB_SUFFIX}'
  1588. fi
  1589. if test "$UNSHARED_LIB_SUFFIX" = "" ; then
  1590. UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a'
  1591. fi
  1592. if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then
  1593. LIB_SUFFIX=${SHARED_LIB_SUFFIX}
  1594. MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
  1595. INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
  1596. else
  1597. LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
  1598. if test "$RANLIB" = "" ; then
  1599. MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}'
  1600. INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)'
  1601. else
  1602. MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@'
  1603. INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))'
  1604. fi
  1605. dnl Not at all clear what this was doing in Tcl's configure.in
  1606. dnl or why it was needed was needed. In any event, this sort of
  1607. dnl things needs to be done in the big loop above.
  1608. dnl REMOVE THIS BLOCK LATER! (mdejong)
  1609. dnl case $system in
  1610. dnl BSD/OS*)
  1611. dnl ;;
  1612. dnl AIX-[[1-4]].*)
  1613. dnl ;;
  1614. dnl *)
  1615. dnl SHLIB_LD_LIBS=""
  1616. dnl ;;
  1617. dnl esac
  1618. fi
  1619. # Stub lib does not depend on shared/static configuration
  1620. if test "$RANLIB" = "" ; then
  1621. MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}'
  1622. INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)'
  1623. else
  1624. MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@'
  1625. INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))'
  1626. fi
  1627. AC_SUBST(DL_LIBS)
  1628. AC_SUBST(DL_OBJS)
  1629. AC_SUBST(PLAT_OBJS)
  1630. AC_SUBST(CFLAGS)
  1631. AC_SUBST(CFLAGS_DEBUG)
  1632. AC_SUBST(CFLAGS_OPTIMIZE)
  1633. AC_SUBST(CFLAGS_WARNING)
  1634. AC_SUBST(EXTRA_CFLAGS)
  1635. AC_SUBST(LDFLAGS)
  1636. AC_SUBST(LDFLAGS_DEBUG)
  1637. AC_SUBST(LDFLAGS_OPTIMIZE)
  1638. AC_SUBST(CC_SEARCH_FLAGS)
  1639. AC_SUBST(LD_SEARCH_FLAGS)
  1640. AC_SUBST(STLIB_LD)
  1641. AC_SUBST(SHLIB_LD)
  1642. AC_SUBST(TCL_SHLIB_LD_EXTRAS)
  1643. AC_SUBST(TK_SHLIB_LD_EXTRAS)
  1644. AC_SUBST(SHLIB_LD_FLAGS)
  1645. AC_SUBST(SHLIB_LD_LIBS)
  1646. AC_SUBST(SHLIB_CFLAGS)
  1647. AC_SUBST(SHLIB_SUFFIX)
  1648. AC_SUBST(MAKE_LIB)
  1649. AC_SUBST(MAKE_STUB_LIB)
  1650. AC_SUBST(INSTALL_LIB)
  1651. AC_SUBST(INSTALL_STUB_LIB)
  1652. AC_SUBST(RANLIB)
  1653. ])
  1654. #--------------------------------------------------------------------
  1655. # SC_SERIAL_PORT
  1656. #
  1657. # Determine which interface to use to talk to the serial port.
  1658. # Note that #include lines must begin in leftmost column for
  1659. # some compilers to recognize them as preprocessor directives,
  1660. # and some build environments have stdin not pointing at a
  1661. # pseudo-terminal (usually /dev/null instead.)
  1662. #
  1663. # Arguments:
  1664. # none
  1665. #
  1666. # Results:
  1667. #
  1668. # Defines only one of the following vars:
  1669. # HAVE_SYS_MODEM_H
  1670. # USE_TERMIOS
  1671. # USE_TERMIO
  1672. # USE_SGTTY
  1673. #
  1674. #--------------------------------------------------------------------
  1675. AC_DEFUN([SC_SERIAL_PORT], [
  1676. AC_CHECK_HEADERS(sys/modem.h)
  1677. AC_MSG_CHECKING([termios vs. termio vs. sgtty])
  1678. AC_CACHE_VAL(tcl_cv_api_serial, [
  1679. AC_TRY_RUN([
  1680. #include <termios.h>
  1681. int main() {
  1682. struct termios t;
  1683. if (tcgetattr(0, &t) == 0) {
  1684. cfsetospeed(&t, 0);
  1685. t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
  1686. return 0;
  1687. }
  1688. return 1;
  1689. }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1690. if test $tcl_cv_api_serial = no ; then
  1691. AC_TRY_RUN([
  1692. #include <termio.h>
  1693. int main() {
  1694. struct termio t;
  1695. if (ioctl(0, TCGETA, &t) == 0) {
  1696. t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
  1697. return 0;
  1698. }
  1699. return 1;
  1700. }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1701. fi
  1702. if test $tcl_cv_api_serial = no ; then
  1703. AC_TRY_RUN([
  1704. #include <sgtty.h>
  1705. int main() {
  1706. struct sgttyb t;
  1707. if (ioctl(0, TIOCGETP, &t) == 0) {
  1708. t.sg_ospeed = 0;
  1709. t.sg_flags |= ODDP | EVENP | RAW;
  1710. return 0;
  1711. }
  1712. return 1;
  1713. }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1714. fi
  1715. if test $tcl_cv_api_serial = no ; then
  1716. AC_TRY_RUN([
  1717. #include <termios.h>
  1718. #include <errno.h>
  1719. int main() {
  1720. struct termios t;
  1721. if (tcgetattr(0, &t) == 0
  1722. || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  1723. cfsetospeed(&t, 0);
  1724. t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB;
  1725. return 0;
  1726. }
  1727. return 1;
  1728. }], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1729. fi
  1730. if test $tcl_cv_api_serial = no; then
  1731. AC_TRY_RUN([
  1732. #include <termio.h>
  1733. #include <errno.h>
  1734. int main() {
  1735. struct termio t;
  1736. if (ioctl(0, TCGETA, &t) == 0
  1737. || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  1738. t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB;
  1739. return 0;
  1740. }
  1741. return 1;
  1742. }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1743. fi
  1744. if test $tcl_cv_api_serial = no; then
  1745. AC_TRY_RUN([
  1746. #include <sgtty.h>
  1747. #include <errno.h>
  1748. int main() {
  1749. struct sgttyb t;
  1750. if (ioctl(0, TIOCGETP, &t) == 0
  1751. || errno == ENOTTY || errno == ENXIO || errno == EINVAL) {
  1752. t.sg_ospeed = 0;
  1753. t.sg_flags |= ODDP | EVENP | RAW;
  1754. return 0;
  1755. }
  1756. return 1;
  1757. }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
  1758. fi])
  1759. case $tcl_cv_api_serial in
  1760. termios) AC_DEFINE(USE_TERMIOS);;
  1761. termio) AC_DEFINE(USE_TERMIO);;
  1762. sgtty) AC_DEFINE(USE_SGTTY);;
  1763. esac
  1764. AC_MSG_RESULT($tcl_cv_api_serial)
  1765. ])
  1766. #--------------------------------------------------------------------
  1767. # SC_MISSING_POSIX_HEADERS
  1768. #
  1769. # Supply substitutes for missing POSIX header files. Special
  1770. # notes:
  1771. # - stdlib.h doesn't define strtol, strtoul, or
  1772. # strtod insome versions of SunOS
  1773. # - some versions of string.h don't declare procedures such
  1774. # as strstr
  1775. #
  1776. # Arguments:
  1777. # none
  1778. #
  1779. # Results:
  1780. #
  1781. # Defines some of the following vars:
  1782. # NO_DIRENT_H
  1783. # NO_ERRNO_H
  1784. # NO_VALUES_H
  1785. # NO_LIMITS_H
  1786. # NO_STDLIB_H
  1787. # NO_STRING_H
  1788. # NO_SYS_WAIT_H
  1789. # NO_DLFCN_H
  1790. # HAVE_UNISTD_H
  1791. # HAVE_SYS_PARAM_H
  1792. #
  1793. # HAVE_STRING_H ?
  1794. #
  1795. #--------------------------------------------------------------------
  1796. AC_DEFUN([SC_MISSING_POSIX_HEADERS], [
  1797. AC_MSG_CHECKING(dirent.h)
  1798. AC_TRY_LINK([#include <sys/types.h>
  1799. #include <dirent.h>], [
  1800. #ifndef _POSIX_SOURCE
  1801. # ifdef __Lynx__
  1802. /*
  1803. * Generate compilation error to make the test fail: Lynx headers
  1804. * are only valid if really in the POSIX environment.
  1805. */
  1806. missing_procedure();
  1807. # endif
  1808. #endif
  1809. DIR *d;
  1810. struct dirent *entryPtr;
  1811. char *p;
  1812. d = opendir("foobar");
  1813. entryPtr = readdir(d);
  1814. p = entryPtr->d_name;
  1815. closedir(d);
  1816. ], tcl_ok=yes, tcl_ok=no)
  1817. if test $tcl_ok = no; then
  1818. AC_DEFINE(NO_DIRENT_H)
  1819. fi
  1820. AC_MSG_RESULT($tcl_ok)
  1821. AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
  1822. AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
  1823. AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
  1824. AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)])
  1825. AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
  1826. AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
  1827. AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
  1828. AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
  1829. if test $tcl_ok = 0; then
  1830. AC_DEFINE(NO_STDLIB_H)
  1831. fi
  1832. AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
  1833. AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
  1834. AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
  1835. # See also memmove check below for a place where NO_STRING_H can be
  1836. # set and why.
  1837. if test $tcl_ok = 0; then
  1838. AC_DEFINE(NO_STRING_H)
  1839. fi
  1840. AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
  1841. AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
  1842. # OS/390 lacks sys/param.h (and doesn't need it, by chance).
  1843. AC_HAVE_HEADERS(unistd.h sys/param.h)
  1844. ])
  1845. #--------------------------------------------------------------------
  1846. # SC_PATH_X
  1847. #
  1848. # Locate the X11 header files and the X11 library archive. Try
  1849. # the ac_path_x macro first, but if it doesn't find the X stuff
  1850. # (e.g. because there's no xmkmf program) then check through
  1851. # a list of possible directories. Under some conditions the
  1852. # autoconf macro will return an include directory that contains
  1853. # no include files, so double-check its result just to be safe.
  1854. #
  1855. # Arguments:
  1856. # none
  1857. #
  1858. # Results:
  1859. #
  1860. # Sets the the following vars:
  1861. # XINCLUDES
  1862. # XLIBSW
  1863. #
  1864. #--------------------------------------------------------------------
  1865. AC_DEFUN([SC_PATH_X], [
  1866. AC_PATH_X
  1867. not_really_there=""
  1868. if test "$no_x" = ""; then
  1869. if test "$x_includes" = ""; then
  1870. AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
  1871. else
  1872. if test ! -r $x_includes/X11/Intrinsic.h; then
  1873. not_really_there="yes"
  1874. fi
  1875. fi
  1876. fi
  1877. if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  1878. AC_MSG_CHECKING(for X11 header files)
  1879. found_xincludes="no"
  1880. AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
  1881. if test "$found_xincludes" = "no"; then
  1882. 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"
  1883. for i in $dirs ; do
  1884. if test -r $i/X11/Intrinsic.h; then
  1885. AC_MSG_RESULT($i)
  1886. XINCLUDES=" -I$i"
  1887. found_xincludes="yes"
  1888. break
  1889. fi
  1890. done
  1891. fi
  1892. else
  1893. if test "$x_includes" != ""; then
  1894. XINCLUDES="-I$x_includes"
  1895. found_xincludes="yes"
  1896. fi
  1897. fi
  1898. if test found_xincludes = "no"; then
  1899. AC_MSG_RESULT(couldn't find any!)
  1900. fi
  1901. if test "$no_x" = yes; then
  1902. AC_MSG_CHECKING(for X11 libraries)
  1903. XLIBSW=nope
  1904. 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"
  1905. for i in $dirs ; do
  1906. if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
  1907. AC_MSG_RESULT($i)
  1908. XLIBSW="-L$i -lX11"
  1909. x_libraries="$i"
  1910. break
  1911. fi
  1912. done
  1913. else
  1914. if test "$x_libraries" = ""; then
  1915. XLIBSW=-lX11
  1916. else
  1917. XLIBSW="-L$x_libraries -lX11"
  1918. fi
  1919. fi
  1920. if test "$XLIBSW" = nope ; then
  1921. AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
  1922. fi
  1923. if test "$XLIBSW" = nope ; then
  1924. AC_MSG_RESULT(couldn't find any! Using -lX11.)
  1925. XLIBSW=-lX11
  1926. fi
  1927. ])
  1928. #--------------------------------------------------------------------
  1929. # SC_BLOCKING_STYLE
  1930. #
  1931. # The statements below check for systems where POSIX-style
  1932. # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
  1933. # On these systems (mostly older ones), use the old BSD-style
  1934. # FIONBIO approach instead.
  1935. #
  1936. # Arguments:
  1937. # none
  1938. #
  1939. # Results:
  1940. #
  1941. # Defines some of the following vars:
  1942. # HAVE_SYS_IOCTL_H
  1943. # HAVE_SYS_FILIO_H
  1944. # USE_FIONBIO
  1945. # O_NONBLOCK
  1946. #
  1947. #--------------------------------------------------------------------
  1948. AC_DEFUN([SC_BLOCKING_STYLE], [
  1949. AC_CHECK_HEADERS(sys/ioctl.h)
  1950. AC_CHECK_HEADERS(sys/filio.h)
  1951. AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
  1952. if test -f /usr/lib/NextStep/software_version; then
  1953. system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  1954. else
  1955. system=`uname -s`-`uname -r`
  1956. if test "$?" -ne 0 ; then
  1957. system=unknown
  1958. else
  1959. # Special check for weird MP-RAS system (uname returns weird
  1960. # results, and the version is kept in special file).
  1961. if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  1962. system=MP-RAS-`awk '{print $3}' /etc/.relid'`
  1963. fi
  1964. if test "`uname -s`" = "AIX" ; then
  1965. system=AIX-`uname -v`.`uname -r`
  1966. fi
  1967. fi
  1968. fi
  1969. case $system in
  1970. # There used to be code here to use FIONBIO under AIX. However, it
  1971. # was reported that FIONBIO doesn't work under AIX 3.2.5. Since
  1972. # using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
  1973. # code (JO, 5/31/97).
  1974. OSF*)
  1975. AC_DEFINE(USE_FIONBIO)
  1976. AC_MSG_RESULT(FIONBIO)
  1977. ;;
  1978. SunOS-4*)
  1979. AC_DEFINE(USE_FIONBIO)
  1980. AC_MSG_RESULT(FIONBIO)
  1981. ;;
  1982. ULTRIX-4.*)
  1983. AC_DEFINE(USE_FIONBIO)
  1984. AC_MSG_RESULT(FIONBIO)
  1985. ;;
  1986. *)
  1987. AC_MSG_RESULT(O_NONBLOCK)
  1988. ;;
  1989. esac
  1990. ])
  1991. #--------------------------------------------------------------------
  1992. # SC_TIME_HANLDER
  1993. #
  1994. # Checks how the system deals with time.h, what time structures
  1995. # are used on the system, and what fields the structures have.
  1996. #
  1997. # Arguments:
  1998. # none
  1999. #
  2000. # Results:
  2001. #
  2002. # Defines some of the following vars:
  2003. # USE_DELTA_FOR_TZ
  2004. # HAVE_TM_GMTOFF
  2005. # HAVE_TM_TZADJ
  2006. # HAVE_TIMEZONE_VAR
  2007. #
  2008. #--------------------------------------------------------------------
  2009. AC_DEFUN([SC_TIME_HANDLER], [
  2010. AC_CHECK_HEADERS(sys/time.h)
  2011. AC_HEADER_TIME
  2012. AC_STRUCT_TIMEZONE
  2013. AC_CHECK_FUNCS(gmtime_r localtime_r)
  2014. AC_MSG_CHECKING([tm_tzadj in struct tm])
  2015. AC_CACHE_VAL(tcl_cv_member_tm_tzadj,
  2016. AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
  2017. tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
  2018. AC_MSG_RESULT($tcl_cv_member_tm_tzadj)
  2019. if test $tcl_cv_member_tm_tzadj = yes ; then
  2020. AC_DEFINE(HAVE_TM_TZADJ)
  2021. fi
  2022. AC_MSG_CHECKING([tm_gmtoff in struct tm])
  2023. AC_CACHE_VAL(tcl_cv_member_tm_gmtoff,
  2024. AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
  2025. tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
  2026. AC_MSG_RESULT($tcl_cv_member_tm_gmtoff)
  2027. if test $tcl_cv_member_tm_gmtoff = yes ; then
  2028. AC_DEFINE(HAVE_TM_GMTOFF)
  2029. fi
  2030. #
  2031. # Its important to include time.h in this check, as some systems
  2032. # (like convex) have timezone functions, etc.
  2033. #
  2034. AC_MSG_CHECKING([long timezone variable])
  2035. AC_CACHE_VAL(tcl_cv_var_timezone,
  2036. AC_TRY_COMPILE([#include <time.h>],
  2037. [extern long timezone;
  2038. timezone += 1;
  2039. exit (0);],
  2040. tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
  2041. AC_MSG_RESULT($tcl_cv_timezone_long)
  2042. if test $tcl_cv_timezone_long = yes ; then
  2043. AC_DEFINE(HAVE_TIMEZONE_VAR)
  2044. else
  2045. #
  2046. # On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
  2047. #
  2048. AC_MSG_CHECKING([time_t timezone variable])
  2049. AC_CACHE_VAL(tcl_cv_timezone_time,
  2050. AC_TRY_COMPILE([#include <time.h>],
  2051. [extern time_t timezone;
  2052. timezone += 1;
  2053. exit (0);],
  2054. tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
  2055. AC_MSG_RESULT($tcl_cv_timezone_time)
  2056. if test $tcl_cv_timezone_time = yes ; then
  2057. AC_DEFINE(HAVE_TIMEZONE_VAR)
  2058. fi
  2059. fi
  2060. ])
  2061. #--------------------------------------------------------------------
  2062. # SC_BUGGY_STRTOD
  2063. #
  2064. # Under Solaris 2.4, strtod returns the wrong value for the
  2065. # terminating character under some conditions. Check for this
  2066. # and if the problem exists use a substitute procedure
  2067. # "fixstrtod" (provided by Tcl) that corrects the error.
  2068. # Also, on Compaq's Tru64 Unix 5.0,
  2069. # strtod(" ") returns 0.0 instead of a failure to convert.
  2070. #
  2071. # Arguments:
  2072. # none
  2073. #
  2074. # Results:
  2075. #
  2076. # Might defines some of the following vars:
  2077. # strtod (=fixstrtod)
  2078. #
  2079. #--------------------------------------------------------------------
  2080. AC_DEFUN([SC_BUGGY_STRTOD], [
  2081. AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
  2082. if test "$tcl_strtod" = 1; then
  2083. AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
  2084. AC_CACHE_VAL(tcl_cv_strtod_buggy,[
  2085. AC_TRY_RUN([
  2086. extern double strtod();
  2087. int main() {
  2088. char *infString="Inf", *nanString="NaN", *spaceString=" ";
  2089. char *term;
  2090. double value;
  2091. value = strtod(infString, &term);
  2092. if ((term != infString) && (term[-1] == 0)) {
  2093. exit(1);
  2094. }
  2095. value = strtod(nanString, &term);
  2096. if ((term != nanString) && (term[-1] == 0)) {
  2097. exit(1);
  2098. }
  2099. value = strtod(spaceString, &term);
  2100. if (term == (spaceString+1)) {
  2101. exit(1);
  2102. }
  2103. exit(0);
  2104. }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)])
  2105. if test "$tcl_cv_strtod_buggy" = 1; then
  2106. AC_MSG_RESULT(ok)
  2107. else
  2108. AC_MSG_RESULT(buggy)
  2109. LIBOBJS="$LIBOBJS fixstrtod.o"
  2110. AC_DEFINE(strtod, fixstrtod)
  2111. fi
  2112. fi
  2113. ])
  2114. #--------------------------------------------------------------------
  2115. # SC_TCL_LINK_LIBS
  2116. #
  2117. # Search for the libraries needed to link the Tcl shell.
  2118. # Things like the math library (-lm) and socket stuff (-lsocket vs.
  2119. # -lnsl) are dealt with here.
  2120. #
  2121. # Arguments:
  2122. # Requires the following vars to be set in the Makefile:
  2123. # DL_LIBS
  2124. # LIBS
  2125. # MATH_LIBS
  2126. #
  2127. # Results:
  2128. #
  2129. # Subst's the following var:
  2130. # TCL_LIBS
  2131. # MATH_LIBS
  2132. #
  2133. # Might append to the following vars:
  2134. # LIBS
  2135. #
  2136. # Might define the following vars:
  2137. # HAVE_NET_ERRNO_H
  2138. #
  2139. #--------------------------------------------------------------------
  2140. AC_DEFUN([SC_TCL_LINK_LIBS], [
  2141. #--------------------------------------------------------------------
  2142. # On a few very rare systems, all of the libm.a stuff is
  2143. # already in libc.a. Set compiler flags accordingly.
  2144. # Also, Linux requires the "ieee" library for math to work
  2145. # right (and it must appear before "-lm").
  2146. #--------------------------------------------------------------------
  2147. AC_CHECK_FUNC(sin, MATH_LIBS="", MATH_LIBS="-lm")
  2148. AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
  2149. #--------------------------------------------------------------------
  2150. # Interactive UNIX requires -linet instead of -lsocket, plus it
  2151. # needs net/errno.h to define the socket-related error codes.
  2152. #--------------------------------------------------------------------
  2153. AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
  2154. AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)])
  2155. #--------------------------------------------------------------------
  2156. # Check for the existence of the -lsocket and -lnsl libraries.
  2157. # The order here is important, so that they end up in the right
  2158. # order in the command line generated by make. Here are some
  2159. # special considerations:
  2160. # 1. Use "connect" and "accept" to check for -lsocket, and
  2161. # "gethostbyname" to check for -lnsl.
  2162. # 2. Use each function name only once: can't redo a check because
  2163. # autoconf caches the results of the last check and won't redo it.
  2164. # 3. Use -lnsl and -lsocket only if they supply procedures that
  2165. # aren't already present in the normal libraries. This is because
  2166. # IRIX 5.2 has libraries, but they aren't needed and they're
  2167. # bogus: they goof up name resolution if used.
  2168. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  2169. # To get around this problem, check for both libraries together
  2170. # if -lsocket doesn't work by itself.
  2171. #--------------------------------------------------------------------
  2172. tcl_checkBoth=0
  2173. AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1)
  2174. if test "$tcl_checkSocket" = 1; then
  2175. AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt,
  2176. LIBS="$LIBS -lsocket", tcl_checkBoth=1)])
  2177. fi
  2178. if test "$tcl_checkBoth" = 1; then
  2179. tk_oldLibs=$LIBS
  2180. LIBS="$LIBS -lsocket -lnsl"
  2181. AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs])
  2182. fi
  2183. AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname,
  2184. [LIBS="$LIBS -lnsl"])])
  2185. # Don't perform the eval of the libraries here because DL_LIBS
  2186. # won't be set until we call SC_CONFIG_CFLAGS
  2187. TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
  2188. AC_SUBST(TCL_LIBS)
  2189. AC_SUBST(MATH_LIBS)
  2190. ])
  2191. #--------------------------------------------------------------------
  2192. # SC_TCL_EARLY_FLAGS
  2193. #
  2194. # Check for what flags are needed to be passed so the correct OS
  2195. # features are available.
  2196. #
  2197. # Arguments:
  2198. # None
  2199. #
  2200. # Results:
  2201. #
  2202. # Might define the following vars:
  2203. # _ISOC99_SOURCE
  2204. # _LARGEFILE64_SOURCE
  2205. #
  2206. #--------------------------------------------------------------------
  2207. AC_DEFUN([SC_TCL_EARLY_FLAG],[
  2208. AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
  2209. AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
  2210. AC_TRY_COMPILE([[#define ]$1[ 1
  2211. ]$2], $3,
  2212. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
  2213. [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
  2214. if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
  2215. AC_DEFINE($1)
  2216. tcl_flags="$tcl_flags $1"
  2217. fi])
  2218. AC_DEFUN([SC_TCL_EARLY_FLAGS],[
  2219. AC_MSG_CHECKING([for required early compiler flags])
  2220. tcl_flags=""
  2221. SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
  2222. [char *p = (char *)strtoll; char *q = (char *)strtoull;])
  2223. SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
  2224. [struct stat64 buf; int i = stat64("/", &buf);])
  2225. if test "x${tcl_flags}" = "x" ; then
  2226. AC_MSG_RESULT(none)
  2227. else
  2228. AC_MSG_RESULT(${tcl_flags})
  2229. fi])
  2230. #--------------------------------------------------------------------
  2231. # SC_TCL_64BIT_FLAGS
  2232. #
  2233. # Check for what is defined in the way of 64-bit features.
  2234. #
  2235. # Arguments:
  2236. # None
  2237. #
  2238. # Results:
  2239. #
  2240. # Might define the following vars:
  2241. # TCL_WIDE_INT_IS_LONG
  2242. # TCL_WIDE_INT_TYPE
  2243. # HAVE_STRUCT_DIRENT64
  2244. # HAVE_STRUCT_STAT64
  2245. # HAVE_TYPE_OFF64_T
  2246. #
  2247. #--------------------------------------------------------------------
  2248. AC_DEFUN([SC_TCL_64BIT_FLAGS], [
  2249. AC_MSG_CHECKING([for 64-bit integer type])
  2250. AC_CACHE_VAL(tcl_cv_type_64bit,[
  2251. tcl_cv_type_64bit=none
  2252. # See if the compiler knows natively about __int64
  2253. AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
  2254. tcl_type_64bit=__int64, tcl_type_64bit="long long")
  2255. # See if we should use long anyway Note that we substitute in the
  2256. # type that is our current guess for a 64-bit type inside this check
  2257. # program, so it should be modified only carefully...
  2258. AC_TRY_RUN([#include <unistd.h>
  2259. int main() {exit(!(sizeof(]${tcl_type_64bit}[) > sizeof(long)));}
  2260. ], tcl_cv_type_64bit=${tcl_type_64bit},:,:)])
  2261. if test "${tcl_cv_type_64bit}" = none ; then
  2262. AC_DEFINE(TCL_WIDE_INT_IS_LONG)
  2263. AC_MSG_RESULT(using long)
  2264. else
  2265. AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
  2266. AC_MSG_RESULT(${tcl_cv_type_64bit})
  2267. # Now check for auxiliary declarations
  2268. AC_MSG_CHECKING([for struct dirent64])
  2269. AC_CACHE_VAL(tcl_cv_struct_dirent64,[
  2270. AC_TRY_COMPILE([#include <sys/types.h>
  2271. #include <sys/dirent.h>],[struct dirent64 p;],
  2272. tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
  2273. if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
  2274. AC_DEFINE(HAVE_STRUCT_DIRENT64)
  2275. fi
  2276. AC_MSG_RESULT(${tcl_cv_struct_dirent64})
  2277. AC_MSG_CHECKING([for struct stat64])
  2278. AC_CACHE_VAL(tcl_cv_struct_stat64,[
  2279. AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
  2280. ],
  2281. tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
  2282. if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
  2283. AC_DEFINE(HAVE_STRUCT_STAT64)
  2284. fi
  2285. AC_MSG_RESULT(${tcl_cv_struct_stat64})
  2286. AC_MSG_CHECKING([for off64_t])
  2287. AC_CACHE_VAL(tcl_cv_type_off64_t,[
  2288. AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
  2289. ],
  2290. tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
  2291. if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
  2292. AC_DEFINE(HAVE_TYPE_OFF64_T)
  2293. fi
  2294. AC_MSG_RESULT(${tcl_cv_type_off64_t})
  2295. fi])