aclocal.m4 26 KB

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