1#---------------------------------------------------------------------------
2#
3# zz40-xc-ovr.m4
4#
5# Copyright (c) 2013 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#---------------------------------------------------------------------------
20
21# serial 1
22
23
24dnl The funny name of this file is intentional in order to make it
25dnl sort alphabetically after any libtool, autoconf or automake
26dnl provided .m4 macro file that might get copied into this same
27dnl subdirectory. This allows that macro (re)definitions from this
28dnl file may override those provided in other files.
29
30
31dnl Version macros
32dnl -------------------------------------------------
33dnl Public macros.
34
35m4_define([XC_CONFIGURE_PREAMBLE_VER_MAJOR],[1])dnl
36m4_define([XC_CONFIGURE_PREAMBLE_VER_MINOR],[0])dnl
37
38
39dnl _XC_CFG_PRE_PREAMBLE
40dnl -------------------------------------------------
41dnl Private macro.
42
43AC_DEFUN([_XC_CFG_PRE_PREAMBLE],
44[
45## -------------------------------- ##
46@%:@@%:@  [XC_CONFIGURE_PREAMBLE] ver: []dnl
47XC_CONFIGURE_PREAMBLE_VER_MAJOR.[]dnl
48XC_CONFIGURE_PREAMBLE_VER_MINOR  ##
49## -------------------------------- ##
50
51xc_configure_preamble_ver_major='XC_CONFIGURE_PREAMBLE_VER_MAJOR'
52xc_configure_preamble_ver_minor='XC_CONFIGURE_PREAMBLE_VER_MINOR'
53
54#
55# Set IFS to space, tab and newline.
56#
57
58xc_space=' '
59xc_tab='	'
60xc_newline='
61'
62IFS="$xc_space$xc_tab$xc_newline"
63
64#
65# Set internationalization behavior variables.
66#
67
68LANG='C'
69LC_ALL='C'
70LANGUAGE='C'
71export LANG
72export LC_ALL
73export LANGUAGE
74
75#
76# Some useful variables.
77#
78
79xc_msg_warn='configure: WARNING:'
80xc_msg_abrt='Can not continue.'
81xc_msg_err='configure: error:'
82])
83
84
85dnl _XC_CFG_PRE_BASIC_CHK_CMD_ECHO
86dnl -------------------------------------------------
87dnl Private macro.
88dnl
89dnl Emits shell code that verifies that 'echo' command
90dnl is available, otherwise aborts execution.
91
92AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO],
93[dnl
94AC_REQUIRE([_XC_CFG_PRE_PREAMBLE])dnl
95#
96# Verify that 'echo' command is available, otherwise abort.
97#
98
99xc_tst_str='unknown'
100(`echo "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
101case "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    ;;
110esac
111])
112
113
114dnl _XC_CFG_PRE_BASIC_CHK_CMD_TEST
115dnl -------------------------------------------------
116dnl Private macro.
117dnl
118dnl Emits shell code that verifies that 'test' command
119dnl is available, otherwise aborts execution.
120
121AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_TEST],
122[dnl
123AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_ECHO])dnl
124#
125# Verify that 'test' command is available, otherwise abort.
126#
127
128xc_tst_str='unknown'
129(`test -n "$xc_tst_str" >/dev/null 2>&1`) && xc_tst_str='success'
130case "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    ;;
138esac
139])
140
141
142dnl _XC_CFG_PRE_BASIC_CHK_VAR_PATH
143dnl -------------------------------------------------
144dnl Private macro.
145dnl
146dnl Emits shell code that verifies that 'PATH' variable
147dnl is set, otherwise aborts execution.
148
149AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_VAR_PATH],
150[dnl
151AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_CMD_TEST])dnl
152#
153# Verify that 'PATH' variable is set, otherwise abort.
154#
155
156xc_tst_str='unknown'
157(`test -n "$PATH" >/dev/null 2>&1`) && xc_tst_str='success'
158case "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    ;;
166esac
167])
168
169
170dnl _XC_CFG_PRE_BASIC_CHK_CMD_EXPR
171dnl -------------------------------------------------
172dnl Private macro.
173dnl
174dnl Emits shell code that verifies that 'expr' command
175dnl is available, otherwise aborts execution.
176
177AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_CMD_EXPR],
178[dnl
179AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
180#
181# Verify that 'expr' command is available, otherwise abort.
182#
183
184xc_tst_str='unknown'
185xc_tst_str=`expr "$xc_tst_str" : '.*' 2>/dev/null`
186case "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    ;;
194esac
195])
196
197
198dnl _XC_CFG_PRE_BASIC_CHK_UTIL_SED
199dnl -------------------------------------------------
200dnl Private macro.
201dnl
202dnl Emits shell code that verifies that 'sed' utility
203dnl is found within 'PATH', otherwise aborts execution.
204dnl
205dnl This 'sed' is required in order to allow configure
206dnl script bootstrapping itself. No fancy testing for a
207dnl proper 'sed' this early, that should be done later.
208
209AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_SED],
210[dnl
211AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
212#
213# Verify that 'sed' utility is found within 'PATH', otherwise abort.
214#
215
216xc_tst_str='unknown'
217xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
218  | sed -e 's:unknown:success:' 2>/dev/null`
219case "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    ;;
227esac
228])
229
230
231dnl _XC_CFG_PRE_BASIC_CHK_UTIL_GREP
232dnl -------------------------------------------------
233dnl Private macro.
234dnl
235dnl Emits shell code that verifies that 'grep' utility
236dnl is found within 'PATH', otherwise aborts execution.
237dnl
238dnl This 'grep' is required in order to allow configure
239dnl script bootstrapping itself. No fancy testing for a
240dnl proper 'grep' this early, that should be done later.
241
242AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_GREP],
243[dnl
244AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
245#
246# Verify that 'grep' utility is found within 'PATH', otherwise abort.
247#
248
249xc_tst_str='unknown'
250(`echo "$xc_tst_str" 2>/dev/null \
251  | grep 'unknown' >/dev/null 2>&1`) && xc_tst_str='success'
252case "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    ;;
260esac
261])
262
263
264dnl _XC_CFG_PRE_BASIC_CHK_UTIL_TR
265dnl -------------------------------------------------
266dnl Private macro.
267dnl
268dnl Emits shell code that verifies that 'tr' utility
269dnl is found within 'PATH', otherwise aborts execution.
270
271AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_TR],
272[dnl
273AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_VAR_PATH])dnl
274#
275# Verify that 'tr' utility is found within 'PATH', otherwise abort.
276#
277
278xc_tst_str="${xc_tab}98s7u6c5c4e3s2s10"
279xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
280  | tr -d "0123456789$xc_tab" 2>/dev/null`
281case "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    ;;
289esac
290])
291
292
293dnl _XC_CFG_PRE_BASIC_CHK_UTIL_WC
294dnl -------------------------------------------------
295dnl Private macro.
296dnl
297dnl Emits shell code that verifies that 'wc' utility
298dnl is found within 'PATH', otherwise aborts execution.
299
300AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_WC],
301[dnl
302AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_TR])dnl
303#
304# Verify that 'wc' utility is found within 'PATH', otherwise abort.
305#
306
307xc_tst_str='unknown unknown unknown unknown'
308xc_tst_str=`echo "$xc_tst_str" 2>/dev/null \
309  | wc -w 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null`
310case "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    ;;
318esac
319])
320
321
322dnl _XC_CFG_PRE_BASIC_CHK_UTIL_CAT
323dnl -------------------------------------------------
324dnl Private macro.
325dnl
326dnl Emits shell code that verifies that 'cat' utility
327dnl is found within 'PATH', otherwise aborts execution.
328
329AC_DEFUN([_XC_CFG_PRE_BASIC_CHK_UTIL_CAT],
330[dnl
331AC_REQUIRE([_XC_CFG_PRE_BASIC_CHK_UTIL_WC])dnl
332#
333# Verify that 'cat' utility is found within 'PATH', otherwise abort.
334#
335
336xc_tst_str='unknown'
337xc_tst_str=`cat <<_EOT 2>/dev/null \
338  | wc -l 2>/dev/null | tr -d "$xc_space$xc_tab" 2>/dev/null
339unknown
340unknown
341unknown
342_EOT`
343case "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    ;;
351esac
352])
353
354
355dnl _XC_CFG_PRE_CHECK_PATH_SEPARATOR
356dnl -------------------------------------------------
357dnl Private macro.
358dnl
359dnl Emits shell code that computes the path separator
360dnl and stores the result in 'PATH_SEPARATOR', unless
361dnl the user has already set it with a non-empty value.
362dnl
363dnl This path separator is the symbol used to separate
364dnl or diferentiate paths inside the 'PATH' environment
365dnl variable.
366dnl
367dnl Non-empty user provided 'PATH_SEPARATOR' always
368dnl overrides the auto-detected one.
369
370AC_DEFUN([_XC_CFG_PRE_CHECK_PATH_SEPARATOR],
371[dnl
372AC_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.
378xc_tst_dirs_col='x'
379xc_tst_prev_IFS=$IFS; IFS=':'
380for xc_tst_dir in $PATH; do
381  IFS=$xc_tst_prev_IFS
382  xc_tst_dirs_col="x$xc_tst_dirs_col"
383done
384IFS=$xc_tst_prev_IFS
385xc_tst_dirs_col=`expr "$xc_tst_dirs_col" : '.*'`
386
387# Directory count in 'PATH' when using a semicolon separator.
388xc_tst_dirs_sem='x'
389xc_tst_prev_IFS=$IFS; IFS=';'
390for xc_tst_dir in $PATH; do
391  IFS=$xc_tst_prev_IFS
392  xc_tst_dirs_sem="x$xc_tst_dirs_sem"
393done
394IFS=$xc_tst_prev_IFS
395xc_tst_dirs_sem=`expr "$xc_tst_dirs_sem" : '.*'`
396
397if 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
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 diferentiate 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
669