tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

configure.ac (14950B)


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