acinclude.m4 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  1. dnl aclocal.m4
  2. dnl macros autoconf uses when building configure from configure.in
  3. dnl
  4. dnl
  5. dnl EGG_CHECK_CC()
  6. dnl
  7. dnl FIXME: make a better test
  8. dnl
  9. AC_DEFUN(EGG_CHECK_CC, [dnl
  10. if test "${cross_compiling-x}" = "x"
  11. then
  12. cat << 'EOF' >&2
  13. configure: error:
  14. This system does not appear to have a working C compiler.
  15. A working C compiler is required to compile Eggdrop.
  16. EOF
  17. exit 1
  18. fi
  19. ])dnl
  20. dnl EGG_IPV6_OPTIONS()
  21. dnl
  22. AC_DEFUN(EGG_IPV6_OPTIONS, [dnl
  23. AC_MSG_CHECKING(whether or not you disabled IPv6 support)
  24. AC_ARG_ENABLE(ipv6, [ --disable-ipv6 disable IPv6 support],
  25. [ ac_cv_dipv6="yes"
  26. AC_MSG_RESULT(yes)
  27. ],
  28. [ ac_cv_dipv6="no"
  29. if test "$egg_cv_ipv6_supported" = "no"; then
  30. ac_cv_dipv6="no"
  31. fi
  32. AC_MSG_RESULT($ac_cv_dipv6)
  33. ])
  34. if test "$ac_cv_dipv6" = "no"; then
  35. AC_DEFINE(USE_IPV6, 1, [Define if you want ipv6 support])
  36. fi
  37. ])dnl
  38. dnl EGG_CHECK_SOCKLEN_T()
  39. dnl
  40. AC_DEFUN(EGG_CHECK_SOCKLEN_T, [dnl
  41. AC_MSG_CHECKING(for socklen_t)
  42. AC_CACHE_VAL(egg_cv_socklen_t,[
  43. AC_TRY_RUN([
  44. #include <unistd.h>
  45. #include <sys/types.h>
  46. #include <sys/socket.h>
  47. #include <netinet/in.h>
  48. #include <arpa/inet.h>
  49. int main()
  50. {
  51. socklen_t test = sizeof(int);
  52. return 0;
  53. }
  54. ],
  55. egg_cv_socklen_t=yes, egg_cv_socklen_t=no, egg_cv_socklen_t=no)])
  56. if test "$egg_cv_socklen_t" = "yes"; then
  57. AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if you have support for socklen_t])
  58. AC_MSG_RESULT(yes)
  59. else
  60. AC_MSG_RESULT(no)
  61. fi
  62. ])dnl
  63. dnl EGG_CHECK_CCPIPE()
  64. dnl
  65. dnl Checks whether the compiler supports the `-pipe' flag, which
  66. dnl speeds up the compilation.
  67. AC_DEFUN(EGG_CHECK_CCPIPE, [dnl
  68. if test -z "$no_pipe"
  69. then
  70. if test -n "$GCC"
  71. then
  72. AC_CACHE_CHECK(whether the compiler understands -pipe, egg_cv_var_ccpipe, [dnl
  73. ac_old_CC="$CC"
  74. CC="$CC -pipe"
  75. AC_TRY_COMPILE(,, egg_cv_var_ccpipe="yes", egg_cv_var_ccpipe="no")
  76. CC="$ac_old_CC"
  77. ])
  78. if test "$egg_cv_var_ccpipe" = "yes"
  79. then
  80. CC="$CC -pipe"
  81. fi
  82. fi
  83. fi
  84. ])dnl
  85. dnl EGG_CHECK_CCSTATIC()
  86. dnl
  87. dnl Checks whether the compiler supports the `-static' flag.
  88. AC_DEFUN(EGG_CHECK_CCSTATIC, [dnl
  89. if test -z "$no_static"
  90. then
  91. if test -n "$GCC"
  92. then
  93. AC_CACHE_CHECK(whether the compiler understands -static, egg_cv_var_ccstatic, [dnl
  94. ac_old_CC="$CC"
  95. CC="$CC -static"
  96. AC_TRY_COMPILE(,, egg_cv_var_ccstatic="yes", egg_cv_var_ccstatic="no")
  97. CC="$ac_old_CC"
  98. ])
  99. if test "$egg_cv_var_ccstatic" = "yes"
  100. then
  101. CCDEBUG="$CC"
  102. CC="$CC -static"
  103. else
  104. cat << 'EOF' >&2
  105. configure: error:
  106. Your C compiler does not support -static.
  107. This compile flag is required for the botpack.
  108. EOF
  109. exit 1
  110. fi
  111. fi
  112. fi
  113. ])dnl
  114. dnl EGG_PROG_HEAD_1()
  115. dnl
  116. AC_DEFUN(EGG_PROG_HEAD_1,
  117. [cat << 'EOF' > conftest.head
  118. a
  119. b
  120. c
  121. EOF
  122. for ac_prog in 'head -1' 'head -n 1' 'sed 1q';
  123. do
  124. AC_MSG_CHECKING([whether $ac_prog works])
  125. AC_CACHE_VAL(ac_cv_prog_HEAD_1,
  126. [ if test -n "$HEAD_1"
  127. then
  128. ac_cv_prog_HEAD_1="$HEAD_1" # Let the user override the test.
  129. else
  130. if test "`cat conftest.head | $ac_prog`" = "a";
  131. then
  132. AC_MSG_RESULT([yes])
  133. ac_cv_prog_HEAD_1=$ac_prog
  134. else
  135. AC_MSG_RESULT([no])
  136. fi
  137. fi])dnl
  138. test -n "$ac_cv_prog_HEAD_1" && break
  139. done
  140. if test "${ac_cv_prog_HEAD_1-x}" = "x"
  141. then
  142. cat << 'EOF' >&2
  143. configure: error:
  144. This system seems to lack a working 'head -1' or 'head -n 1' command.
  145. A working 'head -1' (or equivalent) command is required to compile Eggdrop.
  146. EOF
  147. exit 1
  148. fi
  149. rm -f conftest.head
  150. HEAD_1=$ac_cv_prog_HEAD_1
  151. AC_SUBST(HEAD_1)dnl
  152. ])dnl
  153. dnl EGG_PROG_STRIP()
  154. dnl
  155. AC_DEFUN(EGG_PROG_STRIP, [dnl
  156. AC_CHECK_PROG(STRIP, strip, strip)
  157. if test "${STRIP-x}" = "x"
  158. then
  159. STRIP=touch
  160. fi
  161. ])dnl
  162. dnl EGG_PROG_CCACHE()
  163. dnl
  164. AC_DEFUN(EGG_PROG_CCACHE, [dnl
  165. AC_CHECK_PROG(CCACHE, ccache, ccache)
  166. if ! test "${CCACHE-x}" = "x"
  167. then
  168. CCACHE=ccache
  169. fi
  170. ])dnl
  171. dnl EGG_PROG_OBJCOPY()
  172. dnl
  173. AC_DEFUN(EGG_PROG_OBJCOPY, [dnl
  174. AC_CHECK_PROG(OBJCOPY, objcopy, objcopy)
  175. if ! test "${OBJCOPY-x}" = "x"
  176. then
  177. OBJCOPY="objcopy --remove-section=.note --remove-section=.comment"
  178. else
  179. OBJCOPY=touch
  180. fi
  181. ])dnl
  182. dnl EGG_PROG_DISTCC()
  183. dnl
  184. AC_DEFUN(EGG_PROG_DISTCC, [dnl
  185. AC_CHECK_PROG(DISTCC, distcc, distcc)
  186. if ! test "${DISTCC-x}" = "x"
  187. then
  188. DISTCC=distcc
  189. else
  190. DISTCC=
  191. fi
  192. ])dnl
  193. dnl EGG_PROG_AWK()
  194. dnl
  195. AC_DEFUN(EGG_PROG_AWK, [dnl
  196. # awk is needed for Tcl library and header checks, and eggdrop version subst
  197. AC_PROG_AWK
  198. if test "${AWK-x}" = "x"
  199. then
  200. cat << 'EOF' >&2
  201. configure: error:
  202. This system seems to lack a working 'awk' command.
  203. A working 'awk' command is required to compile Eggdrop.
  204. EOF
  205. exit 1
  206. fi
  207. ])dnl
  208. dnl EGG_PROG_BASENAME()
  209. dnl
  210. AC_DEFUN(EGG_PROG_BASENAME, [dnl
  211. # basename is needed for Tcl library and header checks
  212. AC_CHECK_PROG(BASENAME, basename, basename)
  213. if test "${BASENAME-x}" = "x"
  214. then
  215. cat << 'EOF' >&2
  216. configure: error:
  217. This system seems to lack a working 'basename' command.
  218. A working 'basename' command is required to compile Eggdrop.
  219. EOF
  220. exit 1
  221. fi
  222. ])dnl
  223. dnl EGG_CHECK_OS()
  224. dnl
  225. dnl FIXME/NOTICE:
  226. dnl This function is obsolete. Any NEW code/checks should be written
  227. dnl as individual tests that will be checked on ALL operating systems.
  228. dnl
  229. AC_DEFUN(EGG_CHECK_OS, [dnl
  230. LINUX=no
  231. IRIX=no
  232. SUNOS=no
  233. HPUX=no
  234. EGG_CYGWIN=no
  235. AC_CACHE_CHECK(system type, egg_cv_var_system_type, egg_cv_var_system_type=`$UNAME -s`)
  236. AC_CACHE_CHECK(system release, egg_cv_var_system_release, egg_cv_var_system_release=`$UNAME -r`)
  237. case "$egg_cv_var_system_type" in
  238. BSD/OS)
  239. case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
  240. 2)
  241. ;;
  242. *)
  243. CFLAGS="$CFLAGS -Wall"
  244. ;;
  245. esac
  246. ;;
  247. CYGWI*)
  248. case "`echo $egg_cv_var_system_release | cut -c 1-3`" in
  249. 1.*)
  250. AC_PROG_CC_WIN32
  251. CC="$CC $WIN32FLAGS"
  252. AC_MSG_CHECKING(for /usr/lib/binmode.o)
  253. if test -r /usr/lib/binmode.o
  254. then
  255. AC_MSG_RESULT(yes)
  256. LIBS="$LIBS /usr/lib/binmode.o"
  257. else
  258. AC_MSG_RESULT(no)
  259. AC_MSG_WARN(Make sure the directory Eggdrop is installed into is mounted in binary mode.)
  260. fi
  261. ;;
  262. *)
  263. AC_MSG_WARN(Make sure the directory Eggdrop is installed into is mounted in binary mode.)
  264. ;;
  265. esac
  266. EGG_CYGWIN=yes
  267. AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under cygwin])
  268. ;;
  269. HP-UX)
  270. HPUX=yes
  271. AC_DEFINE(HPUX_HACKS, 1, [Define if running on hpux that supports dynamic linking])dnl
  272. if test "`echo $egg_cv_var_system_release | cut -d . -f 2`" = "10"
  273. then
  274. AC_DEFINE(HPUX10_HACKS, 1, [Define if running on hpux 10.x])dnl
  275. fi
  276. ;;
  277. dell)
  278. AC_MSG_RESULT(Dell SVR4)
  279. ;;
  280. IRIX)
  281. IRIX=yes
  282. ;;
  283. Ultrix)
  284. SHELL=/bin/sh5
  285. ;;
  286. SINIX*)
  287. ;;
  288. BeOS)
  289. ;;
  290. Linux)
  291. LINUX=yes
  292. CFLAGS="$CFLAGS -Wall"
  293. ;;
  294. Lynx)
  295. ;;
  296. QNX)
  297. ;;
  298. OSF1)
  299. case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
  300. V*)
  301. # FIXME: we should check this in a separate test
  302. # Digital OSF uses an ancient version of gawk
  303. if test "$AWK" = "gawk"
  304. then
  305. AWK=awk
  306. fi
  307. ;;
  308. 1.0|1.1|1.2)
  309. AC_DEFINE(OSF1_HACKS, 1, [Define if running on OSF/1 platform])dnl
  310. ;;
  311. 1.*)
  312. AC_DEFINE(OSF1_HACKS, 1, [Define if running on OSF/1 platform])dnl
  313. ;;
  314. *)
  315. ;;
  316. esac
  317. AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform])dnl
  318. AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions without regard to HAVE_SNPRINTF])dnl
  319. ;;
  320. SunOS)
  321. if ! test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "5"
  322. then
  323. # SunOS 4
  324. SUNOS=yes
  325. fi
  326. ;;
  327. *BSD)
  328. # FreeBSD/OpenBSD/NetBSD
  329. ;;
  330. *)
  331. AC_MSG_CHECKING(if system is Mach based)
  332. if test -r /mach
  333. then
  334. AC_MSG_RESULT(yes)
  335. AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step])dnl
  336. else
  337. AC_MSG_RESULT(no)
  338. AC_MSG_CHECKING(if system is QNX)
  339. if test -r /cmds
  340. then
  341. AC_MSG_RESULT(yes)
  342. else
  343. AC_MSG_RESULT(no)
  344. AC_MSG_RESULT(Something unknown!)
  345. AC_MSG_RESULT([If you get dynamic modules to work, be sure to let the devel team know HOW :)])
  346. fi
  347. fi
  348. ;;
  349. esac
  350. ])dnl
  351. dnl EGG_CHECK_LIBS()
  352. dnl
  353. AC_DEFUN(EGG_CHECK_LIBS, [dnl
  354. # FIXME: this needs to be fixed so that it works on IRIX
  355. if test "$IRIX" = "yes"
  356. then
  357. AC_MSG_WARN(Skipping library tests because they CONFUSE Irix.)
  358. else
  359. AC_CHECK_LIB(socket, socket)
  360. AC_CHECK_LIB(nsl, connect)
  361. AC_CHECK_LIB(dns, gethostbyname)
  362. AC_CHECK_LIB(z, gzopen, ZLIB="-lz")
  363. AC_CHECK_LIB(ssl, SSL_accept, SSL="-lssl -lcrypto", SSL="", -lcrypto)
  364. AC_CHECK_LIB(dl, dlopen)
  365. AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
  366. # This is needed for Tcl libraries compiled with thread support
  367. AC_CHECK_LIB(pthread, pthread_mutex_init, [dnl
  368. ac_cv_lib_pthread_pthread_mutex_init=yes
  369. ac_cv_lib_pthread="-lpthread"], [dnl
  370. AC_CHECK_LIB(pthread, __pthread_mutex_init, [dnl
  371. ac_cv_lib_pthread_pthread_mutex_init=yes
  372. ac_cv_lib_pthread="-lpthread"], [dnl
  373. AC_CHECK_LIB(pthreads, pthread_mutex_init, [dnl
  374. ac_cv_lib_pthread_pthread_mutex_init=yes
  375. ac_cv_lib_pthread="-lpthreads"], [dnl
  376. AC_CHECK_FUNC(pthread_mutex_init, [dnl
  377. ac_cv_lib_pthread_pthread_mutex_init=yes
  378. ac_cv_lib_pthread=""],
  379. ac_cv_lib_pthread_pthread_mutex_init=no)])])])
  380. if test "$SUNOS" = "yes"
  381. then
  382. # For suns without yp or something like that
  383. AC_CHECK_LIB(dl, main)
  384. else
  385. if test "$HPUX" = "yes"
  386. then
  387. AC_CHECK_LIB(dld, shl_load)
  388. fi
  389. fi
  390. fi
  391. ])dnl
  392. dnl EGG_CHECK_FUNC_VSPRINTF()
  393. dnl
  394. AC_DEFUN(EGG_CHECK_FUNC_VSPRINTF, [dnl
  395. AC_CHECK_FUNCS(vsprintf)
  396. if test "$ac_cv_func_vsprintf" = "no"
  397. then
  398. cat << 'EOF' >&2
  399. configure: error:
  400. Your system does not have the sprintf/vsprintf libraries.
  401. These are required to compile almost anything. Sorry.
  402. EOF
  403. exit 1
  404. fi
  405. ])dnl
  406. dnl EGG_CHECK_FUNC_UNAME()
  407. dnl
  408. AC_DEFUN(EGG_CHECK_FUNC_UNAME, [dnl
  409. AC_CHECK_FUNCS(uname)
  410. if test "$ac_cv_func_uname" = "no"
  411. then
  412. cat << 'EOF' >&2
  413. configure: error:
  414. Your system does not have the uname() function.
  415. This is required for the botpack.
  416. EOF
  417. exit 1
  418. fi
  419. ])dnl
  420. dnl EGG_CHECK_ZLIB()
  421. dnl
  422. AC_DEFUN(EGG_CHECK_ZLIB, [dnl
  423. if test "x${ZLIB}" = x; then
  424. cat >&2 <<EOF
  425. configure: error:
  426. Your system does not provide a working zlib compression library.
  427. It is required.
  428. EOF
  429. exit 1
  430. else
  431. if test "${ac_cv_header_zlib_h}" != yes; then
  432. cat >&2 <<EOF
  433. configure: error:
  434. Your system does not provide the necessary zlib header file.
  435. It is required.
  436. EOF
  437. exit 1
  438. fi
  439. fi
  440. ])dnl
  441. dnl EGG_CHECK_SSL()
  442. dnl
  443. AC_DEFUN(EGG_CHECK_SSL, [dnl
  444. if test "x${SSL}" = x; then
  445. cat >&2 <<EOF
  446. configure: error:
  447. Your system does not provide a working ssl library.
  448. It is required. Download openssl at www.openssl.org
  449. EOF
  450. exit 1
  451. else
  452. if test "${ac_cv_header_openssl_ssl_h}" != yes; then
  453. cat >&2 <<EOF
  454. configure: error:
  455. Your system does not provide the necessary ssl header file.
  456. It is required. Download openssl at www.openssl.org
  457. EOF
  458. exit 1
  459. fi
  460. fi
  461. ])dnl
  462. dnl EGG_HEADER_STDC()
  463. dnl
  464. AC_DEFUN(EGG_HEADER_STDC, [dnl
  465. if test "$ac_cv_header_stdc" = "no"
  466. then
  467. cat << 'EOF' >&2
  468. configure: error:
  469. Your system must support ANSI C Header files.
  470. These are required for the language support. Sorry.
  471. EOF
  472. exit 1
  473. fi
  474. ])dnl
  475. dnl EGG_TCL_ARG_WITH()
  476. dnl
  477. AC_DEFUN(EGG_TCL_ARG_WITH, [dnl
  478. # oohh new configure --variables for those with multiple Tcl libs
  479. AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to Tcl library], tcllibname="$withval")
  480. AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to Tcl header], tclincname="$withval")
  481. WARN=0
  482. # Make sure either both or neither $tcllibname and $tclincname are set
  483. if test ! "${tcllibname-x}" = "x"
  484. then
  485. if test "${tclincname-x}" = "x"
  486. then
  487. WARN=1
  488. tcllibname=""
  489. TCLLIB=""
  490. TCLINC=""
  491. fi
  492. else
  493. if test ! "${tclincname-x}" = "x"
  494. then
  495. WARN=1
  496. tclincname=""
  497. TCLLIB=""
  498. TCLINC=""
  499. fi
  500. fi
  501. if test "$WARN" = 1
  502. then
  503. cat << 'EOF' >&2
  504. configure: warning:
  505. You must specify both --with-tcllib and --with-tclinc for them to work.
  506. configure will now attempt to autodetect both the Tcl library and header...
  507. EOF
  508. fi
  509. ])dnl
  510. dnl EGG_TCL_ENV()
  511. dnl
  512. AC_DEFUN(EGG_TCL_ENV, [dnl
  513. WARN=0
  514. # Make sure either both or neither $TCLLIB and $TCLINC are set
  515. if test ! "${TCLLIB-x}" = "x"
  516. then
  517. if test "${TCLINC-x}" = "x"
  518. then
  519. WARN=1
  520. WVAR1=TCLLIB
  521. WVAR2=TCLINC
  522. TCLLIB=""
  523. fi
  524. else
  525. if test ! "${TCLINC-x}" = "x"
  526. then
  527. WARN=1
  528. WVAR1=TCLINC
  529. WVAR2=TCLLIB
  530. TCLINC=""
  531. fi
  532. fi
  533. if test "$WARN" = 1
  534. then
  535. cat << EOF >&2
  536. configure: warning:
  537. Environment variable $WVAR1 was set, but I did not detect ${WVAR2}.
  538. Please set both TCLLIB and TCLINC correctly if you wish to use them.
  539. configure will now attempt to autodetect both the Tcl library and header...
  540. EOF
  541. fi
  542. ])dnl
  543. dnl EGG_TCL_WITH_TCLLIB()
  544. dnl
  545. AC_DEFUN(EGG_TCL_WITH_TCLLIB, [dnl
  546. # Look for Tcl library: if $tcllibname is set, check there first
  547. if test ! "${tcllibname-x}" = "x"
  548. then
  549. if test -f "$tcllibname" && test -r "$tcllibname"
  550. then
  551. TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'`
  552. TCLLIBFN=`$BASENAME $tcllibname | cut -c4-`
  553. TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`"
  554. TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-`
  555. else
  556. cat << EOF >&2
  557. configure: warning:
  558. The file '$tcllibname' given to option --with-tcllib is not valid.
  559. configure will now attempt to autodetect both the Tcl library and header...
  560. EOF
  561. tcllibname=""
  562. tclincname=""
  563. TCLLIB=""
  564. TCLLIBFN=""
  565. TCLINC=""
  566. TCLINCFN=""
  567. fi
  568. fi
  569. ])dnl
  570. dnl EGG_TCL_WITH_TCLINC()
  571. dnl
  572. AC_DEFUN(EGG_TCL_WITH_TCLINC, [dnl
  573. # Look for Tcl header: if $tclincname is set, check there first
  574. if test ! "${tclincname-x}" = "x"
  575. then
  576. if test -f "$tclincname" && test -r "$tclincname"
  577. then
  578. TCLINC=`echo $tclincname | sed 's%/[[^/]][[^/]]*$%%'`
  579. TCLINCFN=`$BASENAME $tclincname`
  580. else
  581. cat << EOF >&2
  582. configure: warning:
  583. The file '$tclincname' given to option --with-tclinc is not valid.
  584. configure will now attempt to autodetect both the Tcl library and header...
  585. EOF
  586. tcllibname=""
  587. tclincname=""
  588. TCLLIB=""
  589. TCLLIBFN=""
  590. TCLINC=""
  591. TCLINCFN=""
  592. fi
  593. fi
  594. ])dnl
  595. dnl EGG_TCL_FIND_LIBRARY()
  596. dnl
  597. AC_DEFUN(EGG_TCL_FIND_LIBRARY, [dnl
  598. # Look for Tcl library: if $TCLLIB is set, check there first
  599. if test "${TCLLIBFN-x}" = "x"
  600. then
  601. if test ! "${TCLLIB-x}" = "x"
  602. then
  603. if test -d "$TCLLIB"
  604. then
  605. for tcllibfns in $tcllibnames
  606. do
  607. for tcllibext in $tcllibextensions
  608. do
  609. if test -r "$TCLLIB/lib$tcllibfns$tcllibext"
  610. then
  611. TCLLIBFN="$tcllibfns$tcllibext"
  612. TCLLIBEXT="$tcllibext"
  613. TCLLIBFNS="$tcllibfns"
  614. break 2
  615. fi
  616. done
  617. done
  618. fi
  619. if test "${TCLLIBFN-x}" = "x"
  620. then
  621. cat << 'EOF' >&2
  622. configure: warning:
  623. Environment variable TCLLIB was set, but incorrect.
  624. Please set both TCLLIB and TCLINC correctly if you wish to use them.
  625. configure will now attempt to autodetect both the Tcl library and header...
  626. EOF
  627. TCLLIB=""
  628. TCLLIBFN=""
  629. TCLINC=""
  630. TCLINCFN=""
  631. fi
  632. fi
  633. fi
  634. ])dnl
  635. dnl EGG_TCL_FIND_HEADER()
  636. dnl
  637. AC_DEFUN(EGG_TCL_FIND_HEADER, [dnl
  638. # Look for Tcl header: if $TCLINC is set, check there first
  639. if test "${TCLINCFN-x}" = "x"
  640. then
  641. if test ! "${TCLINC-x}" = "x"
  642. then
  643. if test -d "$TCLINC"
  644. then
  645. for tclheaderfn in $tclheadernames
  646. do
  647. if test -r "$TCLINC/$tclheaderfn"
  648. then
  649. TCLINCFN="$tclheaderfn"
  650. break
  651. fi
  652. done
  653. fi
  654. if test "${TCLINCFN-x}" = "x"
  655. then
  656. cat << 'EOF' >&2
  657. configure: warning:
  658. Environment variable TCLINC was set, but incorrect.
  659. Please set both TCLLIB and TCLINC correctly if you wish to use them.
  660. configure will now attempt to autodetect both the Tcl library and header...
  661. EOF
  662. TCLLIB=""
  663. TCLLIBFN=""
  664. TCLINC=""
  665. TCLINCFN=""
  666. fi
  667. fi
  668. fi
  669. ])dnl
  670. dnl EGG_TCL_CHECK_LIBRARY()
  671. dnl
  672. AC_DEFUN(EGG_TCL_CHECK_LIBRARY, [dnl
  673. AC_MSG_CHECKING(for Tcl library)
  674. # Attempt autodetect for $TCLLIBFN if it's not set
  675. if test ! "${TCLLIBFN-x}" = "x"
  676. then
  677. AC_MSG_RESULT(using $TCLLIB/lib$TCLLIBFN)
  678. else
  679. for tcllibfns in $tcllibnames
  680. do
  681. for tcllibext in $tcllibextensions
  682. do
  683. for tcllibpath in $tcllibpaths
  684. do
  685. if test -r "$tcllibpath/lib$tcllibfns$tcllibext"
  686. then
  687. AC_MSG_RESULT(found $tcllibpath/lib$tcllibfns$tcllibext)
  688. TCLLIB="$tcllibpath"
  689. TCLLIBFN="$tcllibfns$tcllibext"
  690. TCLLIBEXT="$tcllibext"
  691. TCLLIBFNS="$tcllibfns"
  692. break 3
  693. fi
  694. done
  695. done
  696. done
  697. fi
  698. # Show if $TCLLIBFN wasn't found
  699. if test "${TCLLIBFN-x}" = "x"
  700. then
  701. AC_MSG_RESULT(not found)
  702. fi
  703. AC_SUBST(TCLLIB)dnl
  704. AC_SUBST(TCLLIBFN)dnl
  705. ])dnl
  706. dnl EGG_TCL_CHECK_HEADER()
  707. dnl
  708. AC_DEFUN(EGG_TCL_CHECK_HEADER, [dnl
  709. AC_MSG_CHECKING(for Tcl header)
  710. # Attempt autodetect for $TCLINCFN if it's not set
  711. if test ! "${TCLINCFN-x}" = "x"
  712. then
  713. AC_MSG_RESULT(using $TCLINC/$TCLINCFN)
  714. else
  715. for tclheaderpath in $tclheaderpaths
  716. do
  717. for tclheaderfn in $tclheadernames
  718. do
  719. if test -r "$tclheaderpath/$tclheaderfn"
  720. then
  721. AC_MSG_RESULT(found $tclheaderpath/$tclheaderfn)
  722. TCLINC="$tclheaderpath"
  723. TCLINCFN="$tclheaderfn"
  724. break 2
  725. fi
  726. done
  727. done
  728. # FreeBSD hack ...
  729. if test "${TCLINCFN-x}" = "x"
  730. then
  731. for tcllibfns in $tcllibnames
  732. do
  733. for tclheaderpath in $tclheaderpaths
  734. do
  735. for tclheaderfn in $tclheadernames
  736. do
  737. if test -r "$tclheaderpath/$tcllibfns/$tclheaderfn"
  738. then
  739. AC_MSG_RESULT(found $tclheaderpath/$tcllibfns/$tclheaderfn)
  740. TCLINC="$tclheaderpath/$tcllibfns"
  741. TCLINCFN="$tclheaderfn"
  742. break 3
  743. fi
  744. done
  745. done
  746. done
  747. fi
  748. fi
  749. # Show if $TCLINCFN wasn't found
  750. if test "${TCLINCFN-x}" = "x"
  751. then
  752. AC_MSG_RESULT(not found)
  753. fi
  754. AC_SUBST(TCLINC)dnl
  755. AC_SUBST(TCLINCFN)dnl
  756. ])dnl
  757. dnl EGG_CACHE_UNSET(CACHE-ID)
  758. dnl
  759. dnl Unsets a certain cache item. Typically called before using
  760. dnl the AC_CACHE_*() macros.
  761. AC_DEFUN(EGG_CACHE_UNSET, [dnl
  762. unset $1
  763. ])
  764. dnl EGG_TCL_DETECT_CHANGE()
  765. dnl
  766. dnl Detect whether the Tcl system has changed since our last
  767. dnl configure run. Set egg_tcl_changed accordingly.
  768. dnl
  769. dnl Tcl related feature and version checks should re-run their
  770. dnl checks as soon as egg_tcl_changed is set to "yes".
  771. AC_DEFUN(EGG_TCL_DETECT_CHANGE, [dnl
  772. AC_MSG_CHECKING(whether the Tcl system has changed)
  773. egg_tcl_changed=yes
  774. egg_tcl_id="$TCLLIB:$TCLLIBFN:$TCLINC:$TCLINCFN"
  775. if test ! "$egg_tcl_id" = ":::"
  776. then
  777. egg_tcl_cached=yes
  778. AC_CACHE_VAL(egg_cv_var_tcl_id, [dnl
  779. egg_cv_var_tcl_id="$egg_tcl_id"
  780. egg_tcl_cached=no
  781. ])
  782. if test "$egg_tcl_cached" = "yes"
  783. then
  784. if test "${egg_cv_var_tcl_id-x}" = "${egg_tcl_id-x}"
  785. then
  786. egg_tcl_changed=no
  787. else
  788. egg_cv_var_tcl_id="$egg_tcl_id"
  789. fi
  790. fi
  791. fi
  792. if test "$egg_tcl_changed" = "yes"
  793. then
  794. AC_MSG_RESULT(yes)
  795. else
  796. AC_MSG_RESULT(no)
  797. fi
  798. ])
  799. dnl EGG_TCL_CHECK_VERSION()
  800. dnl
  801. AC_DEFUN(EGG_TCL_CHECK_VERSION, [dnl
  802. # Both TCLLIBFN & TCLINCFN must be set, or we bail
  803. TCL_FOUND=0
  804. if test ! "${TCLLIBFN-x}" = "x" && test ! "${TCLINCFN-x}" = "x"
  805. then
  806. TCL_FOUND=1
  807. # Check Tcl's version
  808. if test "$egg_tcl_changed" = "yes"
  809. then
  810. EGG_CACHE_UNSET(egg_cv_var_tcl_version)
  811. fi
  812. AC_MSG_CHECKING(for Tcl version)
  813. AC_CACHE_VAL(egg_cv_var_tcl_version, [dnl
  814. egg_cv_var_tcl_version=`grep TCL_VERSION $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`
  815. ])
  816. if test ! "${egg_cv_var_tcl_version-x}" = "x"
  817. then
  818. AC_MSG_RESULT($egg_cv_var_tcl_version)
  819. else
  820. AC_MSG_RESULT(not found)
  821. TCL_FOUND=0
  822. fi
  823. # Check Tcl's patch level (if available)
  824. if test "$egg_tcl_changed" = "yes"
  825. then
  826. EGG_CACHE_UNSET(egg_cv_var_tcl_patch_level)
  827. fi
  828. AC_MSG_CHECKING(for Tcl patch level)
  829. AC_CACHE_VAL(egg_cv_var_tcl_patch_level, [dnl
  830. eval "egg_cv_var_tcl_patch_level=`grep TCL_PATCH_LEVEL $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`"
  831. ])
  832. if test ! "${egg_cv_var_tcl_patch_level-x}" = "x"
  833. then
  834. AC_MSG_RESULT($egg_cv_var_tcl_patch_level)
  835. else
  836. egg_cv_var_tcl_patch_level="unknown"
  837. AC_MSG_RESULT(unknown)
  838. fi
  839. fi
  840. # Check if we found Tcl's version
  841. if test "$TCL_FOUND" = 0
  842. then
  843. cat << 'EOF' >&2
  844. configure: error:
  845. I can't find Tcl on this system.
  846. The download website is at:
  847. http://www.tcl.tk/software/tcltk/download84.html
  848. A nice direct link for the tarball is:
  849. http://aleron.dl.sourceforge.net/sourceforge/tcl/tcl8.4.4-src.tar.gz
  850. OR
  851. Just type: ./build -T
  852. EOF
  853. exit 1
  854. fi
  855. ])dnl
  856. dnl EGG_TCL_CHECK_PRE80()
  857. dnl
  858. AC_DEFUN(EGG_TCL_CHECK_PRE80, [dnl
  859. # Is this version of Tcl too old for us to use ?
  860. TCL_VER_PRE80=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (i[[1]] < 8) print "yes"; else print "no"}'`
  861. if test "$TCL_VER_PRE80" = "yes"
  862. then
  863. cat << EOF >&2
  864. configure: error:
  865. Your Tcl version is much too old for Eggdrop to use.
  866. I suggest you download and compile a more recent version.
  867. The most reliable current version is $tclrecommendver and
  868. can be downloaded from $tclrecommendsite
  869. EOF
  870. exit 1
  871. fi
  872. ])dnl
  873. dnl EGG_TCL_TESTLIBS()
  874. dnl
  875. AC_DEFUN(EGG_TCL_TESTLIBS, [dnl
  876. # Set variables for Tcl library tests
  877. TCL_TEST_LIB="$TCLLIBFNS"
  878. TCL_TEST_OTHERLIBS="-L$TCLLIB $EGG_MATH_LIB"
  879. if test ! "${ac_cv_lib_pthread-x}" = "x"
  880. then
  881. TCL_TEST_OTHERLIBS="$TCL_TEST_OTHERLIBS $ac_cv_lib_pthread"
  882. fi
  883. ])dnl
  884. dnl EGG_TCL_CHECK_FREE()
  885. dnl
  886. AC_DEFUN(EGG_TCL_CHECK_FREE, [dnl
  887. if test "$egg_tcl_changed" = "yes"
  888. then
  889. EGG_CACHE_UNSET(egg_cv_var_tcl_free)
  890. fi
  891. # Check for Tcl_Free()
  892. AC_CHECK_LIB($TCL_TEST_LIB, Tcl_Free, egg_cv_var_tcl_free="yes", egg_cv_var_tcl_free="no", $TCL_TEST_OTHERLIBS)
  893. if test "$egg_cv_var_tcl_free" = "yes"
  894. then
  895. AC_DEFINE(HAVE_TCL_FREE, 1, [Define for Tcl that has Tcl_Free() (7.5p1 and later)])dnl
  896. fi
  897. ])dnl
  898. dnl EGG_TCL_CHECK_THREADS()
  899. dnl
  900. AC_DEFUN(EGG_TCL_CHECK_THREADS, [dnl
  901. if test "$egg_tcl_changed" = "yes"
  902. then
  903. EGG_CACHE_UNSET(egg_cv_var_tcl_threaded)
  904. fi
  905. # Check for TclpFinalizeThreadData()
  906. AC_CHECK_LIB($TCL_TEST_LIB, TclpFinalizeThreadData, egg_cv_var_tcl_threaded="yes", egg_cv_var_tcl_threaded="no", $TCL_TEST_OTHERLIBS)
  907. enable_tcl_threads=no
  908. if test "$egg_cv_var_tcl_threaded" = "yes"
  909. then
  910. if test "$enable_tcl_threads" = "no"
  911. then
  912. cat << 'EOF' >&2
  913. configure: warning:
  914. You have disabled threads support on a system with a threaded Tcl library.
  915. Tcl features that rely on scheduled events may not function properly.
  916. EOF
  917. fi
  918. # Add pthread library to $LIBS if we need it
  919. if test ! "${ac_cv_lib_pthread-x}" = "x"
  920. then
  921. LIBS="$ac_cv_lib_pthread $LIBS"
  922. fi
  923. fi
  924. ])dnl
  925. dnl EGG_TCL_LIB_REQS()
  926. dnl
  927. AC_DEFUN(EGG_TCL_LIB_REQS, [dnl
  928. if test "$EGG_CYGWIN" = "yes"
  929. then
  930. TCL_REQS="$TCLLIB/lib$TCLLIBFN"
  931. TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
  932. else
  933. if test ! "$TCLLIBEXT" = ".a"
  934. then
  935. cat << 'EOF' >&2
  936. configure: warning:
  937. Your Tcl library is not compiled statically.
  938. You will need to compile Tcl statically to successfully compile wraith.
  939. EOF
  940. exit 1
  941. else
  942. # Was the --with-tcllib option given ?
  943. if test ! "${tcllibname-x}" = "x"
  944. then
  945. TCL_REQS="$TCLLIB/lib$TCLLIBFN"
  946. TCL_LIBS="$TCLLIB/lib$TCLLIBFN $EGG_MATH_LIB"
  947. else
  948. TCL_REQS="$TCLLIB/lib$TCLLIBFN"
  949. TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
  950. fi
  951. fi
  952. fi
  953. AC_SUBST(TCL_REQS)dnl
  954. AC_SUBST(TCL_LIBS)dnl
  955. ])dnl
  956. dnl EGG_SUBST_VERSION()
  957. dnl
  958. AC_DEFUN(EGG_SUBST_VERSION, [dnl
  959. VERSION=`grep "char" $srcdir/src/main.c | $AWK '/egg_version/ {print [$]5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
  960. NUMVER=`grep "int" $srcdir/src/main.c | $AWK '/egg_numver =/ {print [$]5}' | sed -e 's/\;//g'`
  961. if ! test -f $srcdir/pack/pack.cfg; then
  962. cat << EOF >&2
  963. configure: error:
  964. Your pack cfg is missing, please copy it to $srcdir/pack/pack.cfg
  965. EOF
  966. exit 1
  967. fi
  968. PACKNAME=`grep "PACKNAME " $srcdir/pack/pack.cfg | $AWK '/PACKNAME/ {print [$]2}'`
  969. version_num=`echo $VERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
  970. AC_DEFINE_UNQUOTED(EGG_VERSION, $version_num, [Defines the current pack version])dnl
  971. AC_SUBST(VERSION)dnl
  972. AC_SUBST(NUMVER)dnl
  973. AC_SUBST(PACKNAME)dnl
  974. ])dnl
  975. dnl EGG_SUBST_MOD_UPDIR()
  976. dnl
  977. dnl Since module's Makefiles aren't generated by configure, some
  978. dnl paths in src/mod/Makefile.in take care of them. For correct
  979. dnl path "calculation", we need to keep absolute paths in mind
  980. dnl (which don't need a "../" pre-pended).
  981. AC_DEFUN(EGG_SUBST_MOD_UPDIR, [dnl
  982. case "$srcdir" in
  983. [[\\/]]* | ?:[[\\/]]*)
  984. MOD_UPDIR=""
  985. ;;
  986. *)
  987. MOD_UPDIR="../"
  988. ;;
  989. esac
  990. AC_SUBST(MOD_UPDIR)dnl
  991. ])dnl
  992. dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
  993. dnl
  994. dnl Replace FILE-NAME if the newly created contents differs from the existing
  995. dnl file contents. Otherwise, leave the file alone. This avoids needless
  996. dnl recompiles.
  997. m4_define(EGG_REPLACE_IF_CHANGED,
  998. [
  999. AC_CONFIG_COMMANDS([replace-if-changed],
  1000. [[
  1001. egg_replace_file="$1"
  1002. $2
  1003. if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file; then
  1004. echo "$1 is unchanged"
  1005. else
  1006. echo "creating $1"
  1007. mv conftest.out $egg_replace_file
  1008. fi
  1009. rm -f conftest.out
  1010. ]],
  1011. [[$3]])
  1012. ])
  1013. dnl EGG_TCL_LUSH()
  1014. AC_DEFUN([EGG_TCL_LUSH],
  1015. [
  1016. EGG_REPLACE_IF_CHANGED(lush.h,
  1017. [
  1018. cat > conftest.out << EOF
  1019. /* Ignore me but do not erase me. I am a kludge. */
  1020. #include "${egg_tclinc}/${egg_tclincfn}"
  1021. EOF
  1022. ], [
  1023. egg_tclinc="$TCLINC"
  1024. egg_tclincfn="$TCLINCFN"
  1025. ])
  1026. ])
  1027. dnl EGG_SAVE_PARAMETERS()
  1028. dnl
  1029. AC_DEFUN(EGG_SAVE_PARAMETERS, [dnl
  1030. # Remove --cache-file and --srcdir arguments so they do not pile up.
  1031. egg_ac_parameters=
  1032. ac_prev=
  1033. for ac_arg in $ac_configure_args; do
  1034. if test -n "$ac_prev"; then
  1035. ac_prev=
  1036. continue
  1037. fi
  1038. case $ac_arg in
  1039. -cache-file | --cache-file | --cache-fil | --cache-fi \
  1040. | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
  1041. ac_prev=cache_file ;;
  1042. -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  1043. | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
  1044. | --c=*)
  1045. ;;
  1046. --config-cache | -C)
  1047. ;;
  1048. -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  1049. ac_prev=srcdir ;;
  1050. -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  1051. ;;
  1052. *) egg_ac_parameters="$egg_ac_parameters $ac_arg" ;;
  1053. esac
  1054. done
  1055. AC_SUBST(egg_ac_parameters)dnl
  1056. ])dnl
  1057. AC_DEFUN([AC_PROG_CC_WIN32], [
  1058. AC_MSG_CHECKING([how to access the Win32 API])
  1059. WIN32FLAGS=
  1060. AC_TRY_COMPILE(,[
  1061. #ifndef WIN32
  1062. # ifndef _WIN32
  1063. # error WIN32 or _WIN32 not defined
  1064. # endif
  1065. #endif], [
  1066. dnl found windows.h with the current config.
  1067. AC_MSG_RESULT([present by default])
  1068. ], [
  1069. dnl try -mwin32
  1070. ac_compile_save="$ac_compile"
  1071. dnl we change CC so config.log looks correct
  1072. save_CC="$CC"
  1073. ac_compile="$ac_compile -mwin32"
  1074. CC="$CC -mwin32"
  1075. AC_TRY_COMPILE(,[
  1076. #ifndef WIN32
  1077. # ifndef _WIN32
  1078. # error WIN32 or _WIN32 not defined
  1079. # endif
  1080. #endif], [
  1081. dnl found windows.h using -mwin32
  1082. AC_MSG_RESULT([found via -mwin32])
  1083. ac_compile="$ac_compile_save"
  1084. CC="$save_CC"
  1085. WIN32FLAGS="-mwin32"
  1086. ], [
  1087. ac_compile="$ac_compile_save"
  1088. CC="$save_CC"
  1089. AC_MSG_RESULT([not found])
  1090. ])
  1091. ])
  1092. ])
  1093. dnl