A clone of btpd with my configuration changes.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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