www.pudn.com > xvoice-0.8.1.rar > configure.in


dnl Process this file with autoconf to produce a configure script.
dnl XV=xvoice

dnl XVoice definitions
PACKAGE=xvoice

dnl Gtk+ and Gtk-- version dependencies 
gtk_min_maj_rev=1
gtk_min_min_rev=2
gtk_min_mic_rev=0

AC_INIT(src/Target.h)
AM_INIT_AUTOMAKE(xvoice, "0.8.1")
AM_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_LANG_CPLUSPLUS
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

AC_ARG_PROGRAM

dnl Checks for libraries.
AC_CHECK_LIB(smapi, SmOpen, have_smapi=yes, have_smapi=no)
if test "$have_smapi" = "no"; then
	AC_MSG_ERROR(*** ViaVoice SMAPI NOT found. Is ViaVoice installed? ***)
else
	XV_VV_LIBS="-L/usr/lib/ViaVoice/lib"
	XV_VV_CFLAGS="-I/usr/lib/ViaVoice/include"
	AC_DEFINE(HAVE_SMAPI)
fi

AM_CONDITIONAL(HAVE_SMAPI, test x$have_smapi = xyes)

dnl Checks for header files.
AC_PATH_X
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
dnl AC_C_CONST


dnl 
dnl Test for gnome-config
dnl 
AC_CHECK_PROG(GNOME_CONFIG, gnome-config, yes, no)
if test "$GNOME_CONFIG" = "no"; then
	AC_MSG_ERROR(*** gnome-config NOT found. Is gnome installed? ***)
else
	XV_GNOME_LIBS=`gnome-config --libs gnomeui`
	XV_GNOME_CFLAGS=`gnome-config --cflags gnomeui`
	XV_GNOME_VERSION=`gnome-config --version`
fi

dnl 
dnl Test for gtk-config
dnl 
AC_CHECK_PROG(GTK_CONFIG, gtk-config, yes, no)
if test "$GTK_CONFIG" = "no"; then
	AC_MSG_ERROR(*** gtk-config NOT found. Is gtk+ installed? ***)
else
dnl	XV_GTK_LIBS=`gtk-config --libs`
dnl	XV_GTK_CFLAGS=`gtk-config --cflags`
	XV_GTK_VERSION=`gtk-config --version`
fi


dnl 
dnl Make sure we have a valid major GTK version 
dnl 
AC_MSG_CHECKING(if GTK+ version (1.2) is used)
gtk_maj_rev=`echo $XV_GTK_VERSION | cut -f1-2 -d.`
if test "$gtk_maj_rev" = "1.2" ; then
	AC_MSG_RESULT(yes ($gtk_maj_rev))

	dnl Make sure we have a valid minor GTK version 
	AC_MSG_CHECKING(if proper GTK+ revision is used)
	gtk_min_rev=`echo $XV_GTK_VERSION | cut -f3 -d.`
	min_ver_ok="F"

	dnl if test "$gtk_min_rev" = "0"; then
	dnl 	min_ver_ok="T"
	dnl fi
	dnl
	dnl if test "$gtk_min_rev" = "1"; then
	dnl 	min_ver_ok="U"
	dnl fi

	min_ver_ok="T"

	if test "$min_ver_ok" = "T"; then
		AC_MSG_RESULT(yes ($gtk_min_rev))
	fi

	if test "$min_ver_ok" = "U"; then
		AC_MSG_RESULT(yes ($gtk_min_rev) untested)
	fi

	if test "$min_ver_ok" = "F"; then
		AC_MSG_RESULT(no ($gtk_min_rev))
		AC_MSG_RESULT(*** Error: gtk minor version revision ($gtk_min_rev) won't work with required Gtk-- ***)
		AC_MSG_ERROR(See the README file on which versions of Gtk you need!)
	fi
else
	AC_MSG_RESULT(no ($gtk_maj_rev))
	AC_MSG_RESULT(*** Error: Gtk+ version ($gtk_maj_rev) < won't work ***)
	AC_MSG_ERROR(Check the README file on which versions of Gtk+ you need!)
fi

dnl 
dnl make sure C++ compiler is powerful/complete enough
dnl 
AC_MSG_CHECKING(if C++ compiler supports bool (required))
AC_TRY_COMPILE(
[
],[
   bool b=true;
   bool b1=false;
],[
  ac_bool=yes
],[
  config_error=yes
  AC_WARN(bool type is not supported by your compiler)
])
AC_MSG_RESULT([$ac_bool])

dnl AC_MSG_CHECKING(if C++ environment has working string class (required))
dnl AC_TRY_LINK(
dnl [
dnl #include 
dnl   class foo {
dnl   public:
dnl     void f(const string &s);
dnl   };
dnl   void foo::f(const string &s) {
dnl     f(s.c_str());
dnl   }
dnl ],[
dnl    foo f1;
dnl    f1.f("test");
dnl ],[
dnl   gtkmm_string_ok=yes
dnl ],[
dnl   gtkmm_string_ok=no
dnl   config_error=yes
dnl   AC_WARN(C++ compilers string support does not work)
dnl ])
dnl AC_MSG_RESULT([$gtkmm_string_ok])


dnl
dnl check if the previous C++ tests went OK
dnl
AC_MSG_CHECKING(if C++ environment provides all required features)
if test "x$config_error" = xyes ; then
  AC_MSG_RESULT([no])
  AC_WARN(*** )
  AC_WARN(*** Your compiler is not powerful enough to compile ***)
  AC_WARN(*** terraform. See the configure output and log for ***) 
  AC_WARN(*** details. Egcs 1.1.2 works for me.               ***)
  AC_WARN(*** )
  AC_MSG_ERROR(Config error - exiting ...)
fi
AC_MSG_RESULT([yes])


AC_SUBST(XV_CFLAGS)
AC_SUBST(XV_CXXFLAGS)
dnl AC_SUBST(XV_GTK_CFLAGS)
dnl AC_SUBST(XV_GTK_LIBS)
AC_SUBST(XV_GNOME_CFLAGS)
AC_SUBST(XV_GNOME_LIBS)
AC_SUBST(XV_VV_CFLAGS)
AC_SUBST(XV_VV_LIBS)

AC_OUTPUT(Makefile \
	src/Makefile \
	src/expat/Makefile \
	xvoice.spec)