Add installation information for the tarball users and from a git checkout.
[libsigsegv.git] / m4 / bold.m4
blob139ef782245e8d0a2d4ae02a075cd4e6994275fe
1 # bold.m4
2 # serial 3 (libsigsegv-2.15)
3 dnl Copyright (C) 1999-2002 Ralf S. Engelschall <rse@engelschall.com>
4 dnl Copyright (C) 2002-2024 Bruno Haible <bruno@clisp.org>
5 dnl This file is free software, distributed under the terms of the GNU
6 dnl General Public License as published by the Free Software Foundation;
7 dnl either version 2 of the License, or (at your option) any later version.
8 dnl As a special exception to the GNU General Public License, this file
9 dnl may be distributed as part of a program that contains a configuration
10 dnl script generated by Autoconf, under the same distribution terms as
11 dnl the rest of that program.
13 # Determine the escape sequences for switching bold output on and off.
14 AC_DEFUN([RSE_BOLD],
16   dnl Not pretty.
17   dnl AC_REQUIRE([AC_PROG_AWK])
19   case $TERM in
20     # for the most important terminal types we directly know the sequences
21     xterm*|vt220*|vt100*)
22       term_bold=`${AWK:-awk} 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' </dev/null 2>/dev/null`
23       term_norm=`${AWK:-awk} 'BEGIN { printf("%c%c%c", 27, 91, 109); }' </dev/null 2>/dev/null`
24       ;;
25     # for all others, we try to use a possibly existing `tput' or `tcout' utility
26     *)
27       paths=`echo "$PATH" | sed -e 's/:/ /g'`
28       for tool in tput tcout; do
29         for dir in $paths; do
30           if test -r "$dir/$tool"; then
31             for seq in bold md smso; do # 'smso' is last
32               bold="`$dir/$tool $seq 2>/dev/null`"
33               if test -n "$bold"; then
34                 term_bold="$bold"
35                 break
36               fi
37             done
38             if test -n "$term_bold"; then
39               for seq in sgr0 me rmso reset; do # 'reset' is last
40                 norm="`$dir/$tool $seq 2>/dev/null`"
41                 if test -n "$norm"; then
42                   term_norm="$norm"
43                   break
44                 fi
45               done
46             fi
47             break
48           fi
49         done
50         if test -n "$term_bold" && test -n "$term_norm"; then
51           break
52         fi
53       done
54       ;;
55   esac
56   echo "$term_bold" | tr -d '\n' > termbold
57   echo "$term_norm" | tr -d '\n' > termnorm