Home | History | Annotate | Download | only in m4
      1 #---------------------------------------------------------------------------
      2 #
      3 # zz40-xc-ovr.m4
      4 #
      5 # Copyright (c) 2013 - 2018 Daniel Stenberg <daniel (a] haxx.se>
      6 #
      7 # Permission to use, copy, modify, and distribute this software for any
      8 # purpose with or without fee is hereby granted, provided that the above
      9 # copyright notice and this permission notice appear in all copies.
     10 #
     11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18 #
     19 #---------------------------------------------------------------------------
     20 
     21 dnl The funny name of this file is intentional in order to make it
     22 dnl sort alphabetically after any libtool, autoconf or automake
     23 dnl provided .m4 macro file that might get copied into this same
     24 dnl subdirectory. This allows that macro (re)definitions from this
     25 dnl file may override those provided in other files.
     26 
     27 
     28 dnl Version macros
     29 dnl -------------------------------------------------
     30 dnl Public macros.
     31 
     32 m4_define([XC_CONFIGURE_PREAMBLE_VER_MAJOR],[1])dnl
     33 m4_define([XC_CONFIGURE_PREAMBLE_VER_MINOR],[0])dnl
     34 
     35 
     36 dnl _XC_CFG_PRE_PREAMBLE
     37 dnl -------------------------------------------------
     38 dnl Private macro.
     39 
     40 AC_DEFUN([_XC_CFG_PRE_PREAMBLE],
     41 [
     42 ## -------------------------------- ##
     43 @%:@@%:@  [XC_CONFIGURE_PREAMBLE] ver: []dnl
     44 XC_CONFIGURE_PREAMBLE_VER_MAJOR.[]dnl
     45 XC_CONFIGURE_PREAMBLE_VER_MINOR  ##
     46 ## -------------------------------- ##
     47 
     48 xc_configure_preamble_ver_major='XC_CONFIGURE_PREAMBLE_VER_MAJOR'
     49 xc_configure_preamble_ver_minor='XC_CONFIGURE_PREAMBLE_VER_MINOR'
     50 
     51 #
     52 # Set IFS to space, tab and newline.
     53 #
     54 
     55 xc_space=' '
     56 xc_tab='	'
     57 xc_newline='
     58 '
     59 IFS="$xc_space$xc_tab$xc_newline"
     60 
     61 #
     62 # Set internationalization behavior variables.
     63 #
     64 
     65 LANG='C'
     66 LC_ALL='C'
     67 LANGUAGE='C'
     68 export LANG
     69 export LC_ALL
     70 export LANGUAGE
     71 
     72 #
     73 # Some useful variables.
     74 #
     75 
     76 xc_msg_warn='configure: WARNING:'
     77 xc_msg_abrt='Can not continue.'
     78 xc_msg_err='configure: error:'
     79 ])
     80 
     81 
     82 dnl _XC_CFG_PRE_BASIC_CHK_CMD_ECHO
     83 dnl -------------------------------------------------
     84 dnl Private macro.
     85 dnl
     86 dnl Emits shell code that verifies that 'echo' command
     87 dnl is available, otherwise aborts execution.
     88 
     89 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO],
     90 [dnl
     91 AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
     92 #
     93 # Verify that 'echo' command is available, otherwise abort.
     94 #
     95 
     96 xc_tst_str='unknown'
     97 (`echo "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
     98 case "x$xc_tst_str" in @%:@ ((
     99   xsuccess)
    100     :
    101     ;;
    102   *)
    103     # Try built-in echo, and fail.
    104     echo "$xc_msg_err 'echo' command not found. $xc_msg_abrt" >&2
    105     exit 1
    106     ;;
    107 esac
    108 ])
    109 
    110 
    111 dnl _XC_CFG_PRE_BASIC_CHK_CMD_TEST
    112 dnl -------------------------------------------------
    113 dnl Private macro.
    114 dnl
    115 dnl Emits shell code that verifies that 'test' command
    116 dnl is available, otherwise aborts execution.
    117 
    118 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_TEST],
    119 [dnl
    120 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
    121 #
    122 # Verify that 'test' command is available, otherwise abort.
    123 #
    124 
    125 xc_tst_str='unknown'
    126 (`test -n "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
    127 case "x$xc_tst_str" in @%:@ ((
    128   xsuccess)
    129     :
    130     ;;
    131   *)
    132     echo "$xc_msg_err 'test' command not found. $xc_msg_abrt" >&2
    133     exit 1
    134     ;;
    135 esac
    136 ])
    137 
    138 
    139 dnl _XC_CFG_PRE_BASIC_CHK_VAR_PATH
    140 dnl -------------------------------------------------
    141 dnl Private macro.
    142 dnl
    143 dnl Emits shell code that verifies that 'PATH' variable
    144 dnl is set, otherwise aborts execution.
    145 
    146 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_VAR_PATH],
    147 [dnl
    148 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
    149 #
    150 # Verify that 'PATH' variable is set, otherwise abort.
    151 #
    152 
    153 xc_tst_str='unknown'
    154 (`test -n "$PATH" >/dev/null 2>&1`) && xc_tst_str='success'
    155 case "x$xc_tst_str" in @%:@ ((
    156   xsuccess)
    157     :
    158     ;;
    159   *)
    160     echo "$xc_msg_err 'PATH' variable not set. $xc_msg_abrt" >&2
    161     exit 1
    162     ;;
    163 esac
    164 ])
    165 
    166 
    167 dnl _XC_CFG_PRE_BASIC_CHK_CMD_EXPR
    168 dnl -------------------------------------------------
    169 dnl Private macro.
    170 dnl
    171 dnl Emits shell code that verifies that 'expr' command
    172 dnl is available, otherwise aborts execution.
    173 
    174 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR],
    175 [dnl
    176 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    177 #
    178 # Verify that 'expr' command is available, otherwise abort.
    179 #
    180 
    181 xc_tst_str='unknown'
    182 xc_tst_str=`expr "$xc_tst_str" : '.*' 2>/dev/null`
    183 case "x$xc_tst_str" in @%:@ ((
    184   x7)
    185     :
    186     ;;
    187   *)
    188     echo "$xc_msg_err 'expr' command not found. $xc_msg_abrt" >&2
    189     exit 1
    190     ;;
    191 esac
    192 ])
    193 
    194 
    195 dnl _XC_CFG_PRE_BASIC_CHK_UTIL_SED
    196 dnl -------------------------------------------------
    197 dnl Private macro.
    198 dnl
    199 dnl Emits shell code that verifies that 'sed' utility
    200 dnl is found within 'PATH', otherwise aborts execution.
    201 dnl
    202 dnl This 'sed' is required in order to allow configure
    203 dnl script bootstrapping itself. No fancy testing for a
    204 dnl proper 'sed' this early, that should be done later.
    205 
    206 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_SED],
    207 [dnl
    208 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    209 #
    210 # Verify that 'sed' utility is found within 'PATH', otherwise abort.
    211 #
    212 
    213 xc_tst_str='unknown'
    214 xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
    215   | sed -e 's:unknown:success:' 2>/dev/null`
    216 case "x$xc_tst_str" in @%:@ ((
    217   xsuccess)
    218     :
    219     ;;
    220   *)
    221     echo "$xc_msg_err 'sed' utility not found in 'PATH'. $xc_msg_abrt" >&2
    222     exit 1
    223     ;;
    224 esac
    225 ])
    226 
    227 
    228 dnl _XC_CFG_PRE_BASIC_CHK_UTIL_GREP
    229 dnl -------------------------------------------------
    230 dnl Private macro.
    231 dnl
    232 dnl Emits shell code that verifies that 'grep' utility
    233 dnl is found within 'PATH', otherwise aborts execution.
    234 dnl
    235 dnl This 'grep' is required in order to allow configure
    236 dnl script bootstrapping itself. No fancy testing for a
    237 dnl proper 'grep' this early, that should be done later.
    238 
    239 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP],
    240 [dnl
    241 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    242 #
    243 # Verify that 'grep' utility is found within 'PATH', otherwise abort.
    244 #
    245 
    246 xc_tst_str='unknown'
    247 (`echo "$xc_tst_str" 2>/dev/null \
    248   | grep 'unknown' >/dev/null 2>&1`) && xc_tst_str='success'
    249 case "x$xc_tst_str" in @%:@ ((
    250   xsuccess)
    251     :
    252     ;;
    253   *)
    254     echo "$xc_msg_err 'grep' utility not found in 'PATH'. $xc_msg_abrt" >&2
    255     exit 1
    256     ;;
    257 esac
    258 ])
    259 
    260 
    261 dnl _XC_CFG_PRE_BASIC_CHK_UTIL_TR
    262 dnl -------------------------------------------------
    263 dnl Private macro.
    264 dnl
    265 dnl Emits shell code that verifies that 'tr' utility
    266 dnl is found within 'PATH', otherwise aborts execution.
    267 
    268 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_TR],
    269 [dnl
    270 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    271 #
    272 # Verify that 'tr' utility is found within 'PATH', otherwise abort.
    273 #
    274 
    275 xc_tst_str="${xc_tab}98s7u6c5c4e3s2s10"
    276 xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
    277   | tr -d "0123456789$xc_tab" 2>/dev/null`
    278 case "x$xc_tst_str" in @%:@ ((
    279   xsuccess)
    280     :
    281     ;;
    282   *)
    283     echo "$xc_msg_err 'tr' utility not found in 'PATH'. $xc_msg_abrt" >&2
    284     exit 1
    285     ;;
    286 esac
    287 ])
    288 
    289 
    290 dnl _XC_CFG_PRE_BASIC_CHK_UTIL_WC
    291 dnl -------------------------------------------------
    292 dnl Private macro.
    293 dnl
    294 dnl Emits shell code that verifies that 'wc' utility
    295 dnl is found within 'PATH', otherwise aborts execution.
    296 
    297 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_WC],
    298 [dnl
    299 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
    300 #
    301 # Verify that 'wc' utility is found within 'PATH', otherwise abort.
    302 #
    303 
    304 xc_tst_str='unknown unknown unknown unknown'
    305 xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
    306   | wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null`
    307 case "x$xc_tst_str" in @%:@ ((
    308   x4)
    309     :
    310     ;;
    311   *)
    312     echo "$xc_msg_err 'wc' utility not found in 'PATH'. $xc_msg_abrt" >&2
    313     exit 1
    314     ;;
    315 esac
    316 ])
    317 
    318 
    319 dnl _XC_CFG_PRE_BASIC_CHK_UTIL_CAT
    320 dnl -------------------------------------------------
    321 dnl Private macro.
    322 dnl
    323 dnl Emits shell code that verifies that 'cat' utility
    324 dnl is found within 'PATH', otherwise aborts execution.
    325 
    326 AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT],
    327 [dnl
    328 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
    329 #
    330 # Verify that 'cat' utility is found within 'PATH', otherwise abort.
    331 #
    332 
    333 xc_tst_str='unknown'
    334 xc_tst_str=`cat <<_EOT 2>/dev/null \
    335   | wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null
    336 unknown
    337 unknown
    338 unknown
    339 _EOT`
    340 case "x$xc_tst_str" in @%:@ ((
    341   x3)
    342     :
    343     ;;
    344   *)
    345     echo "$xc_msg_err 'cat' utility not found in 'PATH'. $xc_msg_abrt" >&2
    346     exit 1
    347     ;;
    348 esac
    349 ])
    350 
    351 
    352 dnl _XC_CFG_PRE_CHECK_PATH_SEPARATOR
    353 dnl -------------------------------------------------
    354 dnl Private macro.
    355 dnl
    356 dnl Emits shell code that computes the path separator
    357 dnl and stores the result in 'PATH_SEPARATOR', unless
    358 dnl the user has already set it with a non-empty value.
    359 dnl
    360 dnl This path separator is the symbol used to separate
    361 dnl or diferentiate paths inside the 'PATH' environment
    362 dnl variable.
    363 dnl
    364 dnl Non-empty user provided 'PATH_SEPARATOR' always
    365 dnl overrides the auto-detected one.
    366 
    367 AC_DEFUN([_XC_CFG_PRE_CHECK_PATH_SEPARATOR],
    368 [dnl
    369 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
    370 #
    371 # Auto-detect and set 'PATH_SEPARATOR', unless it is already non-empty set.
    372 #
    373 
    374 # Directory count in 'PATH' when using a colon separator.
    375 xc_tst_dirs_col='x'
    376 xc_tst_prev_IFS=$IFS; IFS=':'
    377 for xc_tst_dir in $PATH; do
    378   IFS=$xc_tst_prev_IFS
    379   xc_tst_dirs_col="x$xc_tst_dirs_col"
    380 done
    381 IFS=$xc_tst_prev_IFS
    382 xc_tst_dirs_col=`expr "$xc_tst_dirs_col" : '.*'`
    383 
    384 # Directory count in 'PATH' when using a semicolon separator.
    385 xc_tst_dirs_sem='x'
    386 xc_tst_prev_IFS=$IFS; IFS=';'
    387 for xc_tst_dir in $PATH; do
    388   IFS=$xc_tst_prev_IFS
    389   xc_tst_dirs_sem="x$xc_tst_dirs_sem"
    390 done
    391 IFS=$xc_tst_prev_IFS
    392 xc_tst_dirs_sem=`expr "$xc_tst_dirs_sem" : '.*'`
    393 
    394 if test $xc_tst_dirs_sem -eq $xc_tst_dirs_col; then
    395   # When both counting methods give the same result we do not want to
    396   # chose one over the other, and consider auto-detection not possible.
    397   if test -z "$PATH_SEPARATOR"; then
    398     # User should provide the correct 'PATH_SEPARATOR' definition.
    399     # Until then, guess that it is colon!
    400     echo "$xc_msg_warn path separator not determined, guessing colon" >&2
    401     PATH_SEPARATOR=':'
    402   fi
    403 else
    404   # Separator with the greater directory count is the auto-detected one.
    405   if test $xc_tst_dirs_sem -gt $xc_tst_dirs_col; then
    406     xc_tst_auto_separator=';'
    407   else
    408     xc_tst_auto_separator=':'
    409   fi
    410   if test -z "$PATH_SEPARATOR"; then
    411     # Simply use the auto-detected one when not already set.
    412     PATH_SEPARATOR=$xc_tst_auto_separator
    413   elif test "x$PATH_SEPARATOR" != "x$xc_tst_auto_separator"; then
    414     echo "$xc_msg_warn 'PATH_SEPARATOR' does not match auto-detected one." >&2
    415   fi
    416 fi
    417 xc_PATH_SEPARATOR=$PATH_SEPARATOR
    418 AC_SUBST([PATH_SEPARATOR])dnl
    419 ])
    420 
    421 
    422 dnl _XC_CFG_PRE_POSTLUDE
    423 dnl -------------------------------------------------
    424 dnl Private macro.
    425 
    426 AC_DEFUN([_XC_CFG_PRE_POSTLUDE],
    427 [dnl
    428 AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
    429 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
    430 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
    431 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    432 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
    433 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
    434 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
    435 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
    436 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
    437 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
    438 AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
    439 dnl
    440 xc_configure_preamble_result='yes'
    441 ])
    442 
    443 
    444 dnl XC_CONFIGURE_PREAMBLE
    445 dnl -------------------------------------------------
    446 dnl Public macro.
    447 dnl
    448 dnl This macro emits shell code which does some
    449 dnl very basic checks related with the availability
    450 dnl of some commands and utilities needed to allow
    451 dnl configure script bootstrapping itself when using
    452 dnl these to figure out other settings. Also emits
    453 dnl code that performs PATH_SEPARATOR auto-detection
    454 dnl and sets its value unless it is already set with
    455 dnl a non-empty value.
    456 dnl
    457 dnl These basic checks are intended to be placed and
    458 dnl executed as early as possible in the resulting
    459 dnl configure script, and as such these must be pure
    460 dnl and portable shell code.
    461 dnl
    462 dnl This macro may be used directly, or indirectly
    463 dnl when using other macros that AC_REQUIRE it such
    464 dnl as XC_CHECK_PATH_SEPARATOR.
    465 dnl
    466 dnl Currently the mechanism used to ensure that this
    467 dnl macro expands early enough in generated configure
    468 dnl script is making it override autoconf and libtool
    469 dnl PATH_SEPARATOR check.
    470 
    471 AC_DEFUN([XC_CONFIGURE_PREAMBLE],
    472 [dnl
    473 AC_PREREQ([2.50])dnl
    474 dnl
    475 AC_BEFORE([$0],[_XC_CFG_PRE_PREAMBLE])dnl
    476 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
    477 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
    478 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    479 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
    480 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
    481 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
    482 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
    483 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
    484 AC_BEFORE([$0],[_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
    485 AC_BEFORE([$0],[_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
    486 AC_BEFORE([$0],[_XC_CFG_PRE_POSTLUDE])dnl
    487 dnl
    488 AC_BEFORE([$0],[AC_CHECK_TOOL])dnl
    489 AC_BEFORE([$0],[AC_CHECK_PROG])dnl
    490 AC_BEFORE([$0],[AC_CHECK_TOOLS])dnl
    491 AC_BEFORE([$0],[AC_CHECK_PROGS])dnl
    492 dnl
    493 AC_BEFORE([$0],[AC_PATH_TOOL])dnl
    494 AC_BEFORE([$0],[AC_PATH_PROG])dnl
    495 AC_BEFORE([$0],[AC_PATH_PROGS])dnl
    496 dnl
    497 AC_BEFORE([$0],[AC_PROG_SED])dnl
    498 AC_BEFORE([$0],[AC_PROG_GREP])dnl
    499 AC_BEFORE([$0],[AC_PROG_LN_S])dnl
    500 AC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl
    501 AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
    502 AC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl
    503 AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
    504 dnl
    505 AC_BEFORE([$0],[LT_INIT])dnl
    506 AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
    507 AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl
    508 dnl
    509 AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
    510 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
    511 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
    512 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
    513 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR])dnl
    514 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_SED])dnl
    515 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP])dnl
    516 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
    517 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
    518 AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT])dnl
    519 AC_REQUIRE([_XC_CFG_PRE_CHECK_PATH_SEPARATOR])dnl
    520 AC_REQUIRE([_XC_CFG_PRE_POSTLUDE])dnl
    521 dnl
    522 m4_pattern_forbid([^_*XC])dnl
    523 m4_define([$0],[])dnl
    524 ])
    525 
    526 
    527 dnl Override autoconf and libtool PATH_SEPARATOR check
    528 dnl -------------------------------------------------
    529 dnl Macros overriding.
    530 dnl
    531 dnl This is done to ensure that the same check is
    532 dnl used across different autoconf versions and to
    533 dnl allow expansion of XC_CONFIGURE_PREAMBLE macro
    534 dnl early enough in the generated configure script.
    535 
    536 dnl
    537 dnl Override when using autoconf 2.53 and newer.
    538 dnl
    539 
    540 m4_ifdef([_AS_PATH_SEPARATOR_PREPARE],
    541 [dnl
    542 m4_undefine([_AS_PATH_SEPARATOR_PREPARE])dnl
    543 m4_defun([_AS_PATH_SEPARATOR_PREPARE],
    544 [dnl
    545 AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
    546 m4_define([$0],[])dnl
    547 ])dnl
    548 ])
    549 
    550 dnl
    551 dnl Override when using autoconf 2.50 to 2.52
    552 dnl
    553 
    554 m4_ifdef([_AC_INIT_PREPARE_FS_SEPARATORS],
    555 [dnl
    556 m4_undefine([_AC_INIT_PREPARE_FS_SEPARATORS])dnl
    557 m4_defun([_AC_INIT_PREPARE_FS_SEPARATORS],
    558 [dnl
    559 AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
    560 ac_path_separator=$PATH_SEPARATOR
    561 m4_define([$0],[])dnl
    562 ])dnl
    563 ])
    564 
    565 dnl
    566 dnl Override when using libtool 1.4.2
    567 dnl
    568 
    569 m4_ifdef([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
    570 [dnl
    571 m4_undefine([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
    572 m4_defun([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
    573 [dnl
    574 AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
    575 lt_cv_sys_path_separator=$PATH_SEPARATOR
    576 m4_define([$0],[])dnl
    577 ])dnl
    578 ])
    579 
    580 
    581 dnl XC_CHECK_PATH_SEPARATOR
    582 dnl -------------------------------------------------
    583 dnl Public macro.
    584 dnl
    585 dnl Usage of this macro ensures that generated configure
    586 dnl script uses the same PATH_SEPARATOR check irrespective
    587 dnl of autoconf or libtool version being used to generate
    588 dnl configure script.
    589 dnl
    590 dnl Emits shell code that computes the path separator
    591 dnl and stores the result in 'PATH_SEPARATOR', unless
    592 dnl the user has already set it with a non-empty value.
    593 dnl
    594 dnl This path separator is the symbol used to separate
    595 dnl or diferentiate paths inside the 'PATH' environment
    596 dnl variable.
    597 dnl
    598 dnl Non-empty user provided 'PATH_SEPARATOR' always
    599 dnl overrides the auto-detected one.
    600 dnl
    601 dnl Strictly speaking the check is done in two steps. The
    602 dnl first, which does the actual check, takes place in
    603 dnl XC_CONFIGURE_PREAMBLE macro and happens very early in
    604 dnl generated configure script. The second one shows and
    605 dnl logs the result of the check into config.log at a later
    606 dnl configure stage. Placement of this second stage in
    607 dnl generated configure script will be done where first
    608 dnl direct or indirect usage of this macro happens.
    609 
    610 AC_DEFUN([XC_CHECK_PATH_SEPARATOR],
    611 [dnl
    612 AC_PREREQ([2.50])dnl
    613 dnl
    614 AC_BEFORE([$0],[AC_CHECK_TOOL])dnl
    615 AC_BEFORE([$0],[AC_CHECK_PROG])dnl
    616 AC_BEFORE([$0],[AC_CHECK_TOOLS])dnl
    617 AC_BEFORE([$0],[AC_CHECK_PROGS])dnl
    618 dnl
    619 AC_BEFORE([$0],[AC_PATH_TOOL])dnl
    620 AC_BEFORE([$0],[AC_PATH_PROG])dnl
    621 AC_BEFORE([$0],[AC_PATH_PROGS])dnl
    622 dnl
    623 AC_BEFORE([$0],[AC_PROG_SED])dnl
    624 AC_BEFORE([$0],[AC_PROG_GREP])dnl
    625 AC_BEFORE([$0],[AC_PROG_LN_S])dnl
    626 AC_BEFORE([$0],[AC_PROG_MKDIR_P])dnl
    627 AC_BEFORE([$0],[AC_PROG_INSTALL])dnl
    628 AC_BEFORE([$0],[AC_PROG_MAKE_SET])dnl
    629 AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl
    630 dnl
    631 AC_BEFORE([$0],[LT_INIT])dnl
    632 AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl
    633 AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl
    634 dnl
    635 AC_REQUIRE([XC_CONFIGURE_PREAMBLE])dnl
    636 dnl
    637 #
    638 # Check that 'XC_CONFIGURE_PREAMBLE' has already run.
    639 #
    640 
    641 if test -z "$xc_configure_preamble_result"; then
    642   AC_MSG_ERROR([xc_configure_preamble_result not set (internal problem)])
    643 fi
    644 
    645 #
    646 # Check that 'PATH_SEPARATOR' has already been set.
    647 #
    648 
    649 if test -z "$xc_PATH_SEPARATOR"; then
    650   AC_MSG_ERROR([xc_PATH_SEPARATOR not set (internal problem)])
    651 fi
    652 if test -z "$PATH_SEPARATOR"; then
    653   AC_MSG_ERROR([PATH_SEPARATOR not set (internal or config.site problem)])
    654 fi
    655 AC_MSG_CHECKING([for path separator])
    656 AC_MSG_RESULT([$PATH_SEPARATOR])
    657 if test "x$PATH_SEPARATOR" != "x$xc_PATH_SEPARATOR"; then
    658   AC_MSG_CHECKING([for initial path separator])
    659   AC_MSG_RESULT([$xc_PATH_SEPARATOR])
    660   AC_MSG_ERROR([path separator mismatch (internal or config.site problem)])
    661 fi
    662 dnl
    663 m4_pattern_forbid([^_*XC])dnl
    664 m4_define([$0],[])dnl
    665 ])
    666