acinclude.m4 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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. AC_DEFUN([EGG_CHECK_CC],
  8. [
  9. if test "${cross_compiling-x}" = "x"
  10. then
  11. cat << 'EOF' >&2
  12. configure: error:
  13. This system does not appear to have a working C compiler.
  14. A working C compiler is required to compile Eggdrop.
  15. EOF
  16. exit 1
  17. fi
  18. if test -n "$GXX"; then
  19. CXXFLAGS="$CXXFLAGS"
  20. fi
  21. ])
  22. dnl EGG_IPV6_OPTIONS()
  23. dnl
  24. AC_DEFUN([EGG_IPV6_OPTIONS],
  25. [
  26. AC_MSG_CHECKING(whether or not you disabled IPv6 support)
  27. AC_ARG_ENABLE(ipv6, [ --disable-ipv6 disable IPv6 support],
  28. [ ac_cv_dipv6="yes"
  29. AC_MSG_RESULT(yes)
  30. ],
  31. [ ac_cv_dipv6="no"
  32. if test "$egg_cv_ipv6_supported" = "no"; then
  33. ac_cv_dipv6="no"
  34. fi
  35. AC_MSG_RESULT($ac_cv_dipv6)
  36. ])
  37. if ! test "$EGG_CYGWIN" = "yes"; then
  38. if test "$ac_cv_dipv6" = "no"; then
  39. AC_DEFINE(USE_IPV6, 1, [Define if you want ipv6 support])
  40. fi
  41. fi
  42. ])
  43. dnl EGG_CHECK_SOCKLEN_T()
  44. dnl
  45. AC_DEFUN([EGG_CHECK_SOCKLEN_T],
  46. [
  47. AC_MSG_CHECKING(for socklen_t)
  48. AC_CACHE_VAL(egg_cv_socklen_t,[
  49. AC_TRY_RUN([
  50. #include <unistd.h>
  51. #include <sys/types.h>
  52. #include <sys/socket.h>
  53. #include <netinet/in.h>
  54. #include <arpa/inet.h>
  55. int main()
  56. {
  57. socklen_t test = sizeof(int);
  58. return 0;
  59. }
  60. ],
  61. egg_cv_socklen_t=yes, egg_cv_socklen_t=no, egg_cv_socklen_t=no)])
  62. if test "$egg_cv_socklen_t" = "yes"; then
  63. AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if you have support for socklen_t])
  64. AC_MSG_RESULT(yes)
  65. else
  66. AC_MSG_RESULT(no)
  67. fi
  68. ])
  69. dnl EGG_CHECK_CCPIPE()
  70. dnl
  71. dnl This function checks whether or not the compiler supports the `-pipe' flag,
  72. dnl which speeds up the compilation.
  73. dnl
  74. AC_DEFUN([EGG_CHECK_CCPIPE],
  75. [
  76. if test -n "$GXX" && test -z "$no_pipe"; then
  77. AC_CACHE_CHECK([whether the compiler understands -pipe], egg_cv_var_ccpipe, [
  78. ac_old_CXX="$CXX"
  79. CXX="$CXX -pipe"
  80. AC_COMPILE_IFELSE([[
  81. int main ()
  82. {
  83. return(0);
  84. }
  85. ]], [
  86. egg_cv_var_ccpipe="yes"
  87. ], [
  88. egg_cv_var_ccpipe="no"
  89. ])
  90. CXX="$ac_old_CXX"
  91. ])
  92. if test "$egg_cv_var_ccpipe" = "yes"; then
  93. CXX="$CXX -pipe"
  94. fi
  95. fi
  96. ])
  97. dnl EGG_CHECK_CCWALL()
  98. dnl
  99. dnl See if the compiler supports -Wall.
  100. dnl
  101. AC_DEFUN([EGG_CHECK_CCWALL],
  102. [
  103. if test -n "$GXX" && test -z "$no_wall"; then
  104. AC_CACHE_CHECK([whether the compiler understands -Wall], egg_cv_var_ccwall, [
  105. ac_old_CXXFLAGS="$CXXFLAGS"
  106. CXXFLAGS="$CXXFLAGS -Wall"
  107. AC_COMPILE_IFELSE([[
  108. int main ()
  109. {
  110. return(0);
  111. }
  112. ]], [
  113. egg_cv_var_ccwall="yes"
  114. ], [
  115. egg_cv_var_ccwall="no"
  116. ])
  117. CXXFLAGS="$ac_old_CXXFLAGS"
  118. ])
  119. if test "$egg_cv_var_ccwall" = "yes"; then
  120. CXXFLAGS="$CXXFLAGS -Wall"
  121. fi
  122. fi
  123. ])
  124. dnl EGG_CHECK_CCSTATIC()
  125. dnl
  126. dnl Checks whether the compiler supports the `-static' flag.
  127. AC_DEFUN([EGG_CHECK_CCSTATIC],
  128. [
  129. if test "$USE_STATIC" = "yes"
  130. then
  131. if test -n "$GXX"
  132. then
  133. AC_CACHE_CHECK(whether the compiler understands -static, egg_cv_var_ccstatic, [dnl
  134. AC_TRY_COMPILE(,, egg_cv_var_ccstatic="yes", egg_cv_var_ccstatic="no")
  135. ])
  136. if ! test "$egg_cv_var_ccstatic" = "yes"
  137. then
  138. cat << 'EOF' >&2
  139. configure: error:
  140. Your OS or C++ compiler does not support -static.
  141. This compile flag is required for the botpack on this OS.
  142. EOF
  143. exit 1
  144. fi
  145. fi
  146. STATIC="-static"
  147. else
  148. STATIC=""
  149. fi
  150. AC_SUBST(STATIC)dnl
  151. ])
  152. dnl EGG_PROG_HEAD_1()
  153. dnl
  154. AC_DEFUN([EGG_PROG_HEAD_1],
  155. [
  156. cat << 'EOF' > conftest.head
  157. a
  158. b
  159. c
  160. EOF
  161. for ac_prog in 'head -1' 'head -n 1' 'sed 1q';
  162. do
  163. AC_MSG_CHECKING([whether $ac_prog works])
  164. AC_CACHE_VAL(ac_cv_prog_HEAD_1,
  165. [ if test -n "$HEAD_1"
  166. then
  167. ac_cv_prog_HEAD_1="$HEAD_1" # Let the user override the test.
  168. else
  169. if test "`cat conftest.head | $ac_prog`" = "a";
  170. then
  171. AC_MSG_RESULT([yes])
  172. ac_cv_prog_HEAD_1=$ac_prog
  173. else
  174. AC_MSG_RESULT([no])
  175. fi
  176. fi])dnl
  177. test -n "$ac_cv_prog_HEAD_1" && break
  178. done
  179. if test "${ac_cv_prog_HEAD_1-x}" = "x"
  180. then
  181. cat << 'EOF' >&2
  182. configure: error:
  183. This system seems to lack a working 'head -1' or 'head -n 1' command.
  184. A working 'head -1' (or equivalent) command is required to compile Eggdrop.
  185. EOF
  186. exit 1
  187. fi
  188. rm -f conftest.head
  189. HEAD_1=$ac_cv_prog_HEAD_1
  190. AC_SUBST(HEAD_1)dnl
  191. ])
  192. dnl EGG_PROG_AWK()
  193. dnl
  194. AC_DEFUN([EGG_PROG_AWK],
  195. [
  196. # awk is needed for Tcl library and header checks, and eggdrop version subst
  197. AC_PROG_AWK
  198. if test "${AWK-x}" = "x"
  199. then
  200. cat << 'EOF' >&2
  201. configure: error:
  202. This system seems to lack a working 'awk' command.
  203. A working 'awk' command is required to compile Eggdrop.
  204. EOF
  205. exit 1
  206. fi
  207. ])
  208. dnl EGG_PROG_BASENAME()
  209. dnl
  210. AC_DEFUN([EGG_PROG_BASENAME],
  211. [
  212. # basename is needed for Tcl library and header checks
  213. AC_CHECK_PROG(BASENAME, basename, basename)
  214. if test "${BASENAME-x}" = "x"
  215. then
  216. cat << 'EOF' >&2
  217. configure: error:
  218. This system seems to lack a working 'basename' command.
  219. A working 'basename' command is required to compile Eggdrop.
  220. EOF
  221. exit 1
  222. fi
  223. ])
  224. dnl EGG_CHECK_OS()
  225. dnl
  226. dnl
  227. AC_DEFUN([EGG_CHECK_OS],
  228. [
  229. EGG_CYGWIN=no
  230. USE_STATIC=yes
  231. AC_CACHE_CHECK(system type, egg_cv_var_system_type, egg_cv_var_system_type=`$UNAME -s`)
  232. AC_CACHE_CHECK(system release, egg_cv_var_system_release, egg_cv_var_system_release=`$UNAME -r`)
  233. AC_CACHE_CHECK(system machine, egg_cv_var_system_machine, egg_cv_var_system_machine=`$UNAME -m`)
  234. BUILDOS="$egg_cv_var_system_type"
  235. BUILDARCH="$egg_cv_var_system_machine"
  236. USE_GENERIC_I486="yes"
  237. case "$egg_cv_var_system_type" in
  238. BSD/OS)
  239. ;;
  240. CYGWI*)
  241. AC_PROG_CC_WIN32
  242. CXX="$CXX $WIN32FLAGS"
  243. EGG_CYGWIN="yes"
  244. EGG_CYGWIN_BINMODE
  245. AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under cygwin])
  246. AC_DEFINE(WIN32_LEAN_AND_MEAN, 1, [Define if windows])
  247. ;;
  248. IRIX)
  249. ;;
  250. HP-UX)
  251. AC_DEFINE(MD32_XARRAY, 1, [Define under HPUX])
  252. ;;
  253. Ultrix)
  254. SHELL=/bin/sh5
  255. ;;
  256. SINIX*)
  257. ;;
  258. BeOS)
  259. ;;
  260. Linux)
  261. ;;
  262. Lynx)
  263. ;;
  264. QNX)
  265. ;;
  266. OSF1)
  267. case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
  268. V*)
  269. if test "$AWK" = "gawk"
  270. then
  271. AWK=awk
  272. fi
  273. ;;
  274. 1.0|1.1|1.2)
  275. AC_DEFINE(OSF1_HACKS, 1, [Define if running on OSF/1 platform])dnl
  276. ;;
  277. 1.*)
  278. AC_DEFINE(OSF1_HACKS, 1, [Define if running on OSF/1 platform])dnl
  279. ;;
  280. *)
  281. ;;
  282. esac
  283. AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform])dnl
  284. AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions without regard to HAVE_SNPRINTF])dnl
  285. ;;
  286. SunOS)
  287. SUNOS="yes"
  288. USE_STATIC="no"
  289. ;;
  290. Darwin)
  291. USE_STATIC="no"
  292. USE_GENERIC_I486="no"
  293. ;;
  294. *BSD)
  295. # FreeBSD/OpenBSD/NetBSD
  296. ;;
  297. *)
  298. AC_MSG_CHECKING(if system is Mach based)
  299. if test -r /mach
  300. then
  301. AC_MSG_RESULT(yes)
  302. AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step])dnl
  303. else
  304. AC_MSG_RESULT(no)
  305. AC_MSG_CHECKING(if system is QNX)
  306. if test -r /cmds
  307. then
  308. AC_MSG_RESULT(yes)
  309. else
  310. AC_MSG_RESULT(no)
  311. AC_MSG_RESULT(Something unknown!)
  312. fi
  313. fi
  314. ;;
  315. esac
  316. case "$egg_cv_var_system_machine" in
  317. i*)
  318. if test "$USE_GENERIC_I486" = "yes"; then
  319. CXX="$CXX -march=i486"
  320. BUILDARCH="i486"
  321. fi
  322. ;;
  323. *)
  324. ;;
  325. esac
  326. AC_SUBST(BUILDOS)dnl
  327. AC_SUBST(BUILDARCH)dnl
  328. ])
  329. dnl EGG_CYGWIN_BINMODE
  330. dnl
  331. dnl Check for binmode.o on Cygwin.
  332. dnl
  333. AC_DEFUN([EGG_CYGWIN_BINMODE],
  334. [
  335. if test $EGG_CYGWIN = "yes"; then
  336. AC_MSG_CHECKING([for /usr/lib/binmode.o])
  337. if test -r /usr/lib/binmode.o; then
  338. AC_MSG_RESULT([yes])
  339. LIBS="$LIBS /usr/lib/binmode.o"
  340. else
  341. AC_MSG_RESULT([no])
  342. AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.])
  343. fi
  344. fi
  345. ])
  346. dnl EGG_CHECK_LIBS()
  347. dnl
  348. AC_DEFUN([EGG_CHECK_LIBS],
  349. [
  350. AC_CHECK_LIB(socket, socket)
  351. # AC_CHECK_LIB(nsl, connect)
  352. # AC_CHECK_LIB(dl, dlopen)
  353. # AC_CHECK_LIB(nsl, gethostbyname)
  354. # AC_CHECK_LIB(dns, gethostbyname)
  355. # AC_CHECK_LIB(z, gzopen, ZLIB="-lz")
  356. # This is needed for Tcl libraries compiled with thread support
  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(pthread, __pthread_mutex_init, [dnl
  361. # ac_cv_lib_pthread_pthread_mutex_init=yes
  362. # ac_cv_lib_pthread="-lpthread"], [dnl
  363. # AC_CHECK_LIB(pthreads, pthread_mutex_init, [dnl
  364. # ac_cv_lib_pthread_pthread_mutex_init=yes
  365. # ac_cv_lib_pthread="-lpthreads"], [dnl
  366. # AC_CHECK_FUNC(pthread_mutex_init, [dnl
  367. # ac_cv_lib_pthread_pthread_mutex_init=yes
  368. # ac_cv_lib_pthread=""],
  369. # ac_cv_lib_pthread_pthread_mutex_init=no)])])])
  370. if test "$SUNOS" = "yes"; then
  371. # For suns without yp
  372. AC_CHECK_LIB(dl, main)
  373. AC_CHECK_LIB(socket, main)
  374. AC_CHECK_LIB(nsl, main)
  375. fi
  376. ])
  377. dnl EGG_CHECK_FUNC_VSPRINTF()
  378. dnl
  379. AC_DEFUN([EGG_CHECK_FUNC_VSPRINTF],
  380. [
  381. AC_CHECK_FUNCS(vsprintf)
  382. if test "$ac_cv_func_vsprintf" = "no"
  383. then
  384. cat << 'EOF' >&2
  385. configure: error:
  386. Your system does not have the sprintf/vsprintf libraries.
  387. These are required to compile almost anything. Sorry.
  388. EOF
  389. exit 1
  390. fi
  391. ])
  392. dnl EGG_CHECK_FUNC_UNAME()
  393. dnl
  394. AC_DEFUN([EGG_CHECK_FUNC_UNAME],
  395. [
  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. ])
  407. dnl EGG_CHECK_ZLIB()
  408. dnl
  409. AC_DEFUN([EGG_CHECK_ZLIB],
  410. [
  411. if test "x${ZLIB}" = x; then
  412. cat >&2 <<EOF
  413. configure: error:
  414. Your system does not provide a working zlib compression library.
  415. It is required.
  416. EOF
  417. exit 1
  418. else
  419. if test "${ac_cv_header_zlib_h}" != yes; then
  420. cat >&2 <<EOF
  421. configure: error:
  422. Your system does not provide the necessary zlib header file.
  423. It is required.
  424. EOF
  425. exit 1
  426. fi
  427. fi
  428. ])
  429. dnl CHECK_SSL()
  430. dnl
  431. AC_DEFUN([CHECK_SSL],
  432. [
  433. dnl Adapted from Ratbox configure.ac
  434. dnl OpenSSL support
  435. AC_MSG_CHECKING(for path to OpenSSL)
  436. AC_ARG_WITH(openssl,
  437. [AS_HELP_STRING([--with-openssl=DIR],[Path to OpenSSL])],
  438. [cf_with_openssl=$withval],
  439. [cf_with_openssl="auto"]
  440. )
  441. cf_openssl_basedir=""
  442. if test "$cf_with_openssl" != "auto"; then
  443. dnl Support for --with-openssl=/some/place
  444. cf_openssl_basedir="`echo ${cf_with_openssl} | sed 's/\/$//'`"
  445. else
  446. dnl Do the auto-probe here. Check some common directory paths.
  447. for dirs in /usr/local/ssl /usr/pkg /usr/local /usr/local/openssl; do
  448. if test -f "${dirs}/include/openssl/opensslv.h" ; then
  449. cf_openssl_basedir="${dirs}"
  450. break
  451. fi
  452. done
  453. unset dirs
  454. fi
  455. dnl Now check cf_openssl_found to see if we found anything.
  456. if test ! -z "$cf_openssl_basedir"; then
  457. if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
  458. SSL_INCLUDES="-I${cf_openssl_basedir}/include"
  459. SSL_LIBS="-L${cf_openssl_basedir}/lib"
  460. else
  461. dnl OpenSSL wasn't found in the directory specified.
  462. cf_openssl_basedir=""
  463. fi
  464. else
  465. dnl See if present in system base (in which case, no need to change the include path)
  466. if test -f "/usr/include/openssl/opensslv.h" ; then
  467. cf_openssl_basedir="/usr"
  468. fi
  469. fi
  470. dnl Has it been found by now?
  471. if test ! -z "$cf_openssl_basedir"; then
  472. AC_MSG_RESULT($cf_openssl_basedir)
  473. else
  474. AC_MSG_RESULT([not found])
  475. AC_MSG_ERROR([OpenSSL is required.], 1)
  476. fi
  477. unset cf_openssl_basedir
  478. save_CXX="$CXX"
  479. CXX="$CXX $SSL_INCLUDES"
  480. save_LIBS="$LIBS"
  481. LIBS="$LIBS $SSL_LIBS"
  482. dnl Check OpenSSL version
  483. AC_MSG_CHECKING(for OpenSSL version)
  484. AC_TRY_COMPILE([#include <openssl/opensslv.h>],[
  485. #if !defined(OPENSSL_VERSION_NUMBER)
  486. #error "Missing openssl version"
  487. #endif
  488. #if (OPENSSL_VERSION_NUMBER < 0x0090800f)
  489. #error "Old/Insecure OpenSSL version " OPENSSL_VERSION_TEXT
  490. #endif],
  491. [AC_MSG_RESULT(OK)],
  492. [
  493. AC_MSG_RESULT([too old.])
  494. AC_MSG_ERROR([OpenSSL version is too old.], 1)
  495. ]
  496. )
  497. CXX="$CXX $SSL_LIBS"
  498. AC_CHECK_LIB(crypto, AES_encrypt,
  499. [SSL_LIBS="$SSL_LIBS -lcrypto"],
  500. [
  501. AC_MSG_RESULT([not found.])
  502. AC_MSG_ERROR([Libcrypto/openssl is required.], 1)
  503. ]
  504. )
  505. CXX="$save_CXX"
  506. LIBS="$save_LIBS"
  507. AC_SUBST(SSL_INCLUDES)
  508. AC_SUBST(SSL_LIBS)
  509. ])
  510. dnl EGG_HEADER_STDC()
  511. dnl
  512. AC_DEFUN([EGG_HEADER_STDC],
  513. [
  514. if test "$ac_cv_header_stdc" = "no"
  515. then
  516. cat << 'EOF' >&2
  517. configure: error:
  518. Your system must support ANSI C Header files.
  519. These are required for the language support. Sorry.
  520. EOF
  521. exit 1
  522. fi
  523. ])
  524. dnl EGG_CACHE_UNSET(CACHE-ID)
  525. dnl
  526. dnl Unsets a certain cache item. Typically called before using
  527. dnl the AC_CACHE_*() macros.
  528. AC_DEFUN([EGG_CACHE_UNSET],
  529. [
  530. unset $1
  531. ])
  532. dnl EGG_SUBST_VERSION()
  533. dnl
  534. AC_DEFUN([EGG_SUBST_VERSION],
  535. [
  536. VERSION=`grep "char" $srcdir/src/main.c | $AWK '/egg_version/ {print [$]5}' | sed -e 's/\"//g' | sed -e 's/\;//g'`
  537. version_num=`echo $VERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
  538. AC_DEFINE_UNQUOTED(EGG_VERSION, $version_num, [Defines the current pack version])dnl
  539. AC_SUBST(VERSION)dnl
  540. AC_SUBST(NUMVER)dnl
  541. ])
  542. dnl EGG_SUBST_MOD_UPDIR()
  543. dnl
  544. dnl Since module's Makefiles aren't generated by configure, some
  545. dnl paths in src/mod/Makefile.in take care of them. For correct
  546. dnl path "calculation", we need to keep absolute paths in mind
  547. dnl (which don't need a "../" pre-pended).
  548. AC_DEFUN([EGG_SUBST_MOD_UPDIR],
  549. [
  550. case "$srcdir" in
  551. [[\\/]]* | ?:[[\\/]]*)
  552. MOD_UPDIR=""
  553. ;;
  554. *)
  555. MOD_UPDIR="../"
  556. ;;
  557. esac
  558. AC_SUBST(MOD_UPDIR)dnl
  559. ])dnl
  560. dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
  561. dnl
  562. dnl Replace FILE-NAME if the newly created contents differs from the existing
  563. dnl file contents. Otherwise, leave the file alone. This avoids needless
  564. dnl recompiles.
  565. m4_define(EGG_REPLACE_IF_CHANGED,
  566. [
  567. AC_CONFIG_COMMANDS([replace-if-changed],
  568. [[
  569. egg_replace_file="$1"
  570. $2
  571. if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file; then
  572. echo "$1 is unchanged"
  573. else
  574. echo "creating $1"
  575. mv conftest.out $egg_replace_file
  576. fi
  577. rm -f conftest.out
  578. ]],
  579. [[$3]])
  580. ])
  581. dnl EGG_SAVE_PARAMETERS()
  582. dnl
  583. AC_DEFUN([EGG_SAVE_PARAMETERS],
  584. [
  585. # Remove --cache-file and --srcdir arguments so they do not pile up.
  586. egg_ac_parameters=
  587. ac_prev=
  588. for ac_arg in $ac_configure_args; do
  589. if test -n "$ac_prev"; then
  590. ac_prev=
  591. continue
  592. fi
  593. case $ac_arg in
  594. -cache-file | --cache-file | --cache-fil | --cache-fi \
  595. | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
  596. ac_prev=cache_file ;;
  597. -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  598. | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
  599. | --c=*)
  600. ;;
  601. --config-cache | -C)
  602. ;;
  603. -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  604. ac_prev=srcdir ;;
  605. -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  606. ;;
  607. *) egg_ac_parameters="$egg_ac_parameters $ac_arg" ;;
  608. esac
  609. done
  610. AC_SUBST(egg_ac_parameters)dnl
  611. ])
  612. AC_DEFUN([AC_PROG_CC_WIN32],
  613. [
  614. AC_MSG_CHECKING([how to access the Win32 API])
  615. WIN32FLAGS=
  616. AC_TRY_COMPILE(,[
  617. #ifndef WIN32
  618. # ifndef _WIN32
  619. # error WIN32 or _WIN32 not defined
  620. # endif
  621. #endif], [
  622. dnl found windows.h with the current config.
  623. AC_MSG_RESULT([present by default])
  624. ], [
  625. dnl try -mwin32
  626. ac_compile_save="$ac_compile"
  627. dnl we change CC so config.log looks correct
  628. save_CXX="$CXX"
  629. ac_compile="$ac_compile -mwin32"
  630. CXX="$CXX -mwin32"
  631. AC_TRY_COMPILE(,[
  632. #ifndef WIN32
  633. # ifndef _WIN32
  634. # error WIN32 or _WIN32 not defined
  635. # endif
  636. #endif], [
  637. dnl found windows.h using -mwin32
  638. AC_MSG_RESULT([found via -mwin32])
  639. ac_compile="$ac_compile_save"
  640. CXX="$save_CXX"
  641. WIN32FLAGS="-mwin32"
  642. ], [
  643. ac_compile="$ac_compile_save"
  644. CXX="$save_CXX"
  645. AC_MSG_RESULT([not found])
  646. ])
  647. ])
  648. ])
  649. AC_DEFUN([EGG_CHECK_RANDOM_MAX],
  650. [
  651. AC_MSG_CHECKING([for random limit])
  652. case "$egg_cv_var_system_type" in
  653. SunOS) RMAX=0x7FFFFFFF
  654. ;;
  655. *) RMAX=RAND_MAX
  656. ;;
  657. esac
  658. AC_MSG_RESULT([$RMAX])
  659. AC_DEFINE_UNQUOTED(RANDOM_MAX, $RMAX, [Define limit of random() function.])
  660. ])