NR: Add index entries for `<<`, `\\`, and `>>`
[lilypond/mirror.git] / autogen.sh
bloba152435df513e7e174f8d8da1ffe0c60f1ea6598
1 #!/bin/sh
3 # Run this to generate configure and initial GNUmakefiles
5 # This file is part of LilyPond, the GNU music typesetter.
7 # Copyright (C) 2002--2023 Jan Nieuwenhuizen <janneke@gnu.org>,
8 # Han-Wen Nienhuys <hanwen@xs4all.nl>
10 # LilyPond is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
15 # LilyPond is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
23 srcdir=`dirname -- $0`
25 # Canonicalize paths.
26 srcdir=`cd "$srcdir"; pwd`
27 builddir=`pwd`
29 for arg; do
30 case $arg in
31 --ci)
32 CI=true
33 shift
36 --currdir)
37 CURRDIR=true
38 shift
41 --help)
42 exec echo "\
43 Usage: $0 [OPTION]... [CONFIGURE-OPTION]...
44 Generate LilyPond's 'configure' script, then execute it
45 with CONFIGURE-OPTION arguments.
47 --ci also set 'configure' flags for gitlab's CI
48 --currdir generate 'configure' script in current directory
49 instead of the location of 'autogen.sh'
50 --help display this help and exit
51 --noconfigure don't execute generated 'configure' script"
52 exit 0
55 --noconf*)
56 NOCONFIGURE=true
57 shift
61 break
63 esac
64 done
66 if test ! -w "$srcdir"; then
67 echo "Directory '$srcdir' is write-only, assuming option '--currdir'"
68 CURRDIR=true
71 if test -n "$CURRDIR" && test ! -w "$builddir"; then
72 echo >&2 "$0: Directory '$builddir' is write-only, can't proceed"
73 exit 1
76 parent=`dirname "$builddir"`
77 if test "$srcdir" = "$builddir"; then
78 prefix=.
79 elif test "$srcdir" = "$parent"; then
80 prefix=..
81 else
82 prefix="$srcdir"
85 if test -n "$CURRDIR"; then
86 configure=./configure
87 if test "$prefix" != . && test "$prefix" != ..; then
88 suffix=" --srcdir $srcdir"
91 echo "Running autoconf in '$builddir' ..."
92 SRCDIR="$srcdir" \
93 autoconf -I "$srcdir" -o configure "$srcdir/configure.ac" \
94 || exit 1
95 else
96 configure="$prefix/configure"
98 cd "$srcdir"
99 echo "Running autoconf in '$srcdir' ..."
100 autoconf || exit 1
104 if test -n "$NOCONFIGURE"; then
105 echo "You can now run '$configure$suffix [...]'"
106 exit 0
109 if test -n "$CI" ; then
110 conf_flags="$conf_flags --enable-checking"
111 conf_flags="$conf_flags --enable-gs-api"
112 conf_flags="$conf_flags --disable-debugging"
114 CFLAGS="$CFLAGS -Werror"
115 export CFLAGS
118 if test -z "${conf_flags}$*"; then
119 cat <<EOF
120 Warning: about to run the 'configure' script without arguments.
121 Add arguments to the '$0' command line
122 to pass them to 'configure'.
124 Invoke with '--noconfigure' to skip execution of 'configure'.
128 echo Running $configure$suffix $conf_flags "$@" ...
129 exec "$configure" $suffix $conf_flags "$@"