2
0

ac_cflags_sun_option.m4 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. AC_DEFUN([AX_CFLAGS_SUN_OPTION_OLD], [dnl
  2. AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
  3. AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$2])dnl
  4. AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)],
  5. VAR,[VAR="no, unknown"
  6. AC_LANG_SAVE
  7. AC_LANG_C
  8. ac_save_[]FLAGS="$[]FLAGS"
  9. for ac_arg dnl
  10. in "+xstrconst -Xc % m4_ifval($2,$2,-option)" dnl Solaris C
  11. #
  12. do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  13. AC_TRY_COMPILE([],[return 0;],
  14. [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  15. done
  16. FLAGS="$ac_save_[]FLAGS"
  17. AC_LANG_RESTORE
  18. ])
  19. case ".$VAR" in
  20. .ok|.ok,*) m4_ifvaln($3,$3) ;;
  21. .|.no|.no,*) m4_ifvaln($4,$4) ;;
  22. *) m4_ifvaln($3,$3,[
  23. if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  24. then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  25. else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  26. m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  27. fi ]) ;;
  28. esac
  29. AS_VAR_POPDEF([VAR])dnl
  30. AS_VAR_POPDEF([FLAGS])dnl
  31. ])
  32. dnl the only difference - the LANG selection... and the default FLAGS
  33. AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_OLD], [dnl
  34. AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
  35. AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$2])dnl
  36. AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)],
  37. VAR,[VAR="no, unknown"
  38. AC_LANG_SAVE
  39. AC_LANG_CXX
  40. ac_save_[]FLAGS="$[]FLAGS"
  41. for ac_arg dnl
  42. in "+xstrconst -Xc % m4_ifval($2,$2,-option)" dnl Solaris C
  43. #
  44. do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  45. AC_TRY_COMPILE([],[return 0;],
  46. [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  47. done
  48. FLAGS="$ac_save_[]FLAGS"
  49. AC_LANG_RESTORE
  50. ])
  51. case ".$VAR" in
  52. .ok|.ok,*) m4_ifvaln($3,$3) ;;
  53. .|.no|.no,*) m4_ifvaln($4,$4) ;;
  54. *) m4_ifvaln($3,$3,[
  55. if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  56. then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
  57. else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
  58. m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
  59. fi ]) ;;
  60. esac
  61. AS_VAR_POPDEF([VAR])dnl
  62. AS_VAR_POPDEF([FLAGS])dnl
  63. ])
  64. dnl -----------------------------------------------------------------------
  65. AC_DEFUN([AX_CFLAGS_SUN_OPTION_NEW], [dnl
  66. AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
  67. AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$1])dnl
  68. AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)],
  69. VAR,[VAR="no, unknown"
  70. AC_LANG_SAVE
  71. AC_LANG_C
  72. ac_save_[]FLAGS="$[]FLAGS"
  73. for ac_arg dnl
  74. in "+xstrconst -Xc % m4_ifval($1,$1,-option)" dnl Solaris C
  75. #
  76. do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  77. AC_TRY_COMPILE([],[return 0;],
  78. [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  79. done
  80. FLAGS="$ac_save_[]FLAGS"
  81. AC_LANG_RESTORE
  82. ])
  83. case ".$VAR" in
  84. .ok|.ok,*) m4_ifvaln($3,$3) ;;
  85. .|.no|.no,*) m4_ifvaln($4,$4) ;;
  86. *) m4_ifvaln($3,$3,[
  87. if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  88. then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
  89. else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
  90. m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
  91. fi ]) ;;
  92. esac
  93. AS_VAR_POPDEF([VAR])dnl
  94. AS_VAR_POPDEF([FLAGS])dnl
  95. ])
  96. dnl the only difference - the LANG selection... and the default FLAGS
  97. AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_NEW], [dnl
  98. AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
  99. AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$1])dnl
  100. AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)],
  101. VAR,[VAR="no, unknown"
  102. AC_LANG_SAVE
  103. AC_LANG_CXX
  104. ac_save_[]FLAGS="$[]FLAGS"
  105. for ac_arg dnl
  106. in "+xstrconst -Xc % m4_ifval($1,$1,-option)" dnl Solaris C
  107. #
  108. do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
  109. AC_TRY_COMPILE([],[return 0;],
  110. [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
  111. done
  112. FLAGS="$ac_save_[]FLAGS"
  113. AC_LANG_RESTORE
  114. ])
  115. case ".$VAR" in
  116. .ok|.ok,*) m4_ifvaln($3,$3) ;;
  117. .|.no|.no,*) m4_ifvaln($4,$4) ;;
  118. *) m4_ifvaln($3,$3,[
  119. if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
  120. then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
  121. else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
  122. m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
  123. fi ]) ;;
  124. esac
  125. AS_VAR_POPDEF([VAR])dnl
  126. AS_VAR_POPDEF([FLAGS])dnl
  127. ])
  128. AC_DEFUN([AX_CFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1,
  129. [AX_CFLAGS_SUN_OPTION_NEW($@)],[AX_CFLAGS_SUN_OPTION_OLD($@)])])
  130. AC_DEFUN([AX_CXXFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1,
  131. [AX_CXXFLAGS_SUN_OPTION_NEW($@)],[AX_CXXFLAGS_SUN_OPTION_OLD($@)])])