acinclude.m4 6.2 KB

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