113498266Sopenharmony_ci#---------------------------------------------------------------------------
213498266Sopenharmony_ci#
313498266Sopenharmony_ci# zz40-xc-ovr.m4
413498266Sopenharmony_ci#
513498266Sopenharmony_ci# Copyright (C) Daniel Stenberg <daniel@haxx.se>
613498266Sopenharmony_ci#
713498266Sopenharmony_ci# Permission to use, copy, modify, and distribute this software for any
813498266Sopenharmony_ci# purpose with or without fee is hereby granted, provided that the above
913498266Sopenharmony_ci# copyright notice and this permission notice appear in all copies.
1013498266Sopenharmony_ci#
1113498266Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1213498266Sopenharmony_ci# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1313498266Sopenharmony_ci# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1413498266Sopenharmony_ci# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1513498266Sopenharmony_ci# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1613498266Sopenharmony_ci# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1713498266Sopenharmony_ci# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1813498266Sopenharmony_ci#
1913498266Sopenharmony_ci# SPDX-License-Identifier: ISC
2013498266Sopenharmony_ci#
2113498266Sopenharmony_ci#---------------------------------------------------------------------------
2213498266Sopenharmony_ci
2313498266Sopenharmony_cidnl The funny name of this file is intentional in order to make it
2413498266Sopenharmony_cidnl sort alphabetically after any libtool, autoconf or automake
2513498266Sopenharmony_cidnl provided .m4 macro file that might get copied into this same
2613498266Sopenharmony_cidnl subdirectory. This allows that macro (re)definitions from this
2713498266Sopenharmony_cidnl file may override those provided in other files.
2813498266Sopenharmony_ci
2913498266Sopenharmony_ci
3013498266Sopenharmony_cidnl Version macros
3113498266Sopenharmony_cidnl -------------------------------------------------
3213498266Sopenharmony_cidnl Public macros.
3313498266Sopenharmony_ci
3413498266Sopenharmony_cim4_define([XC_CONFIGURE_PREAMBLE_VER_MAJOR],[1])dnl
3513498266Sopenharmony_cim4_define([XC_CONFIGURE_PREAMBLE_VER_MINOR],[0])dnl
3613498266Sopenharmony_ci
3713498266Sopenharmony_ci
3813498266Sopenharmony_cidnl _XC_CFG_PRE_PREAMBLE
3913498266Sopenharmony_cidnl -------------------------------------------------
4013498266Sopenharmony_cidnl Private macro.
4113498266Sopenharmony_ci
4213498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_PREAMBLE],
4313498266Sopenharmony_ci[
4413498266Sopenharmony_ci## -------------------------------- ##
4513498266Sopenharmony_ci@%:@@%:@  [XC_CONFIGURE_PREAMBLE] ver: []dnl
4613498266Sopenharmony_ciXC_CONFIGURE_PREAMBLE_VER_MAJOR.[]dnl
4713498266Sopenharmony_ciXC_CONFIGURE_PREAMBLE_VER_MINOR  ##
4813498266Sopenharmony_ci## -------------------------------- ##
4913498266Sopenharmony_ci
5013498266Sopenharmony_cixc_configure_preamble_ver_major='XC_CONFIGURE_PREAMBLE_VER_MAJOR'
5113498266Sopenharmony_cixc_configure_preamble_ver_minor='XC_CONFIGURE_PREAMBLE_VER_MINOR'
5213498266Sopenharmony_ci
5313498266Sopenharmony_ci#
5413498266Sopenharmony_ci# Set IFS to space, tab and newline.
5513498266Sopenharmony_ci#
5613498266Sopenharmony_ci
5713498266Sopenharmony_cixc_space=' '
5813498266Sopenharmony_cixc_tab='	'
5913498266Sopenharmony_cixc_newline='
6013498266Sopenharmony_ci'
6113498266Sopenharmony_ciIFS="$xc_space$xc_tab$xc_newline"
6213498266Sopenharmony_ci
6313498266Sopenharmony_ci#
6413498266Sopenharmony_ci# Set internationalization behavior variables.
6513498266Sopenharmony_ci#
6613498266Sopenharmony_ci
6713498266Sopenharmony_ciLANG='C'
6813498266Sopenharmony_ciLC_ALL='C'
6913498266Sopenharmony_ciLANGUAGE='C'
7013498266Sopenharmony_ciexport LANG
7113498266Sopenharmony_ciexport LC_ALL
7213498266Sopenharmony_ciexport LANGUAGE
7313498266Sopenharmony_ci
7413498266Sopenharmony_ci#
7513498266Sopenharmony_ci# Some useful variables.
7613498266Sopenharmony_ci#
7713498266Sopenharmony_ci
7813498266Sopenharmony_cixc_msg_warn='configure: WARNING:'
7913498266Sopenharmony_cixc_msg_abrt='Can not continue.'
8013498266Sopenharmony_cixc_msg_err='configure: error:'
8113498266Sopenharmony_ci])
8213498266Sopenharmony_ci
8313498266Sopenharmony_ci
8413498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_CMD_ECHO
8513498266Sopenharmony_cidnl -------------------------------------------------
8613498266Sopenharmony_cidnl Private macro.
8713498266Sopenharmony_cidnl
8813498266Sopenharmony_cidnl Emits shell code that verifies that 'echo' command
8913498266Sopenharmony_cidnl is available, otherwise aborts execution.
9013498266Sopenharmony_ci
9113498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO],
9213498266Sopenharmony_ci[dnl
9313498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
9413498266Sopenharmony_ci#
9513498266Sopenharmony_ci# Verify that 'echo' command is available, otherwise abort.
9613498266Sopenharmony_ci#
9713498266Sopenharmony_ci
9813498266Sopenharmony_cixc_tst_str='unknown'
9913498266Sopenharmony_ci(`echo "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
10013498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
10113498266Sopenharmony_ci  xsuccess)
10213498266Sopenharmony_ci    :
10313498266Sopenharmony_ci    ;;
10413498266Sopenharmony_ci  *)
10513498266Sopenharmony_ci    # Try built-in echo, and fail.
10613498266Sopenharmony_ci    echo "$xc_msg_err 'echo' command not found. $xc_msg_abrt" >&2
10713498266Sopenharmony_ci    exit 1
10813498266Sopenharmony_ci    ;;
10913498266Sopenharmony_ciesac
11013498266Sopenharmony_ci])
11113498266Sopenharmony_ci
11213498266Sopenharmony_ci
11313498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_CMD_TEST
11413498266Sopenharmony_cidnl -------------------------------------------------
11513498266Sopenharmony_cidnl Private macro.
11613498266Sopenharmony_cidnl
11713498266Sopenharmony_cidnl Emits shell code that verifies that 'test' command
11813498266Sopenharmony_cidnl is available, otherwise aborts execution.
11913498266Sopenharmony_ci
12013498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_TEST],
12113498266Sopenharmony_ci[dnl
12213498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
12313498266Sopenharmony_ci#
12413498266Sopenharmony_ci# Verify that 'test' command is available, otherwise abort.
12513498266Sopenharmony_ci#
12613498266Sopenharmony_ci
12713498266Sopenharmony_cixc_tst_str='unknown'
12813498266Sopenharmony_ci(`test -n "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
12913498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
13013498266Sopenharmony_ci  xsuccess)
13113498266Sopenharmony_ci    :
13213498266Sopenharmony_ci    ;;
13313498266Sopenharmony_ci  *)
13413498266Sopenharmony_ci    echo "$xc_msg_err 'test' command not found. $xc_msg_abrt" >&2
13513498266Sopenharmony_ci    exit 1
13613498266Sopenharmony_ci    ;;
13713498266Sopenharmony_ciesac
13813498266Sopenharmony_ci])
13913498266Sopenharmony_ci
14013498266Sopenharmony_ci
14113498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_VAR_PATH
14213498266Sopenharmony_cidnl -------------------------------------------------
14313498266Sopenharmony_cidnl Private macro.
14413498266Sopenharmony_cidnl
14513498266Sopenharmony_cidnl Emits shell code that verifies that 'PATH' variable
14613498266Sopenharmony_cidnl is set, otherwise aborts execution.
14713498266Sopenharmony_ci
14813498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_VAR_PATH],
14913498266Sopenharmony_ci[dnl
15013498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
15113498266Sopenharmony_ci#
15213498266Sopenharmony_ci# Verify that 'PATH' variable is set, otherwise abort.
15313498266Sopenharmony_ci#
15413498266Sopenharmony_ci
15513498266Sopenharmony_cixc_tst_str='unknown'
15613498266Sopenharmony_ci(`test -n "$PATH" >/dev/null 2>&1`) && xc_tst_str='success'
15713498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
15813498266Sopenharmony_ci  xsuccess)
15913498266Sopenharmony_ci    :
16013498266Sopenharmony_ci    ;;
16113498266Sopenharmony_ci  *)
16213498266Sopenharmony_ci    echo "$xc_msg_err 'PATH' variable not set. $xc_msg_abrt" >&2
16313498266Sopenharmony_ci    exit 1
16413498266Sopenharmony_ci    ;;
16513498266Sopenharmony_ciesac
16613498266Sopenharmony_ci])
16713498266Sopenharmony_ci
16813498266Sopenharmony_ci
16913498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_CMD_EXPR
17013498266Sopenharmony_cidnl -------------------------------------------------
17113498266Sopenharmony_cidnl Private macro.
17213498266Sopenharmony_cidnl
17313498266Sopenharmony_cidnl Emits shell code that verifies that 'expr' command
17413498266Sopenharmony_cidnl is available, otherwise aborts execution.
17513498266Sopenharmony_ci
17613498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR],
17713498266Sopenharmony_ci[dnl
17813498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
17913498266Sopenharmony_ci#
18013498266Sopenharmony_ci# Verify that 'expr' command is available, otherwise abort.
18113498266Sopenharmony_ci#
18213498266Sopenharmony_ci
18313498266Sopenharmony_cixc_tst_str='unknown'
18413498266Sopenharmony_cixc_tst_str=`expr "$xc_tst_str" : '.*' 2>/dev/null`
18513498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
18613498266Sopenharmony_ci  x7)
18713498266Sopenharmony_ci    :
18813498266Sopenharmony_ci    ;;
18913498266Sopenharmony_ci  *)
19013498266Sopenharmony_ci    echo "$xc_msg_err 'expr' command not found. $xc_msg_abrt" >&2
19113498266Sopenharmony_ci    exit 1
19213498266Sopenharmony_ci    ;;
19313498266Sopenharmony_ciesac
19413498266Sopenharmony_ci])
19513498266Sopenharmony_ci
19613498266Sopenharmony_ci
19713498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_UTIL_SED
19813498266Sopenharmony_cidnl -------------------------------------------------
19913498266Sopenharmony_cidnl Private macro.
20013498266Sopenharmony_cidnl
20113498266Sopenharmony_cidnl Emits shell code that verifies that 'sed' utility
20213498266Sopenharmony_cidnl is found within 'PATH', otherwise aborts execution.
20313498266Sopenharmony_cidnl
20413498266Sopenharmony_cidnl This 'sed' is required in order to allow configure
20513498266Sopenharmony_cidnl script bootstrapping itself. No fancy testing for a
20613498266Sopenharmony_cidnl proper 'sed' this early, that should be done later.
20713498266Sopenharmony_ci
20813498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_SED],
20913498266Sopenharmony_ci[dnl
21013498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
21113498266Sopenharmony_ci#
21213498266Sopenharmony_ci# Verify that 'sed' utility is found within 'PATH', otherwise abort.
21313498266Sopenharmony_ci#
21413498266Sopenharmony_ci
21513498266Sopenharmony_cixc_tst_str='unknown'
21613498266Sopenharmony_cixc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
21713498266Sopenharmony_ci  | sed -e 's:unknown:success:' 2>/dev/null`
21813498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
21913498266Sopenharmony_ci  xsuccess)
22013498266Sopenharmony_ci    :
22113498266Sopenharmony_ci    ;;
22213498266Sopenharmony_ci  *)
22313498266Sopenharmony_ci    echo "$xc_msg_err 'sed' utility not found in 'PATH'. $xc_msg_abrt" >&2
22413498266Sopenharmony_ci    exit 1
22513498266Sopenharmony_ci    ;;
22613498266Sopenharmony_ciesac
22713498266Sopenharmony_ci])
22813498266Sopenharmony_ci
22913498266Sopenharmony_ci
23013498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_UTIL_GREP
23113498266Sopenharmony_cidnl -------------------------------------------------
23213498266Sopenharmony_cidnl Private macro.
23313498266Sopenharmony_cidnl
23413498266Sopenharmony_cidnl Emits shell code that verifies that 'grep' utility
23513498266Sopenharmony_cidnl is found within 'PATH', otherwise aborts execution.
23613498266Sopenharmony_cidnl
23713498266Sopenharmony_cidnl This 'grep' is required in order to allow configure
23813498266Sopenharmony_cidnl script bootstrapping itself. No fancy testing for a
23913498266Sopenharmony_cidnl proper 'grep' this early, that should be done later.
24013498266Sopenharmony_ci
24113498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP],
24213498266Sopenharmony_ci[dnl
24313498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
24413498266Sopenharmony_ci#
24513498266Sopenharmony_ci# Verify that 'grep' utility is found within 'PATH', otherwise abort.
24613498266Sopenharmony_ci#
24713498266Sopenharmony_ci
24813498266Sopenharmony_cixc_tst_str='unknown'
24913498266Sopenharmony_ci(`echo "$xc_tst_str" 2>/dev/null \
25013498266Sopenharmony_ci  | grep 'unknown' >/dev/null 2>&1`) && xc_tst_str='success'
25113498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
25213498266Sopenharmony_ci  xsuccess)
25313498266Sopenharmony_ci    :
25413498266Sopenharmony_ci    ;;
25513498266Sopenharmony_ci  *)
25613498266Sopenharmony_ci    echo "$xc_msg_err 'grep' utility not found in 'PATH'. $xc_msg_abrt" >&2
25713498266Sopenharmony_ci    exit 1
25813498266Sopenharmony_ci    ;;
25913498266Sopenharmony_ciesac
26013498266Sopenharmony_ci])
26113498266Sopenharmony_ci
26213498266Sopenharmony_ci
26313498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_UTIL_TR
26413498266Sopenharmony_cidnl -------------------------------------------------
26513498266Sopenharmony_cidnl Private macro.
26613498266Sopenharmony_cidnl
26713498266Sopenharmony_cidnl Emits shell code that verifies that 'tr' utility
26813498266Sopenharmony_cidnl is found within 'PATH', otherwise aborts execution.
26913498266Sopenharmony_ci
27013498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_TR],
27113498266Sopenharmony_ci[dnl
27213498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
27313498266Sopenharmony_ci#
27413498266Sopenharmony_ci# Verify that 'tr' utility is found within 'PATH', otherwise abort.
27513498266Sopenharmony_ci#
27613498266Sopenharmony_ci
27713498266Sopenharmony_cixc_tst_str="${xc_tab}98s7u6c5c4e3s2s10"
27813498266Sopenharmony_cixc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
27913498266Sopenharmony_ci  | tr -d "0123456789$xc_tab" 2>/dev/null`
28013498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
28113498266Sopenharmony_ci  xsuccess)
28213498266Sopenharmony_ci    :
28313498266Sopenharmony_ci    ;;
28413498266Sopenharmony_ci  *)
28513498266Sopenharmony_ci    echo "$xc_msg_err 'tr' utility not found in 'PATH'. $xc_msg_abrt" >&2
28613498266Sopenharmony_ci    exit 1
28713498266Sopenharmony_ci    ;;
28813498266Sopenharmony_ciesac
28913498266Sopenharmony_ci])
29013498266Sopenharmony_ci
29113498266Sopenharmony_ci
29213498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_UTIL_WC
29313498266Sopenharmony_cidnl -------------------------------------------------
29413498266Sopenharmony_cidnl Private macro.
29513498266Sopenharmony_cidnl
29613498266Sopenharmony_cidnl Emits shell code that verifies that 'wc' utility
29713498266Sopenharmony_cidnl is found within 'PATH', otherwise aborts execution.
29813498266Sopenharmony_ci
29913498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_WC],
30013498266Sopenharmony_ci[dnl
30113498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
30213498266Sopenharmony_ci#
30313498266Sopenharmony_ci# Verify that 'wc' utility is found within 'PATH', otherwise abort.
30413498266Sopenharmony_ci#
30513498266Sopenharmony_ci
30613498266Sopenharmony_cixc_tst_str='unknown unknown unknown unknown'
30713498266Sopenharmony_cixc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
30813498266Sopenharmony_ci  | wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null`
30913498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
31013498266Sopenharmony_ci  x4)
31113498266Sopenharmony_ci    :
31213498266Sopenharmony_ci    ;;
31313498266Sopenharmony_ci  *)
31413498266Sopenharmony_ci    echo "$xc_msg_err 'wc' utility not found in 'PATH'. $xc_msg_abrt" >&2
31513498266Sopenharmony_ci    exit 1
31613498266Sopenharmony_ci    ;;
31713498266Sopenharmony_ciesac
31813498266Sopenharmony_ci])
31913498266Sopenharmony_ci
32013498266Sopenharmony_ci
32113498266Sopenharmony_cidnl _XC_CFG_PRE_BASIC_CHK_UTIL_CAT
32213498266Sopenharmony_cidnl -------------------------------------------------
32313498266Sopenharmony_cidnl Private macro.
32413498266Sopenharmony_cidnl
32513498266Sopenharmony_cidnl Emits shell code that verifies that 'cat' utility
32613498266Sopenharmony_cidnl is found within 'PATH', otherwise aborts execution.
32713498266Sopenharmony_ci
32813498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT],
32913498266Sopenharmony_ci[dnl
33013498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
33113498266Sopenharmony_ci#
33213498266Sopenharmony_ci# Verify that 'cat' utility is found within 'PATH', otherwise abort.
33313498266Sopenharmony_ci#
33413498266Sopenharmony_ci
33513498266Sopenharmony_cixc_tst_str='unknown'
33613498266Sopenharmony_cixc_tst_str=`cat <<_EOT 2>/dev/null \
33713498266Sopenharmony_ci  | wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null
33813498266Sopenharmony_ciunknown
33913498266Sopenharmony_ciunknown
34013498266Sopenharmony_ciunknown
34113498266Sopenharmony_ci_EOT`
34213498266Sopenharmony_cicase "x$xc_tst_str" in @%:@ ((
34313498266Sopenharmony_ci  x3)
34413498266Sopenharmony_ci    :
34513498266Sopenharmony_ci    ;;
34613498266Sopenharmony_ci  *)
34713498266Sopenharmony_ci    echo "$xc_msg_err 'cat' utility not found in 'PATH'. $xc_msg_abrt" >&2
34813498266Sopenharmony_ci    exit 1
34913498266Sopenharmony_ci    ;;
35013498266Sopenharmony_ciesac
35113498266Sopenharmony_ci])
35213498266Sopenharmony_ci
35313498266Sopenharmony_ci
35413498266Sopenharmony_cidnl _XC_CFG_PRE_CHECK_PATH_SEPARATOR
35513498266Sopenharmony_cidnl -------------------------------------------------
35613498266Sopenharmony_cidnl Private macro.
35713498266Sopenharmony_cidnl
35813498266Sopenharmony_cidnl Emits shell code that computes the path separator
35913498266Sopenharmony_cidnl and stores the result in 'PATH_SEPARATOR', unless
36013498266Sopenharmony_cidnl the user has already set it with a non-empty value.
36113498266Sopenharmony_cidnl
36213498266Sopenharmony_cidnl This path separator is the symbol used to separate
36313498266Sopenharmony_cidnl or differentiate paths inside the 'PATH' environment
36413498266Sopenharmony_cidnl variable.
36513498266Sopenharmony_cidnl
36613498266Sopenharmony_cidnl Non-empty user provided 'PATH_SEPARATOR' always
36713498266Sopenharmony_cidnl overrides the auto-detected one.
36813498266Sopenharmony_ci
36913498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_CHECK_PATH_SEPARATOR],
37013498266Sopenharmony_ci[dnl
37113498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
37213498266Sopenharmony_ci#
37313498266Sopenharmony_ci# Auto-detect and set 'PATH_SEPARATOR', unless it is already non-empty set.
37413498266Sopenharmony_ci#
37513498266Sopenharmony_ci
37613498266Sopenharmony_ci# Directory count in 'PATH' when using a colon separator.
37713498266Sopenharmony_cixc_tst_dirs_col='x'
37813498266Sopenharmony_cixc_tst_prev_IFS=$IFS; IFS=':'
37913498266Sopenharmony_cifor xc_tst_dir in $PATH; do
38013498266Sopenharmony_ci  IFS=$xc_tst_prev_IFS
38113498266Sopenharmony_ci  xc_tst_dirs_col="x$xc_tst_dirs_col"
38213498266Sopenharmony_cidone
38313498266Sopenharmony_ciIFS=$xc_tst_prev_IFS
38413498266Sopenharmony_cixc_tst_dirs_col=`expr "$xc_tst_dirs_col" : '.*'`
38513498266Sopenharmony_ci
38613498266Sopenharmony_ci# Directory count in 'PATH' when using a semicolon separator.
38713498266Sopenharmony_cixc_tst_dirs_sem='x'
38813498266Sopenharmony_cixc_tst_prev_IFS=$IFS; IFS=';'
38913498266Sopenharmony_cifor xc_tst_dir in $PATH; do
39013498266Sopenharmony_ci  IFS=$xc_tst_prev_IFS
39113498266Sopenharmony_ci  xc_tst_dirs_sem="x$xc_tst_dirs_sem"
39213498266Sopenharmony_cidone
39313498266Sopenharmony_ciIFS=$xc_tst_prev_IFS
39413498266Sopenharmony_cixc_tst_dirs_sem=`expr "$xc_tst_dirs_sem" : '.*'`
39513498266Sopenharmony_ci
39613498266Sopenharmony_ciif test $xc_tst_dirs_sem -eq $xc_tst_dirs_col; then
39713498266Sopenharmony_ci  # When both counting methods give the same result we do not want to
39813498266Sopenharmony_ci  # chose one over the other, and consider auto-detection not possible.
39913498266Sopenharmony_ci  if test -z "$PATH_SEPARATOR"; then
40013498266Sopenharmony_ci    # User should provide the correct 'PATH_SEPARATOR' definition.
40113498266Sopenharmony_ci    # Until then, guess that it is colon!
40213498266Sopenharmony_ci    echo "$xc_msg_warn path separator not determined, guessing colon" >&2
40313498266Sopenharmony_ci    PATH_SEPARATOR=':'
40413498266Sopenharmony_ci  fi
40513498266Sopenharmony_cielse
40613498266Sopenharmony_ci  # Separator with the greater directory count is the auto-detected one.
40713498266Sopenharmony_ci  if test $xc_tst_dirs_sem -gt $xc_tst_dirs_col; then
40813498266Sopenharmony_ci    xc_tst_auto_separator=';'
40913498266Sopenharmony_ci  else
41013498266Sopenharmony_ci    xc_tst_auto_separator=':'
41113498266Sopenharmony_ci  fi
41213498266Sopenharmony_ci  if test -z "$PATH_SEPARATOR"; then
41313498266Sopenharmony_ci    # Simply use the auto-detected one when not already set.
41413498266Sopenharmony_ci    PATH_SEPARATOR=$xc_tst_auto_separator
41513498266Sopenharmony_ci  elif test "x$PATH_SEPARATOR" != "x$xc_tst_auto_separator"; then
41613498266Sopenharmony_ci    echo "$xc_msg_warn 'PATH_SEPARATOR' does not match auto-detected one." >&2
41713498266Sopenharmony_ci  fi
41813498266Sopenharmony_cifi
41913498266Sopenharmony_cixc_PATH_SEPARATOR=$PATH_SEPARATOR
42013498266Sopenharmony_ciAC_SUBST([PATH_SEPARATOR])dnl
42113498266Sopenharmony_ci])
42213498266Sopenharmony_ci
42313498266Sopenharmony_ci
42413498266Sopenharmony_cidnl _XC_CFG_PRE_POSTLUDE
42513498266Sopenharmony_cidnl -------------------------------------------------
42613498266Sopenharmony_cidnl Private macro.
42713498266Sopenharmony_ci
42813498266Sopenharmony_ciAC_DEFUN([_XC_CFG_PRE_POSTLUDE],
42913498266Sopenharmony_ci[dnl
43013498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
43113498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
43213498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
43313498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
43413498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
43513498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
43613498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
43713498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
43813498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
43913498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
44013498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
44113498266Sopenharmony_cidnl
44213498266Sopenharmony_cixc_configure_preamble_result='yes'
44313498266Sopenharmony_ci])
44413498266Sopenharmony_ci
44513498266Sopenharmony_ci
44613498266Sopenharmony_cidnl XC_CONFIGURE_PREAMBLE
44713498266Sopenharmony_cidnl -------------------------------------------------
44813498266Sopenharmony_cidnl Public macro.
44913498266Sopenharmony_cidnl
45013498266Sopenharmony_cidnl This macro emits shell code which does some
45113498266Sopenharmony_cidnl very basic checks related with the availability
45213498266Sopenharmony_cidnl of some commands and utilities needed to allow
45313498266Sopenharmony_cidnl configure script bootstrapping itself when using
45413498266Sopenharmony_cidnl these to figure out other settings. Also emits
45513498266Sopenharmony_cidnl code that performs PATH_SEPARATOR auto-detection
45613498266Sopenharmony_cidnl and sets its value unless it is already set with
45713498266Sopenharmony_cidnl a non-empty value.
45813498266Sopenharmony_cidnl
45913498266Sopenharmony_cidnl These basic checks are intended to be placed and
46013498266Sopenharmony_cidnl executed as early as possible in the resulting
46113498266Sopenharmony_cidnl configure script, and as such these must be pure
46213498266Sopenharmony_cidnl and portable shell code.
46313498266Sopenharmony_cidnl
46413498266Sopenharmony_cidnl This macro may be used directly, or indirectly
46513498266Sopenharmony_cidnl when using other macros that AC_REQUIRE it such
46613498266Sopenharmony_cidnl as XC_CHECK_PATH_SEPARATOR.
46713498266Sopenharmony_cidnl
46813498266Sopenharmony_cidnl Currently the mechanism used to ensure that this
46913498266Sopenharmony_cidnl macro expands early enough in generated configure
47013498266Sopenharmony_cidnl script is making it override autoconf and libtool
47113498266Sopenharmony_cidnl PATH_SEPARATOR check.
47213498266Sopenharmony_ci
47313498266Sopenharmony_ciAC_DEFUN([XC_CONFIGURE_PREAMBLE],
47413498266Sopenharmony_ci[dnl
47513498266Sopenharmony_ciAC_PREREQ([2.50])dnl
47613498266Sopenharmony_cidnl
47713498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_PREAMBLE])dnl
47813498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
47913498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
48013498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
48113498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
48213498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
48313498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
48413498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
48513498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
48613498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
48713498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
48813498266Sopenharmony_ciAC_BEFORE([$0],[_XC_CFG_PRE_POSTLUDE])dnl
48913498266Sopenharmony_cidnl
49013498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_TOOL])dnl
49113498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_PROG])dnl
49213498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_TOOLS])dnl
49313498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_PROGS])dnl
49413498266Sopenharmony_cidnl
49513498266Sopenharmony_ciAC_BEFORE([$0],[AC_PATH_TOOL])dnl
49613498266Sopenharmony_ciAC_BEFORE([$0],[AC_PATH_PROG])dnl
49713498266Sopenharmony_ciAC_BEFORE([$0],[AC_PATH_PROGS])dnl
49813498266Sopenharmony_cidnl
49913498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_SED])dnl
50013498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_GREP])dnl
50113498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_LN_S])dnl
50213498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl
50313498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_INSTALL])dnl
50413498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl
50513498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
50613498266Sopenharmony_cidnl
50713498266Sopenharmony_ciAC_BEFORE([$0],[LT_INIT])dnl
50813498266Sopenharmony_ciAC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
50913498266Sopenharmony_ciAC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl
51013498266Sopenharmony_cidnl
51113498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
51213498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
51313498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
51413498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
51513498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
51613498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
51713498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
51813498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
51913498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
52013498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
52113498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
52213498266Sopenharmony_ciAC_REQUIRE([_XC_CFG_PRE_POSTLUDE])dnl
52313498266Sopenharmony_cidnl
52413498266Sopenharmony_cim4_pattern_forbid([^_*XC])dnl
52513498266Sopenharmony_cim4_define([$0],[])dnl
52613498266Sopenharmony_ci])
52713498266Sopenharmony_ci
52813498266Sopenharmony_ci
52913498266Sopenharmony_cidnl Override autoconf and libtool PATH_SEPARATOR check
53013498266Sopenharmony_cidnl -------------------------------------------------
53113498266Sopenharmony_cidnl Macros overriding.
53213498266Sopenharmony_cidnl
53313498266Sopenharmony_cidnl This is done to ensure that the same check is
53413498266Sopenharmony_cidnl used across different autoconf versions and to
53513498266Sopenharmony_cidnl allow expansion of XC_CONFIGURE_PREAMBLE macro
53613498266Sopenharmony_cidnl early enough in the generated configure script.
53713498266Sopenharmony_ci
53813498266Sopenharmony_cidnl
53913498266Sopenharmony_cidnl Override when using autoconf 2.53 and newer.
54013498266Sopenharmony_cidnl
54113498266Sopenharmony_ci
54213498266Sopenharmony_cim4_ifdef([_AS_PATH_SEPARATOR_PREPARE],
54313498266Sopenharmony_ci[dnl
54413498266Sopenharmony_cim4_undefine([_AS_PATH_SEPARATOR_PREPARE])dnl
54513498266Sopenharmony_cim4_defun([_AS_PATH_SEPARATOR_PREPARE],
54613498266Sopenharmony_ci[dnl
54713498266Sopenharmony_ciAC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
54813498266Sopenharmony_cim4_define([$0],[])dnl
54913498266Sopenharmony_ci])dnl
55013498266Sopenharmony_ci])
55113498266Sopenharmony_ci
55213498266Sopenharmony_cidnl
55313498266Sopenharmony_cidnl Override when using autoconf 2.50 to 2.52
55413498266Sopenharmony_cidnl
55513498266Sopenharmony_ci
55613498266Sopenharmony_cim4_ifdef([_AC_INIT_PREPARE_FS_SEPARATORS],
55713498266Sopenharmony_ci[dnl
55813498266Sopenharmony_cim4_undefine([_AC_INIT_PREPARE_FS_SEPARATORS])dnl
55913498266Sopenharmony_cim4_defun([_AC_INIT_PREPARE_FS_SEPARATORS],
56013498266Sopenharmony_ci[dnl
56113498266Sopenharmony_ciAC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
56213498266Sopenharmony_ciac_path_separator=$PATH_SEPARATOR
56313498266Sopenharmony_cim4_define([$0],[])dnl
56413498266Sopenharmony_ci])dnl
56513498266Sopenharmony_ci])
56613498266Sopenharmony_ci
56713498266Sopenharmony_cidnl
56813498266Sopenharmony_cidnl Override when using libtool 1.4.2
56913498266Sopenharmony_cidnl
57013498266Sopenharmony_ci
57113498266Sopenharmony_cim4_ifdef([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
57213498266Sopenharmony_ci[dnl
57313498266Sopenharmony_cim4_undefine([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
57413498266Sopenharmony_cim4_defun([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
57513498266Sopenharmony_ci[dnl
57613498266Sopenharmony_ciAC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
57713498266Sopenharmony_cilt_cv_sys_path_separator=$PATH_SEPARATOR
57813498266Sopenharmony_cim4_define([$0],[])dnl
57913498266Sopenharmony_ci])dnl
58013498266Sopenharmony_ci])
58113498266Sopenharmony_ci
58213498266Sopenharmony_ci
58313498266Sopenharmony_cidnl XC_CHECK_PATH_SEPARATOR
58413498266Sopenharmony_cidnl -------------------------------------------------
58513498266Sopenharmony_cidnl Public macro.
58613498266Sopenharmony_cidnl
58713498266Sopenharmony_cidnl Usage of this macro ensures that generated configure
58813498266Sopenharmony_cidnl script uses the same PATH_SEPARATOR check irrespective
58913498266Sopenharmony_cidnl of autoconf or libtool version being used to generate
59013498266Sopenharmony_cidnl configure script.
59113498266Sopenharmony_cidnl
59213498266Sopenharmony_cidnl Emits shell code that computes the path separator
59313498266Sopenharmony_cidnl and stores the result in 'PATH_SEPARATOR', unless
59413498266Sopenharmony_cidnl the user has already set it with a non-empty value.
59513498266Sopenharmony_cidnl
59613498266Sopenharmony_cidnl This path separator is the symbol used to separate
59713498266Sopenharmony_cidnl or differentiate paths inside the 'PATH' environment
59813498266Sopenharmony_cidnl variable.
59913498266Sopenharmony_cidnl
60013498266Sopenharmony_cidnl Non-empty user provided 'PATH_SEPARATOR' always
60113498266Sopenharmony_cidnl overrides the auto-detected one.
60213498266Sopenharmony_cidnl
60313498266Sopenharmony_cidnl Strictly speaking the check is done in two steps. The
60413498266Sopenharmony_cidnl first, which does the actual check, takes place in
60513498266Sopenharmony_cidnl XC_CONFIGURE_PREAMBLE macro and happens very early in
60613498266Sopenharmony_cidnl generated configure script. The second one shows and
60713498266Sopenharmony_cidnl logs the result of the check into config.log at a later
60813498266Sopenharmony_cidnl configure stage. Placement of this second stage in
60913498266Sopenharmony_cidnl generated configure script will be done where first
61013498266Sopenharmony_cidnl direct or indirect usage of this macro happens.
61113498266Sopenharmony_ci
61213498266Sopenharmony_ciAC_DEFUN([XC_CHECK_PATH_SEPARATOR],
61313498266Sopenharmony_ci[dnl
61413498266Sopenharmony_ciAC_PREREQ([2.50])dnl
61513498266Sopenharmony_cidnl
61613498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_TOOL])dnl
61713498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_PROG])dnl
61813498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_TOOLS])dnl
61913498266Sopenharmony_ciAC_BEFORE([$0],[AC_CHECK_PROGS])dnl
62013498266Sopenharmony_cidnl
62113498266Sopenharmony_ciAC_BEFORE([$0],[AC_PATH_TOOL])dnl
62213498266Sopenharmony_ciAC_BEFORE([$0],[AC_PATH_PROG])dnl
62313498266Sopenharmony_ciAC_BEFORE([$0],[AC_PATH_PROGS])dnl
62413498266Sopenharmony_cidnl
62513498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_SED])dnl
62613498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_GREP])dnl
62713498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_LN_S])dnl
62813498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl
62913498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_INSTALL])dnl
63013498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl
63113498266Sopenharmony_ciAC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
63213498266Sopenharmony_cidnl
63313498266Sopenharmony_ciAC_BEFORE([$0],[LT_INIT])dnl
63413498266Sopenharmony_ciAC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
63513498266Sopenharmony_ciAC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl
63613498266Sopenharmony_cidnl
63713498266Sopenharmony_ciAC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
63813498266Sopenharmony_cidnl
63913498266Sopenharmony_ci#
64013498266Sopenharmony_ci# Check that 'XC_CONFIGURE_PREAMBLE' has already run.
64113498266Sopenharmony_ci#
64213498266Sopenharmony_ci
64313498266Sopenharmony_ciif test -z "$xc_configure_preamble_result"; then
64413498266Sopenharmony_ci  AC_MSG_ERROR([xc_configure_preamble_result not set (internal problem)])
64513498266Sopenharmony_cifi
64613498266Sopenharmony_ci
64713498266Sopenharmony_ci#
64813498266Sopenharmony_ci# Check that 'PATH_SEPARATOR' has already been set.
64913498266Sopenharmony_ci#
65013498266Sopenharmony_ci
65113498266Sopenharmony_ciif test -z "$xc_PATH_SEPARATOR"; then
65213498266Sopenharmony_ci  AC_MSG_ERROR([xc_PATH_SEPARATOR not set (internal problem)])
65313498266Sopenharmony_cifi
65413498266Sopenharmony_ciif test -z "$PATH_SEPARATOR"; then
65513498266Sopenharmony_ci  AC_MSG_ERROR([PATH_SEPARATOR not set (internal or config.site problem)])
65613498266Sopenharmony_cifi
65713498266Sopenharmony_ciAC_MSG_CHECKING([for path separator])
65813498266Sopenharmony_ciAC_MSG_RESULT([$PATH_SEPARATOR])
65913498266Sopenharmony_ciif test "x$PATH_SEPARATOR" != "x$xc_PATH_SEPARATOR"; then
66013498266Sopenharmony_ci  AC_MSG_CHECKING([for initial path separator])
66113498266Sopenharmony_ci  AC_MSG_RESULT([$xc_PATH_SEPARATOR])
66213498266Sopenharmony_ci  AC_MSG_ERROR([path separator mismatch (internal or config.site problem)])
66313498266Sopenharmony_cifi
66413498266Sopenharmony_cidnl
66513498266Sopenharmony_cim4_pattern_forbid([^_*XC])dnl
66613498266Sopenharmony_cim4_define([$0],[])dnl
66713498266Sopenharmony_ci])
668