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