dnl Process this file with autoconf 2.53 to produce a configure script.
###############################################################################
# BRLTTY - A background process providing access to the Linux console (when in
#          text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2003 by The BRLTTY Team. All rights reserved.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation.  Please see the file COPYING for details.
#
# Web Page: http://mielke.cc/brltty/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################

AC_PREREQ([2.53])
AC_INIT([brltty], [3.3.1], [http://mielke.cc/brltty/])
AC_CONFIG_SRCDIR([Programs/brltty.h])
BRLTTY_SUMMARY_BEGIN

AC_SUBST([BRLAPI_MAJOR], [0])
AC_SUBST([BRLAPI_MINOR], [1])
AC_SUBST([BRLAPI_REVISION], [0])
AC_SUBST([BRLAPI_VERSION], [${BRLAPI_MAJOR}.${BRLAPI_MINOR}])
AC_SUBST([BRLAPI_RELEASE], [${BRLAPI_VERSION}.${BRLAPI_REVISION}])
AC_DEFINE_UNQUOTED([BRLAPI_RELEASE], ["${BRLAPI_RELEASE}"])

AC_SUBST([PACKAGE_TITLE], ["`echo "${PACKAGE_NAME}" | sed -e 'y%abcdefghijklmnopqrstuvwxyz%ABCDEFGHIJKLMNOPQRSTUVWXYZ%'`"])
AC_DEFINE_UNQUOTED([PACKAGE_TITLE], ["${PACKAGE_TITLE}"])

AC_SUBST([package_date], ["`date "+%Y/%m/%d"`"])

AC_CONFIG_HEADER([config.h])
AC_CONFIG_HEADER([Programs/brlapi.h])
AC_PREFIX_DEFAULT([])
AC_CONFIG_AUX_DIR([aux])
AC_CANONICAL_SYSTEM

brltty_default_execute_root="/${PACKAGE_NAME}-${PACKAGE_VERSION}"
BRLTTY_ARG_WITH(
   [execute-root], [DIRECTORY],
   [where the package is to be anchored at run-time],
   [execute_root], [""]
)
if test "${execute_root}" = "no"
then
   execute_root=""
elif test "${execute_root}" = "yes"
then
   execute_root="${brltty_default_execute_root}"
fi
AC_SUBST([execute_root])
BRLTTY_SUMMARY_ITEM([execute-root], [execute_root])

brltty_default_install_root="/tmp/${PACKAGE_NAME}-${PACKAGE_VERSION}"
BRLTTY_ARG_WITH(
   [install-root], [DIRECTORY],
   [where to install the package],
   [install_root], ["${execute_root}"]
)
if test "${install_root}" = "no"
then
   install_root="${execute_root}"
elif test "${install_root}" = "yes"
then
   install_root="${brltty_default_install_root}"
fi
AC_SUBST([install_root])
BRLTTY_SUMMARY_ITEM([install-root], [install_root])

AC_SUBST([configuration_file], ["${PACKAGE_NAME}.conf"])
BRLTTY_DEFINE_EXPANDED([CONFIGURATION_FILE], ["${configuration_file}"])

BRLTTY_PORTABLE_DIRECTORY([includedir], [/usr])
BRLTTY_PORTABLE_DIRECTORY([mandir], [/usr/share])

BRLTTY_SUMMARY_ITEM([bindir], [bindir])
BRLTTY_SUMMARY_ITEM([libdir], [libdir])
BRLTTY_SUMMARY_ITEM([sysconfdir], [sysconfdir])
BRLTTY_SUMMARY_ITEM([mandir], [mandir])
BRLTTY_SUMMARY_ITEM([includedir], [includedir])

AC_SUBST([program_directory], ["${bindir}"])
AC_SUBST([library_directory], ["${libdir}/${PACKAGE_NAME}"])
AC_SUBST([data_directory], ["${sysconfdir}/${PACKAGE_NAME}"])
AC_SUBST([manpage_directory], ["${mandir}"])
AC_SUBST([include_directory], ["${includedir}/${PACKAGE_NAME}"])

original_prefix="${prefix}"
test "${prefix}" = "NONE" && prefix=""
original_exec_prefix="${exec_prefix}"
test "${exec_prefix}" = "NONE" && exec_prefix="${prefix}"
BRLTTY_DEFINE_EXPANDED([HOME_DIRECTORY], ["${execute_root}${data_directory}"])
BRLTTY_DEFINE_EXPANDED([CONFIGURATION_DIRECTORY], ["${sysconfdir}"])
BRLTTY_DEFINE_EXPANDED([LIBRARY_DIRECTORY], ["${execute_root}${library_directory}"])
eval 'configuration_directory="'"${sysconfdir}"'"'
AC_SUBST([configuration_directory])
BRLTTY_DEFINE_EXPANDED([BRLAPI_ETCDIR], ["${configuration_directory}"])
prefix="${original_prefix}"
exec_prefix="${original_exec_prefix}"

brltty_default_compiler_prefix="${host_os}-"
BRLTTY_ARG_WITH(
   [compiler-prefix], [PREFIX],
   [prefix for compiler programs],
   [compiler_prefix], [""]
)
if test "${compiler_prefix}" = "no"
then
   compiler_prefix=""
elif test "${compiler_prefix}" = "yes"
then
   compiler_prefix="${brltty_default_compiler_prefix}"
fi
AC_SUBST([compiler_prefix])
BRLTTY_SUMMARY_ITEM([compiler-prefix], [compiler_prefix])

brltty_default_init_path=/sbin/init_real
BRLTTY_ARG_WITH(
   [init-path], [FILE],
   [path to real init program],
   [init_path], [""]
)
if test "${init_path}" = "no"
then
   init_path=""
elif test "${init_path}" = "yes"
then
   init_path="${brltty_default_init_path}"
fi
if test -n "${init_path}"
then
   AC_DEFINE_UNQUOTED([INIT_PATH], ["${init_path}"])
fi
BRLTTY_SUMMARY_ITEM([init-path], [init_path])

AC_PROG_MAKE_SET

AC_PROG_CC
if test "${GCC}" = "yes"
then
   CFLAGS="${CFLAGS} -Wall"
fi

if test -z "${CXX}"
then
   if test "${GCC}" = "yes"
   then
      AC_SEARCH_LIBS([__cxa_pure_virtual], [supc++])
      AC_CACHE_CHECK([if the C compiler can compile C++], [brltty_cv_prog_cc_cxx], [dnl
      brltty_save_ac_ext="${ac_ext}"
      ac_ext="cc"
      AC_TRY_LINK([], [class c {};],
                  [brltty_cv_prog_cc_cxx="yes"],
                  [brltty_cv_prog_cc_cxx="no"])
      ac_ext="${brltty_save_ac_ext}"])
      test "${brltty_cv_prog_cc_cxx}" = "yes" && CXX="${CC}"
   fi
fi
AC_PROG_CXX
if test "$GXX" = "yes"
then
   CXXFLAGS="${CXXFLAGS} -Wall"
fi

AC_CHECK_PROGS([LD], [ld], [ld])
AC_PROG_RANLIB
AC_PROG_YACC
AC_PROG_AWK
AC_PROG_LN_S

AC_PROG_INSTALL
BRLTTY_EXECUTABLE_PATH([INSTALL])

AC_CACHE_CHECK([for make relocatable object command], [brltty_cv_prog_mkobj], [dnl
case "${host_os}"
in
   *)
      brltty_cv_prog_mkobj="\$(LD) -r -o"
      ;;
esac])
MKOBJ="${brltty_cv_prog_mkobj}"
AC_SUBST([MKOBJ])

AC_CACHE_CHECK([for make shared object command], [brltty_cv_prog_mklib], [dnl
if test "${GCC}" = "yes"
then
   brltty_cv_prog_mklib="\$(CC) -shared -Wl,-soname,SONAME -o"
else
   case "${host_os}"
   in
      linux*)
         brltty_cv_prog_mklib="\$(LD) -shared -soname SONAME -o"
         ;;
      solaris*)
         brltty_cv_prog_mklib="\$(LD) -G -h SONAME -o"
         ;;
      hpux*)
         brltty_cv_prog_mklib="\$(LD) -b +h SONAME -o"
         ;;
      *)
         brltty_cv_prog_mklib="\$(LD) -o"
         ;;
   esac
fi])
AC_SUBST([MKLIB], ["${brltty_cv_prog_mklib}"])

AC_CACHE_CHECK([for configure shared object directory command], [brltty_cv_prog_conflibdir], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_prog_conflibdir="/sbin/ldconfig -n"
      ;;
   *)
      brltty_cv_prog_conflibdir=":"
      ;;
esac])
AC_SUBST([CONFLIBDIR], ["${brltty_cv_prog_conflibdir}"])

AC_CHECK_HEADERS([getopt.h syslog.h])
AC_CHECK_FUNCS([vsyslog])
AC_CHECK_HEADERS([sys/io.h linux/vt.h])

AC_C_CONST
AC_C_INLINE
AC_OBJEXT
AC_EXEEXT

AC_CACHE_CHECK([for system-dependent compilation flags], [brltty_cv_prog_cc_sysflags], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_prog_cc_sysflags="-D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -D_XOPEN_SOURCE"
      ;;
   *)
      brltty_cv_prog_cc_sysflags=""
      ;;
esac])
SYSCFLAGS="${brltty_cv_prog_cc_sysflags}"
AC_SUBST([SYSCFLAGS])

AC_CACHE_CHECK([for c compiler yacc source flags], [brltty_cv_prog_cc_yaccflags], [dnl
if test "${GCC}" = "yes"
then
   brltty_cv_prog_cc_yaccflags="-Wno-parentheses -Wno-unused -Wno-uninitialized -Wno-unknown-pragmas"
else
   case "${host_os}"
   in
      *)
         brltty_cv_prog_cc_yaccflags=""
         ;;
   esac
fi])
YCFLAGS="${brltty_cv_prog_cc_yaccflags}"
AC_SUBST([YCFLAGS])

AC_CACHE_CHECK([for c compiler shared object flags], [brltty_cv_prog_cc_libflags], [dnl
if test "${GCC}" = "yes"
then
   brltty_cv_prog_cc_libflags="-fPIC"
else
   case "${host_os}"
   in
      *)
         brltty_cv_prog_cc_libflags=""
         ;;
   esac
fi])
LIBCFLAGS="${brltty_cv_prog_cc_libflags}"
AC_SUBST([LIBCFLAGS])

AC_CACHE_CHECK([for c++ compiler shared object flags], [brltty_cv_prog_cxx_libflags], [dnl
if test "$GXX" = "yes"
then
   brltty_cv_prog_cxx_libflags="-fPIC"
else
   case "${host_os}"
   in
      *)
         brltty_cv_prog_cxx_libflags=""
         ;;
   esac
fi])
LIBCXXFLAGS="${brltty_cv_prog_cxx_libflags}"
AC_SUBST([LIBCXXFLAGS])

AC_CACHE_CHECK([for shared object extension], [brltty_cv_ext_lib], [dnl
case "${host_os}"
in
   hpux*)
      brltty_cv_ext_lib="sl"
      ;;
   *)
      brltty_cv_ext_lib="so"
      ;;
esac])
library_extension="${brltty_cv_ext_lib}"
AC_SUBST([library_extension])
AC_DEFINE_UNQUOTED([LIBRARY_EXTENSION], ["${library_extension}"])

AC_CACHE_CHECK([for static archive extension], [brltty_cv_ext_arc], [dnl
case "${host_os}"
in
   *)
      brltty_cv_ext_arc="a"
      ;;
esac])
archive_extension="${brltty_cv_ext_arc}"
AC_SUBST([archive_extension])

AC_CACHE_CHECK([for shared object run-time search path environment variable], [brltty_cv_env_libsearch], [dnl
case "${host_os}"
in
   hpux*)
      brltty_cv_env_libsearch="SHLIB_PATH"
      ;;
   *)
      brltty_cv_env_libsearch="LD_LIBRARY_PATH"
      ;;
esac])
libsearch_variable="${brltty_cv_env_libsearch}"
AC_SUBST([libsearch_variable])

case "${host_os}"
in
   linux*)
      system_object="linux"
      ;;
   solaris*)
      system_object="solaris"
      ;;
   hpux*)
      system_object="hpux"
      if test -d /opt/audio
      then
         SYSCFLAGS="${SYSCFLAGS} -I/opt/audio/include"
         LIBS="-L/opt/audio/lib -lAlib ${LIBS}"
         AC_DEFINE([HAVE_HPUX_AUDIO])
      fi
      ;;
   *)
      AC_MSG_ERROR([no system object available for ${host_os}])
      ;;
esac
system_object="sys_${system_object}.o"
AC_SUBST([system_object])

BRLTTY_ARG_DISABLE(
   [tainted-components],
   [components with build-time dependencies], [dnl
   brltty_tainted_components="yes"
])

BRLTTY_ARG_DISABLE(
   [preferences-menu],
   [the preferences menu], [dnl
   AC_DEFINE([ENABLE_PREFERENCES_MENU])
])

BRLTTY_ARG_DISABLE(
   [table-selection],
   [text/attribute/contraction table selection in preferences menu], [dnl
   AC_DEFINE([ENABLE_TABLE_SELECTION])
])

BRLTTY_ARG_DISABLE(
   [learn-mode],
   [interactive command learn mode], [dnl
   AC_DEFINE([ENABLE_LEARN_MODE])
])

BRLTTY_ARG_DISABLE(
   [contracted-braille],
   [in-line contracted braille], [dnl
   AC_DEFINE([ENABLE_CONTRACTED_BRAILLE])
   contracted_braille_objects="ctb_compile.o ctb_translate.o"
   install_contraction_tables=install-contraction-tables
])
AC_SUBST([contracted_braille_objects])
AC_SUBST([install_contraction_tables])

BRLTTY_ARG_DISABLE(
   [beeper-tunes],
   [tunes via beeper (console bell)], [dnl
   AC_DEFINE([ENABLE_BEEPER_TUNES])
   beeper_tune_objects="beeper.o"
])
AC_SUBST([beeper_tune_objects])

BRLTTY_ARG_DISABLE(
   [pcm-tunes],
   [tunes via PCM (soundcard digital audio)], [dnl
   AC_DEFINE([ENABLE_PCM_TUNES])
   pcm_tune_objects="pcm.o"
])
AC_SUBST([pcm_tune_objects])

BRLTTY_ARG_DISABLE(
   [midi-tunes],
   [tunes via MIDI (Musical Instrument Digital Interface)], [dnl
   AC_DEFINE([ENABLE_MIDI_TUNES])
   midi_tune_objects="midi.o"
])
AC_SUBST([midi_tune_objects])

BRLTTY_ARG_DISABLE(
   [fm-tunes],
   [tunes via FM (soundcard synthesizer)], [dnl
   AC_DEFINE([ENABLE_FM_TUNES])
   fm_tune_objects="fm.o adlib.o"
])
AC_SUBST([fm_tune_objects])

BRLTTY_ARG_DISABLE(
   [pm-configfile],
   [user customization of Papenmeier driver], [dnl
   AC_DEFINE([ENABLE_PM_CONFIGURATION_FILE])
   PM_CONFIGFILE_DEPENDENCY=configuration-file
])
AC_SUBST([PM_CONFIGFILE_DEPENDENCY])

BRLTTY_ARG_ENABLE(
   [gpm],
   [mouse tracking via GPM], [dnl
   AC_CHECK_LIB([gpm], [Gpm_Open])
])

BRLTTY_ARG_ENABLE(
   [api],
   [the application programming interface], [dnl
   AC_DEFINE([ENABLE_API])
   api_objects="api_server.o api_common.o rangelist.o"
   build_api="api"
   install_api="install-api"
   BRLTTY_SEARCH_LIBS([pthread_create], [pthread])
])
AC_SUBST([api_objects])
AC_SUBST([build_api])
AC_SUBST([install_api])
AC_SUBST([api_keyfile], [brlapi.key])
BRLTTY_DEFINE_EXPANDED([BRLAPI_AUTHFILE], ["${api_keyfile}"])

AC_CACHE_CHECK([for linkage editor flags], [brltty_cv_prog_ld_flags], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_prog_ld_flags="-export-dynamic -rpath ${execute_root}${library_directory}"
      ;;
   solaris*)
      brltty_cv_prog_ld_flags="-R ${execute_root}${library_directory}"
      ;;
   hpux*)
      brltty_cv_prog_ld_flags="-E +s +b ${execute_root}${library_directory}"
      ;;
   *)
      brltty_cv_prog_ld_flags=""
      ;;
esac])
brltty_link_flags="${brltty_cv_prog_ld_flags}"

AC_CACHE_CHECK([for static linkage flag], [brltty_cv_prog_ld_static], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_prog_ld_static="-static"
      ;;
   solaris*)
      brltty_cv_prog_ld_static="-dn"
      ;;
   hpux*)
      brltty_cv_prog_ld_static="-Bstatic"
      ;;
   *)
      brltty_cv_prog_ld_static=""
      ;;
esac])
brltty_static_flag="${brltty_cv_prog_ld_static}"
BRLTTY_ARG_ENABLE(
   [standalone-programs],
   [statically linked executables], [dnl
   brltty_standalone_programs="yes"
   brltty_link_flags="${brltty_link_flags} ${brltty_static_flag}"
])

LDFLAGS="${LDFLAGS} -Wl,`echo "${brltty_link_flags}" | sed -e '
s/^ *//
s/ *$//
s/  */ /g
y/ /,/
'`"

BRLTTY_SEARCH_LIBS([sin], [m])
BRLTTY_SEARCH_LIBS([pow], [m])
case "${host_os}"
in
   linux*)
      BRLTTY_SEARCH_LIBS([dlopen], [dl])
      ;;
   solaris*)
      BRLTTY_SEARCH_LIBS([dlopen], [dl])
      ;;
   hpux*)
      BRLTTY_SEARCH_LIBS([shl_load], [dld])
      ;;
   *)
      ;;
esac

BRLTTY_BRAILLE_DRIVER([al], [Alva])
BRLTTY_BRAILLE_DRIVER([bl], [BrailleLite])
BRLTTY_BRAILLE_DRIVER([bn], [BrailleNote])
BRLTTY_BRAILLE_DRIVER([cb], [CombiBraille])
BRLTTY_BRAILLE_DRIVER([ec], [EcoBraille])
BRLTTY_BRAILLE_DRIVER([eu], [EuroBraille])
BRLTTY_BRAILLE_DRIVER([ht], [HandyTech])
BRLTTY_BRAILLE_DRIVER([lt], [LogText])
BRLTTY_BRAILLE_DRIVER([mb], [MultiBraille])
BRLTTY_BRAILLE_DRIVER([md], [MDV])
BRLTTY_BRAILLE_DRIVER([mn], [MiniBraille])
BRLTTY_BRAILLE_DRIVER([pm], [Papenmeier])
BRLTTY_BRAILLE_DRIVER([ts], [TSI])
BRLTTY_BRAILLE_DRIVER([va], [Vario])
BRLTTY_BRAILLE_DRIVER([vd], [VideoBraille])
BRLTTY_BRAILLE_DRIVER([vh], [VarioHT])
case "${host_os}"
in
   linux*)
      BRLTTY_BRAILLE_DRIVER([vo], [Voyager])
      ;;
   *)
      ;;
esac
BRLTTY_BRAILLE_DRIVER([vs], [VisioBraille])
BRLTTY_ARG_DRIVER([braille])

AC_CACHE_CHECK([for default braille device], [brltty_cv_default_braille_device], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_default_braille_device="/dev/ttyS0"
      ;;
   solaris*)
      brltty_cv_default_braille_device="/dev/ttya"
      ;;
   hpux*)
      brltty_cv_default_braille_device="/dev/tty0p0"
      ;;
   *)
      brltty_cv_default_braille_device=""
      AC_MSG_WARN([no default braille device])
      ;;
esac])

BRLTTY_ARG_WITH(
   [braille-device], [DEVICE],
   [default braille display device],
   [braille_device], ["${brltty_cv_default_braille_device}"]
)
if test "${braille_device}" = "no"
then
   braille_device=""
elif test "${braille_device}" = "yes"
then
   braille_device="${brltty_cv_default_braille_device}"
fi
test "`expr "${braille_device}" : "/"`" -eq 0 && braille_device="/dev/${braille_device}"
AC_DEFINE_UNQUOTED([BRAILLE_DEVICE], ["${braille_device}"])
BRLTTY_SUMMARY_ITEM([braille-device], [braille_device])

BRLTTY_TEXT_TABLE([text.cz.tbl], [Czech (iso-8859-2)])
BRLTTY_TEXT_TABLE([text.da.tbl], [Danish])
BRLTTY_TEXT_TABLE([text.de.tbl], [German])
BRLTTY_TEXT_TABLE([text.es.tbl], [Spanish])
BRLTTY_TEXT_TABLE([text.fr.tbl], [French])
BRLTTY_TEXT_TABLE([text.fr-cbifs.tbl], [French (Code Braille Informatique Français Standard)])
BRLTTY_TEXT_TABLE([text.it.tbl], [Italian])
BRLTTY_TEXT_TABLE([text.nabcc.tbl], [North American Braille Computer Code])
BRLTTY_TEXT_TABLE([text.no-h.tbl], [Norwegian and German])
BRLTTY_TEXT_TABLE([text.no-p.tbl], [Norwegian])
BRLTTY_TEXT_TABLE([text.pl.tbl], [Polish (iso-8859-2)])
BRLTTY_TEXT_TABLE([text.ru.tbl], [Russian (koi8-r)])
BRLTTY_TEXT_TABLE([text.se1.tbl], [Swedish])
BRLTTY_TEXT_TABLE([text.se2.tbl], [Swedish])
BRLTTY_TEXT_TABLE([text.uk.tbl], [United Kingdom English])
BRLTTY_TEXT_TABLE([text.us.tbl], [American English])
BRLTTY_TEXT_TABLE([text.vni.tbl], [Vietnamese])
brltty_default_text_table=text.nabcc.tbl
BRLTTY_ARG_WITH(
   [text-table], [FILE],
   [default text table]brltty_tables_text,
   [text_table], ["${brltty_default_text_table}"]
)
install_text_tables=install-text-tables
if test "${text_table}" = "no"
then
   install_text_tables=
   text_table="${brltty_default_text_table}"
elif test "${text_table}" = "yes"
then
   text_table="${brltty_default_text_table}"
fi
AC_SUBST([install_text_tables])
AC_SUBST([text_table])
AC_DEFINE_UNQUOTED([TEXT_TABLE], ["${text_table}"])
BRLTTY_SUMMARY_ITEM([text-table], [text_table])

BRLTTY_ATTRIBUTES_TABLE([attributes.tbl], [])
BRLTTY_ATTRIBUTES_TABLE([attrib.tbl], [])
brltty_default_attributes_table=attributes.tbl
BRLTTY_ARG_WITH(
   [attributes-table], [FILE],
   [default attributes table]brltty_tables_attributes,
   [attributes_table], ["${brltty_default_attributes_table}"]
)
install_attributes_tables=install-attributes-tables
if test "${attributes_table}" = "no"
then
   install_attributes_tables=
   attributes_table="${brltty_default_attributes_table}"
elif test "${attributes_table}" = "yes"
then
   attributes_table="${brltty_default_attributes_table}"
fi
AC_SUBST([install_attributes_tables])
AC_SUBST([attributes_table])
AC_DEFINE_UNQUOTED([ATTRIBUTES_TABLE], ["${attributes_table}"])
BRLTTY_SUMMARY_ITEM([attributes-table], [attributes_table])

BRLTTY_ARG_DISABLE(
   [speech-support],
   [speech synthesizer support], [dnl
   AC_DEFINE([ENABLE_SPEECH_SUPPORT])
   speech_support_object="spk.o"
])
AC_SUBST([speech_support_object])

BRLTTY_SPEECH_DRIVER([al], [Alva])
BRLTTY_SPEECH_DRIVER([bl], [BrailleLite])
BRLTTY_SPEECH_DRIVER([cb], [CombiBraille])
BRLTTY_SPEECH_DRIVER([es], [ExternalSpeech])
BRLTTY_SPEECH_DRIVER([fv], [Festival])
BRLTTY_SPEECH_DRIVER([gs], [GenericSay])
BRLTTY_SPEECH_DRIVER([tv], [Televox])
if test "${brltty_tainted_components}" = "yes"
then
   AC_CHECK_HEADER([eci.h], [BRLTTY_SPEECH_DRIVER([vv], [ViaVoice])])
fi
BRLTTY_ARG_DRIVER([speech])

AC_CACHE_CHECK([for default screen driver], [brltty_cv_default_screen_driver], [dnl
case "${host_os}"
in
   linux*)
      brltty_cv_default_screen_driver="linux"
      ;;
   *)
      brltty_cv_default_screen_driver="shm"
      AC_MSG_WARN([no default screen driver - using ${brltty_cv_default_screen_driver}])
      ;;
esac])

BRLTTY_ARG_WITH(
   [screen-driver], [DRIVER],
   [screen driver],
   [screen_driver], ["${brltty_cv_default_screen_driver}"]
)
if test "${screen_driver}" = "no"
then
   screen_driver="null"
elif test "${screen_driver}" = "yes"
then
   screen_driver="${brltty_cv_default_screen_driver}"
fi
AC_SUBST([screen_object], ["scr_${screen_driver}.${OBJEXT}"])
BRLTTY_SUMMARY_ITEM([screen-driver], [screen_driver])

AC_SUBST([library_prefix], [lib])
AC_SUBST([library_name], ["${library_prefix}${PACKAGE_NAME}"])
AC_DEFINE_UNQUOTED([LIBRARY_NAME], ["${library_name}"])

brltty_driver_names=
for brltty_driver in ${brltty_item_names_braille} ${brltty_item_names_speech}
do
   if test `expr "${brltty_driver_names} " : ".* ${brltty_driver} "` -eq 0
   then
      brltty_driver_names="${brltty_driver_names} ${brltty_driver} "
   fi
done
changequote(, )dnl
brltty_setup_files="`echo "${brltty_driver_names}" | sed -e '
s%  *% %g
s% \([^ ][^ ]*\)% Drivers/\1%g
s%^%. Programs Documents BrailleTables Unicode Drivers/Voyager/kernel%
s%\([^ ][^ ]*\) %\1/Makefile:setup.mk.in:\1/Makefile.in %g
s% *$%%
'`"
changequote([, ])dnl
BRLTTY_VAR_TRIM([brltty_driver_names])
AC_SUBST([brltty_driver_names])

configuration_file_customization_script="Bootdisks/bp2cf"
AC_SUBST_FILE([configuration_file_customization_script])

AC_SUBST([install_drivers])
BRLTTY_SUMMARY_END
AC_OUTPUT([
   config.mk
   brltty.spec
   brltty.lsm
   Documents/BrlAPIref.doxy
   Drivers/Voyager/mkhlp
   ${brltty_setup_files}])
