acinclude.m4 27 KB

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