acinclude.m4 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. #
  2. # Copyright 2005 The Apache Software Foundation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. AC_DEFUN([FUSE_DFS_INITIALIZE],
  17. [
  18. AM_INIT_AUTOMAKE([ foreign 1.9.5 no-define ])
  19. if test "x$1" = "xlocalinstall"; then
  20. wdir=`pwd`
  21. # To use $wdir undef quote.
  22. #
  23. ##########
  24. AC_PREFIX_DEFAULT([`pwd`/install])
  25. echo
  26. fi
  27. AC_PROG_CC
  28. AC_PROG_CXX
  29. AC_PROG_RANLIB(RANLIB, ranlib)
  30. AC_PATH_PROGS(BASH, bash)
  31. AC_PATH_PROGS(PERL, perl)
  32. AC_PATH_PROGS(PYTHON, python)
  33. AC_PATH_PROGS(AR, ar)
  34. AC_PATH_PROGS(ANT, ant)
  35. PRODUCT_MK=""
  36. ])
  37. AC_DEFUN([FUSE_DFS_WITH_EXTERNAL_PATH],
  38. [
  39. cdir=`pwd`
  40. AC_MSG_CHECKING([Checking EXTERNAL_PATH set to])
  41. AC_ARG_WITH([externalpath],
  42. [ --with-externalpath=DIR User specified path to external fuse dfs components.],
  43. [
  44. if test "x${EXTERNAL_PATH}" != "x"; then
  45. echo ""
  46. echo "ERROR: You have already set EXTERNAL_PATH in your environment"
  47. echo "Cannot override it using --with-externalpath. Unset EXTERNAL_PATH to use this option"
  48. exit 1
  49. fi
  50. EXTERNAL_PATH=$withval
  51. ],
  52. [
  53. if test "x${EXTERNAL_PATH}" = "x"; then
  54. EXTERNAL_PATH=$1
  55. fi
  56. ]
  57. )
  58. if test "x${EXTERNAL_PATH}" = "x"; then
  59. export EXTERNAL_PATH="$cdir/external"
  60. GLOBAL_HEADER_MK="include ${EXTERNAL_PATH}/global_header.mk"
  61. GLOBAL_FOOTER_MK="include ${EXTERNAL_PATH}/global_footer.mk"
  62. else
  63. export EXTERNAL_PATH
  64. GLOBAL_HEADER_MK="include ${EXTERNAL_PATH}/global_header.mk"
  65. GLOBAL_FOOTER_MK="include ${EXTERNAL_PATH}/global_footer.mk"
  66. fi
  67. AC_MSG_RESULT($EXTERNAL_PATH)
  68. if test ! -d ${EXTERNAL_PATH}; then
  69. echo ""
  70. echo "ERROR: EXTERNAL_PATH set to an nonexistent directory ${EXTERNAL_PATH}"
  71. exit 1
  72. fi
  73. AC_SUBST(EXTERNAL_PATH)
  74. AC_SUBST(GLOBAL_HEADER_MK)
  75. AC_SUBST(GLOBAL_FOOTER_MK)
  76. ])
  77. # Set option to enable shared mode. Set DEBUG and OPT for use in Makefile.am.
  78. AC_DEFUN([FUSE_DFS_ENABLE_DEFAULT_OPT_BUILD],
  79. [
  80. AC_MSG_CHECKING([whether to enable optimized build])
  81. AC_ARG_ENABLE([opt],
  82. [ --disable-opt Set up debug mode.],
  83. [
  84. ENABLED_OPT=$enableval
  85. ],
  86. [
  87. ENABLED_OPT="yes"
  88. ]
  89. )
  90. if test "$ENABLED_OPT" = "yes"
  91. then
  92. CFLAGS="-Wall -O3"
  93. CXXFLAGS="-Wall -O3"
  94. else
  95. CFLAGS="-Wall -g"
  96. CXXFLAGS="-Wall -g"
  97. fi
  98. AC_MSG_RESULT($ENABLED_OPT)
  99. AM_CONDITIONAL([OPT], [test "$ENABLED_OPT" = yes])
  100. AM_CONDITIONAL([DEBUG], [test "$ENABLED_OPT" = no])
  101. ])
  102. # Set option to enable debug mode. Set DEBUG and OPT for use in Makefile.am.
  103. AC_DEFUN([FUSE_DFS_ENABLE_DEFAULT_DEBUG_BUILD],
  104. [
  105. AC_MSG_CHECKING([whether to enable debug build])
  106. AC_ARG_ENABLE([debug],
  107. [ --disable-debug Set up opt mode.],
  108. [
  109. ENABLED_DEBUG=$enableval
  110. ],
  111. [
  112. ENABLED_DEBUG="yes"
  113. ]
  114. )
  115. if test "$ENABLED_DEBUG" = "yes"
  116. then
  117. CFLAGS="-Wall -g"
  118. CXXFLAGS="-Wall -g"
  119. else
  120. CFLAGS="-Wall -O3"
  121. CXXFLAGS="-Wall -O3"
  122. fi
  123. AC_MSG_RESULT($ENABLED_DEBUG)
  124. AM_CONDITIONAL([DEBUG], [test "$ENABLED_DEBUG" = yes])
  125. AM_CONDITIONAL([OPT], [test "$ENABLED_DEBUG" = no])
  126. ])
  127. # Set option to enable static libs.
  128. AC_DEFUN([FUSE_DFS_ENABLE_DEFAULT_STATIC],
  129. [
  130. SHARED=""
  131. STATIC=""
  132. AC_MSG_CHECKING([whether to enable static mode])
  133. AC_ARG_ENABLE([static],
  134. [ --disable-static Set up shared mode.],
  135. [
  136. ENABLED_STATIC=$enableval
  137. ],
  138. [
  139. ENABLED_STATIC="yes"
  140. ]
  141. )
  142. if test "$ENABLED_STATIC" = "yes"
  143. then
  144. LTYPE=".a"
  145. else
  146. LTYPE=".so"
  147. SHARED_CXXFLAGS="-fPIC"
  148. SHARED_CFLAGS="-fPIC"
  149. SHARED_LDFLAGS="-shared -fPIC"
  150. AC_SUBST(SHARED_CXXFLAGS)
  151. AC_SUBST(SHARED_CFLAGS)
  152. AC_SUBST(SHARED_LDFLAGS)
  153. fi
  154. AC_MSG_RESULT($ENABLED_STATIC)
  155. AC_SUBST(LTYPE)
  156. AM_CONDITIONAL([STATIC], [test "$ENABLED_STATIC" = yes])
  157. AM_CONDITIONAL([SHARED], [test "$ENABLED_STATIC" = no])
  158. ])
  159. # Set option to enable shared libs.
  160. AC_DEFUN([FUSE_DFS_ENABLE_DEFAULT_SHARED],
  161. [
  162. SHARED=""
  163. STATIC=""
  164. AC_MSG_CHECKING([whether to enable shared mode])
  165. AC_ARG_ENABLE([shared],
  166. [ --disable-shared Set up static mode.],
  167. [
  168. ENABLED_SHARED=$enableval
  169. ],
  170. [
  171. ENABLED_SHARED="yes"
  172. ]
  173. )
  174. if test "$ENABLED_SHARED" = "yes"
  175. then
  176. LTYPE=".so"
  177. SHARED_CXXFLAGS="-fPIC"
  178. SHARED_CFLAGS="-fPIC"
  179. SHARED_LDFLAGS="-shared -fPIC"
  180. AC_SUBST(SHARED_CXXFLAGS)
  181. AC_SUBST(SHARED_CFLAGS)
  182. AC_SUBST(SHARED_LDFLAGS)
  183. else
  184. LTYPE=".a"
  185. fi
  186. AC_MSG_RESULT($ENABLED_SHARED)
  187. AC_SUBST(LTYPE)
  188. AM_CONDITIONAL([SHARED], [test "$ENABLED_SHARED" = yes])
  189. AM_CONDITIONAL([STATIC], [test "$ENABLED_SHARED" = no])
  190. ])
  191. # Generates define flags and conditionals as specified by user.
  192. # This gets enabled *only* if user selects --enable-<FEATURE> otion.
  193. AC_DEFUN([FUSE_DFS_ENABLE_FEATURE],
  194. [
  195. ENABLE=""
  196. flag="$1"
  197. value="$3"
  198. AC_MSG_CHECKING([whether to enable $1])
  199. AC_ARG_ENABLE([$2],
  200. [ --enable-$2 Enable $2.],
  201. [
  202. ENABLE=$enableval
  203. ],
  204. [
  205. ENABLE="no"
  206. ]
  207. )
  208. AM_CONDITIONAL([$1], [test "$ENABLE" = yes])
  209. if test "$ENABLE" = "yes"
  210. then
  211. if test "x${value}" = "x"
  212. then
  213. AC_DEFINE([$1])
  214. else
  215. AC_DEFINE_UNQUOTED([$1], [$value])
  216. fi
  217. fi
  218. AC_MSG_RESULT($ENABLE)
  219. ])
  220. # can also use eval $2=$withval;AC_SUBST($2)
  221. AC_DEFUN([FUSE_DFS_WITH_PATH],
  222. [
  223. USRFLAG=""
  224. USRFLAG=$1
  225. AC_MSG_CHECKING([Checking $1 set to])
  226. AC_ARG_WITH([$2],
  227. [ --with-$2=DIR User specified path.],
  228. [
  229. LOC=$withval
  230. eval $USRFLAG=$withval
  231. ],
  232. [
  233. LOC=$3
  234. eval $USRFLAG=$3
  235. ]
  236. )
  237. AC_SUBST([$1])
  238. AC_MSG_RESULT($LOC)
  239. ])
  240. AC_DEFUN([FUSE_DFS_SET_FLAG_VALUE],
  241. [
  242. SETFLAG=""
  243. AC_MSG_CHECKING([Checking $1 set to])
  244. SETFLAG=$1
  245. eval $SETFLAG=\"$2\"
  246. AC_SUBST([$SETFLAG])
  247. AC_MSG_RESULT($2)
  248. ])
  249. # NOTES
  250. # if using if else bourne stmt you must have more than a macro in it.
  251. # EX1 is not correct. EX2 is correct
  252. # EX1: if test "$XX" = "yes"; then
  253. # AC_SUBST(xx)
  254. # fi
  255. # EX2: if test "$XX" = "yes"; then
  256. # xx="foo"
  257. # AC_SUBST(xx)
  258. # fi