A clone of btpd with my configuration changes.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

133 lignes
3.4 KiB

  1. AC_INIT(btpd, 0.13+, btpd@murmeldjur.se)
  2. AM_INIT_AUTOMAKE([foreign subdir-objects])
  3. AC_CONFIG_FILES([Makefile])
  4. AC_PROG_CC
  5. AM_PROG_CC_C_O
  6. AC_PROG_RANLIB
  7. AC_USE_SYSTEM_EXTENSIONS
  8. AC_DEFUN([PROG_SILENT_IFELSE],
  9. ac_output=`$1 2>&1`
  10. if test x"$ac_output" != x; then
  11. [$3]
  12. else
  13. [$2]
  14. fi)
  15. AC_DEFUN([CC_ARGS_OK_IFELSE],
  16. AC_LANG_PUSH(C)
  17. AC_LANG_CONFTEST([int foo(void) { return 12; }])
  18. AC_LANG_POP(C)
  19. PROG_SILENT_IFELSE([$CC $1 -c conftest.c],
  20. rm -f conftest.c conftest.$OBJEXT
  21. [$2],
  22. rm -f conftest.c conftest.$OBJEXT
  23. [$3]))
  24. AC_ARG_WITH(openssl,
  25. [ --with-openssl=dir use openssl installed in dir],
  26. [
  27. AC_SUBST(openssl_LDFLAGS,["-L${withval}/lib -Wl,-R,${withval}/lib"])
  28. AC_SUBST(openssl_CPPFLAGS,"-I${withval}/include")
  29. ])
  30. AC_ARG_WITH(evloop-method,
  31. [ --with-evloop-method select evloop method (epoll,poll,kqueue)],
  32. evloop_methods=$withval,
  33. evloop_methods="epoll kqueue poll")
  34. old_LIBS=$LIBS
  35. LIBS=""
  36. AC_SEARCH_LIBS(clock_gettime, rt,,AC_MSG_FAILURE(btpd needs clock_gettime))
  37. AC_SUBST(CLOCKLIB,$LIBS)
  38. LIBS=""
  39. AC_SEARCH_LIBS(inet_ntop, nsl,,AC_MSG_FAILURE(btpd needs inet_ntop))
  40. AC_SEARCH_LIBS(bind, socket,,AC_MSG_FAILURE(btpd needs bind))
  41. AC_SUBST(INETLIBS,$LIBS)
  42. LIBS=$old_LIBS
  43. AC_CHECK_FUNCS(asprintf)
  44. AC_MSG_CHECKING(whether compiler accepts -Wno-pointer-sign)
  45. CC_ARGS_OK_IFELSE(-Wno-pointer-sign,
  46. AC_SUBST(WARNNPS,"-Wno-pointer-sign")
  47. AC_MSG_RESULT(yes)
  48. ,
  49. AC_MSG_RESULT(no))
  50. old_LDFLAGS="$LDFLAGS"
  51. LDFLAGS="$LDFLAGS $openssl_LDFLAGS"
  52. AC_CHECK_LIB(crypto, SHA1_Final,:,AC_MSG_FAILURE(btpd needs openssl's libraries and headers))
  53. LDFLAGS=$old_LDFLAGS
  54. for m in $evloop_methods; do
  55. case $m in
  56. epoll)
  57. AC_CHECK_FUNC(epoll_wait,[
  58. AC_SUBST(EVLOOP_IMPL,"evloop/epoll.${OBJEXT}")
  59. AC_SUBST(EVLOOP_METHOD,EVLOOP_EPOLL)
  60. break])
  61. ;;
  62. kqueue)
  63. AC_CHECK_FUNC(kqueue,[
  64. AC_SUBST(EVLOOP_IMPL,"evloop/kqueue.${OBJEXT}")
  65. AC_SUBST(EVLOOP_METHOD,EVLOOP_KQUEUE)
  66. break])
  67. ;;
  68. poll)
  69. AC_CHECK_FUNC(poll,[
  70. AC_SUBST(EVLOOP_IMPL,"evloop/poll.${OBJEXT}")
  71. AC_SUBST(EVLOOP_METHOD,EVLOOP_POLL)
  72. break])
  73. break
  74. ;;
  75. *)
  76. AC_MSG_ERROR($m is not a valid evloop method)
  77. exit 1
  78. ;;
  79. esac
  80. done
  81. if test x"$EVLOOP_METHOD" == x; then
  82. AC_MSG_FAILURE(no suitable evloop method found)
  83. exit 1
  84. else
  85. AC_MSG_NOTICE(selected evloop method $EVLOOP_METHOD)
  86. fi
  87. for i in 0 1 2 3 4 5 6; do
  88. case $i in
  89. 0) if test x"$TD_CFLAGS$TD_LIBS" == x; then continue; fi;;
  90. 1) TD_CFLAGS=-pthread;;
  91. 2) TD_CFLAGS=-pthreads;;
  92. 3) TD_CFLAGS=-kthread;;
  93. 4) TD_CFLAGS=-mt;;
  94. 5) TD_LIBS=-lpthread;;
  95. 6) AC_MSG_FAILURE(how do you build with pthreads on this system?);;
  96. esac
  97. AC_MSG_CHECKING(whether pthreads compiles with flags \"$TD_CFLAGS $TD_LIBS\")
  98. CC_ARGS_OK_IFELSE($TD_CFLAGS $CFLAGS $TD_LIBS $LIBS,,
  99. AC_MSG_RESULT(no)
  100. TD_CFLAGS=""; TD_LIBS=""
  101. continue)
  102. old_CFLAGS=$CFLAGS; old_LIBS=$LIBS
  103. CFLAGS="$TD_CFLAGS $CFLAGS"; LIBS="$TD_LIBS $LIBS"
  104. AC_LINK_IFELSE([
  105. #include <pthread.h>
  106. int main(void) { return pthread_create(0,0,0,0);}
  107. ], [
  108. AC_MSG_RESULT(yes)
  109. CFLAGS=$old_CFLAGS; LIBS=$old_LIBS
  110. break
  111. ], [
  112. AC_MSG_RESULT(no)
  113. TD_CFLAGS=""; TD_LIBS=""
  114. CFLAGS=$old_CFLAGS; LIBS=$old_LIBS
  115. ])
  116. done
  117. AC_SUBST(TD_CFLAGS)
  118. AC_SUBST(TD_LIBS)
  119. AC_OUTPUT