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. for dir in $places; do
  168. if test -r $dir/$1; then
  169. $5="-I$dir"
  170. break
  171. fi
  172. done
  173. if test "FAIL$[$5]" = "FAIL" ; then
  174. NS_PACKAGE_NOT_COMPLETE($6)
  175. AC_MSG_RESULT(no)
  176. else
  177. changequote(, )dnl
  178.   ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  179. changequote([, ])dnl
  180.                 AC_DEFINE_UNQUOTED($ac_tr_hdr)
  181. V_INCLUDES="$[$5] $V_INCLUDES"
  182. V_DEFINES="-D$ac_tr_hdr $V_DEFINES"
  183. NS_PACKAGE_[$6]_UNDERWAY=true
  184. AC_MSG_RESULT($[$5])
  185. fi
  186. fi
  187. ])
  188. dnl
  189. dnl NS_CHECK_ANY_PATH(ANY,PATH,SUGGESTION,SUGGESTION_PATH,VARIABLE,PACKAGE)
  190. dnl ANY shoudl be the file
  191. dnl PATH is whitespace separated
  192. dnl SUGGESTION, no disables, "" or "yes" enables, otherwise search SUGGESTION_PATH
  193. dnl SUGGESTION_PATH
  194. dnl sets VARIABLE to be the include stuff
  195. dnl PACKAGE is the name specified in NS_{BEGIN,END}_PACKAGE or "no"
  196. dnl
  197. AC_DEFUN(NS_CHECK_ANY_PATH,
  198. [
  199. AC_MSG_CHECKING([for $1])
  200. if test "x$3" = "xno"; then
  201. : disable header
  202. $5=FAIL
  203. NS_PACKAGE_NOT_COMPLETE($6)
  204. AC_MSG_RESULT(no)
  205. else
  206. places="$2"
  207. if test "x$3" != "x" -a "x$3" != xyes; then
  208. if test ! -d $3; then
  209. AC_MSG_ERROR($3 is not a directory)
  210. fi
  211. places="$4"
  212. fi
  213. $5=""
  214. for dir in $places; do
  215. if test -r $dir/$1; then
  216. $5="$dir"
  217. break
  218. fi
  219. done
  220. if test "FAIL$[$5]" = "FAIL" ; then
  221. NS_PACKAGE_NOT_COMPLETE($6)
  222. AC_MSG_RESULT(no)
  223. else
  224. NS_PACKAGE_[$6]_UNDERWAY=true
  225. AC_MSG_RESULT($[$5])
  226. fi
  227. fi
  228. ])
  229. dnl
  230. dnl Final stuff for fns
  231. dnl
  232. AC_DEFUN(NS_FNS_TAIL,
  233. [
  234. AC_SUBST(V_INCLUDES)
  235. AC_SUBST(V_LIBS)
  236. AC_SUBST(V_DEFINES)
  237. dnl AC_SUBST(V_OBJS)
  238. ])