curl-system.m4 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at http://curl.haxx.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. #***************************************************************************
  22. # File version for 'aclocal' use. Keep it a single number.
  23. # serial 3
  24. dnl CURL_CHECK_PATH_SEPARATOR
  25. dnl -------------------------------------------------
  26. dnl Check and compute the path separator for us. This
  27. dnl path separator is the symbol used to diferentiate
  28. dnl or separate paths inside the PATH environment var.
  29. AC_DEFUN([CURL_CHECK_PATH_SEPARATOR], [
  30. if test -z "$curl_cv_PATH_SEPARATOR"; then
  31. if test -z "$PATH"; then
  32. AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.])
  33. fi
  34. dnl Directory count in PATH when using a colon separator.
  35. tst_dirs_col=0
  36. tst_save_IFS=$IFS; IFS=':'
  37. for tst_dir in $PATH; do
  38. IFS=$tst_save_IFS
  39. test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1`
  40. done
  41. IFS=$tst_save_IFS
  42. dnl Directory count in PATH when using a semicolon separator.
  43. tst_dirs_sem=0
  44. tst_save_IFS=$IFS; IFS=';'
  45. for tst_dir in $PATH; do
  46. IFS=$tst_save_IFS
  47. test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1`
  48. done
  49. IFS=$tst_save_IFS
  50. if test $tst_dirs_sem -eq $tst_dirs_col; then
  51. dnl When both counting methods give the same result we do not want to
  52. dnl chose one over the other, and consider auto-detection not possible.
  53. if test -z "$PATH_SEPARATOR"; then
  54. dnl Stop dead until user provides PATH_SEPARATOR definition.
  55. AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.])
  56. fi
  57. else
  58. dnl Separator with the greater directory count is the auto-detected one.
  59. if test $tst_dirs_sem -gt $tst_dirs_col; then
  60. tst_auto_separator=';'
  61. else
  62. tst_auto_separator=':'
  63. fi
  64. if test -z "$PATH_SEPARATOR"; then
  65. dnl Simply use the auto-detected one when not already set.
  66. PATH_SEPARATOR="$tst_auto_separator"
  67. fi
  68. fi
  69. curl_cv_PATH_SEPARATOR="$PATH_SEPARATOR"
  70. fi
  71. AC_SUBST([PATH_SEPARATOR])
  72. AC_SUBST([PATH])
  73. ])
  74. dnl CURL_CHECK_PATH_SEPARATOR_REQUIRED
  75. dnl -------------------------------------------------
  76. dnl Use this to ensure that the path separator check
  77. dnl macro is only expanded and included once.
  78. AC_DEFUN([CURL_CHECK_PATH_SEPARATOR_REQUIRED], [
  79. AC_REQUIRE([CURL_CHECK_PATH_SEPARATOR])dnl
  80. ])