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