2
0

curl-system.m4 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2008, 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. # $Id$
  22. #***************************************************************************
  23. # File version for 'aclocal' use. Keep it a single number.
  24. # serial 2
  25. dnl CURL_CHECK_PATH_SEPARATOR
  26. dnl -------------------------------------------------
  27. dnl Check and compute the path separator for us. This
  28. dnl path separator is the symbol used to diferentiate
  29. dnl or separate paths inside the PATH environment var.
  30. AC_DEFUN([CURL_CHECK_PATH_SEPARATOR], [
  31. if test -z "$curl_cv_PATH_SEPARATOR"; then
  32. if test -z "$PATH"; then
  33. AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.])
  34. fi
  35. dnl Directory count in PATH when using a colon separator.
  36. tst_dirs_col=0
  37. tst_save_IFS=$IFS; IFS=':'
  38. for tst_dir in $PATH; do
  39. IFS=$tst_save_IFS
  40. test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1`
  41. done
  42. IFS=$tst_save_IFS
  43. dnl Directory count in PATH when using a semicolon separator.
  44. tst_dirs_sem=0
  45. tst_save_IFS=$IFS; IFS=';'
  46. for tst_dir in $PATH; do
  47. IFS=$tst_save_IFS
  48. test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1`
  49. done
  50. IFS=$tst_save_IFS
  51. if test $tst_dirs_sem -eq $tst_dirs_col; then
  52. dnl When both counting methods give the same result we do not want to
  53. dnl chose one over the other, and consider auto-detection not possible.
  54. if test -z "$PATH_SEPARATOR"; then
  55. dnl Stop dead until user provides PATH_SEPARATOR definition.
  56. AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.])
  57. fi
  58. else
  59. dnl Separator with the greater directory count is the auto-detected one.
  60. if test $tst_dirs_sem -gt $tst_dirs_col; then
  61. tst_auto_separator=';'
  62. else
  63. tst_auto_separator=':'
  64. fi
  65. if test -z "$PATH_SEPARATOR"; then
  66. dnl Simply use the auto-detected one when not already set.
  67. PATH_SEPARATOR="$tst_auto_separator"
  68. fi
  69. fi
  70. curl_cv_PATH_SEPARATOR="$PATH_SEPARATOR"
  71. fi
  72. AC_SUBST([PATH_SEPARATOR])
  73. AC_SUBST([PATH])
  74. ])