configure.in.fns
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:6k
源码类别:

通讯编程

开发平台:

Visual C++

  1. dnl
  2. dnl autoconf rules to find things in general
  3. dnl
  4. dnl
  5. dnl General approach to using these macros:
  6. dnl
  7. dnl bracket a group of them that must succeed or fail together
  8. dnl with NS_BEGIN_PACKAGE(s)/NS_END_PACKAGE(s).
  9. dnl In between put NS_CHECK_{LIB,HEADER}_PATH().
  10. dnl Custom checks can call NS_PACKAGE_NOT_COMPLETE(s) if something's wrong.
  11. dnl
  12. dnl See configure.in.dmalloc for an example.
  13. dnl
  14. dnl These macros add their stuff to V_LIBS, V_INCLUDES, V_DEFINES.
  15. dnl You should add them to your Makefile.in
  16. dnl You also need to put NS_FNS_TAIL in your configure.in
  17. dnl (typically just before including configure.in.tail).
  18. dnl
  19. dnl
  20. dnl
  21. dnl NS_BEGIN_PACKAGE(NAME)
  22. dnl
  23. dnl (Internally, _UNDERWAY says that we found some part of it,
  24. dnl _COMPLETE says we've got all of it.)
  25. dnl
  26. AC_DEFUN(NS_BEGIN_PACKAGE,
  27. [
  28. NS_PACKAGE_[$1]_UNDERWAY=false
  29. NS_PACKAGE_[$1]_COMPLETE=true
  30. ])
  31. dnl
  32. dnl If a test fails, call NS_PACKAGE_NOT_COMPLETE(NAME) to cause NS_END_PACKAGE to
  33. dnl eventually die.
  34. dnl
  35. AC_DEFUN(NS_PACKAGE_NOT_COMPLETE,
  36. [
  37. NS_PACKAGE_[$1]_COMPLETE=false
  38. ])
  39. dnl
  40. dnl NS_END_PACKAGE(NAME,REQUIRED)
  41. dnl REQUIRED should be "yes" or "no"
  42. dnl
  43. AC_DEFUN(NS_END_PACKAGE,
  44. [
  45. NS_PACKAGE_[$1]_VALID=false
  46. if $NS_PACKAGE_[$1]_UNDERWAY; then
  47. if $NS_PACKAGE_[$1]_COMPLETE; then
  48. : [All components of $1 found.]
  49. NS_PACKAGE_[$1]_VALID=true
  50. else
  51. AC_MSG_ERROR([Installation of $1 seems incomplete or can't be found automatically.
  52. Please correct the problem by telling configure where $1 is
  53. using the argument --with-$1=/path/to/package
  54. (perhaps after installing it),
  55. or the package is not required, disable it with --with-$1=no.])
  56. fi
  57. fi
  58. if test "x$2" = xyes; then
  59. if $NS_PACKAGE_[$1]_VALID; then
  60. :
  61. else
  62. AC_MSG_ERROR([$1 is required but could not be completely found.
  63. Please correct the problem by telling configure where $1 is
  64. using the argument --with-$1=/path/to/package,
  65. or the package is not required, disable it with --with-$1=no.])
  66. fi
  67. fi
  68. ])
  69. dnl
  70. dnl NS_CHECK_LIB_PATH(LIBRARY,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
  71. dnl LIBRARY should be with a dotted version number but without a .a extension
  72. dnl PATH is whitespace separated
  73. dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
  74. dnl SUGGESTION_PATH
  75. dnl sets VARIABLE to be the include stuff
  76. dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
  77. dnl
  78. dnl Automatically adds it to V_LIBS and adds a -DHAVE_LIBLIBRARY to V_DEFINES
  79. dnl
  80. AC_DEFUN(NS_CHECK_LIB_PATH,
  81. [
  82. AC_MSG_CHECKING([for lib$1])
  83. if test "x$3" = "xno"; then
  84. : disable library
  85. $5=FAIL
  86. NS_PACKAGE_NOT_COMPLETE($6)
  87. AC_MSG_RESULT(no)
  88. else
  89. places="$2"
  90. if test "x$3" != "x" -a "x$3" != xyes; then
  91. if test ! -d $3; then
  92. AC_MSG_ERROR($3 is not a directory)
  93. fi
  94. places="$4"
  95. fi
  96. $5=""
  97. dnl full_lib_name is libtcl7.6
  98. full_lib_name="$1"
  99. dnl simple_lib_name is libtcl76
  100. simple_lib_name=`echo $full_lib_name | sed -e 's/.//'`
  101. dnl other_simple_lib_name is libtcl7_6
  102. other_simple_lib_name=`echo $full_lib_name | sed -e 's/./_/'`
  103. dnl simpler_lib_name is libtcl
  104. simpler_lib_name=`echo $simple_lib_name | sed -e 'y/0123456789/          /'`
  105. double_break=false
  106. for dir in $places; do
  107. for file in $full_lib_name $simple_lib_name $other_simple_lib_name $simpler_lib_name
  108. do
  109. if test -r $dir/lib$file.so -o -r $dir/lib$file.a -o -r $dir/lib$file.dylib; then
  110. $5="-L$dir -l$file"
  111. double_break=true
  112. break
  113. fi
  114. done
  115. if $double_break; then
  116. break
  117. fi
  118. done
  119. if test "FAIL$[$5]" = "FAIL" ; then
  120. NS_PACKAGE_NOT_COMPLETE($6)
  121. AC_MSG_RESULT(no)
  122. else
  123. if test "$solaris"; then
  124. $5="-R$dir $[$5]"
  125. fi
  126. changequote(, )dnl
  127. ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' 
  128.     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
  129. changequote([, ])dnl
  130. AC_DEFINE_UNQUOTED($ac_tr_lib)
  131. dnl add to list
  132. V_LIBS="$[$5] $V_LIBS"
  133. V_DEFINES="-D$ac_tr_lib $V_DEFINES"
  134. NS_PACKAGE_[$6]_UNDERWAY=true
  135. AC_MSG_RESULT($[$5])
  136. fi
  137. fi
  138. ])
  139. dnl
  140. dnl NS_CHECK_HEADER_PATH(HEADER,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
  141. dnl HEADER should be file with an extension
  142. dnl PATH is whitespace separated
  143. dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
  144. dnl SUGGESTION_PATH
  145. dnl sets VARIABLE to be the include stuff
  146. dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
  147. dnl
  148. dnl Automatically adds it to V_INCLUDES and adds a -DHAVE_HEADER to V_DEFINES
  149. dnl
  150. AC_DEFUN(NS_CHECK_HEADER_PATH,
  151. [
  152. AC_MSG_CHECKING([for $1])
  153. if test "x$3" = "xno"; then
  154. : disable header
  155. $5=FAIL
  156. NS_PACKAGE_NOT_COMPLETE($6)
  157. AC_MSG_RESULT(no)
  158. else
  159. places="$2"
  160. if test "x$3" != "x" -a "x$3" != xyes; then
  161. if test ! -d $3; then
  162. AC_MSG_ERROR($3 is not a directory)
  163. fi
  164. places="$4"
  165. fi
  166. $5=""
  167. found=""
  168. for dir in $places; do
  169. if test -r $dir/$1; then
  170.                         found="$dir"
  171.                         if test "$CC" != "icc" ||
  172.                                 test "$dir" != "/usr/include"; then
  173.                                 $5="-I$dir"
  174.                         fi
  175. break
  176. fi
  177. done
  178. if test "FAIL$found" = "FAIL" ; then
  179. NS_PACKAGE_NOT_COMPLETE($6)
  180. AC_MSG_RESULT(no)
  181. else
  182. changequote(, )dnl
  183.   ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  184. changequote([, ])dnl
  185.                 AC_DEFINE_UNQUOTED($ac_tr_hdr)
  186. V_INCLUDES="$[$5] $V_INCLUDES"
  187. V_DEFINES="-D$ac_tr_hdr $V_DEFINES"
  188. NS_PACKAGE_[$6]_UNDERWAY=true
  189. AC_MSG_RESULT($[$5])
  190. fi
  191. fi
  192. ])
  193. dnl
  194. dnl NS_CHECK_ANY_PATH(ANY,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
  195. dnl ANY shoudl be the file
  196. dnl PATH is whitespace separated
  197. dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
  198. dnl SUGGESTION_PATH
  199. dnl sets VARIABLE to be the include stuff
  200. dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
  201. dnl
  202. AC_DEFUN(NS_CHECK_ANY_PATH,
  203. [
  204. AC_MSG_CHECKING([for $1])
  205. if test "x$3" = "xno"; then
  206. : disable header
  207. $5=FAIL
  208. NS_PACKAGE_NOT_COMPLETE($6)
  209. AC_MSG_RESULT(no)
  210. else
  211. places="$2"
  212. if test "x$3" != "x" -a "x$3" != xyes; then
  213. if test ! -d $3; then
  214. AC_MSG_ERROR($3 is not a directory)
  215. fi
  216. places="$4"
  217. fi
  218. $5=""
  219. for dir in $places; do
  220. if test -r $dir/$1; then
  221. $5="$dir"
  222. break
  223. fi
  224. done
  225. if test "FAIL$[$5]" = "FAIL" ; then
  226. NS_PACKAGE_NOT_COMPLETE($6)
  227. AC_MSG_RESULT(no)
  228. else
  229. NS_PACKAGE_[$6]_UNDERWAY=true
  230. AC_MSG_RESULT($[$5])
  231. fi
  232. fi
  233. ])
  234. dnl
  235. dnl Final stuff for fns
  236. dnl
  237. AC_DEFUN(NS_FNS_TAIL,
  238. [
  239. AC_SUBST(V_INCLUDES)
  240. AC_SUBST(V_LIBS)
  241. AC_SUBST(V_DEFINES)
  242. dnl AC_SUBST(V_OBJS)
  243. ])