1
0

aclocal.m4 28 KB

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