aclocal.m4 29 KB

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