dnl $Id: configure.in,v 1.53.2.5 2007/01/16 19:54:33 cegger Exp $ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) dnl Should perhaps add the ggi-develop ML as the 3rd argument dnl to AC_INIT but someone has to take care of the spam... AC_INIT([libgiigic],[1.1.2],[http://www.ggi-project.org/contact.html]) AC_CONFIG_SRCDIR([gic/init.c]) AC_CONFIG_MACRO_DIR(m4) AM_INIT_AUTOMAKE([libgiigic],[1.1.2],[-]) AM_MAINTAINER_MODE dnl ======================================================================== dnl Set some defaults use_debug="yes" PATHTAG="pAtHTAg" TAGLEN="7" gic_conffile="libgiigic.conf" ggi_subdir="ggi" dnl ======================================================================== dnl Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_RANLIB LT_INIT([win32-dll]) dnl ======================================================================== dnl Generate libtool LT_OUTPUT dnl ======================================================================== dnl User selectable options dnl Bah! autoconf hasn't set prefix to it's default value yet! test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' GII_INST_PATH GII_UNINST_PATH GGI_INST_PATH GGI_UNINST_PATH AC_ARG_ENABLE(debug, [ --disable-debug don't build with run-time debugging (speed freaks)], use_debug=$enableval) dnl Support the --with-extra-libs and --with-extra-includes command line dnl options to 'configure'. GGI_EXTRA_PATHS dnl dnl ======================================================================== dnl Checks for platform specificas GGI_CHECK_STRING_FUNCS GGI_CC_CHECK4_OPTION([pedantic]) GGI_CHECK_IMPLICIT_DECLARATIONS dnl ======================================================================== dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_HEADER_TIME dnl Check for the extension of shared libraries (excluding the dot) and dnl put it in the @DLLEXT@ Makefile variable. GGI_DLLEXT dnl ======================================================================== dnl Checks for header files. AC_HEADER_STDC GGI_NEED_INTTYPES AC_CHECK_HEADERS(ggi/gg.h ggi/gii.h ggi/ggi.h) dnl ======================================================================== dnl LibGII must be built if test "x$ac_cv_header_ggi_gii_h" != "xyes"; then AC_MSG_ERROR([Either wrong include path is used or LibGII is not properly installed on the system. You need LibGII for building LibGIC. Please compile LibGII first.]) fi dnl Testing libs should use libtool but doesn't - grrrr! dnl This isn't a problem during the build because libtool is always used. dnl Wish I could use $LIBTOOL, but it is written for Makefile use. save_CC="$CC" CC="$SHELL ./libtool --mode=link $CC" AC_CHECK_LIB(gii,giiInit,foo=bar, AC_MSG_ERROR([LibGII is not properly installed on the system. You need LibGII for building LibGIC. Please compile LibGII first.]) ) CC="$save_CC" dnl ======================================================================== dnl Checks for optional libraries and headers RECOGNIZERMODULES="" if test "$enable_shared" = "yes"; then RECOGNIZERMODULES="$RECOGNIZERMODULES cheat.la keys.la mousebutton.la relmouse.la valuator.la" fi if test "$enable_static" = "yes"; then AC_DEFINE(BUILTIN_RECOGNIZERS, 1, [Support for builtin recognizers]) fi AM_CONDITIONAL(BUILTIN_RECOGNIZERS, test "$enable_static" = "yes") ggi_missing_part=no dnl Testing libs should use libtool but doesn't - grrrr! dnl This isn't a problem during the build because libtool is always used. dnl Wish I could use $LIBTOOL, but it is written for Makefile use. save_CC="$CC" CC="$SHELL ./libtool --mode=link $CC" AC_CHECK_LIB(ggi,ggiInit,foo=bar,ggi_missing_part=yes) CC="$save_CC" if test "$ac_cv_header_ggi_ggi_h" != "yes" -o \ "$ggi_missing_part" = "yes" ; then use_libggi=no else use_libggi=yes fi AM_CONDITIONAL([USE_LIBGGI], test "$use_libggi" = "yes") AC_MSG_CHECKING([whether to build demos depending on libggi]) AC_MSG_RESULT($use_libggi) dnl ======================================================================== dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS(strdup) dnl ======================================================================== dnl Finally add some flags dnl Reset CPPFLAGS CPPFLAGS="$ORIGCPPFLAGS" dnl _THREAD_SAFE is used instead of _REENTRANT on some systems CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE" if test "x$use_debug" = "xyes"; then CFLAGS="$CFLAGS -DDEBUG" if test "x$ac_cv_prog_cc_g" = "xyes"; then CFLAGS="$CFLAGS -g" fi fi if test "$ac_cv_c_compiler_gnu" = "yes"; then GGI_CC_CHECK4_OPTION([std=gnu99]) # Common warning flags CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wsign-compare" CFLAGS="$CFLAGS -Wstrict-prototypes -Wswitch" CFLAGS="$CFLAGS -Wmissing-prototypes -Wreturn-type -Wshadow" # Advanced warning flags CFLAGS="$CFLAGS -Wnested-externs -Wredundant-decls" CFLAGS="$CFLAGS -Wuninitialized -Wcast-qual -Wwrite-strings" if test "x$cc_has_werror_implicit_function_declaration" = "xyes"; then CFLAGS="$CFLAGS -Werror-implicit-function-declaration" fi # Buggy warning flag # CFLAGS="$CFLAGS -Wconversion" # Super advanced (only used for building releases) # CFLAGS="$CFLAGS -Werror" fi dnl ======================================================================== dnl Write output AC_SUBST(RECOGNIZERMODULES) dnl Use static_* to substitute into files where values shouldn't dnl dynamicly change. Makefiles need to be able to dynamicly change dnl paths between build and install and shouldn't use these static_*. dnl Files that will be installed must always show the final location where dnl they will reside and should use these static_* values. dnl Ensure that all static_* are fully expanded. eval static_libdir="$libdir" old_val="" until test "$static_libdir" = "$old_val"; do old_val="$static_libdir" eval static_libdir="$static_libdir" done eval static_sysconfdir="$sysconfdir" old_val="" until test "$static_sysconfdir" = "$old_val"; do old_val="$static_sysconfdir" eval static_sysconfdir="$static_sysconfdir" done case "${host}" in *-*-mingw*) dnl Find a relative path that takes us from static_sysconfdir dnl to static_libdir. GGI_SYSCONF_TO_LIB dnl The relative path from sysconfdir to sysconfdir is simple. ggi_sysconfdir="." ;; *) dnl Usually good to use an absolute path. ggi_sysconfdir_to_libdir="$static_libdir/$ggi_subdir" ggi_sysconfdir="$static_sysconfdir/$ggi_subdir" ;; esac AC_SUBST(ggi_subdir) AC_SUBST(ggi_sysconfdir_to_libdir) AC_SUBST(ggi_sysconfdir) AC_SUBST(static_libdir) AC_SUBST(static_sysconfdir) AC_DEFINE_UNQUOTED([GICTAGLEN],$TAGLEN, [The length of the tag]) AC_DEFINE_UNQUOTED([GICPATHTAG],"$PATHTAG", [Tag to identify path to $gic_conffile]) AC_DEFINE_UNQUOTED([GICCONFFILE],"$gic_conffile", [Name of LibGIC master config file]) AC_DEFINE_UNQUOTED([GICCONFDIR],"$PATHTAG$static_sysconfdir/$ggi_subdir", [Tag plus path to config dir]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile include/Makefile include/ggi/Makefile include/ggi/internal/Makefile gic/Makefile recognizers/Makefile recognizers/cheat/Makefile recognizers/keys/Makefile recognizers/mousebutton/Makefile recognizers/relmouse/Makefile recognizers/valuator/Makefile recognizers-shared/Makefile actionlib/Makefile programs/Makefile programs/demos/Makefile programs/snazzymgr/Makefile programs/utils/Makefile doc/Makefile doc/man/Makefile m4/Makefile libgiigic.conf ]) AC_OUTPUT