acinclude.m4 26 KB

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