dnl $Id: configure.in,v 1.46.2.6 2007/01/16 19:51:14 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([libggimisc],[2.2.2],[http://www.ggi-project.org/contact.html]) AC_CONFIG_SRCDIR([include/ggi/misc.h]) AC_CONFIG_MACRO_DIR(m4) dnl Put the name and version of the package here AM_INIT_AUTOMAKE([libggimisc],[2.2.2],[-]) AM_MAINTAINER_MODE dnl ======================================================================== dnl Set some defaults PATHTAG="pAtHTAg" TAGLEN="7" ggimisc_conffile="libggimisc.conf" ggi_subdir="ggi" use_debug="yes" dnl Common usable targets dnl build_x_target="auto" build_x_target="no" # x-target is disabled until someone updated it dnl Linux specific targets build_fbdev_target="auto" build_svgalib_target="auto" dnl Win32 specific targets build_directx_target="auto" 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 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! # if $prefix is set here then gcc warns about reordered system and non-system # dirs. ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` # should be ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$" | grep -v '^[^\:]*: warning:'` if we $ # (ac_err should ignore warnings produced by $ac_try_prog too) # Note, that this might be a autoconf 2.13 issue. # When we do not set prefix here, then --with-gii does NOT default to --prefix then. 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 - TARGETS: dnl Common useable Targets AC_ARG_ENABLE(x, [ --disable-x don't build the X target], build_x_target=$enableval) dnl Linux specific Targets AC_ARG_ENABLE(fbdev, [ --disable-fbdev don't build the fbdev target], build_fbdev_target=$enableval) AC_ARG_ENABLE(svgalib, [ --disable-svgalib don't build the svgalib target], build_svgalib_target=$enableval) dnl FreeBSD specific Targets dnl Win32 specific Targets AC_ARG_ENABLE(directx, [ --disable-directx don't build the directx target], build_directx_target=$enableval) dnl Helpers dnl ======================================================================== dnl Checks for header files. dnl Check for standard C headers AC_HEADER_STDC GGI_NEED_INTTYPES dnl - Check for other headers AC_CHECK_HEADERS(linux/fb.h windows.h) AC_CHECK_HEADERS(ddraw.h, [], [], [#ifdef HAVE_WINDOWS_H # include #endif]) dnl ======================================================================== dnl Checks for typedefs, structures, and compiler characteristics. dnl Check if the compiler supports the 'const' keyword, otherwise define dnl 'const' to empty. AC_C_CONST dnl Check if the compiler supports inlining. If it does define 'inline' to dnl the apropriate keyword, otherwise define it to empty. AC_C_INLINE 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 library functions. dnl ======================================================================== dnl LibGGI must be built GGI_CHECKLIB([libggimisc]) dnl ======================================================================== dnl - Checks for target-specific libraries and headers DISPLAYSUBDIRS="pseudo_stubs" DISPLAYMODULES="" if test "$enable_shared" = "yes"; then DISPLAYMODULES="$DISPLAYMODULES pseudo_stubs_ggimisc.la" fi if test "$enable_static" = "yes"; then AC_DEFINE(BUILTIN_DISPLAY, 1, [Support for builtin display targets]) fi AM_CONDITIONAL(BUILTIN_DISPLAY, test "$enable_static" = "yes") dnl Check for the function 'vga_init' in the 'vga' library. dnl If not found we disable the "svgalib" target. AC_CHECK_LIB(vga,vga_init, foo=bar, build_svgalib_target="no") dnl Use AC_PATH_XTRA if you want to build something that uses X if test "x$build_x_target" != "xno"; then AC_PATH_XTRA if test "x$no_x" = "xyes"; then build_x_target="no" fi fi dnl If linux/fb.h was not found above we disable the "fbdev" target. if test "x$ac_cv_header_linux_fb_h" != "xyes"; then build_fbdev_target="no" fi if test "x$build_fbdev_target" != "xno"; then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ int i = FB_VBLANK_VBLANKING; ]])],[foo=bar],[build_fbdev_target="no"]) fi dnl If ddraw.h was not found above we disable the "directx" target. if test "x$ac_cv_header_ddraw_h" != "xyes"; then build_directx_target="no" fi dnl ======================================================================== dnl - Check for targets AC_MSG_CHECKING(if we should build fbdev target) if test "x$build_fbdev_target" != "xno"; then DISPLAYSUBDIRS="$DISPLAYSUBDIRS fbdev" if test "$enable_shared" = "yes"; then DISPLAYMODULES="$DISPLAYMODULES fbdev_ggimisc.la" fi if test "$enable_static" = "yes"; then AC_DEFINE(BUILTIN_DISPLAY_FBDEV, 1, [Support for builtin display-fbdev]) fi build_fbdev_target="yes" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL(BUILTIN_DISPLAY_FBDEV, test "$enable_static" = "yes" -a \ "x$build_fbdev_target" != "xno") AC_MSG_CHECKING(if we should build svgalib target) if test "x$build_svgalib_target" != "xno"; then DISPLAYSUBDIRS="$DISPLAYSUBDIRS svgalib" if test "$enable_shared" = "yes"; then DISPLAYMODULES="$DISPLAYMODULES svgalib_ggimisc.la" fi if test "$enable_static" = "yes"; then AC_DEFINE(BUILTIN_DISPLAY_SVGALIB, 1, [Support for builtin display-svgalib]) fi build_svgalib_target="yes" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL(BUILTIN_DISPLAY_SVGALIB, test "$enable_static" = "yes" -a \ "x$build_svgalib_target" != "xno") AC_MSG_CHECKING(if we should build X target) if test "x$build_x_target" != "xno"; then DISPLAYSUBDIRS="$DISPLAYSUBDIRS X" if test "$enable_shared" = "yes"; then DISPLAYMODULES="$DISPLAYMODULES x_ggimisc.la" fi if test "$enable_static" = "yes"; then AC_DEFINE(BUILTIN_DISPLAY_X, 1, [Support for builtin display-x]) fi build_x_target="yes" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL(BUILTIN_DISPLAY_X, test "$enable_static" = "yes" -a \ "x$build_x_target" != "xno") AC_MSG_CHECKING(if we should build directx target) if test "x$build_directx_target" != "xno"; then DISPLAYSUBDIRS="$DISPLAYSUBDIRS directx" if test "$enable_shared" = "yes"; then DISPLAYMODULES="$DISPLAYMODULES directx_ggimisc.la" fi if test "$enable_static" = "yes"; then AC_DEFINE(BUILTIN_DISPLAY_DIRECTX, 1, [Support for builtin display-directx]) fi build_directx_target="yes" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AM_CONDITIONAL(BUILTIN_DISPLAY_DIRECTX, test "$enable_static" = "yes" -a \ "x$build_directx_target" != "xno") dnl ======================================================================== dnl Finally add some flags 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]) 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(DISPLAYSUBDIRS) AC_SUBST(DISPLAYMODULES) 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([GGIMISCTAGLEN],$TAGLEN, [The length of the tag]) AC_DEFINE_UNQUOTED([GGIMISCPATHTAG],"$PATHTAG", [Tag to identify path to $ggimisc_conffile]) AC_DEFINE_UNQUOTED([GGIMISCCONFFILE],"$ggimisc_conffile", [Name of the ggimisc config file]) AC_DEFINE_UNQUOTED([GGIMISCCONFDIR],"$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 ggimisc/Makefile display/Makefile display/pseudo_stubs/Makefile display/X/Makefile display/svgalib/Makefile display/fbdev/Makefile display/directx/Makefile display-shared/Makefile demos/Makefile doc/Makefile doc/man/Makefile m4/Makefile dist/Makefile dist/rpm/Makefile dist/rpm/libggimisc.spec libggimisc.conf ]) AC_OUTPUT