1 #***************************************************************************
4 # Copyright (C) 2008 - 2009 by Daniel Stenberg et al
6 # Permission to use, copy, modify, and distribute this software and its
7 # documentation for any purpose and without fee is hereby granted, provided
8 # that the above copyright notice appear in all copies and that both that
9 # copyright notice and this permission notice appear in supporting
10 # documentation, and that the name of M.I.T. not be used in advertising or
11 # publicity pertaining to distribution of the software without specific,
12 # written prior permission. M.I.T. makes no representations about the
13 # suitability of this software for any purpose. It is provided "as is"
14 # without express or implied warranty.
16 #***************************************************************************
18 # File version for 'aclocal' use. Keep it a single number.
22 dnl CARES_CHECK_PATH_SEPARATOR
23 dnl -------------------------------------------------
24 dnl Check and compute the path separator for us. This
25 dnl path separator is the symbol used to diferentiate
26 dnl or separate paths inside the PATH environment var.
28 AC_DEFUN([CARES_CHECK_PATH_SEPARATOR], [
29 if test -z "$cares_cv_PATH_SEPARATOR"; then
30 if test -z "$PATH"; then
31 AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.])
33 dnl Directory count in PATH when using a colon separator.
35 tst_save_IFS=$IFS; IFS=':'
36 for tst_dir in $PATH; do
38 test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1`
41 dnl Directory count in PATH when using a semicolon separator.
43 tst_save_IFS=$IFS; IFS=';'
44 for tst_dir in $PATH; do
46 test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1`
49 if test $tst_dirs_sem -eq $tst_dirs_col; then
50 dnl When both counting methods give the same result we do not want to
51 dnl chose one over the other, and consider auto-detection not possible.
52 if test -z "$PATH_SEPARATOR"; then
53 dnl Stop dead until user provides PATH_SEPARATOR definition.
54 AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.])
57 dnl Separator with the greater directory count is the auto-detected one.
58 if test $tst_dirs_sem -gt $tst_dirs_col; then
59 tst_auto_separator=';'
61 tst_auto_separator=':'
63 if test -z "$PATH_SEPARATOR"; then
64 dnl Simply use the auto-detected one when not already set.
65 PATH_SEPARATOR="$tst_auto_separator"
68 cares_cv_PATH_SEPARATOR="$PATH_SEPARATOR"
70 AC_SUBST([PATH_SEPARATOR])
75 dnl CARES_CHECK_PATH_SEPARATOR_REQUIRED
76 dnl -------------------------------------------------
77 dnl Use this to ensure that the path separator check
78 dnl macro is only expanded and included once.
80 AC_DEFUN([CARES_CHECK_PATH_SEPARATOR_REQUIRED], [
81 AC_REQUIRE([CARES_CHECK_PATH_SEPARATOR])dnl