No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xc-val-flgs.m4 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. #---------------------------------------------------------------------------
  2. #
  3. # xc-val-flgs.m4
  4. #
  5. # Copyright (c) 2013 Daniel Stenberg <daniel@haxx.se>
  6. #
  7. # Permission to use, copy, modify, and distribute this software for any
  8. # purpose with or without fee is hereby granted, provided that the above
  9. # copyright notice and this permission notice appear in all copies.
  10. #
  11. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  14. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  15. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  16. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  17. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. #
  19. # SPDX-License-Identifier: ISC
  20. #---------------------------------------------------------------------------
  21. # serial 1
  22. dnl _XC_CHECK_VAR_LIBS
  23. dnl -------------------------------------------------
  24. dnl Private macro.
  25. AC_DEFUN([_XC_CHECK_VAR_LIBS], [
  26. xc_bad_var_libs=no
  27. for xc_word in $LIBS; do
  28. case "$xc_word" in
  29. -l* | --library=*)
  30. :
  31. ;;
  32. *)
  33. xc_bad_var_libs=yes
  34. ;;
  35. esac
  36. done
  37. if test $xc_bad_var_libs = yes; then
  38. AC_MSG_NOTICE([using LIBS: $LIBS])
  39. AC_MSG_NOTICE([LIBS note: LIBS should only be used to specify libraries (-lname).])
  40. fi
  41. ])
  42. dnl _XC_CHECK_VAR_LDFLAGS
  43. dnl -------------------------------------------------
  44. dnl Private macro.
  45. AC_DEFUN([_XC_CHECK_VAR_LDFLAGS], [
  46. xc_bad_var_ldflags=no
  47. for xc_word in $LDFLAGS; do
  48. case "$xc_word" in
  49. -D*)
  50. xc_bad_var_ldflags=yes
  51. ;;
  52. -U*)
  53. xc_bad_var_ldflags=yes
  54. ;;
  55. -I*)
  56. xc_bad_var_ldflags=yes
  57. ;;
  58. -l* | --library=*)
  59. xc_bad_var_ldflags=yes
  60. ;;
  61. esac
  62. done
  63. if test $xc_bad_var_ldflags = yes; then
  64. AC_MSG_NOTICE([using LDFLAGS: $LDFLAGS])
  65. xc_bad_var_msg="LDFLAGS note: LDFLAGS should only be used to specify linker flags, not"
  66. for xc_word in $LDFLAGS; do
  67. case "$xc_word" in
  68. -D*)
  69. AC_MSG_NOTICE([$xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word])
  70. ;;
  71. -U*)
  72. AC_MSG_NOTICE([$xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word])
  73. ;;
  74. -I*)
  75. AC_MSG_NOTICE([$xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word])
  76. ;;
  77. -l* | --library=*)
  78. AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word])
  79. ;;
  80. esac
  81. done
  82. fi
  83. ])
  84. dnl _XC_CHECK_VAR_CPPFLAGS
  85. dnl -------------------------------------------------
  86. dnl Private macro.
  87. AC_DEFUN([_XC_CHECK_VAR_CPPFLAGS], [
  88. xc_bad_var_cppflags=no
  89. for xc_word in $CPPFLAGS; do
  90. case "$xc_word" in
  91. -rpath*)
  92. xc_bad_var_cppflags=yes
  93. ;;
  94. -L* | --library-path=*)
  95. xc_bad_var_cppflags=yes
  96. ;;
  97. -l* | --library=*)
  98. xc_bad_var_cppflags=yes
  99. ;;
  100. esac
  101. done
  102. if test $xc_bad_var_cppflags = yes; then
  103. AC_MSG_NOTICE([using CPPFLAGS: $CPPFLAGS])
  104. xc_bad_var_msg="CPPFLAGS note: CPPFLAGS should only be used to specify C preprocessor flags, not"
  105. for xc_word in $CPPFLAGS; do
  106. case "$xc_word" in
  107. -rpath*)
  108. AC_MSG_NOTICE([$xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word])
  109. ;;
  110. -L* | --library-path=*)
  111. AC_MSG_NOTICE([$xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word])
  112. ;;
  113. -l* | --library=*)
  114. AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word])
  115. ;;
  116. esac
  117. done
  118. fi
  119. ])
  120. dnl _XC_CHECK_VAR_CFLAGS
  121. dnl -------------------------------------------------
  122. dnl Private macro.
  123. AC_DEFUN([_XC_CHECK_VAR_CFLAGS], [
  124. xc_bad_var_cflags=no
  125. for xc_word in $CFLAGS; do
  126. case "$xc_word" in
  127. -D*)
  128. xc_bad_var_cflags=yes
  129. ;;
  130. -U*)
  131. xc_bad_var_cflags=yes
  132. ;;
  133. -I*)
  134. xc_bad_var_cflags=yes
  135. ;;
  136. -rpath*)
  137. xc_bad_var_cflags=yes
  138. ;;
  139. -L* | --library-path=*)
  140. xc_bad_var_cflags=yes
  141. ;;
  142. -l* | --library=*)
  143. xc_bad_var_cflags=yes
  144. ;;
  145. esac
  146. done
  147. if test $xc_bad_var_cflags = yes; then
  148. AC_MSG_NOTICE([using CFLAGS: $CFLAGS])
  149. xc_bad_var_msg="CFLAGS note: CFLAGS should only be used to specify C compiler flags, not"
  150. for xc_word in $CFLAGS; do
  151. case "$xc_word" in
  152. -D*)
  153. AC_MSG_NOTICE([$xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word])
  154. ;;
  155. -U*)
  156. AC_MSG_NOTICE([$xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word])
  157. ;;
  158. -I*)
  159. AC_MSG_NOTICE([$xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word])
  160. ;;
  161. -rpath*)
  162. AC_MSG_NOTICE([$xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word])
  163. ;;
  164. -L* | --library-path=*)
  165. AC_MSG_NOTICE([$xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word])
  166. ;;
  167. -l* | --library=*)
  168. AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word])
  169. ;;
  170. esac
  171. done
  172. fi
  173. ])
  174. dnl XC_CHECK_USER_FLAGS
  175. dnl -------------------------------------------------
  176. dnl Public macro.
  177. dnl
  178. dnl Performs some sanity checks for LIBS, LDFLAGS,
  179. dnl CPPFLAGS and CFLAGS values that the user might
  180. dnl have set. When checks fails, user is noticed
  181. dnl about errors detected in all of them and script
  182. dnl execution is halted.
  183. dnl
  184. dnl Intended to be used early in configure script.
  185. AC_DEFUN([XC_CHECK_USER_FLAGS], [
  186. AC_PREREQ([2.50])dnl
  187. AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
  188. dnl check order below matters
  189. _XC_CHECK_VAR_LIBS
  190. _XC_CHECK_VAR_LDFLAGS
  191. _XC_CHECK_VAR_CPPFLAGS
  192. _XC_CHECK_VAR_CFLAGS
  193. if test $xc_bad_var_libs = yes ||
  194. test $xc_bad_var_cflags = yes ||
  195. test $xc_bad_var_ldflags = yes ||
  196. test $xc_bad_var_cppflags = yes; then
  197. AC_MSG_ERROR([Can not continue. Fix errors mentioned immediately above this line.])
  198. fi
  199. ])
  200. dnl XC_CHECK_BUILD_FLAGS
  201. dnl -------------------------------------------------
  202. dnl Public macro.
  203. dnl
  204. dnl Performs some sanity checks for LIBS, LDFLAGS,
  205. dnl CPPFLAGS and CFLAGS values that the configure
  206. dnl script might have set. When checks fails, user
  207. dnl is noticed about errors detected in all of them
  208. dnl but script continues execution.
  209. dnl
  210. dnl Intended to be used very late in configure script.
  211. AC_DEFUN([XC_CHECK_BUILD_FLAGS], [
  212. AC_PREREQ([2.50])dnl
  213. dnl check order below matters
  214. _XC_CHECK_VAR_LIBS
  215. _XC_CHECK_VAR_LDFLAGS
  216. _XC_CHECK_VAR_CPPFLAGS
  217. _XC_CHECK_VAR_CFLAGS
  218. if test $xc_bad_var_libs = yes ||
  219. test $xc_bad_var_cflags = yes ||
  220. test $xc_bad_var_ldflags = yes ||
  221. test $xc_bad_var_cppflags = yes; then
  222. AC_MSG_WARN([Continuing even with errors mentioned immediately above this line.])
  223. fi
  224. ])