Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[da7ef8]: configure.in Maximize Restore History

Download this file

configure.in    1400 lines (1231 with data), 36.0 kB

dnl $Id: configure.in,v 5.174 2007/01/07 12:42:49 lirc Exp $

dnl Process this file with autoconf to produce a configure script.
dnl configure.in, (c)1999 Tom Wheeley <tw104@york.ac.uk>

AC_INIT(daemons/lircd.c)

if test "$#" = "0"; then
  if ! ./setup.sh; then
    echo "Please read the documentation!!!"
    exit 1
  fi
  trap - EXIT
  exit 0
fi

AM_INIT_AUTOMAKE(lirc, 0.8.1)
AM_CONFIG_HEADER(config.h)

CFLAGS="${CFLAGS--O2 -g -Wall}"

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PATH_PROG(mknod, mknod, /bin/mknod)
AC_PATH_PROG(mkfifo, mkfifo, /usr/bin/mkfifo)
AC_PATH_PROG(depmod, depmod, /sbin/depmod, $PATH:/sbin)
AC_PATH_PROG(LIBUSB_CONFIG, libusb-config)
AC_PROG_LN_S
AM_PROG_LIBTOOL

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h syslog.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname gettimeofday mkfifo select socket strdup \
	strerror strtoul snprintf strsep vsyslog)

daemon=""
AC_CHECK_FUNCS(daemon)
if test "$ac_cv_func_daemon" != yes; then
  AC_CHECK_LIB(bsd,daemon,daemon="-lbsd")
  if test "$daemon" = ""; then
    AC_MSG_ERROR([*** daemon() function not available on this system])
  fi
fi

forkpty=""
AC_CHECK_FUNCS(forkpty)
if test "$ac_cv_func_forkpty" != yes; then
  AC_CHECK_LIB(util,forkpty,[
    forkpty="-lutil"
    AC_DEFINE(HAVE_FORKPTY)])
fi

vga_progs=
AC_CHECK_HEADER(vga.h,
  [AC_CHECK_HEADER(vgagl.h,
    [AC_CHECK_LIB(vga, vga_init,
      [AC_CHECK_LIB(vgagl, gl_setcontextvga,
        [AC_DEFINE(HAVE_LIBVGA)]
        vga_progs=smode2,,
        -lvga
      )]
    )]
  )]
)
x_progs="irxevent xmode2"
AC_PATH_XTRA
if test "$no_x" = "yes"; then
  x_progs=
fi

dnl getopt_long support
AC_CHECK_FUNCS(getopt_long,,
  [AC_CHECK_LIB(gnugetopt,getopt_long,LDFLAGS="${LDFLAGS} -lgnugetopt",
    [AC_MSG_ERROR([*** your libc doesn't provide the getopt_long function.
Therfore you need to have \"libgnugetopt\" installed to compile LIRC.
You can get a version from:
  http://www.inf.ethz.ch/~mringwal/downloads/libgnugetopt-1.2.tar.gz
Extract the package and do a \"./configure  && make && sudo make install\"
in its directory.
])]
  )]
)
	

dnl Determine default configuration based on OS
case "${host_os}" in
  darwin*)
    dnl Mac OS X configuration

    dnl PortAudio for mac os x
    portaudio_lib_other="-framework CoreAudio -framework AudioToolbox"

    dnl default devdir, on mac os x/darwin, /dev/ can not be used without kernel programming, so use a fifo somewhere else
    devdir_default="/usr/lirc/dev/"
    use_fifos="yes"
    ;;
  *)
    dnl Unix OSS configuration

    dnl PortAudio for UNIX OSS
    portaudio_lib_other="-lm -lpthread ${forkpty}"

    dnl default devdir
    devdir_default="/dev"
    use_fifos="no"
    ;;
esac

# use fifo instead of devnode (required on mac os x)
AM_CONDITIONAL(USE_FIFOS, test "$use_fifos" = "yes")


dnl look for Linux kernel source

AC_PATH_KERNEL_SOURCE

dnl here we see what drivers we could possibly even hope to run.
dnl this could be _much_ more sophisticated!  especially the lirc ones.

AC_MSG_CHECKING([for which drivers can be installed on this system])
AC_MSG_RESULT()

possible_drivers="(none) \
	(userspace)
	(bte) \
	(bw6130) \
	(creative) \
	(dvico) \
	(ea65) \
	(exaudio) \
	(irreal) \
	(livedrive_midi) \
	(livedrive_seq) \
	(logitech) \
	(mediafocusI) \
	(mouseremote) \
	(mouseremote_ps2) \
	(mp3anywhere) \
	(pcmak) \
	(pcmak_usb) \
	(pctv) \
	(remotemaster) \
	(silitek) \
	(slinke) \
	(tira) \
	(uirt2) \
	(uirt2_raw) \
	(usb_uirt_raw) \
	(udp)"

if test x${no_kernel} != xyes; then
  possible_drivers="${possible_drivers} \
	(all) \
	(lirc_dev) \
	(lirc_dev lirc_atiusb) \
	(lirc_dev lirc_bt829) \
	(lirc_dev lirc_cmdir) \
	(lirc_dev lirc_gpio) \
	(lirc_dev lirc_i2c) \
	(lirc_dev lirc_igorplugusb) \
	(lirc_dev lirc_imon) \
	(lirc_dev lirc_it87) \
	(lirc_dev lirc_mceusb) \
	(lirc_dev lirc_mceusb2) \
	(lirc_dev lirc_parallel) \
	(lirc_dev lirc_sasem) \
	(lirc_dev lirc_serial) \
	(lirc_dev lirc_sir) \
	(lirc_dev lirc_streamzap)"
fi

if test -n "${LIBUSB_CONFIG}"; then
  AC_DEFINE(HAVE_LIBUSB)
  possible_drivers="${possible_drivers} (atilibusb)"
fi
AC_CHECK_LIB(caraca_client, caraca_init,
  AC_DEFINE(HAVE_LIBCARACA)
  possible_drivers="${possible_drivers} (caraca)"
)
AC_CHECK_HEADER(iguanaIR.h,
  AC_DEFINE(HAVE_IGUANAIR)
  possible_drivers="${possible_drivers} (iguanaIR)"
)
AC_CHECK_LIB(irman, ir_strerror,
  AC_DEFINE(HAVE_LIBIRMAN)
  possible_drivers="${possible_drivers} (irman)"
)
AC_CHECK_LIB(irman_sw, ir_strerror,
  AC_DEFINE(HAVE_LIBIRMAN_SW)
  possible_drivers="${possible_drivers} (irman_sw)"
)
dnl audio driver requires PortAudio library installed and some linker flags
AC_CHECK_HEADERS(portaudio.h,[
  AC_CHECK_LIB(portaudio, Pa_Initialize,[
    AC_DEFINE(HAVE_LIBPORTAUDIO)
    possible_drivers="${possible_drivers} (audio)"
    ],,${portaudio_lib_other}
  )]
)
dnl audio_alsa driver requires ALSA library installed and some linker flags
have_alsa=no
AC_CHECK_HEADERS(alsa/asoundlib.h,[
  AC_CHECK_LIB(asound, snd_pcm_open,[
    AC_DEFINE(HAVE_LIBALSA)
    have_alsa=yes
    possible_drivers="${possible_drivers} (audio_alsa)"
    ],,
  )]
)
dnl alsa_usb driver requires an ALSA that knows about our hwdep device
if test "$have_alsa" = "yes"; then
  AC_MSG_CHECKING(for ALSA SB RC hwdep support)
  AC_TRY_COMPILE([
#include <alsa/asoundlib.h>
],[
  if (snd_hwdep_info_get_iface(NULL) == SND_HWDEP_IFACE_SB_RC) {}
],[
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_ALSA_SB_RC)
    possible_drivers="${possible_drivers} (alsa_usb)"
    ],[
    AC_MSG_RESULT(no)]
  )
fi
dnl creative_infracd driver requires linux scsi api
AC_CHECK_HEADERS(scsi/sg.h,[
  AC_DEFINE(HAVE_SCSI)
  possible_drivers="${possible_drivers} (creative_infracd)"
  ]
)
dnl dev_input driver requires linux input device api
AC_CHECK_HEADERS(linux/input.h,[
  AC_DEFINE(HAVE_LINUX_DEVINPUT)
  possible_drivers="${possible_drivers} (devinput)"
  ]
)
dnl dsp driver requires linux soundcard api
AC_CHECK_HEADERS(sys/soundcard.h,[
  AC_DEFINE(HAVE_SOUNDCARD)
  possible_drivers="${possible_drivers} (dsp)"
  ]
)

dnl here we see what driver the user wants.

AC_ARG_WITH(driver,
[  --with-driver=X         specify the driver to use, where X is one of:
                          all, none, userspace, act200l, act220l,
                          adaptec, alsa_usb, animax, atilibusb,
                          atiusb, audio, avermedia, avermedia_vdomate,
                          avermedia98, bestbuy, bestbuy2, breakoutbox,
                          bte, bw6130, caraca, chronos, cmdir, comX,
                          cph06x, creative, creative_infracd,
                          devinput, digimatrix, dsp, dvico, ea65,
                          exaudio, flyvideo, gvbctv5pci, hauppauge,
                          hauppauge_dvb, hercules_smarttv_stereo,
                          igorplugusb, iguanaIR, imon, imon_knob,
                          imon_pad, imon_rsc, irdeo, irdeo_remote,
                          irman, irreal, it87, knc_one, kworld,
                          leadtek_0007, leadtek_0010, leadtek_pvr2000,
                          livedrive_midi, livedrive_seq, logitech,
                          lptX, mceusb, mceusb2, mediafocusI,
                          mouseremote, mouseremote_ps2, mp3anywhere,
                          nslu2,packard_bell, parallel, pcmak,
                          pcmak_usb, pctv, pixelview_bt878,
                          pixelview_pak, pixelview_pro, provideo,
                          realmagic, remotemaster, sa1100, sasem,
                          serial, silitek, sir, slinke, streamzap,
                          tekram, tekram_bt829, tira, tvbox, udp,
                          uirt2, uirt2_raw, usb_uirt_raw],
driver=${withval},
driver="unset"
)

#START HARDWARE HEURISTIC

lirc_driver="$driver"
lircd_conf=""
lircmd_conf=""
iguanaIR_lib=""
irman_lib=""
caraca_lib=""
portaudio_lib=""
alsa_lib=""
atilibusb_lib=""
hw_module="hw_default.o receive.o transmit.o"
HW_DEFAULT="hw_default"
kernel_module=""

if test "$driver" = "none"; then
  lirc_driver=none
  hw_module=""
  HW_DEFAULT="hw_null"
fi

if test "$driver" = "userspace" -o "$driver" = "all"; then
  AC_DEFINE(LIRC_DRIVER_ANY)
  lirc_driver=$driver
  
  any_possible_drivers=`echo ${possible_drivers} | sed -e's/ /-/g' \
			  -e's/)-(/ /g'  -e's/(//g' -e's/)//g' \
			  -e's/-$//g'`
  for any_driver in ${any_possible_drivers}; do
  case ${any_driver} in
	alsa_usb)
		hw_module="${hw_module} hw_alsa_usb.o"
		alsa_lib=-lasound
		;;
	atilibusb)
		hw_module="${hw_module} hw_atilibusb.o receive.o"
		atilibusb_lib=`${LIBUSB_CONFIG} --libs`
		CFLAGS="$CFLAGS `${LIBUSB_CONFIG} --cflags`"
		;;
	audio)
		hw_module="${hw_module} hw_audio.o receive.o"
		portaudio_lib="-lportaudio ${portaudio_lib_other}"
		;;
	audio_alsa)
		hw_module="${hw_module} hw_audio_alsa.o receive.o"
		alsa_lib=-lasound
		;;
	bte)
		hw_module="${hw_module} hw_bte.o serial.o"
		;;
	bw6130)
		hw_module="${hw_module} hw_hiddev.o"
		;;
	caraca)
		hw_module="${hw_module} hw_caraca.o"
		caraca_lib=-lcaraca_client
		;;
	creative)
		hw_module="${hw_module} hw_creative.o serial.o"
		;;
	creative_infracd)
		hw_module="${hw_module} hw_creative_infracd.o"
		;;
	devinput)
		hw_module="${hw_module} hw_devinput.o"
		;;
	dsp)
		hw_module="${hw_module} hw_dsp.o receive.o"
		;;
	dvico)
		hw_module="${hw_module} hw_hiddev.o"
		;;
	ea65)
		hw_module="${hw_module} hw_ea65.o serial.o"
		;;
	exaudio)
		;;
	iguanaIR)
		hw_module="${hw_module} hw_iguanaIR.o transmit.o receive.o"
		iguanaIR_lib=-liguanaIR
		;;
	irman)
		hw_module="${hw_module} hw_irman.o serial.o"
		irman_lib=-lirman
		;;
	# There is not much sense in using 'irman_sw' with driver
	# 'any' and that would conflict with 'irman' which will
	# probably also be available.
	#
	#irman_sw)
		#hw_module="${hw_module} hw_irman.o serial.o"
		#irman_lib=-lirman_sw
		#;;
	irreal)
		#hw_module="${hw_module} hw_irreal.o serial.o receive.o transmit.o"
		;;
	lirc_dev-lirc_atiusb)
		;;
	lirc_dev-lirc_cmdir)
		;;
	lirc_dev-lirc_gpio)
		#lirc_driver="${lirc_driver} lirc_dev lirc_gpio"
		;;
	lirc_dev-lirc_i2c)
		#lirc_driver="${lirc_driver} lirc_dev lirc_i2c"
		;;
	lirc_dev-lirc_igorplugusb)
		;;
	lirc_dev-lirc_imon)
		;;
	lirc_dev-lirc_it87)
		;;
	lirc_dev-lirc_mceusb)
		;;
	lirc_dev-lirc_mceusb2)
		;;
	lirc_dev-lirc_parallel)
		;;
	lirc_dev-lirc_sasem)
		;;
	lirc_dev-lirc_serial)
		;;
	lirc_dev-lirc_sir)
		;;
	lirc_dev-lirc_streamzap)
		;;
	lirc_flyvideo)
		;;
	livedrive_midi)
		hw_module="${hw_module} hw_livedrive_common.o hw_livedrive_midi.o"
		;;
	livedrive_seq)
		hw_module="${hw_module} hw_livedrive_common.o hw_livedrive_seq.o"
		;;
	logitech)
		hw_module="${hw_module} hw_logitech.o serial.o"
		;;
	mediafocusI)
		;;
	mouseremote)
		hw_module="${hw_module} hw_mouseremote.o serial.o"
		;;
	mouseremote_ps2)
		hw_module="${hw_module} hw_mouseremote.o serial.o"
		;;
	mp3anywhere)
		hw_module="${hw_module} hw_mp3anywhere.o serial.o"
		;;
	pcmak*)
		hw_module="${hw_module} hw_pcmak.o serial.o"
		;;
	pctv)
		hw_module="${hw_module} hw_pinsys.o serial.o"
		;;
	remotemaster)
		hw_module="${hw_module} hw_pixelview.o serial.o"
		;;
	silitek)
		hw_module="${hw_module} hw_silitek.o serial.o"
		;;
	#slinke)
		#hw_module="${hw_module} hw_slinke.o serial.o receive.o"
		#;;
	tira)
		hw_module="${hw_module} hw_tira.o"
		;;
	udp)
		hw_module="${hw_module} hw_udp.o receive.o"
		;;
	uirt2)
		hw_module="${hw_module} hw_uirt2.o serial.o"
		;;
	uirt2_raw|usb_uirt_raw)
		hw_module="${hw_module} hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o"
		;;
  esac
  done
  #remove duplicates

  #sed segfaults when $hw_module is too long :(
  #hw_module=`echo ${hw_module}| sed \
  #			-e':again' \
  #			-e's/\(.*\)\(\<.*\) \(.*\) \2\(.*\)$/\1\2 \3\4/' \
  #			-e'tagain'`

  space_to_newline()
  { for token in $*; do echo $token; done; }
  newline_to_space()
  { echo $*; }
  
  hw_module=$(newline_to_space $(space_to_newline ${hw_module}| sort -u))

fi

if test "$driver" = "act200l"; then
  lirc_driver="lirc_dev lirc_sir"
  AC_DEFINE(LIRC_SIR_ACTISYS_ACT200L)
fi

if test "$driver" = "act220l"; then
  lirc_driver="lirc_dev lirc_sir"
  AC_DEFINE(LIRC_SIR_ACTISYS_ACT220L)
fi
    
if test "$driver" = "adaptec"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="adaptec/lircd.conf.AVC-2410"
#  lircmd_conf="adaptec/lircmd.conf.AVC-2410"
fi

if test "$driver" = "alsa_usb"; then
  lirc_driver="alsa_usb"
  hw_module="hw_alsa_usb.o"
  HW_DEFAULT="hw_alsa_usb"
  alsa_lib=-lasound
  lircd_conf="creative/lircd.conf.alsa_usb"
fi

if test "$driver" = "animax"; then
  lirc_driver="lirc_dev lirc_serial"
  lircd_conf="animax/lircd.conf.animax"
  lircmd_conf="animax/lircmd.conf.animax"
  AC_DEFINE(LIRC_SERIAL_ANIMAX)
fi

if test "$driver" = "atiusb"; then
  lirc_driver="lirc_dev lirc_atiusb"
  lircd_conf="atiusb/lircd.conf.atiusb"
fi

if test "$driver" = "atilibusb"; then
  lirc_driver="$driver"
  hw_module="hw_atilibusb.o receive.o"
  HW_DEFAULT="hw_atilibusb"
  if test -n "${LIBUSB_CONFIG}"; then
    atilibusb_lib=`${LIBUSB_CONFIG} --libs`
    CFLAGS="$CFLAGS `${LIBUSB_CONFIG} --cflags`"
  fi
fi

if test "$driver" = "audio"; then
  lirc_driver="audio"
  hw_module="hw_audio.o receive.o"
  HW_DEFAULT="hw_audio"
  portaudio_lib="-lportaudio ${portaudio_lib_other}"
fi

if test "$driver" = "audio_alsa"; then
  lirc_driver="audio_alsa"
  hw_module="hw_audio_alsa.o receive.o"
  HW_DEFAULT="hw_audio_alsa"
  alsa_lib=-lasound
fi

if test "$driver" = "avermedia"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="avermedia/lircd.conf.avermedia"
  lircmd_conf="avermedia/lircmd.conf.avermedia"
fi

if test "$driver" = "avermedia98"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="avermedia/lircd.conf.avermedia98"
  lircmd_conf="avermedia/lircmd.conf.avermedia98"
fi

if test "$driver" = "avermedia_vdomate"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="avermedia/lircd.conf.vdomate"
#  lircmd_conf="avermedia/lircmd.conf.vdomate"
fi

if test "$driver" = "bestbuy"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="bestbuy/lircd.conf.bestbuy"
  lircmd_conf="bestbuy/lircmd.conf.bestbuy"
fi

if test "$driver" = "bestbuy2"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="bestbuy/lircd.conf.bestbuy2"
  lircmd_conf="bestbuy/lircmd.conf.bestbuy2"
fi

if test "$driver" = "breakoutbox"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="creative/lircd.conf.breakoutbox"
fi

if test "$driver" = "bte"; then
  lirc_driver="none"
  hw_module="hw_bte.o  serial.o"
  HW_DEFAULT="hw_bte"
  lircd_conf="ericsson/lircd.conf.bte"
#  lircmd_conf="ericsson/lircmd.conf.bte"
fi

if test "$driver" = "bw6130"; then
  lirc_driver="none"
  hw_module="hw_hiddev.o"
  HW_DEFAULT="hw_bw6130"
  lircd_conf="remotec/lircd.conf.BW6130"
  lircmd_conf="remotec/lircmd.conf.BW6130"
fi

if test "$driver" = "caraca"; then
  lirc_driver="caraca"
  hw_module="hw_caraca.o"
  HW_DEFAULT="hw_caraca"
  caraca_lib=-lcaraca_client
  lircd_conf="caraca/lircd.conf.caraca"
#  lircmd_conf="caraca/lircmd.conf.caraca"
fi

if test "$driver" = "chronos"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="chronos/lircd.conf.chronos"
#  lircmd_conf="chronos/lircmd.conf.chronos"
fi

if test "$driver" = "cmdir"; then
  lirc_driver="lirc_dev lirc_cmdir"
fi

if test "$driver" = "com1"; then
  lirc_driver="lirc_dev lirc_serial"
  port=0x3f8
  irq=4
fi

if test "$driver" = "com2"; then
  lirc_driver="lirc_dev lirc_serial"
  port=0x2f8
  irq=3
fi

if test "$driver" = "com3"; then
  lirc_driver="lirc_dev lirc_serial"
  port=0x3e8
  irq=4
fi

if test "$driver" = "com4"; then
  lirc_driver="lirc_dev lirc_serial"
  port=0x2e8
  irq=3
fi

if test "$driver" = "cph03x" -o "$driver" = "cph06x"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="cph03x/lircd.conf.cph03x"
#  lircmd_conf="cph03x/lircmd.conf.cph03x"
fi

if test "$driver" = "creative"; then
  lirc_driver="none"
  hw_module="hw_creative.o serial.o"
  HW_DEFAULT="hw_creative"
  lircd_conf="creative/lircd.conf.creative"
#  lircmd_conf="creative/lircmd.conf.creative"
fi

if test "$driver" = "creative_infracd"; then
  lirc_driver="none"
  hw_module="hw_creative_infracd.o"
  HW_DEFAULT="hw_creative_infracd"
  lircd_conf="creative/lircd.conf.infracd"
fi

if test "$driver" = "devinput"; then
  lirc_driver="none"
  hw_module="hw_devinput.o"
  HW_DEFAULT="hw_devinput"
# for table.html (unset later)
  lircd_conf='<A HREF="http://linux.bytesex.org/v4l2/faq.html#lircd">generic config file for Linux input layer</A>'
fi

if test "$driver" = "digimatrix"; then
  lirc_driver="lirc_dev lirc_it87"
  lircd_conf="asus/lircd.conf.digimatrix"
  AC_DEFINE(LIRC_IT87_DIGIMATRIX)
fi

if test "$driver" = "dsp"; then
  lirc_driver="none"
  hw_module="hw_dsp.o receive.o"
  HW_DEFAULT="hw_dsp"
fi

if test "$driver" = "dvico"; then
  lirc_driver="none"
  hw_module="hw_hiddev.o"
  HW_DEFAULT="hw_dvico"
  lircd_conf="dvico/lircd.conf.fusionHDTV"
fi

if test "$driver" = "ea65"; then
  lirc_driver="none"
  hw_module="hw_ea65.o  serial.o"
  HW_DEFAULT="hw_ea65"
  lircd_conf="ea65/lircd.conf.ea65"
fi

if test "$driver" = "exaudio"; then
  lirc_driver="none"
#  lircd_conf="creative/lircd.conf.exaudio"
#  lircmd_conf="creative/lircmd.conf.exaudio"
fi

if test "$driver" = "flyvideo"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="life-view/lircd.conf.flyvideo"
  lircmd_conf="life-view/lircmd.conf.flyvideo"
fi

if test "$driver" = "gvbctv5pci"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="iodata/lircd.conf.gvbctv5pci"
#  lircmd_conf="iodata/lircmd.conf.gvbctv5pci"
fi

if test "$driver" = "hauppauge"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="hauppauge/lircd.conf.hauppauge"
  lircmd_conf="hauppauge/lircmd.conf.hauppauge"
fi

if test "$driver" = "hauppauge_dvb"; then
  lirc_driver="lirc_dev"
  lircd_conf="hauppauge/lircd.conf.hauppauge"
  lircmd_conf="hauppauge/lircmd.conf.hauppauge"
fi

if test "$driver" = "hercules_smarttv_stereo"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="hercules/lircd.conf.smarttv_stereo"
fi

if test "$driver" = "igorplugusb"; then
  lirc_driver="lirc_dev lirc_igorplugusb"
fi

if test "$driver" = "iguanaIR"; then
  lirc_driver="iguanaIR"
  hw_module="hw_iguanaIR.o transmit.o receive.o"
  HW_DEFAULT="hw_iguanaIR"
  iguanaIR_lib=-liguanaIR
fi

if test "$driver" = "imon"; then
  lirc_driver="lirc_dev lirc_imon"
  lircd_conf="imon/lircd.conf.imon"  
fi

if test "$driver" = "imon_knob"; then
  lirc_driver="lirc_dev lirc_imon"
  lircd_conf="imon/lircd.conf.imon-knob"
fi

if test "$driver" = "imon_pad"; then
  lirc_driver="lirc_dev lirc_imon"
  lircd_conf="imon/lircd.conf.imon-pad"  
fi

if test "$driver" = "imon_rsc"; then
  lirc_driver="lirc_dev lirc_imon"
  lircd_conf="imon/lircd.conf.imon-rsc"  
fi

if test "$driver" = "irdeo"; then
  lirc_driver="lirc_dev lirc_serial"
  AC_DEFINE(LIRC_SERIAL_IRDEO)
fi

if test "$driver" = "irdeo_remote"; then
  lirc_driver="lirc_dev lirc_serial"
  AC_DEFINE(LIRC_SERIAL_IRDEO_REMOTE)
fi

if test "$driver" = "irman"; then
  lirc_driver="irman"
  hw_module="hw_irman.o serial.o"
  HW_DEFAULT="hw_irman"
  irman_lib=-lirman
fi

if test "$driver" = "irman_sw"; then
  lirc_driver="irman_sw"
  hw_module="hw_irman.o serial.o"
  HW_DEFAULT="hw_irman"
  irman_lib=-lirman_sw
fi

if test "$driver" = "irreal"; then
  lirc_driver="none"
  hw_module="hw_irreal.o serial.o receive.o transmit.o"
  HW_DEFAULT="hw_irreal"
fi

if test "$driver" = "it87"; then
  lirc_driver="lirc_dev lirc_it87"
fi

if test "$driver" = "knc_one"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="knc_one/lircd.conf.knc_one"
#  lircmd_conf="knc_one/lircmd.conf.knc_one"
fi

if test "$driver" = "kworld"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="kworld/lircd.conf.kworld"
#  lircmd_conf="kworld/lircmd.conf.kworld"
fi

if test "$driver" = "leadtek_0007"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="leadtek/lircd.conf.RM-0007"
  lircmd_conf="leadtek/lircmd.conf.RM-0007"
fi

if test "$driver" = "leadtek_0010"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="leadtek/lircd.conf.RM-0010"
  lircmd_conf="leadtek/lircmd.conf.RM-0010"
fi

if test "$driver" = "leadtek_pvr2000"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="leadtek/lircd.conf.PVR2000"
#  lircmd_conf="leadtek/lircmd.conf.PVR2000"
fi

if test "$driver" = "livedrive_midi"; then
  lirc_driver="none"
  hw_module="hw_livedrive_common.o hw_livedrive_midi.o"
  HW_DEFAULT="hw_livedrive_midi"
  lircd_conf="creative/lircd.conf.livedrive"
#  lircmd_conf="creative/lircmd.conf.livedrive"
fi

if test "$driver" = "livedrive_seq"; then
  lirc_driver="none"
  hw_module="hw_livedrive_common.o hw_livedrive_seq.o"
  HW_DEFAULT="hw_livedrive_seq"
  lircd_conf="creative/lircd.conf.livedrive"
#  lircmd_conf="creative/lircmd.conf.livedrive"
fi

if test "$driver" = "logitech"; then
  lirc_driver="none"
  hw_module="hw_logitech.o serial.o"
  HW_DEFAULT="hw_logitech"
  lircd_conf="logitech/lircd.conf.logitech"
  lircmd_conf="logitech/lircmd.conf.logitech"
fi

if test "$driver" = "lpt1"; then
  lirc_driver="lirc_dev lirc_parallel"
  port=0x378
  irq=7
fi

if test "$driver" = "lpt2"; then
  lirc_driver="lirc_dev lirc_parallel"
  port=0x278
  irq=5
fi

if test "$driver" = "mceusb"; then
  lirc_driver="lirc_dev lirc_mceusb"
  lircd_conf="mceusb/lircd.conf.mceusb"
fi

if test "$driver" = "mceusb2"; then
  lirc_driver="lirc_dev lirc_mceusb2"
  lircd_conf="mceusb/lircd.conf.mceusb"
fi

if test "$driver" = "mediafocusI"; then
  lirc_driver="none"
  lircd_conf="technisat/lircd.conf.mediafocusI"
#  lircmd_conf="technisat/lircmd.conf.mediafocusI"
fi

if test "$driver" = "mouseremote"; then
  lirc_driver="none"
  hw_module="hw_mouseremote.o serial.o"
  HW_DEFAULT="hw_mouseremote"
  lircd_conf="x10/lircd.conf.mouseremote"
  lircmd_conf="x10/lircmd.conf.mouseremote"
fi

if test "$driver" = "mouseremote_ps2"; then
  lirc_driver="none"
  hw_module="hw_mouseremote.o serial.o"
  HW_DEFAULT="hw_mouseremote_ps2"
  lircd_conf="x10/lircd.conf.mouseremote"
  lircmd_conf="x10/lircmd.conf.mouseremote"
fi

if test "$driver" = "mp3anywhere"; then
  lirc_driver="none"
  hw_module="hw_mp3anywhere.o serial.o"
  HW_DEFAULT="hw_mp3anywhere"
  lircd_conf="x10/lircd.conf.mp3anywhere"
fi

if test "$driver" = "nslu2"; then
  lirc_driver="lirc_dev lirc_serial"
  AC_DEFINE(LIRC_SERIAL_NSLU2)
fi

if test "$driver" = "packard_bell"; then
  lirc_driver="lirc_dev lirc_serial"
  lircd_conf="packard_bell/lircd.conf.packard_bell"
fi

if test "$driver" = "parallel"; then
  lirc_driver="lirc_dev lirc_parallel"
fi

if test "$driver" = "pcmak" -o "$driver" = "pcmak_usb"; then
  lirc_driver="none"
  hw_module="hw_pcmak.o serial.o"
  HW_DEFAULT="hw_pcmak"
  lircd_conf="pcmak/lircd.conf.pcmak"
  lircmd_conf="pcmak/lircmd.conf.pcmak"
fi

if test "$driver" = "pctv"; then
  lirc_driver="none"
  hw_module="hw_pinsys.o serial.o"
  HW_DEFAULT="hw_pinsys"
  lircd_conf="pinnacle_systems/lircd.conf.pctv"
#  lircmd_conf="pinnacle_systems/lircmd.conf.pctv"
fi

if test "$driver" = "pixelview_bt878"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="pixelview/lircd.conf.playtv_bt878"
#  lircmd_conf="pixelview/lircmd.conf.pixelview_bt878"
fi

if test "$driver" = "pixelview_pak"; then
  lirc_driver="lirc_dev lirc_gpio"
# the config files are the same as for the PlayTV pro
  lircd_conf="pixelview/lircd.conf.playtv_pro"
  lircmd_conf="pixelview/lircmd.conf.playtv_pro"
fi

if test "$driver" = "pixelview_pro"; then
  lirc_driver="lirc_dev lirc_gpio"
  lircd_conf="pixelview/lircd.conf.playtv_pro"
  lircmd_conf="pixelview/lircmd.conf.playtv_pro"
fi

if test "$driver" = "provideo"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="provideo/lircd.conf.pv951"
#  lircmd_conf="provideo/lircmd.conf.pv951"
fi

if test "$driver" = "realmagic"; then
  lirc_driver="none"
  hw_module="hw_pixelview.o serial.o"
  HW_DEFAULT="hw_pixelview"
  lircd_conf="sigma_designs/lircd.conf.realmagic"
#  lircmd_conf="sigma_designs/lircmd.conf.realmagic"
fi

if test "$driver" = "remotemaster"; then
  lirc_driver="none"
  hw_module="hw_pixelview.o serial.o"
  HW_DEFAULT="hw_pixelview"
  lircd_conf="pixelview/lircd.conf.remotemaster"
  lircmd_conf="pixelview/lircmd.conf.remotemaster"
fi

if test "$driver" = "sa1100"; then
  lirc_driver="lirc_dev lirc_sir"
  AC_DEFINE(LIRC_ON_SA1100)
fi

if test "$driver" = "sasem"; then
  lirc_driver="lirc_dev lirc_sasem"
  lircd_conf="sasem/lircd.conf.sasem"
fi

if test "$driver" = "serial"; then
  lirc_driver="lirc_dev lirc_serial"
fi

if test "$driver" = "silitek"; then
  lirc_driver="none"
  hw_module="hw_silitek.o serial.o"
  HW_DEFAULT="hw_silitek"
  lircd_conf="silitek/lircd.conf.silitek"
  lircmd_conf="silitek/lircmd.conf.silitek"
fi

if test "$driver" = "sir"; then
  lirc_driver="lirc_dev lirc_sir"
fi

if test "$driver" = "sir_com3"; then
  lirc_driver="lirc_dev lirc_sir"
  port=0x3e8
  irq=4
fi

if test "$driver" = "slinke"; then
  echo
  echo "Please use lirc-0.6.5. The Slink-e is no longer supported."
  echo
  exit 1
  lirc_driver="none"
  hw_module="hw_slinke.o serial.o receive.o"
  HW_DEFAULT="hw_slinke"
fi

if test "$driver" = "streamzap"; then
  lirc_driver="lirc_dev lirc_streamzap"
  lircd_conf="streamzap/lircd.conf.streamzap"
fi

if test "$driver" = "tekram"; then
  lirc_driver="lirc_dev lirc_sir"
  AC_DEFINE(LIRC_SIR_TEKRAM)
fi

if test "$driver" = "tekram_bt829"; then
  lirc_driver="lirc_dev lirc_bt829"
  lircd_conf="tekram/lircd.conf.m230"
  lircmd_conf="tekram/lircmd.conf.m230"
fi

if test "$driver" = "tira"; then
  lirc_driver="none"
  hw_module="hw_tira.o serial.o"
  HW_DEFAULT="hw_tira"
fi

if test "$driver" = "tvbox"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="asus/lircd.conf.asus"
fi

if test "$driver" = "udp"; then
  lirc_driver="none"
  hw_module="hw_udp.o receive.o"
  HW_DEFAULT="hw_udp"
fi

if test "$driver" = "uirt2"; then
  lirc_driver="none"
  hw_module="hw_uirt2.o serial.o"
  HW_DEFAULT="hw_uirt2"
fi
if test "$driver" = "uirt2_raw"; then
  lirc_driver="none"
  hw_module="hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o"
  HW_DEFAULT="hw_uirt2_raw"
fi
if test "$driver" = "usb_uirt_raw"; then
  lirc_driver="none"
  hw_module="hw_uirt2_raw.o hw_uirt2_common.o serial.o receive.o transmit.o"
  HW_DEFAULT="hw_usb_uirt_raw"
fi

#END HARDWARE HEURISTIC

if test "$driver" = "devinput"; then
  lircd_conf=""
fi


AC_DEFINE_UNQUOTED(HW_DEFAULT, ${HW_DEFAULT})

dnl now check to see if the user is behaving himself

if test "$lirc_driver" = "unset"; then
  AC_MSG_ERROR([no driver specified, try ./configure --help])
fi

if echo ${possible_drivers} | grep "($lirc_driver)" >/dev/null 2>&1; then
  dummy=
else
  case $lirc_driver in
  irman*)
    AC_MSG_ERROR([*** you need to first install the libirman package
	(libirman-0.4.2 or better) before you can use this driver])
    ;;
  caraca*)
    AC_MSG_ERROR([*** you need to first install the caraca package
	before you can use this driver])
    ;;
  all|lirc_*)
    AC_MSG_ERROR([*** you need to have the Linux kernel source installed
	for this driver])
    ;;
  atilibusb)
    AC_MSG_ERROR([*** you need to have libusb installed for this driver.

Get it at:

  http://libusb.sourceforge.net/
])
    ;;
  audio)
    AC_MSG_ERROR([*** you need to have the PortAudio library V18 installed
to use the audio driver. You can get it at:
  http://www.inf.ethz.ch/~mringwal/downloads/portaudio_v18_with_configure.zip
Extract the package and do a \"./configure && make && sudo make install\"
in its directory.
])
    ;;
  audio_alsa)
    AC_MSG_ERROR([*** you need to have the ALSA headers and libraries
	for this driver])
    ;;
  alsa_usb)
    AC_MSG_ERROR([*** you need to have the ALSA libraries and drivers
	from at least version 1.0.9 for this driver])
    ;;
  iguanaIR)
    AC_MSG_ERROR([*** you need to have the iguanaIR headers and
        libraries for this driver])
    ;;
  *)
    AC_MSG_ERROR([*** it is not possible to install the specified driver
	on this system])
    ;;
  esac
fi

dnl now we've checked, we can rename things for the drivers/Makefile

if test "$lirc_driver" = "none" || \
	test "$lirc_driver" = "alsa_usb" || \
	test "$lirc_driver" = "userspace" || \
	test "$lirc_driver" = "atilibusb" || \
	test "$lirc_driver" = "audio" || \
	test "$lirc_driver" = "audio_alsa" || \
	test "$lirc_driver" = "caraca" || \
	test "$lirc_driver" = "iguanaIR" || \
	test "$lirc_driver" = "irman" || \
	test "$lirc_driver" = "irman_sw"; then
  lirc_driver=
elif test "$lirc_driver" = "all"; then
  lirc_driver="lirc_dev \
	lirc_atiusb \
	lirc_bt829 \
	lirc_cmdir \
	lirc_gpio \
	lirc_i2c \
	lirc_igorplugusb \
	lirc_imon \
	lirc_it87 \
	lirc_mceusb \
	lirc_mceusb2 \
	lirc_parallel \
	lirc_sasem \
	lirc_serial \
	lirc_sir \
	lirc_streamzap"
fi
if kernel_module=$(expr "$lirc_driver" : 'lirc_dev \(.*\)'); then
  :
elif test "$lirc_driver" != ""; then
  kernel_module=$lirc_driver
fi

dnl slightly more advanced options

dnl maintainer mode options

maintmode_daemons_extra=
AC_ARG_ENABLE(maintainer-mode,
[  --enable-maintainer-mode    enable maintainer specific things],
[
if test x${enableval} = xyes; then
AC_DEFINE(MAINTAINER_MODE)
maintmode_daemons_extra="lircd.simrec lircd.simsend slinke"
fi
])

dnl don't create nor destroy devices when installing and uninstalling

AC_ARG_ENABLE(sandboxed,
[  --enable-sandboxed      don't touch anything out of the install directory],
[ enable_sandboxed="${enableval}" ],
[ enable_sandboxed="no"])
AM_CONDITIONAL(SANDBOXED, test x$enable_sandboxed = xyes)

AC_ARG_WITH(devdir,
[  --with-devdir=DIR       Install device files in DIR (/dev)],
devdir=${withval},
devdir=${devdir_default})

default_moduledir=/lib/modules/`uname -r`/misc
AC_ARG_WITH(moduledir,
[  --with-moduledir=DIR    kernel modules in DIR (/lib/modules/`uname -r`/misc)], 
moduledir=${withval},
moduledir=${default_moduledir})

AC_ARG_ENABLE(long-codes,
[  --disable-long-codes    use this if your compiler won't do long long],
test x${enableval} = xyes && AC_DEFINE(LONG_IR_CODE),
AC_DEFINE(LONG_IR_CODE))

AC_ARG_ENABLE(dyncodes,
[  --enable-dyncodes       use dynamic codes],
test x${enableval} = xyes && AC_DEFINE(DYNCODES))

AC_ARG_WITH(major,
[  --with-major=value      specify the device major for the driver (61)],
lirc_major=${withval},
lirc_major=61)

AC_ARG_WITH(port,
[  --with-port=port        specify the port number for the lirc device.],
port=${withval}
)

AC_ARG_WITH(irq,
[  --with-irq=irq          specify the irq line for the lirc device.],
irq=${withval}
)

AC_ARG_WITH(timer,
[  --with-timer=value      specify the timer value for the parallel driver],
timer=${withval})

dnl I dont think libirman  will accept this at the moment
AC_ARG_WITH(tty,
[  --with-tty=file         specify the tty to use (Irman, RemoteMaster, etc.)],
irtty=${withval})

AC_ARG_WITH(soft-carrier,
[  --without-soft-carrier  use this if your serial hw generates carrier],
test x${withval} = xyes && AC_DEFINE(LIRC_SERIAL_SOFTCARRIER),
AC_DEFINE(LIRC_SERIAL_SOFTCARRIER))

AC_ARG_WITH(transmitter,
[  --with-transmitter      use this if you use a transmitter diode],
test x${withval} = xyes && AC_DEFINE(LIRC_SERIAL_TRANSMITTER))

AC_ARG_WITH(igor,
[  --with-igor             use this if you have an Igor Cesko receiver],
test x${withval} = xyes && AC_DEFINE(LIRC_SERIAL_IGOR))

AC_ARG_ENABLE(debug,
[  --enable-debug          enable debugging features],
test x${enableval} = xyes && AC_DEFINE(DEBUG)
)

AC_ARG_ENABLE(daemonize,
[  --disable-daemonize     disable daemons from daemonizing],
test x${enableval} = xyes && AC_DEFINE(DAEMONIZE),
AC_DEFINE(DAEMONIZE))

AC_ARG_WITH(syslog,
[  --with-syslog=facility  use syslog instead of logfile],
if test -n "${withval}"; then
  facility="${withval}"
  if test "${withval}" = yes; then
    facility=LOG_DAEMON;
  elif test "${withval}" = LOG_AUTH; then
    true;
  elif test "${withval}" = LOG_AUTHPRIV; then
    true;
  elif test "${withval}" = LOG_DAEMON; then
    true;
  elif test "${withval}" = LOG_LOCAL0; then
    true;
  elif test "${withval}" = LOG_LOCAL1; then
    true;
  elif test "${withval}" = LOG_LOCAL2; then
    true;
  elif test "${withval}" = LOG_LOCAL3; then
    true;
  elif test "${withval}" = LOG_LOCAL4; then
    true;
  elif test "${withval}" = LOG_LOCAL5; then
    true;
  elif test "${withval}" = LOG_LOCAL6; then
    true;
  elif test "${withval}" = LOG_LOCAL7; then
    true;
  elif test "${withval}" = LOG_USER; then
    true;
  else
    AC_MSG_ERROR([*** invalid facility (see syslog(3) for possible facilities) ])
  fi
  AC_DEFINE(USE_SYSLOG)
fi
)

dnl if --prefix is not specified, then $prefix is still set to NONE by
dnl configure.  That's bad here where we want to expand it!
cur_prefix=$prefix
test "x${prefix}" = "xNONE" && prefix=$ac_default_prefix 
test "${sysconfdir}" = "\${prefix}/etc" && sysconfdir=/etc
test "${localstatedir}" = "\${prefix}/var" && localstatedir=/var
sysconfdir_exp=`eval "echo ${sysconfdir}"`
localstatedir_exp=`eval "echo ${localstatedir}"`
prefix=$cur_prefix

dnl tell the Makefiles what we decided
AC_SUBST(daemon)
AC_SUBST(forkpty)
AC_SUBST(devdir)
AC_SUBST(sysconfdir)
AC_SUBST(moduledir)
AC_SUBST(lirc_major)
AC_SUBST(driver)
AC_SUBST(lirc_driver)
AC_SUBST(irman_lib)
AC_SUBST(caraca_lib)
AC_SUBST(portaudio_lib)
AC_SUBST(alsa_lib)
AC_SUBST(atilibusb_lib)
AC_SUBST(iguanaIR_lib)
AC_SUBST(vga_progs) 
AC_SUBST(x_progs)
AC_SUBST(hw_module)
AC_SUBST(irtty)
AC_SUBST(lircd_conf)
AC_SUBST(lircmd_conf)
AC_SUBST(maintmode_daemons_extra)

dnl tell the C code what we decided
AC_DEFINE_UNQUOTED(DEVDIR, "$devdir")
AC_DEFINE_UNQUOTED(SYSCONFDIR, "$sysconfdir_exp")
AC_DEFINE_UNQUOTED(LOCALSTATEDIR, "$localstatedir_exp")
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_DEFINE_UNQUOTED(VERSION, "$VERSION")

AC_DEFINE_UNQUOTED(LIRC_DRIVER, "$driver")
AC_DEFINE_UNQUOTED(LIRC_MAJOR, $lirc_major)
if test "$port" != ""; then
  AC_DEFINE_UNQUOTED(LIRC_PORT, $port)
fi
if test "$irq" != ""; then
  AC_DEFINE_UNQUOTED(LIRC_IRQ, $irq)
fi
if test "$timer" != ""; then
  AC_DEFINE_UNQUOTED(LIRC_TIMER, $timer)
fi
AC_DEFINE_UNQUOTED(LIRC_IRTTY, "$irtty")
AC_DEFINE_UNQUOTED(LIRC_SYSLOG, $facility)

dnl bug in automake/autoconf?
dnl SHELL=/bin/sh AC_SUBST(SHELL)

dnl write these decisions out to the Makefiles
AC_OUTPUT([
  Makefile
  drivers/Makefile
  drivers/lirc_atiusb/Makefile
  drivers/lirc_bt829/Makefile
  drivers/lirc_cmdir/Makefile
  drivers/lirc_dev/Makefile
  drivers/lirc_gpio/Makefile
  drivers/lirc_i2c/Makefile
  drivers/lirc_igorplugusb/Makefile
  drivers/lirc_imon/Makefile
  drivers/lirc_it87/Makefile
  drivers/lirc_mceusb/Makefile
  drivers/lirc_mceusb2/Makefile
  drivers/lirc_parallel/Makefile
  drivers/lirc_sasem/Makefile
  drivers/lirc_serial/Makefile
  drivers/lirc_sir/Makefile
  drivers/lirc_streamzap/Makefile
  daemons/Makefile
  tools/Makefile
  doc/Makefile
  doc/man/Makefile
])

echo
if test "$driver" = "all"; then
  echo "All kernel modules will be built."
elif test "$driver" = "mediafocusI"; then
  echo "You will have to use the MediaFocus driver from:"
  echo "http://freenet-homepage.de/mediafocus/"
elif test "$driver" = "exaudio"; then
  echo "You will have to use the Exaudio driver from:"
  echo "http://exaudio.sourceforge.net/"
elif test "$driver" = "alsa_usb"; then
  echo "You will have to use the snd-usb-audio driver from:"
  echo "http://www.alsa-project.org/"
elif test "$driver" = "hauppauge_dvb"; then
  echo "You will have to use the DVB driver from:"
  echo "http://www.linuxtv.org"
elif test "$kernel_module" = ""; then
  echo "Your hardware does not require a special LIRC kernel module."
  if test "${irtty}" != ""; then
    echo
    echo "You will have to use the suitable kernel driver to access ${irtty}."
  fi
else
  echo "You will have to use the $kernel_module kernel module."
fi
echo
echo "Now enter 'make' and 'make install' to compile and install the package."
echo