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