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