acinclude.m4 17 KB

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