aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-11-18 19:29:31 +0000
committerYang Tse <yangsita@gmail.com>2008-11-18 19:29:31 +0000
commit4e4b6de5ce284c006782fd065390f4252cb58532 (patch)
treeab1c5d8c7759ef4274ab6300615dc55173e878b1
parent9aac2328c6544ac794571759621cf262cd5d8a29 (diff)
provide a common PATH_SEPARATOR check method which is required by
upcomming work to support the broadest range of Autoconf versions
-rw-r--r--ares/configure.ac2
-rw-r--r--ares/m4/cares-override.m420
-rw-r--r--ares/m4/cares-system.m476
-rw-r--r--configure.ac2
-rw-r--r--m4/curl-override.m420
-rw-r--r--m4/curl-system.m481
6 files changed, 197 insertions, 4 deletions
diff --git a/ares/configure.ac b/ares/configure.ac
index 6d5096898..ce66b8530 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -14,6 +14,8 @@ CARES_CHECK_OPTION_DEBUG
CARES_CHECK_OPTION_OPTIMIZE
CARES_CHECK_OPTION_WARNINGS
+CARES_CHECK_PATH_SEPARATOR
+
dnl SED is mandatory for configure process and libtool.
dnl Set it now, allowing it to be changed later.
AC_PATH_PROG([SED], [sed], [not_found],
diff --git a/ares/m4/cares-override.m4 b/ares/m4/cares-override.m4
index 9377adba9..ea5b55362 100644
--- a/ares/m4/cares-override.m4
+++ b/ares/m4/cares-override.m4
@@ -3,7 +3,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 1
+# serial 2
dnl CARES_OVERRIDE_AUTOCONF
dnl -------------------------------------------------
@@ -39,7 +39,8 @@ m4_define([AC_LANG_PROGRAM(C)],
int main (void)
{
$2
-; return 0;
+ ;
+ return 0;
}])
dnl Override Autoconf's AC_LANG_CALL (C)
@@ -84,4 +85,19 @@ choke me
#endif
], [return $1 ();])])
+dnl Override Autoconf's PATH_SEPARATOR check
+dnl -------------------------------------------------
+dnl This is done to ensure that the same check is
+dnl used across different Autoconf versions and to
+dnl allow us to use this macro early enough in the
+dnl configure script.
+
+m4_define([_AS_PATH_SEPARATOR_PREPARE],
+[CARES_CHECK_PATH_SEPARATOR
+m4_define([$0],[])])
+
+m4_define([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
+[CARES_CHECK_PATH_SEPARATOR
+m4_define([$0],[])])
+
diff --git a/ares/m4/cares-system.m4 b/ares/m4/cares-system.m4
new file mode 100644
index 000000000..278140160
--- /dev/null
+++ b/ares/m4/cares-system.m4
@@ -0,0 +1,76 @@
+#***************************************************************************
+# $Id$
+#
+# Copyright (C) 2008 by Daniel Stenberg et al
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted, provided
+# that the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission. M.I.T. makes no representations about the
+# suitability of this software for any purpose. It is provided "as is"
+# without express or implied warranty.
+#
+#***************************************************************************
+
+# File version for 'aclocal' use. Keep it a single number.
+# serial 1
+
+
+dnl CARES_CHECK_PATH_SEPARATOR
+dnl -------------------------------------------------
+dnl Check and compute the path separator for us. This
+dnl path separator is the symbol used to diferentiate
+dnl or separate paths inside the PATH environment var.
+
+AC_DEFUN([CARES_CHECK_PATH_SEPARATOR], [
+ if test -z "$cares_cv_PATH_SEPARATOR"; then
+ if test -z "$PATH"; then
+ AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.])
+ fi
+ dnl Directory count in PATH when using a colon separator.
+ tst_dirs_col=0
+ tst_save_IFS=$IFS; IFS=':'
+ for tst_dir in $PATH; do
+ IFS=$tst_save_IFS
+ test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1`
+ done
+ IFS=$tst_save_IFS
+ dnl Directory count in PATH when using a semicolon separator.
+ tst_dirs_sem=0
+ tst_save_IFS=$IFS; IFS=';'
+ for tst_dir in $PATH; do
+ IFS=$tst_save_IFS
+ test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1`
+ done
+ IFS=$tst_save_IFS
+ if test $tst_dirs_sem -eq $tst_dirs_col; then
+ dnl When both counting methods give the same result we do not want to
+ dnl chose one over the other, and consider auto-detection not possible.
+ if test -z "$PATH_SEPARATOR"; then
+ dnl Stop dead until user provides PATH_SEPARATOR definition.
+ AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.])
+ fi
+ else
+ dnl Separator with the greater directory count is the auto-detected one.
+ if test $tst_dirs_sem -gt $tst_dirs_col; then
+ tst_auto_separator=';'
+ PATH_SEPARATOR=';'
+ else
+ tst_auto_separator=':'
+ PATH_SEPARATOR=':'
+ fi
+ if test -z "$PATH_SEPARATOR"; then
+ dnl Simply use the auto-detected one when not already set.
+ PATH_SEPARATOR="$tst_auto_separator"
+ fi
+ fi
+ cares_cv_PATH_SEPARATOR="$PATH_SEPARATOR"
+ fi
+ AC_SUBST([PATH_SEPARATOR])
+ AC_SUBST([PATH])
+])
+
+
diff --git a/configure.ac b/configure.ac
index fe9d80d73..f98bded54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,8 @@ CURL_CHECK_OPTION_DEBUG
CURL_CHECK_OPTION_OPTIMIZE
CURL_CHECK_OPTION_WARNINGS
+CURL_CHECK_PATH_SEPARATOR
+
dnl SED is mandatory for configure process and libtool.
dnl Set it now, allowing it to be changed later.
AC_PATH_PROG([SED], [sed], [not_found],
diff --git a/m4/curl-override.m4 b/m4/curl-override.m4
index 6770088dd..4092d9ab5 100644
--- a/m4/curl-override.m4
+++ b/m4/curl-override.m4
@@ -3,7 +3,7 @@
#***************************************************************************
# File version for 'aclocal' use. Keep it a single number.
-# serial 1
+# serial 2
dnl CURL_OVERRIDE_AUTOCONF
dnl -------------------------------------------------
@@ -39,7 +39,8 @@ m4_define([AC_LANG_PROGRAM(C)],
int main (void)
{
$2
-; return 0;
+ ;
+ return 0;
}])
dnl Override Autoconf's AC_LANG_CALL (C)
@@ -84,4 +85,19 @@ choke me
#endif
], [return $1 ();])])
+dnl Override Autoconf's PATH_SEPARATOR check
+dnl -------------------------------------------------
+dnl This is done to ensure that the same check is
+dnl used across different Autoconf versions and to
+dnl allow us to use this macro early enough in the
+dnl configure script.
+
+m4_define([_AS_PATH_SEPARATOR_PREPARE],
+[CURL_CHECK_PATH_SEPARATOR
+m4_define([$0],[])])
+
+m4_define([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
+[CURL_CHECK_PATH_SEPARATOR
+m4_define([$0],[])])
+
diff --git a/m4/curl-system.m4 b/m4/curl-system.m4
new file mode 100644
index 000000000..57d4cccb6
--- /dev/null
+++ b/m4/curl-system.m4
@@ -0,0 +1,81 @@
+#***************************************************************************
+# _ _ ____ _
+# Project ___| | | | _ \| |
+# / __| | | | |_) | |
+# | (__| |_| | _ <| |___
+# \___|\___/|_| \_\_____|
+#
+# Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://curl.haxx.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# $Id$
+#***************************************************************************
+
+# File version for 'aclocal' use. Keep it a single number.
+# serial 1
+
+
+dnl CURL_CHECK_PATH_SEPARATOR
+dnl -------------------------------------------------
+dnl Check and compute the path separator for us. This
+dnl path separator is the symbol used to diferentiate
+dnl or separate paths inside the PATH environment var.
+
+AC_DEFUN([CURL_CHECK_PATH_SEPARATOR], [
+ if test -z "$curl_cv_PATH_SEPARATOR"; then
+ if test -z "$PATH"; then
+ AC_MSG_ERROR([PATH not set. Cannot continue without PATH being set.])
+ fi
+ dnl Directory count in PATH when using a colon separator.
+ tst_dirs_col=0
+ tst_save_IFS=$IFS; IFS=':'
+ for tst_dir in $PATH; do
+ IFS=$tst_save_IFS
+ test -d "$tst_dir" && tst_dirs_col=`expr $tst_dirs_col + 1`
+ done
+ IFS=$tst_save_IFS
+ dnl Directory count in PATH when using a semicolon separator.
+ tst_dirs_sem=0
+ tst_save_IFS=$IFS; IFS=';'
+ for tst_dir in $PATH; do
+ IFS=$tst_save_IFS
+ test -d "$tst_dir" && tst_dirs_sem=`expr $tst_dirs_sem + 1`
+ done
+ IFS=$tst_save_IFS
+ if test $tst_dirs_sem -eq $tst_dirs_col; then
+ dnl When both counting methods give the same result we do not want to
+ dnl chose one over the other, and consider auto-detection not possible.
+ if test -z "$PATH_SEPARATOR"; then
+ dnl Stop dead until user provides PATH_SEPARATOR definition.
+ AC_MSG_ERROR([PATH_SEPARATOR not set. Cannot continue without it.])
+ fi
+ else
+ dnl Separator with the greater directory count is the auto-detected one.
+ if test $tst_dirs_sem -gt $tst_dirs_col; then
+ tst_auto_separator=';'
+ PATH_SEPARATOR=';'
+ else
+ tst_auto_separator=':'
+ PATH_SEPARATOR=':'
+ fi
+ if test -z "$PATH_SEPARATOR"; then
+ dnl Simply use the auto-detected one when not already set.
+ PATH_SEPARATOR="$tst_auto_separator"
+ fi
+ fi
+ curl_cv_PATH_SEPARATOR="$PATH_SEPARATOR"
+ fi
+ AC_SUBST([PATH_SEPARATOR])
+ AC_SUBST([PATH])
+])
+