1 dnl Process this file with autoconf to produce a configure script. 2 AC_PREREQ(2.59) 3 AC_INIT(alsa-utils, 1.2.6) 4 AC_CONFIG_SRCDIR([aplay/aplay.c]) 5 AC_PREFIX_DEFAULT(/usr) 6 AM_INIT_AUTOMAKE 7 8 AM_MAINTAINER_MODE([enable]) 9 10 AM_GNU_GETTEXT([external]) 11 AM_GNU_GETTEXT_VERSION([0.19.8]) 12 13 dnl Checks for programs. 14 15 AC_PROG_CC 16 dnl AC_PROG_CXX 17 AC_PROG_INSTALL 18 AC_PROG_MKDIR_P 19 AC_PROG_LN_S 20 AC_PROG_SED 21 PKG_PROG_PKG_CONFIG 22 AM_PATH_ALSA(1.2.5) 23 if test "x$enable_alsatest" = "xyes"; then 24 AC_CHECK_FUNC([snd_ctl_elem_add_enumerated], 25 , [AC_ERROR([No user enum control support in alsa-lib])]) 26 fi 27 28 dnl Check components 29 AC_CHECK_HEADERS([alsa/pcm.h], [have_pcm="yes"], [have_pcm="no"], 30 [#include <alsa/asoundlib.h>]) 31 AC_CHECK_HEADERS([alsa/mixer.h], [have_mixer="yes"], [have_mixer="no"], 32 [#include <alsa/asoundlib.h>]) 33 AC_CHECK_HEADERS([alsa/rawmidi.h], [have_rawmidi="yes"], [have_rawmidi="no"], 34 [#include <alsa/asoundlib.h>]) 35 AC_CHECK_HEADERS([alsa/seq.h], [have_seq="yes"], [have_seq="no"], 36 [#include <alsa/asoundlib.h>]) 37 AC_CHECK_HEADERS([alsa/use-case.h], [have_ucm="yes"], [have_ucm="no"], 38 [#include <alsa/asoundlib.h>]) 39 AC_CHECK_HEADERS([alsa/topology.h], [have_topology="yes"], [have_topology="no"], 40 [#include <alsa/asoundlib.h>]) 41 AC_CHECK_HEADERS([samplerate.h], [have_samplerate="yes"], [have_samplerate="no"], 42 [#include <samplerate.h>]) 43 44 AC_CHECK_LIB([asound], [snd_seq_client_info_get_card], [HAVE_SEQ_CLIENT_INFO_GET_CARD="yes"]) 45 if test "$HAVE_SEQ_CLIENT_INFO_GET_CARD" = "yes" ; then 46 AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_CARD], 1, [alsa-lib supports snd_seq_client_info_get_card]) 47 fi 48 AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_PID="yes"]) 49 if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then 50 AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid]) 51 fi 52 AC_CHECK_LIB([atopology], [snd_tplg_save], [have_topology="yes"], [have_topology="no"]) 53 54 # 55 # NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances 56 # for some objects in startup/finish routines of C runtime. As a result, it 57 # outputs some superfluos messages. Furthermore, it brings much memory leak 58 # internally. Totally, libffado support is not recommended at all in usual 59 # purposes except for technical preview. 60 # 61 AC_CHECK_LIB([ffado], [ffado_streaming_init], [have_ffado="yes"], [have_ffado="no"]) 62 AS_IF([test x"$have_ffado" = xyes], 63 [AC_DEFINE([WITH_FFADO], [1], [Define if FFADO library is available])]) 64 65 # Test programs for axfer use shm by memfd_create(2). If not supported, open(2) is used alternatively. 66 AC_CHECK_FUNC([memfd_create], [have_memfd_create="yes"], [have_memfd_create="no"]) 67 AS_IF([test x$have_memfd_create = xyes], 68 [AC_DEFINE([HAVE_MEMFD_CREATE], [1], [Define if Linux kernel supports memfd_create system call])]) 69 70 AM_CONDITIONAL(HAVE_PCM, test "$have_pcm" = "yes") 71 AM_CONDITIONAL(HAVE_MIXER, test "$have_mixer" = "yes") 72 AM_CONDITIONAL(HAVE_RAWMIDI, test "$have_rawmidi" = "yes") 73 AM_CONDITIONAL(HAVE_SEQ, test "$have_seq" = "yes") 74 AM_CONDITIONAL(HAVE_UCM, test "$have_ucm" = "yes") 75 AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") 76 AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") 77 AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes") 78 79 dnl Use tinyalsa 80 alsabat_backend_tiny= 81 AC_ARG_ENABLE(alsabat_backend_tiny, 82 AS_HELP_STRING([--enable-alsabat-backend-tiny], [Use tinyalsa for alsabat backend]), 83 [case "${enableval}" in 84 yes) alsabat_backend_tiny=true ;; 85 no) alsabat_backend_tiny=false ;; 86 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsabat-backend-tiny) ;; 87 esac],[alsabat_backend_tiny=false]) 88 89 dnl Disable bat 90 bat= 91 if test "$have_pcm" = "yes"; then 92 AC_ARG_ENABLE(bat, 93 AS_HELP_STRING([--disable-bat], [Disable bat compilation]), 94 [case "${enableval}" in 95 yes) bat=true ;; 96 no) bat=false ;; 97 *) AC_MSG_ERROR(bad value ${enableval} for --enable-bat) ;; 98 esac],[bat=true]) 99 fi 100 AM_CONDITIONAL(BAT, test x$bat = xtrue) 101 102 if test x$bat = xtrue; then 103 104 saved_CFLAGS="$CFLAGS" 105 saved_LDFLAGS="$LDFLAGS" 106 saved_LIBS="$LIBS" 107 FFTW_INC="" 108 FFTW_LIB="" 109 FFTW_CFLAGS="" 110 dnl Check for libfftw3 111 have_libfftw3="yes" 112 AC_CHECK_LIB([fftw3f], [fftwf_malloc], , [have_libfftw3="no"]) 113 dnl Check for libtinyalsa 114 have_libtinyalsa= 115 if test x$alsabat_backend_tiny = xtrue; then 116 have_libtinyalsa="yes" 117 AC_CHECK_LIB([tinyalsa], [pcm_open], , [have_libtinyalsa="no"]) 118 fi 119 AC_CHECK_LIB([m], [sqrtf], , [AC_MSG_ERROR([Error: Need sqrtf])]) 120 AC_CHECK_LIB([pthread], [pthread_create], , [AC_MSG_ERROR([Error: need PTHREAD library])]) 121 FFTW_CFLAGS="$CFLAGS" 122 FFTW_LIB="$LIBS" 123 CFLAGS="$saved_CFLAGS" 124 LDFLAGS="$saved_LDFLAGS" 125 LIBS="$saved_LIBS" 126 AC_SUBST(FFTW_INC) 127 AC_SUBST(FFTW_LIB) 128 AC_SUBST(FFTW_CFLAGS) 129 130 fi 131 AM_CONDITIONAL(HAVE_LIBFFTW3, test "$have_libfftw3" = "yes") 132 AM_CONDITIONAL(HAVE_LIBTINYALSA, test "$have_libtinyalsa" = "yes") 133 134 dnl Check for librt 135 LIBRT="" 136 AC_MSG_CHECKING(for librt) 137 AC_ARG_WITH(librt, 138 AS_HELP_STRING([--with-librt], [Use librt for monotonic clock (default = yes)]), 139 [ have_librt="$withval" ], [ have_librt="yes" ]) 140 if test "$have_librt" = "yes"; then 141 AC_CHECK_LIB([rt], [clock_gettime], [HAVE_LIBRT="yes"]) 142 if test "$HAVE_LIBRT" = "yes" ; then 143 LIBRT="-lrt" 144 AC_DEFINE([HAVE_LIBRT], 1, [Have librt]) 145 AC_DEFINE([HAVE_CLOCK_GETTIME], 1, [Have clock gettime]) 146 fi 147 else 148 AC_MSG_RESULT(no) 149 fi 150 151 dnl Disable alsamixer 152 CURSESINC="" 153 CURSESLIB="" 154 CURSES_CFLAGS="" 155 alsamixer= 156 if test "$have_mixer" = "yes"; then 157 AC_ARG_ENABLE(alsamixer, 158 AS_HELP_STRING([--disable-alsamixer], [Disable alsamixer compilation]), 159 [case "${enableval}" in 160 yes) alsamixer=true ;; 161 no) alsamixer=false ;; 162 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsamixer) ;; 163 esac],[alsamixer=true]) 164 fi 165 AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue) 166 167 dnl Disable alsaconf 168 AC_ARG_ENABLE(alsaconf, 169 AS_HELP_STRING([--disable-alsaconf], [Disable alsaconf packaging]), 170 [case "${enableval}" in 171 yes) alsaconf=true ;; 172 no) alsaconf=false ;; 173 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;; 174 esac],[alsaconf=true]) 175 AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue) 176 177 dnl Disable alsaloop 178 AC_ARG_ENABLE(alsaloop, 179 AS_HELP_STRING([--disable-alsaloop], [Disable alsaloop packaging]), 180 [case "${enableval}" in 181 yes) alsaloop=true ;; 182 no) alsaloop=false ;; 183 *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaloop) ;; 184 esac],[alsaloop=true]) 185 AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue) 186 187 xmlto_available="" 188 AC_ARG_ENABLE(xmlto, 189 AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]), 190 xmlto="$enableval", xmlto="yes") 191 if test "$xmlto" = "yes"; then 192 AC_CHECK_PROG([xmlto_available], [xmlto], [yes]) 193 fi 194 AM_CONDITIONAL(USE_XMLTO, test x"$xmlto_available" = xyes) 195 196 rst2man_available="" 197 AC_ARG_ENABLE(rst2man, 198 AS_HELP_STRING([--disable-rst2man], [Disable man page creation via rst2man]), 199 rst2man="$enableval", rst2man="yes") 200 if test "$rst2man" = "yes"; then 201 AC_CHECK_PROG([rst2man_available], [rst2man], [yes]) 202 fi 203 AM_CONDITIONAL(USE_RST2MAN, test x"$rst2man_available" = xyes) 204 205 AC_ARG_WITH( 206 [udev-rules-dir], 207 AS_HELP_STRING([--with-udev-rules-dir=DIR],[Directory where to install udev rules to (default=auto)]), 208 [udevrulesdir="$withval"], 209 [udevdir=$($PKG_CONFIG udev --variable=udevdir) 210 if test "x$udevdir" = "x"; then 211 udevrulesdir="/lib/udev/rules.d" 212 else 213 udevrulesdir="$udevdir/rules.d" 214 fi]) 215 AC_SUBST(udevrulesdir) 216 217 dnl Checks for header files. 218 AC_HEADER_STDC 219 if test x$alsamixer = xtrue; then 220 AC_ARG_WITH(curses, 221 AS_HELP_STRING([--with-curses=libname], [Specify the curses library to use (default=auto)]), 222 curseslib="$withval", 223 curseslib="auto") 224 CURSESLIBDIR="" 225 NCURSESLIBSUFFIX="" 226 CURSES_NLS="no" 227 if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then 228 dnl First try out pkg-config, then fall back to old config scripts. 229 PKG_CHECK_MODULES([NCURSESW], [ncursesw], [ 230 CURSESINC="<ncurses.h>" 231 CURSESLIB="${NCURSESW_LIBS}" 232 CURSESLIBDIR= 233 CURSES_CFLAGS="${NCURSESW_CFLAGS}" 234 curseslib="ncursesw" 235 ], [ 236 AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes]) 237 if test "$ncursesw5_config" = "yes"; then 238 CURSESINC="<ncurses.h>" 239 CURSESLIB=`ncursesw5-config --libs` 240 CURSESLIBDIR=`ncursesw5-config --libdir` 241 CURSES_CFLAGS=`ncursesw5-config --cflags` 242 curseslib="ncursesw" 243 else 244 AC_CHECK_LIB(ncursesw, initscr, 245 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"]) 246 fi 247 ]) 248 if test -n "$CURSESINC"; then 249 NCURSESLIBSUFFIX="w" 250 CURSES_NLS="yes" 251 fi 252 fi 253 if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then 254 dnl First try out pkg-config, then fall back to old config scripts. 255 PKG_CHECK_MODULES([NCURSES], [ncurses], [ 256 CURSESINC="<ncurses.h>" 257 CURSESLIB="${NCURSES_LIBS}" 258 CURSESLIBDIR= 259 CURSES_CFLAGS="${NCURSES_CFLAGS}" 260 curseslib="ncurses" 261 ], [ 262 AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes]) 263 if test "$ncurses5_config" = "yes"; then 264 CURSESINC="<ncurses.h>" 265 CURSESLIB=`ncurses5-config --libs` 266 CURSESLIBDIR=`ncurses5-config --libdir` 267 CURSES_CFLAGS=`ncurses5-config --cflags` 268 curseslib="ncurses" 269 else 270 AC_CHECK_LIB(ncurses, initscr, 271 [ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"]) 272 fi 273 ]) 274 fi 275 if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then 276 AC_CHECK_LIB(curses, initscr, 277 [ CURSESINC='<curses.h>'; CURSESLIB='-lcurses'; curseslib="curses"]) 278 fi 279 if test -z "$CURSESINC"; then 280 AC_MSG_ERROR(this packages requires a curses library) 281 fi 282 283 AC_MSG_CHECKING([for curses library]) 284 AC_MSG_RESULT([$curseslib]) 285 AC_MSG_CHECKING([for curses header name]) 286 AC_MSG_RESULT([$CURSESINC]) 287 AC_MSG_CHECKING([for curses compiler flags]) 288 AC_MSG_RESULT([$CURSES_CFLAGS]) 289 290 dnl CURSESLIBS might have the library path at the beginning. If so, we cut it 291 dnl off so that we can insert the other curses libraries before the ncurses 292 dnl library but after the library path (which is later again prepended below). 293 if test -n "$CURSESLIBDIR"; then 294 if test "-L$CURSESLIBDIR " = "$(echo $CURSESLIB | cut -c-$((${#CURSESLIBDIR}+3)) )"; then 295 CURSESLIB="$(echo $CURSESLIB | cut -c$((${#CURSESLIBDIR}+4))-)" 296 fi 297 fi 298 299 saved_CFLAGS="$CFLAGS" 300 saved_LDFLAGS="$LDFLAGS" 301 saved_LIBS="$LIBS" 302 CFLAGS="$CFLAGS $CURSES_CFLAGS" 303 if test -n "$CURSESLIBDIR"; then 304 LDFLAGS="$LDFLAGS -L$CURSESLIBDIR" 305 fi 306 LIBS="$CURSESLIB $LIBS" 307 308 AC_TRY_LINK([#include <panel.h>], [set_escdelay(100);],[HAVE_CURSES_ESCDELAY="yes"]) 309 if test "$HAVE_CURSES_ESCDELAY" = "yes"; then 310 AC_DEFINE([HAVE_CURSES_ESCDELAY], 1, [Have curses set_escdelay]) 311 fi 312 313 if test "$USE_NLS" = "yes"; then 314 AC_MSG_CHECKING([for curses NLS support]) 315 dnl In theory, a single-byte curses works just fine in ISO 8859-* locales. 316 dnl In practice, however, everybody uses UTF-8 nowadays, so we'd better 317 dnl check for wide-character support. 318 dnl For ncurses/ncursesw, CURSES_NLS was already set above. 319 if test "$curseslib" = "curses"; then 320 AC_TRY_LINK([ 321 #define _XOPEN_SOURCE 1 322 #define _XOPEN_SOURCE_EXTENDED 1 323 #include <curses.h> 324 ], [ 325 cchar_t wc; 326 setcchar(&wc, L"x", A_NORMAL, 0, 0); 327 ], 328 [CURSES_NLS="yes"]) 329 fi 330 AC_MSG_RESULT([$CURSES_NLS]) 331 if test "$CURSES_NLS" = "yes"; then 332 AC_DEFINE([ENABLE_NLS_IN_CURSES], [1], 333 [Define if curses-based programs can show translated messages.]) 334 fi 335 fi 336 337 AC_CHECK_HEADERS([panel.h menu.h form.h], [], 338 [AC_MSG_ERROR([required curses helper header not found])]) 339 AC_CHECK_LIB([panel$NCURSESLIBSUFFIX], [new_panel], 340 [CURSESLIB="-lpanel$NCURSESLIBSUFFIX $CURSESLIB"], 341 [AC_MSG_ERROR([panel$NCURSESLIBSUFFIX library not found])]) 342 AC_CHECK_LIB([menu$NCURSESLIBSUFFIX], [new_menu], 343 [CURSESLIB="-lmenu$NCURSESLIBSUFFIX $CURSESLIB"], 344 [AC_MSG_ERROR([menu$NCURSESLIBSUFFIX library not found])]) 345 AC_CHECK_LIB([form$NCURSESLIBSUFFIX], [new_form], 346 [CURSESLIB="-lform$NCURSESLIBSUFFIX $CURSESLIB"], 347 [AC_MSG_ERROR([form$NCURSESLIBSUFFIX library not found])]) 348 349 CFLAGS="$saved_CFLAGS" 350 LDFLAGS="$saved_LDFLAGS" 351 LIBS="$saved_LIBS" 352 353 if test -n "$CURSESLIBDIR"; then 354 CURSESLIB="-L$CURSESLIBDIR $CURSESLIB" 355 fi 356 357 AC_MSG_CHECKING([for curses linker flags]) 358 AC_MSG_RESULT([$CURSESLIB]) 359 fi 360 361 AC_SUBST(CURSESINC) 362 AC_SUBST(CURSESLIB) 363 AC_SUBST(CURSES_CFLAGS) 364 365 test "x$prefix" = xNONE && prefix=$ac_default_prefix 366 367 eval dir="$datadir" 368 case "$dir" in 369 /*) ;; 370 *) dir="$prefix/share" 371 esac 372 373 soundsdir="$dir/sounds/alsa" 374 AC_DEFINE_UNQUOTED(SOUNDSDIR, "$soundsdir", [directory containing sample data]) 375 376 mydatadir="$dir/alsa" 377 AC_DEFINE_UNQUOTED(DATADIR, "$mydatadir", [directory containing alsa configuration]) 378 AC_SUBST(mydatadir) 379 380 AC_ARG_WITH(testsound, 381 AS_HELP_STRING([--with-testsound=file], [give the path of test sound file for alsaconf]), 382 TESTSOUND="$withval", 383 TESTSOUND="$dir/test.wav") 384 AC_SUBST(TESTSOUND) 385 386 AC_CONFIG_HEADERS(include/aconfig.h) 387 388 dnl Checks for typedefs, structures, and compiler characteristics. 389 AC_C_CONST 390 AC_C_INLINE 391 AC_HEADER_TIME 392 393 dnl Checks for library functions. 394 AC_PROG_GCC_TRADITIONAL 395 396 dnl Enable largefile support 397 AC_SYS_LARGEFILE 398 399 SAVE_UTIL_VERSION 400 401 AC_SUBST(LIBRT) 402 403 dnl Check for systemd 404 PKG_CHECK_MODULES(SYSTEMD, [systemd >= 18], 405 [have_min_systemd="yes"], 406 [have_min_systemd="no"]) 407 AC_ARG_WITH([systemdsystemunitdir], 408 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), 409 [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) 410 if test "x$with_systemdsystemunitdir" != xno; then 411 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) 412 fi 413 AM_CONDITIONAL(HAVE_SYSTEMD, [test "$have_min_systemd" = "yes" \ 414 -a -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) 415 416 AC_ARG_WITH([asound-state-dir], 417 AS_HELP_STRING([--with-asound-state-dir=DIR], [Directory to place asound.state file in]), 418 [ASOUND_STATE_DIR="$withval"], 419 [ASOUND_STATE_DIR="/var/lib/alsa"]) 420 AC_SUBST(ASOUND_STATE_DIR) 421 422 AC_ARG_WITH([alsactl-lock-dir], 423 AS_HELP_STRING([--with-alsactl-lock-dir=DIR], [Directory to place lock files in]), 424 [ASOUND_LOCK_DIR="$withval"], 425 [ASOUND_LOCK_DIR="/var/lock"]) 426 AC_SUBST(ASOUND_LOCK_DIR) 427 428 AC_ARG_WITH([alsactl-pidfile-dir], 429 AS_HELP_STRING([--with-alsactl-pidfile-dir=DIR], [Directory to place alsactl.pid file in]), 430 [ALSACTL_PIDFILE_DIR="$withval"], 431 [ALSACTL_PIDFILE_DIR="/var/run"]) 432 AC_SUBST(ALSACTL_PIDFILE_DIR) 433 434 AC_ARG_WITH([alsactl-daemonswitch], 435 AS_HELP_STRING([--with-alsactl-daemonswitch=FILE], [File to test for the daemon mode]), 436 [ALSACTL_DAEMONSWITCH="$withval"], 437 [ALSACTL_DAEMONSWITCH="/etc/alsa/state-daemon.conf"]) 438 AC_SUBST(ALSACTL_DAEMONSWITCH) 439 440 AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ 441 alsamixer/Makefile amidi/Makefile amixer/Makefile \ 442 m4/Makefile po/Makefile.in \ 443 alsaconf/alsaconf alsaconf/Makefile \ 444 alsaconf/po/Makefile \ 445 alsaucm/Makefile topology/Makefile \ 446 bat/Makefile bat/tests/Makefile bat/tests/asound_state/Makefile \ 447 aplay/Makefile include/Makefile iecset/Makefile utils/Makefile \ 448 utils/alsa-utils.spec seq/Makefile seq/aconnect/Makefile \ 449 seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \ 450 speaker-test/Makefile speaker-test/samples/Makefile \ 451 alsaloop/Makefile alsa-info/Makefile \ 452 axfer/Makefile axfer/test/Makefile) 453