Add xterm-white.theme
[cmus.git] / configure
blob0c131c8cf4ac222f594531ac66c6f599b01073b0
1 #!/bin/sh
3 . scripts/configure.sh || exit 1
5 VERSION="2.0.2"
7 check_cflags()
9 check_cc_flag -std=gnu99 -pipe -Wall -Wshadow -Wcast-align -Wpointer-arith \
10 -Wwrite-strings -Wundef -Wmissing-prototypes -Wredundant-decls
12 for i in -Wdeclaration-after-statement -Wold-style-definition -Wno-pointer-sign
14 check_cc_flag $i
15 done
16 return 0
19 check_ncurses()
21 if check_library NCURSES "" -lncursesw
22 then
23 widechars=y
24 return 0
26 if check_library NCURSES "" -lncurses || check_library NCURSES "" -lcurses
27 then
28 widechars=n
29 msg_error "Your ncurses does not support wide characters!"
30 msg_error "Install ncursesw if you need wide character support,"
31 msg_error "you can ignore this warning otherwise."
32 return 0
34 return 1
37 check_mpc()
39 check_library MPC "" "-lmpcdec"
40 return $?
43 check_flac()
45 check_library FLAC "" "-lFLAC -lm"
46 return $?
49 check_mad()
51 pkg_config MAD "mad" "" "-lmad -lm"
52 return $?
55 check_modplug()
57 pkg_config MODPLUG "libmodplug" "-I/usr/include/libmodplug" "-lmodplug -lstdc++ -lm"
58 return $?
61 check_vorbis()
63 if test "$CONFIG_TREMOR" = y
64 then
65 pkg_config VORBIS "vobisidec" "" "-lvorbisidec -lm"
66 return $?
67 else
68 pkg_config VORBIS "vorbisfile" "" "-lvorbisfile -lvorbis -lm -logg"
69 return $?
73 check_alsa()
75 # the alsa.pc file should be always available
76 pkg_config ALSA "alsa"
77 return $?
80 check_ao()
82 pkg_config AO "ao" "" "-lao"
83 return $?
86 check_arts()
88 app_config ARTS artsc-config
89 return $?
92 check_oss()
94 case $(uname -s) in
95 Linux|FreeBSD)
97 *BSD)
98 check_library OSS "" "-lossaudio"
99 return $?
102 # unknown
104 esac
106 OSS_CFLAGS=""
107 OSS_LIBS=""
108 msg_checking "for header <sys/soundcard.h>"
109 if test -f /usr/include/sys/soundcard.h
110 then
111 msg_result "yes"
112 makefile_vars OSS_CFLAGS OSS_LIBS
113 return 0
114 else
115 msg_result "no"
117 return 1
120 check_sun()
122 msg_checking "for header <sys/audioio.h>"
123 if test -f /usr/include/sys/audioio.h
124 then
125 msg_result "yes"
126 return 0
127 else
128 msg_result "no"
129 return 1
133 # defaults
134 prefix=/usr/local
135 DEBUG=1
136 CONFIG_TREMOR=n
137 # unset CONFIG_* variables: if check succeeds 'y', otherwise 'n'
139 USAGE="
140 Options:
141 prefix Installation prefix [$prefix]
142 bindir User executables [\$prefix/bin]
143 datadir Read-only data [\$prefix/share]
144 libdir Libraries [\$prefix/lib]
145 mandir Man pages [\$datadir/man]
146 DEBUG Debugging level (0-2) [$DEBUG]
148 Optional Features: y/n
149 CONFIG_FLAC FLAC (Free Lossless Audio Codec) support [auto]
150 CONFIG_MAD MPEG Audio Decoder (libmad) support [auto]
151 CONFIG_MODPLUG libmodplug (mod, x3m, ...) support [auto]
152 CONFIG_MPC libmpcdec (Musepack .mpc) support [auto]
153 CONFIG_VORBIS Ogg/Vorbis support [auto]
154 CONFIG_TREMOR Use Tremor as Ogg/Vorbis input plugin [n]
155 CONFIG_WAV WAV support [y]
156 CONFIG_ALSA ALSA support [auto]
157 CONFIG_AO Libao cross-platform audio library [auto]
158 CONFIG_ARTS ARTS support [auto]
159 CONFIG_OSS Open Sound System support [auto]
160 CONFIG_SUN Sun Audio support [auto]
162 Also many standard variables like CC are recognized."
164 parse_command_line "$@"
166 case $DEBUG in
167 [0-2])
170 die "DEBUG must be 0-2"
172 esac
174 var_default bindir "${prefix}/bin"
175 var_default datadir "${prefix}/share"
176 var_default libdir "${prefix}/lib"
177 var_default mandir "${datadir}/man"
179 check check_cc
180 check check_cflags
181 check check_cc_depgen
182 check check_endianness
183 check check_dl
184 check check_pthread
185 check check_ncurses
186 check check_iconv
188 check check_flac CONFIG_FLAC
189 check check_mad CONFIG_MAD
190 check check_modplug CONFIG_MODPLUG
191 check check_mpc CONFIG_MPC
192 check check_vorbis CONFIG_VORBIS
193 # nothing to check, just validate the variable values
194 check true CONFIG_TREMOR
195 check true CONFIG_WAV
196 check check_alsa CONFIG_ALSA
197 check check_ao CONFIG_AO
198 check check_arts CONFIG_ARTS
199 check check_oss CONFIG_OSS
200 check check_sun CONFIG_SUN
202 test "$WORDS_BIGENDIAN" = y && CFLAGS="${CFLAGS} -DWORDS_BIGENDIAN"
204 DATADIR="$datadir"
205 LIBDIR="$libdir"
207 config_header config/version.h VERSION
208 config_header config/datadir.h DATADIR
209 config_header config/libdir.h LIBDIR
210 config_header config/debug.h DEBUG
211 config_header config/tremor.h CONFIG_TREMOR
213 makefile_vars VERSION bindir datadir libdir mandir
214 makefile_vars CONFIG_FLAC CONFIG_MAD CONFIG_MODPLUG CONFIG_MPC CONFIG_VORBIS CONFIG_WAV
215 makefile_vars CONFIG_ALSA CONFIG_AO CONFIG_ARTS CONFIG_OSS CONFIG_SUN
217 generate_config_mk