Updated tag value for tizen 2.0 build
[external/c-ares.git] / m4 / cares-system.m4
1 #***************************************************************************
2 # $Id$
3 #
4 # Copyright (C) 2008 - 2009 by Daniel Stenberg et al
5 #
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.
15 #
16 #***************************************************************************
17
18 # File version for 'aclocal' use. Keep it a single number.
19 # serial 3
20
21
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.
27
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.])
32     fi
33     dnl Directory count in PATH when using a colon separator.
34     tst_dirs_col=0
35     tst_save_IFS=$IFS; IFS=':'
36     for tst_dir in $PATH; do
37       IFS=$tst_save_IFS
38       test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1`
39     done
40     IFS=$tst_save_IFS
41     dnl Directory count in PATH when using a semicolon separator.
42     tst_dirs_sem=0
43     tst_save_IFS=$IFS; IFS=';'
44     for tst_dir in $PATH; do
45       IFS=$tst_save_IFS
46       test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1`
47     done
48     IFS=$tst_save_IFS
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.])
55       fi
56     else
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=';'
60       else
61         tst_auto_separator=':'
62       fi
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"
66       fi
67     fi
68     cares_cv_PATH_SEPARATOR="$PATH_SEPARATOR"
69   fi
70   AC_SUBST([PATH_SEPARATOR])
71   AC_SUBST([PATH])
72 ])
73
74
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.
79
80 AC_DEFUN([CARES_CHECK_PATH_SEPARATOR_REQUIRED], [
81   AC_REQUIRE([CARES_CHECK_PATH_SEPARATOR])dnl
82 ])
83