2013-01-23 16:51:03 +04:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# zz40-xc-ovr.m4
|
|
|
|
#
|
|
|
|
# Copyright (c) 2013 Daniel Stenberg <daniel@haxx.se>
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software for any
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
#
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# serial 1
|
|
|
|
|
|
|
|
|
|
|
|
dnl The funny name of this file is intentional in order to make it
|
|
|
|
dnl sort alphabetically after any libtool, autoconf or automake
|
|
|
|
dnl provided .m4 macro file that might get copied into this same
|
|
|
|
dnl subdirectory. This allows that macro (re)definitions from this
|
|
|
|
dnl file may override those provided in other files.
|
|
|
|
|
|
|
|
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Version macros
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Public macros.
|
|
|
|
|
|
|
|
m4_define([XC_CONFIGURE_PREAMBLE_VER_MAJOR],[1])dnl
|
|
|
|
m4_define([XC_CONFIGURE_PREAMBLE_VER_MINOR],[0])dnl
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_PREAMBLE
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_PREAMBLE],
|
2013-01-23 16:51:03 +04:00
|
|
|
[
|
2013-01-28 04:08:15 +04:00
|
|
|
## -------------------------------- ##
|
|
|
|
@%:@@%:@ [XC_CONFIGURE_PREAMBLE] ver: []dnl
|
|
|
|
XC_CONFIGURE_PREAMBLE_VER_MAJOR.[]dnl
|
|
|
|
XC_CONFIGURE_PREAMBLE_VER_MINOR ##
|
|
|
|
## -------------------------------- ##
|
|
|
|
|
|
|
|
xc_configure_preamble_ver_major='XC_CONFIGURE_PREAMBLE_VER_MAJOR'
|
|
|
|
xc_configure_preamble_ver_minor='XC_CONFIGURE_PREAMBLE_VER_MINOR'
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-30 18:46:46 +04:00
|
|
|
#
|
|
|
|
# Set IFS to space, tab and newline.
|
|
|
|
#
|
|
|
|
|
|
|
|
xc_space=' '
|
|
|
|
xc_tab=' '
|
|
|
|
xc_newline='
|
|
|
|
'
|
|
|
|
IFS="$xc_space$xc_tab$xc_newline"
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-30 15:19:23 +04:00
|
|
|
#
|
2013-01-30 18:46:46 +04:00
|
|
|
# Set internationalization behavior variables.
|
2013-01-30 15:19:23 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
LANG='C'
|
|
|
|
LC_ALL='C'
|
|
|
|
LANGUAGE='C'
|
|
|
|
export LANG
|
|
|
|
export LC_ALL
|
|
|
|
export LANGUAGE
|
|
|
|
|
2013-01-30 18:46:46 +04:00
|
|
|
#
|
|
|
|
# Some useful variables.
|
|
|
|
#
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
xc_msg_warn='configure: WARNING:'
|
|
|
|
xc_msg_abrt='Can not continue.'
|
|
|
|
xc_msg_err='configure: error:'
|
|
|
|
])
|
|
|
|
|
2013-01-28 04:08:15 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_CMD_ECHO
|
2013-01-24 00:52:36 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl
|
|
|
|
dnl Emits shell code that verifies that 'echo' command
|
|
|
|
dnl is available, otherwise aborts execution.
|
2013-01-24 00:52:36 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO],
|
2013-01-24 00:52:36 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
#
|
|
|
|
# Verify that 'echo' command is available, otherwise abort.
|
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
|
|
|
(`echo "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
|
2013-01-28 04:08:15 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
2013-01-24 21:39:56 +04:00
|
|
|
xsuccess)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Try built-in echo, and fail.
|
|
|
|
echo "$xc_msg_err 'echo' command not found. $xc_msg_abrt" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2013-01-24 00:52:36 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_CMD_TEST
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Emits shell code that verifies that 'test' command
|
|
|
|
dnl is available, otherwise aborts execution.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_TEST],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
2013-01-24 21:39:56 +04:00
|
|
|
# Verify that 'test' command is available, otherwise abort.
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
2013-01-24 21:39:56 +04:00
|
|
|
(`test -n "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
|
2013-01-28 04:08:15 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
2013-01-23 16:51:03 +04:00
|
|
|
xsuccess)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
2013-01-24 00:52:36 +04:00
|
|
|
echo "$xc_msg_err 'test' command not found. $xc_msg_abrt" >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_VAR_PATH
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Emits shell code that verifies that 'PATH' variable
|
|
|
|
dnl is set, otherwise aborts execution.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_VAR_PATH],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
2013-01-24 21:39:56 +04:00
|
|
|
# Verify that 'PATH' variable is set, otherwise abort.
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
2013-01-24 21:39:56 +04:00
|
|
|
(`test -n "$PATH" >/dev/null 2>&1`) && xc_tst_str='success'
|
2013-01-28 04:08:15 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
2013-01-23 16:51:03 +04:00
|
|
|
xsuccess)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
2013-01-24 21:39:56 +04:00
|
|
|
echo "$xc_msg_err 'PATH' variable not set. $xc_msg_abrt" >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_CMD_EXPR
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Emits shell code that verifies that 'expr' command
|
|
|
|
dnl is available, otherwise aborts execution.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
2013-01-24 21:39:56 +04:00
|
|
|
# Verify that 'expr' command is available, otherwise abort.
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
2013-01-25 17:15:08 +04:00
|
|
|
xc_tst_str=`expr "$xc_tst_str" : '.*' 2>/dev/null`
|
2013-01-28 04:08:15 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
2013-01-23 16:51:03 +04:00
|
|
|
x7)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
2013-01-24 00:52:36 +04:00
|
|
|
echo "$xc_msg_err 'expr' command not found. $xc_msg_abrt" >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_UTIL_SED
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Emits shell code that verifies that 'sed' utility
|
|
|
|
dnl is found within 'PATH', otherwise aborts execution.
|
|
|
|
dnl
|
|
|
|
dnl This 'sed' is required in order to allow configure
|
|
|
|
dnl script bootstrapping itself. No fancy testing for a
|
|
|
|
dnl proper 'sed' this early, that should be done later.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_SED],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
2013-01-24 21:39:56 +04:00
|
|
|
# Verify that 'sed' utility is found within 'PATH', otherwise abort.
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
2013-01-25 17:15:08 +04:00
|
|
|
xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
|
|
|
|
| sed -e 's:unknown:success:' 2>/dev/null`
|
2013-01-28 04:08:15 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
2013-01-23 16:51:03 +04:00
|
|
|
xsuccess)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
2013-01-24 21:39:56 +04:00
|
|
|
echo "$xc_msg_err 'sed' utility not found in 'PATH'. $xc_msg_abrt" >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_UTIL_GREP
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Emits shell code that verifies that 'grep' utility
|
|
|
|
dnl is found within 'PATH', otherwise aborts execution.
|
|
|
|
dnl
|
|
|
|
dnl This 'grep' is required in order to allow configure
|
|
|
|
dnl script bootstrapping itself. No fancy testing for a
|
|
|
|
dnl proper 'grep' this early, that should be done later.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
2013-01-24 21:39:56 +04:00
|
|
|
# Verify that 'grep' utility is found within 'PATH', otherwise abort.
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
2013-01-24 21:39:56 +04:00
|
|
|
(`echo "$xc_tst_str" 2>/dev/null \
|
|
|
|
| grep 'unknown' >/dev/null 2>&1`) && xc_tst_str='success'
|
2013-01-28 04:08:15 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
2013-01-23 16:51:03 +04:00
|
|
|
xsuccess)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
2013-01-24 21:39:56 +04:00
|
|
|
echo "$xc_msg_err 'grep' utility not found in 'PATH'. $xc_msg_abrt" >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-29 18:55:41 +04:00
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_UTIL_TR
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
|
|
|
dnl Emits shell code that verifies that 'tr' utility
|
|
|
|
dnl is found within 'PATH', otherwise aborts execution.
|
|
|
|
|
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_TR],
|
|
|
|
[dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
|
|
|
#
|
|
|
|
# Verify that 'tr' utility is found within 'PATH', otherwise abort.
|
|
|
|
#
|
|
|
|
|
2013-01-30 19:57:43 +04:00
|
|
|
xc_tst_str="${xc_tab}98s7u6c5c4e3s2s10"
|
2013-01-29 18:55:41 +04:00
|
|
|
xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
|
2013-01-30 18:46:46 +04:00
|
|
|
| tr -d "0123456789$xc_tab" 2>/dev/null`
|
2013-01-29 18:55:41 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
|
|
|
xsuccess)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$xc_msg_err 'tr' utility not found in 'PATH'. $xc_msg_abrt" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_UTIL_WC
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
|
|
|
dnl Emits shell code that verifies that 'wc' utility
|
|
|
|
dnl is found within 'PATH', otherwise aborts execution.
|
|
|
|
|
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_WC],
|
|
|
|
[dnl
|
2013-01-30 15:19:23 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
|
2013-01-29 18:55:41 +04:00
|
|
|
#
|
|
|
|
# Verify that 'wc' utility is found within 'PATH', otherwise abort.
|
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown unknown unknown unknown'
|
|
|
|
xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
|
2013-01-30 18:46:46 +04:00
|
|
|
| wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null`
|
2013-01-29 18:55:41 +04:00
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
|
|
|
x4)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$xc_msg_err 'wc' utility not found in 'PATH'. $xc_msg_abrt" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
dnl _XC_CFG_PRE_BASIC_CHK_UTIL_CAT
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
|
|
|
dnl Emits shell code that verifies that 'cat' utility
|
|
|
|
dnl is found within 'PATH', otherwise aborts execution.
|
|
|
|
|
|
|
|
AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT],
|
|
|
|
[dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
|
|
|
|
#
|
|
|
|
# Verify that 'cat' utility is found within 'PATH', otherwise abort.
|
|
|
|
#
|
|
|
|
|
|
|
|
xc_tst_str='unknown'
|
2013-01-30 18:46:46 +04:00
|
|
|
xc_tst_str=`cat <<_EOT 2>/dev/null \
|
|
|
|
| wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null
|
2013-01-29 18:55:41 +04:00
|
|
|
unknown
|
|
|
|
unknown
|
|
|
|
unknown
|
|
|
|
_EOT`
|
|
|
|
case "x$xc_tst_str" in @%:@ ((
|
|
|
|
x3)
|
|
|
|
:
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$xc_msg_err 'cat' utility not found in 'PATH'. $xc_msg_abrt" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_CHECK_PATH_SEPARATOR
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Emits shell code that computes the path separator
|
|
|
|
dnl and stores the result in 'PATH_SEPARATOR', unless
|
|
|
|
dnl the user has already set it with a non-empty value.
|
|
|
|
dnl
|
|
|
|
dnl This path separator is the symbol used to separate
|
|
|
|
dnl or diferentiate paths inside the 'PATH' environment
|
2013-01-25 19:34:13 +04:00
|
|
|
dnl variable.
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl Non-empty user provided 'PATH_SEPARATOR' always
|
|
|
|
dnl overrides the auto-detected one.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_CHECK_PATH_SEPARATOR],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
2013-01-24 21:39:56 +04:00
|
|
|
# Auto-detect and set 'PATH_SEPARATOR', unless it is already non-empty set.
|
2013-01-23 16:51:03 +04:00
|
|
|
#
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
# Directory count in 'PATH' when using a colon separator.
|
2013-01-25 04:47:29 +04:00
|
|
|
xc_tst_dirs_col='x'
|
2013-01-23 16:51:03 +04:00
|
|
|
xc_tst_prev_IFS=$IFS; IFS=':'
|
|
|
|
for xc_tst_dir in $PATH; do
|
|
|
|
IFS=$xc_tst_prev_IFS
|
2013-01-24 21:39:56 +04:00
|
|
|
xc_tst_dirs_col="x$xc_tst_dirs_col"
|
2013-01-23 16:51:03 +04:00
|
|
|
done
|
|
|
|
IFS=$xc_tst_prev_IFS
|
2013-01-25 17:15:08 +04:00
|
|
|
xc_tst_dirs_col=`expr "$xc_tst_dirs_col" : '.*'`
|
2013-01-23 16:51:03 +04:00
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
# Directory count in 'PATH' when using a semicolon separator.
|
2013-01-25 04:47:29 +04:00
|
|
|
xc_tst_dirs_sem='x'
|
2013-01-23 16:51:03 +04:00
|
|
|
xc_tst_prev_IFS=$IFS; IFS=';'
|
|
|
|
for xc_tst_dir in $PATH; do
|
|
|
|
IFS=$xc_tst_prev_IFS
|
2013-01-24 21:39:56 +04:00
|
|
|
xc_tst_dirs_sem="x$xc_tst_dirs_sem"
|
2013-01-23 16:51:03 +04:00
|
|
|
done
|
|
|
|
IFS=$xc_tst_prev_IFS
|
2013-01-25 17:15:08 +04:00
|
|
|
xc_tst_dirs_sem=`expr "$xc_tst_dirs_sem" : '.*'`
|
2013-01-23 16:51:03 +04:00
|
|
|
|
|
|
|
if test $xc_tst_dirs_sem -eq $xc_tst_dirs_col; then
|
|
|
|
# When both counting methods give the same result we do not want to
|
|
|
|
# chose one over the other, and consider auto-detection not possible.
|
|
|
|
if test -z "$PATH_SEPARATOR"; then
|
2013-01-24 21:39:56 +04:00
|
|
|
# Stop dead until user provides 'PATH_SEPARATOR' definition.
|
|
|
|
echo "$xc_msg_err 'PATH_SEPARATOR' variable not set. $xc_msg_abrt" >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# Separator with the greater directory count is the auto-detected one.
|
|
|
|
if test $xc_tst_dirs_sem -gt $xc_tst_dirs_col; then
|
|
|
|
xc_tst_auto_separator=';'
|
|
|
|
else
|
|
|
|
xc_tst_auto_separator=':'
|
|
|
|
fi
|
|
|
|
if test -z "$PATH_SEPARATOR"; then
|
|
|
|
# Simply use the auto-detected one when not already set.
|
2013-01-25 04:47:29 +04:00
|
|
|
PATH_SEPARATOR=$xc_tst_auto_separator
|
2013-01-24 21:39:56 +04:00
|
|
|
elif test "x$PATH_SEPARATOR" != "x$xc_tst_auto_separator"; then
|
|
|
|
echo "$xc_msg_warn 'PATH_SEPARATOR' does not match auto-detected one." >&2
|
2013-01-23 16:51:03 +04:00
|
|
|
fi
|
|
|
|
fi
|
2013-01-29 18:55:41 +04:00
|
|
|
xc_PATH_SEPARATOR=$PATH_SEPARATOR
|
2013-01-23 16:51:03 +04:00
|
|
|
AC_SUBST([PATH_SEPARATOR])dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
dnl _XC_CFG_PRE_POSTLUDE
|
2013-01-23 21:16:52 +04:00
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Private macro.
|
|
|
|
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_DEFUN([_XC_CFG_PRE_POSTLUDE],
|
2013-01-23 21:16:52 +04:00
|
|
|
[dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
|
2013-01-29 18:55:41 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
|
2013-01-25 15:19:45 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
|
2013-01-30 18:46:46 +04:00
|
|
|
dnl
|
2013-01-26 06:49:32 +04:00
|
|
|
xc_configure_preamble_result='yes'
|
2013-01-23 21:16:52 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl XC_CONFIGURE_PREAMBLE
|
|
|
|
dnl -------------------------------------------------
|
|
|
|
dnl Public macro.
|
|
|
|
dnl
|
2013-01-25 19:34:13 +04:00
|
|
|
dnl This macro emits shell code which does some
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl very basic checks related with the availability
|
|
|
|
dnl of some commands and utilities needed to allow
|
|
|
|
dnl configure script bootstrapping itself when using
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl these to figure out other settings. Also emits
|
|
|
|
dnl code that performs PATH_SEPARATOR auto-detection
|
|
|
|
dnl and sets its value unless it is already set with
|
|
|
|
dnl a non-empty value.
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl
|
|
|
|
dnl These basic checks are intended to be placed and
|
|
|
|
dnl executed as early as possible in the resulting
|
|
|
|
dnl configure script, and as such these must be pure
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl and portable shell code.
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl This macro may be used directly, or indirectly
|
|
|
|
dnl when using other macros that AC_REQUIRE it such
|
|
|
|
dnl as XC_CHECK_PATH_SEPARATOR.
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Currently the mechanism used to ensure that this
|
|
|
|
dnl macro expands early enough in generated configure
|
|
|
|
dnl script is making it override autoconf and libtool
|
|
|
|
dnl PATH_SEPARATOR check.
|
2013-01-23 16:51:03 +04:00
|
|
|
|
|
|
|
AC_DEFUN([XC_CONFIGURE_PREAMBLE],
|
|
|
|
[dnl
|
|
|
|
AC_PREREQ([2.50])dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_PREAMBLE])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
|
2013-01-29 18:55:41 +04:00
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
|
2013-01-24 21:39:56 +04:00
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
|
|
|
|
AC_BEFORE([$0],[_XC_CFG_PRE_POSTLUDE])dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_TOOL])dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_PROG])dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_TOOLS])dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_PROGS])dnl
|
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[AC_PATH_TOOL])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PATH_PROG])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PATH_PROGS])dnl
|
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_SED])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_GREP])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_LN_S])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
|
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[LT_INIT])dnl
|
|
|
|
AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
|
|
|
|
AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl
|
|
|
|
dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
|
2013-01-29 18:55:41 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
|
|
|
|
AC_REQUIRE([_XC_CFG_PRE_POSTLUDE])dnl
|
|
|
|
dnl
|
|
|
|
m4_pattern_forbid([^_*XC])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
m4_define([$0],[])dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Override autoconf and libtool PATH_SEPARATOR check
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl -------------------------------------------------
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Macros overriding.
|
|
|
|
dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl This is done to ensure that the same check is
|
|
|
|
dnl used across different autoconf versions and to
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl allow expansion of XC_CONFIGURE_PREAMBLE macro
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl early enough in the generated configure script.
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Override when using autoconf 2.53 and newer.
|
|
|
|
dnl
|
|
|
|
|
2013-01-25 19:34:13 +04:00
|
|
|
m4_ifdef([_AS_PATH_SEPARATOR_PREPARE],
|
|
|
|
[dnl
|
|
|
|
m4_undefine([_AS_PATH_SEPARATOR_PREPARE])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
m4_defun([_AS_PATH_SEPARATOR_PREPARE],
|
|
|
|
[dnl
|
|
|
|
AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
|
|
|
|
m4_define([$0],[])dnl
|
2013-01-25 19:34:13 +04:00
|
|
|
])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Override when using autoconf 2.50 to 2.52
|
|
|
|
dnl
|
|
|
|
|
2013-01-25 19:34:13 +04:00
|
|
|
m4_ifdef([_AC_INIT_PREPARE_FS_SEPARATORS],
|
|
|
|
[dnl
|
|
|
|
m4_undefine([_AC_INIT_PREPARE_FS_SEPARATORS])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
m4_defun([_AC_INIT_PREPARE_FS_SEPARATORS],
|
|
|
|
[dnl
|
|
|
|
AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
|
|
|
|
ac_path_separator=$PATH_SEPARATOR
|
|
|
|
m4_define([$0],[])dnl
|
2013-01-25 19:34:13 +04:00
|
|
|
])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl
|
|
|
|
dnl Override when using libtool 1.4.2
|
|
|
|
dnl
|
|
|
|
|
2013-01-25 19:34:13 +04:00
|
|
|
m4_ifdef([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
|
|
|
|
[dnl
|
|
|
|
m4_undefine([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
m4_defun([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
|
|
|
|
[dnl
|
|
|
|
AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
|
|
|
|
lt_cv_sys_path_separator=$PATH_SEPARATOR
|
|
|
|
m4_define([$0],[])dnl
|
2013-01-25 19:34:13 +04:00
|
|
|
])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl XC_CHECK_PATH_SEPARATOR
|
2013-01-26 06:49:32 +04:00
|
|
|
dnl -------------------------------------------------
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Public macro.
|
2013-01-26 06:49:32 +04:00
|
|
|
dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Usage of this macro ensures that generated configure
|
|
|
|
dnl script uses the same PATH_SEPARATOR check irrespective
|
|
|
|
dnl of autoconf or libtool version being used to generate
|
|
|
|
dnl configure script.
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
dnl Emits shell code that computes the path separator
|
|
|
|
dnl and stores the result in 'PATH_SEPARATOR', unless
|
|
|
|
dnl the user has already set it with a non-empty value.
|
|
|
|
dnl
|
|
|
|
dnl This path separator is the symbol used to separate
|
|
|
|
dnl or diferentiate paths inside the 'PATH' environment
|
|
|
|
dnl variable.
|
|
|
|
dnl
|
|
|
|
dnl Non-empty user provided 'PATH_SEPARATOR' always
|
|
|
|
dnl overrides the auto-detected one.
|
|
|
|
dnl
|
|
|
|
dnl Strictly speaking the check is done in two steps. The
|
|
|
|
dnl first, which does the actual check, takes place in
|
|
|
|
dnl XC_CONFIGURE_PREAMBLE macro and happens very early in
|
|
|
|
dnl generated configure script. The second one shows and
|
|
|
|
dnl logs the result of the check into config.log at a later
|
|
|
|
dnl configure stage. Placement of this second stage in
|
|
|
|
dnl generated configure script will be done where first
|
|
|
|
dnl direct or indirect usage of this macro happens.
|
|
|
|
|
|
|
|
AC_DEFUN([XC_CHECK_PATH_SEPARATOR],
|
2013-01-23 16:51:03 +04:00
|
|
|
[dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
AC_PREREQ([2.50])dnl
|
|
|
|
dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
AC_BEFORE([$0],[AC_CHECK_TOOL])dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_PROG])dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_TOOLS])dnl
|
|
|
|
AC_BEFORE([$0],[AC_CHECK_PROGS])dnl
|
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[AC_PATH_TOOL])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PATH_PROG])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PATH_PROGS])dnl
|
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_SED])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_GREP])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_LN_S])dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
AC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl
|
|
|
|
AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
|
|
|
|
dnl
|
|
|
|
AC_BEFORE([$0],[LT_INIT])dnl
|
|
|
|
AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
|
|
|
|
AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl
|
|
|
|
dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
dnl
|
2013-01-28 04:08:15 +04:00
|
|
|
#
|
2013-01-29 18:55:41 +04:00
|
|
|
# Check that 'XC_CONFIGURE_PREAMBLE' has already run.
|
2013-01-28 04:08:15 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
if test -z "$xc_configure_preamble_result"; then
|
2013-01-29 18:55:41 +04:00
|
|
|
AC_MSG_ERROR([xc_configure_preamble_result not set (internal problem)])
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check that 'PATH_SEPARATOR' has already been set.
|
|
|
|
#
|
|
|
|
|
|
|
|
if test -z "$xc_PATH_SEPARATOR"; then
|
|
|
|
AC_MSG_ERROR([xc_PATH_SEPARATOR not set (internal problem)])
|
2013-01-28 04:08:15 +04:00
|
|
|
fi
|
|
|
|
if test -z "$PATH_SEPARATOR"; then
|
2013-01-29 18:55:41 +04:00
|
|
|
AC_MSG_ERROR([PATH_SEPARATOR not set (internal or config.site problem)])
|
2013-01-28 04:08:15 +04:00
|
|
|
fi
|
|
|
|
AC_MSG_CHECKING([for path separator])
|
|
|
|
AC_MSG_RESULT([$PATH_SEPARATOR])
|
2013-01-29 18:55:41 +04:00
|
|
|
if test "x$PATH_SEPARATOR" != "x$xc_PATH_SEPARATOR"; then
|
|
|
|
AC_MSG_CHECKING([for initial path separator])
|
|
|
|
AC_MSG_RESULT([$xc_PATH_SEPARATOR])
|
|
|
|
AC_MSG_ERROR([path separator mismatch (internal or config.site problem)])
|
|
|
|
fi
|
2013-01-26 06:49:32 +04:00
|
|
|
dnl
|
2013-01-25 19:34:13 +04:00
|
|
|
m4_pattern_forbid([^_*XC])dnl
|
2013-01-23 16:51:03 +04:00
|
|
|
m4_define([$0],[])dnl
|
|
|
|
])
|
|
|
|
|