[7d0df2]: configure.in Maximize Restore History

Download this file

configure.in    1046 lines (905 with data), 27.3 kB

dnl $Id: configure.in,v 5.122 2004/05/23 21:17:27 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.7.0-CVS)
AM_CONFIG_HEADER(config.h)

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_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) (bte) (creative_infracd) (devinput) (dsp) \
	(irreal) (livedrive_midi) (livedrive_seq) (logitech) \
	(mediafocusI) (mp3anywhere) (pctv) (remotemaster) (silitek) \
	(slinke) (tira) (uirt2) (uirt2_raw) (udp)"

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

AC_CHECK_LIB(caraca_client, caraca_init,
  AC_DEFINE(HAVE_LIBCARACA)
  possible_drivers="${possible_drivers} (caraca)"
)
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
AC_CHECK_HEADERS(alsa/asoundlib.h,[
  AC_CHECK_LIB(asound, snd_pcm_open,[
    AC_DEFINE(HAVE_LIBALSA)
    possible_drivers="${possible_drivers} (audio_alsa)"
    ],,
  )]
)

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:
                          none, any, act200l, animax, atiusb, audio,
			  avermedia, avermedia_vdomate, avermedia98,
			  bestbuy, bestbuy2, breakoutbox, bte, caraca,
			  chronos, comX, creative_infracd, dsp,
			  cph03x, cph06x, creative, devinput,
			  flyvideo, gvbctv5pci, hauppauge,
			  hauppauge_dvb, hercules_smarttv_stereo,
			  irdeo, irdeo_remote, irman, irreal, it87,
			  knc_one, kworld, leadtek_0007, leadtek_0010,
			  livedrive_midi, livedrive_seq, logitech,
			  lptX, mceusb, mediafocusI, mp3anywhere,
			  packard_bell, parallel, pctv,
			  pixelview_bt878, pixelview_pak,
			  pixelview_pro, provideo, realmagic,
			  remotemaster, sa1100, serial, silitek, sir,
			  slinke, tekram, tekram_bt829, tira, tvbox,
			  udp, uirt2, uirt2_raw],
driver=${withval},
driver="unset"
)

#START HARDWARE HEURISTIC

lirc_driver="$driver"
lircd_conf=""
lircmd_conf=""
irman_lib=""
caraca_lib=""
portaudio_lib=""
alsa_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" = "any"; then
  AC_DEFINE(LIRC_DRIVER_ANY)
  lirc_driver="none"
  #include creative driver
  hw_module="${hw_module} hw_creative.o serial.o"
  
  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
	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"
		;;
	caraca)
		hw_module="${hw_module} hw_caraca.o"
		caraca_lib=-lcaraca_client
		;;
	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"
		;;
	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_gpio)
		#lirc_driver="${lirc_driver} lirc_dev lirc_gpio"
		;;
	lirc_dev-lirc_i2c)
		#lirc_driver="${lirc_driver} lirc_dev lirc_i2c"
		;;
	lirc_dev-lirc_it87)
		;;
	lirc_dev-lirc_mceusb)
		;;
	lirc_dev-lirc_parallel)
		;;
	lirc_dev-lirc_serial)
		;;
	lirc_dev-lirc_sir)
		;;
	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)
		;;
	mp3anywhere)
		hw_module="${hw_module} hw_mp3anywhere.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)
		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" = "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" = "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" = "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" = "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" = "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"
fi

if test "$driver" = "dsp"; then
  lirc_driver="none"
  hw_module="hw_dsp.o receive.o"
  HW_DEFAULT="hw_dsp"
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" = "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" = "tira"; then
  lirc_driver="none"
  hw_module="hw_tira.o serial.o"
  HW_DEFAULT="hw_tira"
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" = "atiusb"; then
  lirc_driver="lirc_dev lirc_atiusb"
  lircd_conf="atiusb/lircd.conf.atiusb"
fi

if test "$driver" = "mceusb"; then
  lirc_driver="lirc_dev lirc_mceusb"
  lircd_conf="mceusb/lircd.conf.mceusb"
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" = "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" = "mediafocusI"; then
  lirc_driver="none"
  lircd_conf="technisat/lircd.conf.mediafocusI"
#  lircmd_conf="technisat/lircmd.conf.mediafocusI"
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" = "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" = "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.pixelview_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" = "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" = "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" = "tvbox"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="asus/lircd.conf.asus"
fi

if test "$driver" = "breakoutbox"; then
  lirc_driver="lirc_dev lirc_i2c"
  lircd_conf="creative/lircd.conf.breakoutbox"
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

#END HARDWARE HEURISTIC

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])
    ;;
  lirc_*)
    AC_MSG_ERROR([*** you need to have the Linux kernel source installed
	for this driver])
    ;;
  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])
    ;;
  *)
    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" = "irman" || test "$lirc_driver" = "irman_sw" || test "$lirc_driver" = "caraca" || test "$lirc_driver" = "audio" || test "$lirc_driver" = "audio_alsa"; then
  lirc_driver=
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],
[
AC_DEFINE(MAINTAINER_MODE)
maintmode_daemons_extra="lircd.simrec lircd.simsend slinke"
])

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},
[case $lirc_driver in
*lirc_serial)   port=${port:-0x3f8} ;;
*lirc_sir)   port=${port:-0x3f8} ;;
*lirc_parallel) port=${port:-0x378} ;;
esac]
)

AC_ARG_WITH(irq,
[  --with-irq=irq          specify the irq line for the lirc device.],
irq=${withval},
[case $lirc_driver in
*lirc_serial)   irq=${irq:-4} ;;
*lirc_sir)   irq=${irq:-4} ;;
*lirc_parallel) irq=${irq:-7} ;;
esac]
)

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

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(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)
AC_DEFINE_UNQUOTED(LIRC_PORT, $port)
AC_DEFINE_UNQUOTED(LIRC_IRQ, $irq)
AC_DEFINE_UNQUOTED(LIRC_TIMER, $timer)
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_serial/Makefile
  drivers/lirc_sir/Makefile
  drivers/lirc_parallel/Makefile
  drivers/lirc_i2c/Makefile
  drivers/lirc_gpio/Makefile
  drivers/lirc_dev/Makefile
  drivers/lirc_it87/Makefile
  drivers/lirc_bt829/Makefile
  drivers/lirc_atiusb/Makefile
  drivers/lirc_mceusb/Makefile
  daemons/Makefile
  tools/Makefile
  doc/Makefile
  doc/man/Makefile
])

echo
if test "$driver" = "mediafocusI"; then
  echo "You will have to use the MediaFocus driver from:"
  echo "http://www.uni-giessen.de/~gej2/"
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 kernel module."
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