dnl ----------------------------------------------------------------------- dnl configure.in for xmp dnl dnl Process this file with autoconf to produce a configure script. dnl $Id: configure.in,v 1.9 2001/01/20 01:06:28 claudio Exp $ dnl ----------------------------------------------------------------------- AC_INIT(src/include/xmp.h) AC_CONFIG_HEADER(src/include/config.h) AC_CONFIG_AUX_DIR(./scripts) AC_CANONICAL_HOST AC_SUBST(CINCS) CINCS="${CPPFLAGS}" AC_SUBST(PLUGIN) PLUGIN="" AC_SUBST(LDFLAGS) LDFLAGS="" AC_SUBST(X_XMP) X_XMP="xxmp" AC_SUBST(DRIVERS) DRIVERS="" AC_SUBST(DYNDRV) DYNDRV="" AC_SUBST(MIXER) MIXER="mix_all.o" dnl ----------------------------------------------------------------------- dnl Config arguments dnl ----------------------------------------------------------------------- AC_ARG_ENABLE(dynamic, [ --enable-dynamic Build drivers as dynamic modules]) AC_ARG_ENABLE(oss, [ --disable-oss Don't compile OSS support]) AC_ARG_ENABLE(alsa, [ --disable-alsa Don't compile ALSA support]) AC_ARG_ENABLE(xmms, [ --disable-xmms Don't build the XMMS plugin]) AC_ARG_ENABLE(esd, [ --disable-esd Don't compile ESD support]) AC_ARG_WITH(oss, [ --with-oss= OSS prefix (optional)], oss_path="$withval", oss_path="/usr/lib/oss") AC_ARG_WITH(xmms, [ --with-xmms= XMMS prefix (optional)], xmms_path="$withval", xmms_path="/usr") dnl ----------------------------------------------------------------------- dnl Check for programs. dnl ----------------------------------------------------------------------- if test "${target}" = NONE; then target=${host} target_cpu=${host_cpu} target_verndor=${host_vendor} target_os=${host_os} fi AC_SUBST(PLATFORM) PLATFORM="${target}" AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB AC_HEADER_STDC dnl XMP_CACHED_TEST(,,,,) define(XMP_CACHED_TEST,[ AC_CACHE_CHECK([$1],[$2],[ if test [$3]; then $2=yes else $2=no fi]) if test "x$$2" = xyes; then true $4 else true $5 fi]) dnl ----------------------------------------------------------------------- dnl Check for OSS dnl ----------------------------------------------------------------------- XMP_CACHED_TEST(for ${oss_path},ac_cv_dir_usr_lib_oss,-d /usr/lib/oss, CINCS="${CINCS} -I/usr/lib/oss/include", XMP_CACHED_TEST(for /usr/src/sys/i386/isa/sound, ac_cv_dir_usr_src_sys_i386_isa_sound, -d /usr/src/sys/i386/isa/sound, CINCS="${CINCS} -I/usr/src/sys/i386/isa/sound",)) dnl ----------------------------------------------------------------------- dnl Check for XMMS dnl ----------------------------------------------------------------------- if test "${enable_xmms}" != "no"; then xmms_cflags="`xmms-config --cflags`" if test ! -z "${xmms_cflags}"; then AC_CHECKING([for XMMS flags... ${xmms_cflags}]) else AC_MSG_WARN(xmms-config not found) enable_xmms="no" fi fi if test "${enable_xmms}" != "no"; then CPPFLAGS="${CINCS} `xmms-config --cflags`" AC_CHECK_HEADERS(xmms/plugin.h) fi if test "${ac_cv_header_xmms_plugin_h}" = "yes"; then PLUGIN="xmms" fi dnl ----------------------------------------------------------------------- dnl Check for header files dnl ----------------------------------------------------------------------- CPPFLAGS="${CINCS}" AC_CHECK_HEADERS(strings.h getopt.h sys/select.h sys/param.h \ sys/soundcard.h machine/soundcard.h \ sys/ultrasound.h linux/ultrasound.h machine/ultrasound.h \ awe_voice.h sys/awe_voice.h linux/awe_voice.h \ sys/asoundlib.h) dnl ----------------------------------------------------------------------- dnl Check OS/architecture independent drivers dnl ----------------------------------------------------------------------- if test "${enable_dynamic}" = yes; then AC_CHECK_LIB(dl, dlopen) AC_DEFINE(DYNAMIC_DRV) LDFLAGS="${LDFLAGS} -rdynamic" DYNDRV="dyndrv" fi if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \ test "${ac_cv_header_machine_soundcard_h}" = "yes"; then if test "${enable_oss}" != "no"; then DRIVERS="${DRIVERS} oss_seq.o oss_mix.o" AC_DEFINE(DRIVER_OSS_SEQ) AC_DEFINE(DRIVER_OSS_MIX) fi fi if test "${ac_cv_header_sys_asoundlib_h}" = "yes"; then AC_CHECK_LIB(asound, snd_ctl_open, [ if test "${enable_alsa}" != "no"; then LIBS="${LIBS} -lasound" DRIVERS="${DRIVERS} alsa_mix.o" AC_DEFINE(DRIVER_ALSA_MIX) fi]) fi if test "$enable_esd" = yes; then AC_CHECK_LIB(esd, esd_play_stream) if test "${enable_dynamic}" != "yes"; then LIBS="${LIBS} ${LDFLAGS} -lesd" fi DRIVERS="${DRIVERS} esd.o" AC_DEFINE(DRIVER_ESD) fi dnl ----------------------------------------------------------------------- dnl OS/Architecture dependent options dnl ----------------------------------------------------------------------- dnl case ${target_cpu} in dnl i386|i486|i586|i686) dnl MIXER="mix_i386.o" dnl ;; dnl esac case ${target_os} in dnl dnl Tests for non-OSS Linux dnl linux*) case ${target_cpu} in dnl dnl S/Linux dnl sparc) CINCS="${CINCS} -I/usr/src/linux/drivers" CPPFLAGS="${CINCS}" AC_CHECK_HEADERS(sbus/audio/audio.h) if test "${ac_cv_header_sbus_audio_audio_h}" = "yes"; then DRIVERS="${DRIVERS} solaris.o" AC_DEFINE(DRIVER_SOLARIS) fi ;; dnl dnl Linux/Alpha dnl alpha) ;; esac ;; dnl dnl Test for HP-UX dnl hpux*) AC_CHECK_HEADERS(sys/audio.h) if test "${ac_cv_header_sys_audio_h}" = "yes"; then DRIVERS="${DRIVERS} hpux.o" AC_DEFINE(DRIVER_HPUX) fi ;; dnl dnl Test for Solaris dnl solaris*) AC_CHECK_HEADERS(sys/audioio.h sys/audio.io.h sun/audioio.h) if test "${ac_cv_header_sys_audioio_h}" = "yes" || \ test "${ac_cv_header_sys_audio_io_h}" = "yes" || \ test "${ac_cv_header_sun_audioio_h}" = "yes"; then DRIVERS="${DRIVERS} solaris.o" AC_DEFINE(DRIVER_SOLARIS) fi ;; dnl dnl Test for SGI dnl irix*) AC_CHECK_HEADERS(dmedia/audio.h) if test "${ac_cv_header_dmedia_audio_h}" = "yes"; then DRIVERS="${DRIVERS} sgi.o" LIBS="${LIBS} -laudio" AC_DEFINE(DRIVER_SGI) fi ;; dnl dnl Test for AIX dnl irix*) AC_CHECK_HEADERS(audio.h) if test "${ac_cv_header_audio_h}" = "yes"; then DRIVERS="${DRIVERS} aix.o" AC_DEFINE(DRIVER_AIX) fi ;; dnl dnl Test for FreeBSD dnl freebsd*) AC_CHECK_HEADERS(sys/resource.h sys/rtprio.h) ;; dnl dnl Test for NetBSD dnl netbsd*) AC_CHECK_HEADERS(sys/audioio.h) if test "${ac_cv_header_sys_audioio_h}" = "yes"; then DRIVERS="${DRIVERS} netbsd.o" AC_DEFINE(DRIVER_NETBSD) fi ;; dnl dnl Test for OpenBSD dnl fixed by Chris Cox dnl openbsd*) AC_CHECK_HEADERS(sys/audio.h sys/audioio.h) if test "${ac_cv_header_sys_audio_h}" = "yes"; then DRIVERS="${DRIVERS} openbsd.o" AC_DEFINE(DRIVER_OPENBSD) elif test "${ac_cv_header_sys_audioio_h}" = "yes"; then DRIVERS="${DRIVERS} openbsd.o" AC_DEFINE(DRIVER_OPENBSD) fi ;; esac dnl ----------------------------------------------------------------------- dnl Checks for typedefs, structures, and compiler characteristics. dnl ----------------------------------------------------------------------- dnl XMP_CACHED_TRY_COMPILE(,,,,,) define(XMP_CACHED_TRY_COMPILE,[ AC_CACHE_CHECK([$1],[$2],[AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])]) if test "x$$2" = xyes; then true $5 else true $6 fi]) dnl XMP_CACHED_TRY_RUN(,,,,,) define(XMP_CACHED_TRY_RUN,[ if test "${cross_compiling}" = no; then AC_CACHE_CHECK([$1],[$2],[ oldcflags="${CFLAGS}" CFLAGS="${CFLAGS} $3" AC_TRY_RUN($4,[$2=yes],[$2=no]) CFLAGS="${oldcflags}"]) if test "x$$2" = xyes; then CFLAGS="${CFLAGS} $3" $5 else true $6 fi else echo "not checking $1 (cross-compiling)" fi]) AC_C_BIGENDIAN if test "${GCC-no}" = yes; then CFLAGS="${CFLAGS} -Wall -Wno-implicit-int -finline-functions" XMP_CACHED_TRY_RUN(whether gcc needs -fsigned-char, ac_cv_c_flag_f_signed_char,,[ main(){char foo=0xff;return(foo<0);}], CFLAGS="${CFLAGS} -fsigned-char") fi for sound_hdr in sys/soundcard.h machine/soundcard.h; do sound_safe=`echo "$sound_hdr" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$ac_cv_header_'$sound_safe`\" = yes"; then XMP_CACHED_TRY_COMPILE(whether $sound_hdr knows about audio_buf_info, ac_cv_audio_buf_info,[ #include <$sound_hdr>], audio_buf_info info;, AC_DEFINE(HAVE_AUDIO_BUF_INFO),) fi done for sound_hdr in awe_voice.h sys/awe_voice.h linux/awe_voice.h; do sound_safe=`echo "$sound_hdr" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$ac_cv_header_'$sound_safe`\" = yes"; then XMP_CACHED_TRY_COMPILE(whether $sound_hdr knows about AWE_MD_NEW_VOLUME_CALC, ac_cv_awe_md_new_volume_calc,[ #include <$sound_hdr>], int foo=AWE_MD_NEW_VOLUME_CALC;, AC_DEFINE(HAVE_AWE_MD_NEW_VOLUME_CALC),) fi done if test "${GCC-no}" = yes; then XMP_CACHED_TRY_COMPILE(whether gcc understands __attribute__((packed)), ac_cv_c_attribute_packed, ,struct foo{int bar;}__attribute__((packed));, AC_DEFINE(HAVE_ATTRIBUTE_PACKED) PACKED=yes,PACKED=no) else dnl These two are for the XL C compiler XMP_CACHED_TRY_RUN(whether the compiler needs -qalign=packed, ac_cv_c_flag_q_align_packed,-qalign=packed,[ struct foobar{char foo;int bar;}; main(){return(sizeof(struct foobar)-5);}], PACKED=yes,PACKED=no) XMP_CACHED_TRY_RUN(whether the compiler needs -qchars=signed, ac_cv_c_flag_q_chars_signed,,[ main(){char foo=0xff;return(foo<0);}], CFLAGS="${CFLAGS} -qchars=signed") fi if test "${PACKED}" = no; then AC_MSG_ERROR(Don't know how to use packed data structures!) fi dnl ----------------------------------------------------------------------- dnl Checks for library functions. dnl ----------------------------------------------------------------------- AC_PROG_GCC_TRADITIONAL AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS(select getopt_long snprintf) AC_PATH_XTRA if test "$no_x" = yes; then X_XMP="" fi AC_OUTPUT(Makefile.rules)