[go: up one dir, main page]

Menu

[3cb4b9]: / configure.in  Maximize  Restore  History

Download this file

976 lines (825 with data), 33.0 kB

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

dnl ========================================================= Initialization ===
dnl --------------------------------------------------------- Setup autoconf ---
dnl
AC_INIT(configure.in)
AC_PREREQ([2.50])
AC_CONFIG_HEADER(src/config.h)
AC_CANONICAL_TARGET

dnl --------------------------------------------------- Some basic variables ---
dnl
TARGETS=base
APPLICATIONS='icewm icewm-session icesh icewmhint icewmbg icewmtray'
TESTCASES=`echo src/test*.cc | sed 's%src/\([[^ ]]*\)\.cc%\1%g'`
TESTCASES="$TESTCASES iceview icesame iceicon icerun icelist" # iceclock 
features=''

dnl ---------- Checking for a C compiler in hope that it understands C++ too ---
dnl
AC_LANG_CPLUSPLUS
AC_PROG_CXX

dnl ----------- If both CC and CXX are GNU compilers, it is better to use CC ---
dnl ---- for linking. 
dnl Unfortunately this has problems with newer g++/gcc/... :(
dnl if test x"$ac_cv_prog_gxx" != x; then
dnl    AC_PROG_CC
dnl    if test x"$ac_cv_prog_gcc" != x; then
dnl        CXX_LINK=${CC}
dnl        AC_DEFINE(NEED_ALLOC_OPERATORS, 1, 
dnl          [ Define if you need an implementation of the allocation operators. (gcc 3.0) ])   
dnl    fi
dnl fi

dnl ---------- Also check how to turn off RTTI and exception handling ---

dnl --- SunONE C++ supports no-rtti flag only in compat=4 mode
if test -z "`${CXX} -V 2>&1 | grep Sun`"; then
  ICE_CXX_FLAG_ACCEPT(no_rtti, -fno-rtti)
fi
dnl --- Intel C++ supports -fno-rtti, but doens't support -fno-*-exceptions
if test $(basename $CXX) != "icc"; then
  if test -n "`${CXX} -V 2>&1 | grep Sun`"; then
    dnl --- Sun ONE C++ syntax for "no exceptions"
    ICE_CXX_FLAG_ACCEPT(no_exceptions, -features=no%except)
  else
    if test $(basename $CXX) = "g++" ||
       test $(basename $CXX) = "gcc"; then
      ICE_CXX_FLAG_ACCEPT(no_exceptions, -fno-exceptions)
      if test x"$no_exceptions_ok" = xno; then
        ICE_CXX_FLAG_ACCEPT(no_exceptions, -fno-handle-exceptions)
      fi
    fi
  fi
fi

if test $(basename $CXX) = "g++" ||
   test $(basename $CXX) = "gcc" ; then
  ICE_CXX_FLAG_ACCEPT(warn_xxx, -Wall -Wpointer-arith -Wconversion -Wwrite-strings -Winline -Woverloaded-virtual -W)
  ICE_CXX_FLAG_ACCEPT(permissive, -fpermissive)  
else
  dnl --- Sun ONE doesn't support GCC -W* and -fpermissive
  dnl --- Intel C++ doesn't supports lots of GCC -W* and -fpermissive
  if test $(basename $CXX) = "icc"; then
    dnl --- Using -w0 to avoid noisy "remark" messages 
    ICE_CXX_FLAG_ACCEPT(warn_xxx, -w0)
  fi
fi

if test x"$CXX_LINK" = x; then
  CXX_LINK=$CXX
fi

AC_SUBST(CXX_LINK)

if test x"$HOSTCXX" = x; then
  HOSTCXX=$CXX
fi

AC_SUBST(HOSTCXX)

if test x"$HOSTCXX_LINK" = x; then
  HOSTCXX_LINK=$CXX
fi

AC_SUBST(HOSTCXX_LINK)

#this test is broken, because AC_TRY_LINK calls g++
#AC_MSG_CHECKING([if we need our own C++ allocation operators])
#AC_TRY_LINK([ void icewm_alloc() {
#  char * cp = new char; delete cp;
#  char *ca = new char[23]; delete[] ca; } ],,
#  [ AC_MSG_RESULT(no) ],
#  [ AC_MSG_RESULT(yes)
#    AC_DEFINE(NEED_ALLOC_OPERATORS, 1, 
#      [ Define if you need an implementation of the allocation operators. (gcc 3.0) ]) ])

AC_PROG_INSTALL

dnl ================================ Checks for things which don't require X ===
dnl ------------------------------------------------ Checks for header files ---
dnl
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/ioctl.h sys/time.h unistd.h)
AC_CHECK_HEADERS(linux/threads.h linux/tasks.h)
AC_CHECK_HEADERS(sched.h sys/dkstat.h sys/param.h sys/sysctl.h uvm/uvm_param.h)

AC_CHECK_HEADERS(libgen.h)	dnl --  basename() for FreeBSD
AC_CHECK_HEADERS(machine/apmvar.h)
AC_CHECK_HEADERS(machine/apm_bios.h)

AC_CHECK_HEADERS(kstat.h,
  [ CORE_LIBS="${CORE_LIBS} -lkstat"

    AC_MSG_CHECKING([if have old kstat])
    AC_TRY_COMPILE([#include <kstat.h>], [kstat_named_t k; k.value.ui32],
      [ AC_MSG_RESULT(no) ],
      [ AC_MSG_RESULT(yes) 
        AC_DEFINE(HAVE_OLD_KSTAT, 1,
	  [define if have old kstat (Solaris only?)])])])

dnl ---------- Checks for typedefs, structures, and compiler characteristics ---
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)

dnl ------------------------------------------- Checks for library functions ---
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gettimeofday putenv select socket strtol strtoul basename)
AC_CHECK_FUNCS(sysctlbyname)
AC_FUNC_SELECT_ARGTYPES

dnl ------ Checking for getloadavg(). Compatible with gcc 3.3 on FreeBSD 5.2 ---
AC_MSG_CHECKING([for getloadavg])
AC_TRY_LINK([#include <stdlib.h>],
 [double loadavg[3]; getloadavg(loadavg, 3) == 0;],
 [ AC_MSG_RESULT(yes)
   AC_DEFINE(HAVE_GETLOADAVG2, 1, [getloadavg() is available])],
 [ AC_MSG_RESULT(no)  ])

dnl ---------------------------------------- Check for kern.cp_time MIB item ---
AC_MSG_CHECKING([for kern.cp_time])
if /sbin/sysctl kern.cp_time 2>&1 | grep 'kern.cp_time *[[:=]]' >/dev/null; then
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_SYSCTL_CP_TIME, 1, [kern.cp_time MIB item is available])
else
  AC_MSG_RESULT(no)
fi

dnl ------------------------------------------------------- Checking for X11 ---
AC_PATH_XTRA

if test x"$no_x" != x; then
  AC_MSG_ERROR([X Window System or development libraries not found. Make sure you have headers and libraries installed!])
fi

dnl ===================================================== Maintaince Support ===
dnl
AC_ARG_ENABLE(depend,
  [  --enable-depend Automatic .h dependencies. Requires GNU make and gcc.],
  [ if test "${enable_depend}" != "no"; then
      features="${features} depend"
      GCCDEP=-MMD
    fi ])

AC_ARG_ENABLE(debug,
  [  --enable-debug          Use this option if you want to debug IceWM],
  [ if test "${enable_debug}" = "yes"; then
      AC_DEFINE(DEBUG, 1, [Define if you want to debug IceWM])
      DEBUG="-g -DDEBUG -O0"
      features="${features} debugging-symbols"
    else
      DEBUG=
    fi ])

dnl =========================================================== I18N Support ===
dnl
AC_ARG_ENABLE(i18n,
  [  --disable-i18n          Disable internationalization])
if test "$enable_i18n" != "no"; then
      AC_CHECK_HEADERS(langinfo.h,,
      [ AC_MSG_ERROR([I18N support has been requested but langinfo.h wasn´t found.
*** Check your system configuration.])])
      AC_CHECK_FUNC(nl_langinfo,,
      [ AC_MSG_ERROR([I18N support has been requested but nl_langinfo wasn´t found.
*** Check your system configuration.])])

      ice_nl_codesets=""

      ICE_CHECK_NL_ITEM(CODESET,
        [ ice_nl_codesets="${ice_nl_codesets} CODESET," ])
      ICE_CHECK_NL_ITEM(_NL_CTYPE_CODESET_NAME,
        [ ice_nl_codesets="${ice_nl_codesets} _NL_CTYPE_CODESET_NAME," ])

      if test "${ice_nl_codesets}" = ""; then
        AC_MSG_ERROR([I18N support has been requested but nl_langinfo doesn't
*** return any information about the locale's codeset. Check your manuals.
*** Ask your vendor. Contact icewm-devel@lists.sourceforge.net when you know 
*** the name of the locale-dependent parameter for your platform.])
      fi

      ice_nl_codesets="${ice_nl_codesets} 0"
      AC_DEFINE_UNQUOTED(CONFIG_NL_CODESETS, ${ice_nl_codesets},
        [define how to query the current locale's codeset])

      ice_iconv_cxxflags="${CXXFLAGS}"

      AC_CHECK_HEADERS(iconv.h,,
      [ AC_MSG_ERROR([I18N support has been requested but iconv.h wasn´t found.
*** Check your system configuration.
***
*** You might have to upgrade your C runtime library. If your system is 
*** based on the GNU C library (glibc) you'll need version 2.2 or newer.
*** You also have the chance to install GNU libiconv available
*** from ftp://ftp.gnu.org/pub/gnu/libiconv/.
***
*** Alternatively you could call configure with the --disable-i18n switch.])])

      AC_CHECK_DECL(_libiconv_version,
      [ AC_MSG_RESULT(assuming iconv.h belongs to GNU libiconv)
        LIBS="-liconv $LIBS"
        AC_TRY_LINK([#include <iconv.h>], [iconv(0,0,0,0,0);],
        AC_TRY_LINK([#include <iconv.h>], [iconv_open(0,0);],
        AC_TRY_LINK([#include <iconv.h>], [iconv_close(0);],
	CXXFLAGS="${CXXFLAGS}"
	CORE_LIBS="${CORE_LIBS} -liconv"
	AC_DEFINE(CONFIG_LIBICONV, 1, [Define when using libiconv]),
        AC_MSG_ERROR([iconv.h appears to be part of libiconv but linking failed.
*** Check your system configuration.
***
*** You might have to upgrade your C runtime library. If your system is 
*** based on the GNU C library (glibc) you'll need version 2.2 or newer.
*** You also have the chance to install GNU libiconv available
*** from ftp://ftp.gnu.org/pub/gnu/libiconv/.
***
*** Alternatively you could call configure with the --disable-i18n switch.]))))],

      [ AC_MSG_RESULT(assuming iconv.h belongs to the C library)
        AC_CHECK_FUNCS(iconv iconv_open iconv_close,,
        AC_MSG_ERROR([iconv.h appears to be part of libc but linking failed.
*** Check your system configuration.
***
*** You might have to upgrade your C runtime library. If your system is 
*** based on the GNU C library (glibc) you'll need version 2.2 or newer.
*** You also have the chance to install GNU libiconv available
*** from ftp://ftp.gnu.org/pub/gnu/libiconv/.
***
*** Alternatively you could call configure with the --disable-i18n switch.]))],
      [#include <iconv.h>])

      AC_ARG_WITH(unicode-set,
        [  --with-unicode-set=CODESET   your iconv's unicode set in machine endian encoding
                          (e.g. WCHAR_T, UCS-4-INTERNAL, UCS-4LE, UCS-4BE)],
	   AC_DEFINE_UNQUOTED(CONFIG_UNICODE_SET, "$with_unicode_set",
	     [preferred Unicode set]),
	   with_unicode_set=UCS-4//TRANSLIT)

      if test "$with_unicode_set" = "UCS-4//TRANSLIT" ; then

          ice_sufficent_iconv=no
    
          ICE_CHECK_CONVERSION(UTF-8,$with_unicode_set,no,$ice_libiconv,
              ice_sufficent_iconv=yes)
              
          if test "$ice_sufficent_iconv" != "yes"
          then
            AC_MSG_WARN([Your implementation of iconv doesn't grok TRANSLIT])
            with_unicode_set=UCS-4
          fi
      fi
      
      ice_sufficent_iconv=no
      
      ICE_CHECK_CONVERSION(ISO-8859-1,$with_unicode_set,no,$ice_libiconv,
      ICE_CHECK_CONVERSION(ISO-8859-2,$with_unicode_set,no,$ice_libiconv,
      ICE_CHECK_CONVERSION(UTF-8,$with_unicode_set,no,$ice_libiconv,
          ice_sufficent_iconv=yes)))

      CXXFLAGS="${ice_iconv_cxxflags}"

      if test "$ice_sufficent_iconv" != "yes"
      then
        AC_MSG_ERROR([Your implementation of iconv isn't able to perform
*** the codeset conversions required. Check your system configuration.
***
*** You might have to upgrade your C runtime library. If your system is 
*** based on the GNU C library (glibc) you'll need version 2.2 or newer.
*** You also have the chance to install GNU libiconv available
*** from ftp://ftp.gnu.org/pub/gnu/libiconv/.
***
*** Alternatively you could call configure with the --disable-i18n switch.])
      fi

      AC_DEFINE(CONFIG_I18N, 1, [Define to enable internationalization])
      features="${features} i18n"
fi

dnl ============================================================ NLS Support ===
dnl
AC_ARG_ENABLE(nls,
  [  --disable-nls           Disable internationalized message])

if test "$enable_nls" != "no"; then
  AC_CHECK_FUNC(bindtextdomain,,
  [ AC_CHECK_LIB(intl, bindtextdomain,
    [ CORE_LIBS="${CORE_LIBS} -lintl"
    ],
    [ AC_MSG_ERROR([NLS (national language support) has been requested but 
*** the 'bindtextdomain' function neither has been found in your C runtime library 
*** nor in an external library called 'libintl'.
***
*** Install your vendor's version of libintl or get GNU gettext available 
*** from ftp://ftp.gnu.org/pub/gnu/gettext/.
***
*** Alternatively you could call configure with the --disable-nls switch.])])])

  AC_DEFINE(ENABLE_NLS, 1, [Define to enable internationalized message])
  features="${features} nls"
  TARGETS=$TARGETS' nls'

  AC_PATH_PROG(XGETTEXT, xgettext)
  AC_PATH_PROG(MSGMERGE, msgmerge)
  AC_PATH_PROG(MSGFMT, msgfmt)
  
  MSGMERGE="${MSGMERGE}" # --indent --verbose"
  MSGFMT="${MSGFMT}" # --check --statistics --verbose"
  
  if test ! -x "$MSGFMT" ; then
     AC_MSG_ERROR(['msgfmt' not found. Perhaps you need to install 'gettext'?.])
  fi


  AC_SUBST(XGETTEXT)
  AC_SUBST(MSGMERGE)
  AC_SUBST(MSGFMT)

  NLS_SOURCES=`grep -l '\<_\>' "src/"*.cc | sed 's%^%\$(top_srcdir)/%g'`
  NLS_SOURCES=`echo ${NLS_SOURCES}`
  NLS_POFILES=`cd "${srcdir}/po"; echo *.po`
  NLS_POXFILES=`echo ${NLS_POFILES} | sed 's%\.po%.pox%g'`
  NLS_MOFILES=`echo ${NLS_POFILES} | sed 's%\.po%.mo%g'`

  AC_SUBST(NLS_SOURCES)
  AC_SUBST(NLS_POFILES)
  AC_SUBST(NLS_POXFILES)
  AC_SUBST(NLS_MOFILES)

  localedir='${datadir}/locale'
fi

dnl ================================================ Features of the XServer ===
dnl
CORE_CFLAGS="${X_CFLAGS}"
CORE_LIBS="${X_PRE_LIBS} ${CORE_LIBS} -lX11 ${X_LIBS} ${X_EXTRA_LIBS}"

no_x_libs=$LIBS
LIBS=$CORE_LIBS

AC_CHECK_LIB(X11, XInternAtoms,
  [ AC_DEFINE(HAVE_XINTERNATOMS, 1, [Define to enable XInternAtoms]) ])

AC_ARG_ENABLE(sm,
  [  --disable-sm            Don't support the X session managment protocol])
  if test "$enable_sm" != "no"; then
    AC_CHECK_LIB(ICE, IceConnectionNumber,
      [ AC_DEFINE(CONFIG_SESSION, 1, [Define to support the X session managment protocol]) ],
      [ AC_MSG_WARN([Unable to use X shared memory extension]) ])
  fi

ac_have_shape=no
AC_ARG_ENABLE(shape,
  [  --disable-shape         Don't use X shape extension])
  if test "$enable_shape" != "no"; then
    AC_CHECK_LIB(Xext, XShapeCombineRectangles,
      [ CORE_LIBS="${CORE_LIBS} -lXext"
        AC_DEFINE(CONFIG_SHAPE, 1, [Define to enable X shape extension])
	ac_have_shape=yes ],
      [ AC_MSG_WARN([Unable to use X shape extension]) ])
  fi

if test "$ac_have_shape" = "yes"; then
AC_ARG_ENABLE(shaped-decorations,
[  --disable-shaped-decorations
                          Disable transparent frame decoration (titlebar,
                          borders), requires X shape extension (experimental) ])
  if test "$enable_shaped_decorations" != "no"; then
    AC_DEFINE(CONFIG_SHAPED_DECORATION, 1, [Define to allow transparent frame borders.])
    features="${features} shaped-decorations"
  fi
fi

AC_ARG_ENABLE(gradients,
[  --enable-gradients      Support gradients (experimental,
                          implies --enable-antialiasing) ])
  if test "$enable_gradients" = "yes"; then
    AC_DEFINE(CONFIG_GRADIENTS, 1, [Define to enable gradient support.])
    enable_antialiasing=yes
    features="${features} gradients"
  fi

AC_ARG_ENABLE(antialiasing,
[  --enable-antialiasing   Support antialiasing (experimental,
                          implies --enable-xfreetype) ])
  if test "$enable_antialiasing" = "yes"; then
    AC_DEFINE(CONFIG_ANTIALIASING, 1, [Define to enable antialiasing.])
    features="${features} antialiasing"
    
    if test "$enable_xfreetype" = "" ; then
      enable_xfreetype=implied
    fi
  fi

AC_ARG_ENABLE(xrandr,
[ --disable-xrandr         Disable XRANDR extension support])
  if test "$enable_xrandr" != "no"; then
    AC_DEFINE(CONFIG_XRANDR, 1, [Define to enable XRANDR extension])
    CORE_LIBS="$LIBS -lXrandr -lXrender -lXext"
  fi

AC_ARG_ENABLE(corefonts,
[  --enable-corefonts   Support X11 core fonts])

AC_ARG_ENABLE(xfreetype,
[  --disable-xfreetype     Don't use XFreeType for text rendering.
                          Requires --enable-i18n. ])
  
  if test "$enable_corefonts" != "yes" -a "$enable_xfreetype" = no; then
     AC_MSG_ERROR("xfreetype or core fonts must be enabled")
  fi
  if test "$enable_xfreetype" != "no" -o "$enable_xfreetype" = "implied"; then
    AC_PATH_PROG(XFT_CONFIG, xft-config,, ${with_xft_arg-${PATH}})
    if test "${XFT_CONFIG}" = ""; then
      AC_PATH_PROG(PKG_CONFIG, pkg-config)
      if test "${PKG_CONFIG}" != ""; then
        ${PKG_CONFIG} xft 2>/dev/null
        if test $? -eq 0 ; then
          XFT_CONFIG='pkg-config xft'
        fi
      fi
    fi
    if test "${XFT_CONFIG}" != ""; then
      XFT_CFLAGS=`${XFT_CONFIG} --cflags`
      XFT_LIBS=`${XFT_CONFIG} --libs`
      AC_DEFINE(CONFIG_XFREETYPE, 2, [Define to enable XFreeType support.])
      CORE_CFLAGS="${CORE_CFLAGS} $XFT_CFLAGS"
      CORE_LIBS="${CORE_LIBS} $XFT_LIBS"
      features="${features} xfreetype"
    else
      AC_CHECK_HEADERS(X11/Xft/Xft.h,
      [ AC_CHECK_LIB(Xft, XftDrawCreate,
        [ AC_DEFINE(CONFIG_XFREETYPE, 1, [Define to enable XFreeType support.])
          CORE_LIBS="${CORE_LIBS} -lXft"
          enable_corefonts=yes
          features="${features} xfreetype" ],
        [ if test "$enable_xfreetype" != "implied"; then
            AC_MSG_ERROR([Xft support has been requested but libraries were not found.
  *** Configure your X server to support XFreeType.
  *** Information about how to do this can be found in RELNOTES for XFree86.])
          fi ])],
      [ if test "$enable_xfreetype" != "implied"; then
          AC_MSG_ERROR([Xft support has been requested but headers were not found.
  *** Configure your X server to support XFreeType.
  *** Information about how to do this can be found in RELNOTES for XFree86.])
          fi ])
    fi
  fi

  if test "$enable_corefonts" = "yes"; then
    AC_DEFINE(CONFIG_COREFONTS, 1, [Define to enable X11 core conts.])
    features="${features} corefonts"
  fi

dnl ============================================================= GUI Events ===
dnl
AC_ARG_ENABLE(guievents,
  [  --enable-guievents      Enable GUI events (experimental)],
  [ if test "$enable_guievents" != "no"; then
      AC_DEFINE(CONFIG_GUIEVENTS, 1, [Define to enable GUI events support.])
      features="${features} gui-events"
      
      AC_ARG_WITH(icesound,
	[  --with-icesound=interfaces]
        [                  List of audio interfaces for icesound. Requires]
        [                  support for GUI events. Default: OSS,Y,ESound],,
	[ with_icesound='OSS,Y,ESound' ])

      for iface in `[ echo ${with_icesound} | 
      		      sed -e 's/\([^,][^,]*\)\(,\|$\)/\1 /g' ]`; do
	case ${iface} in
	  OSS|oss)
	    AC_DEFINE(ENABLE_OSS, 1, [Define to enable OSS support.])
	    CONFIG_OSS=yes;;

	  Y|Y2|YIFF|y|y2|yiff)
	    AC_CHECK_HEADERS(Y2/Y.h,
	    AC_CHECK_LIB(Y2, YOpenConnection,
	      [ AC_DEFINE(ENABLE_YIFF, 1, [Define to enable YIFF support.])
		AUDIO_LIBS="${AUDIO_LIBS} -lY2"
		CONFIG_YIFF=yes ]));;

	  ESound|ESD|esound|esd)
	    AC_ARG_WITH(esd-config,
	      [  --with-esd-config=path  Path to esd-config],
	      [  ESD_CONFIG=$with_esd_config ],
	      [  AC_PATH_PROG(ESD_CONFIG, esd-config) ])

            if test "${ESD_CONFIG}" != ""; then
              ESD_CFLAGS="`${ESD_CONFIG} --cflags`"
              ESD_LIBS="`${ESD_CONFIG} --libs`"
	      
              ac_flags="$CXXFLAGS ${ESD_CFLAGS}"
	      ac_libs="$LIBS ${ESD_LIBS}"
	      
#	      CXXFLAGS="${CXXFLAGS} ${ESD_CFLAGS}"
#	      LIBS="${LIBS} ${ESD_LIBS}"

	      AC_CHECK_HEADERS(esd.h,,
		[ AC_MSG_ERROR([Invalid compiler flags returned by ${ESD_CONFIG}.
*** Check your installation.])])
	      AC_CHECK_LIB(esd, esd_open_sound,,
		[ AC_MSG_ERROR([Invalid linker flags returned by ${ESD_CONFIG}.
*** Check your installation.])])

	      CXXFLAGS="$ac_flags"
	      LIBS="$ac_libs"

	      AC_DEFINE(ENABLE_ESD, 1, [Define to enable ESD support.])

              AUDIO_CFLAGS="${AUDIO_CFLAGS} ${ESD_CFLAGS}"
              AUDIO_LIBS="${AUDIO_LIBS} ${ESD_LIBS}"

	      CONFIG_ESD=yes
	    fi;;
	  *)
	    AC_MSG_WARN([Invalid audio interface: ${iface}])
	esac
      done

      for iface in OSS YIFF ESD; do
	eval test \"\${CONFIG_${iface}}\" = "yes" &&
	audio_support="${audio_support} ${iface}"
      done

      if test "${audio_support}" = ""; then
	AC_MSG_ERROR([You have to specify at least one valid audio interface.])
      else
	APPLICATIONS="${APPLICATIONS} icesound"
      fi
    fi ])

AC_ARG_ENABLE(xinerama,
  [  --disable-xinerama      Disable xinerama support])
  if test "$enable_xinerama" = "no"; then 
    echo ; 
  else
    LIBS="$LIBS -lXinerama -lXext "
    AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
      [
        CORE_LIBS="-lXinerama $CORE_LIBS"
        AC_DEFINE(XINERAMA, 1, [Define to enable Xinerama support])],
      [ AC_MSG_ERROR([Xinerama can not be found])])
  fi

AC_ARG_ENABLE(x86-asm,
  [  --disable-x86-asm       Don't use optimized x86 assembly code ])

  case $target_cpu in
    i[[3-6]]86) ice_x86_target=yes;;
    *) ice_x86_target=no;;
  esac

  if test "$ice_x86_target" = "yes"; then
    test "$enable_x86_asm" != "no" && enable_x86_asm=yes \
                                   || enable_x86_asm=no
  fi

  if test "$enable_x86_asm" = "yes"; then
    AC_DEFINE(CONFIG_X86_ASM, 1, [Define to enable x86 assembly code.])
    features="${features} x86-asm"
  fi

AC_ARG_ENABLE(prefs,
  [  --disable-prefs         Disable configurable preferences])
  if test "$enable_prefs" = "no"; then
    AC_DEFINE(NO_CONFIGURE, 1, [Define to disable preferences support.])
  fi

AC_ARG_ENABLE(keyconf,
  [  --disable-keyconf       Disable configurable keybindings])
  if test "$enable_keyconf" = "no"; then
    AC_DEFINE(NO_KEYBIND, 1, [Define to disable keybinding support.])
  fi

AC_ARG_ENABLE(menuconf,
  [  --disable-menuconf      Disable configurable menus])
  if test "$enable_menuconf" = "no"; then
    AC_DEFINE(NO_CONFIGURE_MENUS, 1, [Define to disable configurable menu support.])
  fi

AC_ARG_ENABLE(winoptions,
  [  --disable-winoptions    Disable configurable window options])
  if test "$enable_winoptions" = "no"; then
    AC_DEFINE(NO_WINDOW_OPTIONS, 1, [Define to disable configurable window options support.])
  fi

dnl ======================================== Stripped down versions of IceWM ===
dnl
AC_ARG_ENABLE(taskbar,
  [  --disable-taskbar       Disable builtin taskbar])
  if test "$enable_taskbar" = "no"; then
    echo;
  else 
    AC_DEFINE(CONFIG_TASKBAR, 1, [Define to to enable the builtin taskbar.])
  fi

AC_ARG_ENABLE(winmenu,
  [  --disable-winmenu       Disable the window list menu])
  if test "$enable_winmenu" = "no"; then
    echo;
  else 
    AC_DEFINE(CONFIG_WINMENU, 1, [Define to to enable the window list menu.])
  fi

AC_ARG_ENABLE(lite,
  [  --enable-lite           Build lightweight version of IceWM],,
  [ enable_lite=no ])
  if test "${enable_lite}" != "yes"; then
    AC_DEFINE(CONFIG_TOOLTIP, 		1,	[Tooltips])
    if test "${enable_taskbar}" != "no"; then
      AC_DEFINE(CONFIG_TASKBAR, 		1,	[Taskbar])
      AC_DEFINE(CONFIG_ADDRESSBAR,	1,	[Address bar])
      AC_DEFINE(CONFIG_TRAY, 		1,	[Window tray])
      AC_DEFINE(CONFIG_APPLET_MAILBOX,	1,	[Mailbox applet])
      AC_DEFINE(CONFIG_APPLET_CPU_STATUS,	1,	[CPU status applet])
      AC_DEFINE(CONFIG_APPLET_NET_STATUS,	1,	[Network status applet])
      AC_DEFINE(CONFIG_APPLET_CLOCK,	1,	[LCD clock applet])
      AC_DEFINE(CONFIG_APPLET_APM,	1,	[APM status applet])
    fi
    AC_DEFINE(CONFIG_WINLIST,		1,	[OS/2 like window list])
    if test "${enable_winmenu}" != "no"; then
      AC_DEFINE(CONFIG_WINMENU,		1,	[Window menu])
    fi
    
    APPLICATIONS="${APPLICATIONS} icehelp"
  else
    AC_DEFINE(LITE, 			1,	[Lite version])
  fi

AC_ARG_WITH(gnome-root-property,
  [  --with-gnome-root-property[=atom]]
  [                        Name of a root window property indicating that]
  [                        GNOME is active. Default: GNOME_SM_PROXY.]
  [--without-gnome-root-property]
  [                        Assume that GNOME is active when \$SESSION_MANAGER]
  [                        is set. Most session managers set this variable.])
  if test "${with_gnome_root_property}" != "no"; then
    if test "${with_gnome_root_property}" = ""; then
      with_gnome_root_property="GNOME_SM_PROXY"
    fi
    AC_DEFINE_UNQUOTED(CONFIG_GNOME_ROOT_PROPERTY,
      [ "${with_gnome_root_property}" ],
      [ Name of a root window property indicating that GNOME is active.])
  fi

dnl ========================================================== Image library ===
dnl
ICE_ARG_WITH(imlib,
  [  --with-imlib[=path]       Use Imlib for images [path to imlib-config]])
ICE_ARG_WITH(xpm,
  [  --with-xpm[=prefix]       Use libXpm for images [search it in prefix/lib]])

if test "${with_imlib_sign}" != "yes"; then
  if test "${with_xpm_sign}" != "yes"; then
    if test "${with_imlib_sign}" != "no"; then
      with_imlib_sign=yes                           # --- IMLIB by default ---
    else 
      with_xpm_sign=yes
    fi
  fi
fi

if test "${with_imlib_sign}" = "yes"; then
  if test "${with_xpm_sign}" = "yes"; then
    AC_MSG_ERROR([libXpm and Imlib can not be used in the same time])
  fi
fi

dnl ------------------------------------------------------ check for Imlib ---
dnl
if test "${with_imlib_sign}" = "yes"; then
  AC_PATH_PROG(IMLIB_CONFIG, imlib-config,, ${with_imlib_arg-${PATH}})
  if test "${IMLIB_CONFIG}" = ""; then
    AC_MSG_ERROR([imlib-config can not be found])
  else 
    IMAGE_CFLAGS=`$IMLIB_CONFIG --cflags`
    IMAGE_LIBS=`$IMLIB_CONFIG --libs`

    AC_DEFINE(CONFIG_IMLIB, 1, [Define to use Imlib for image rendering])

    image_library=Imlib
  fi
fi

dnl -------------------------------------------------------- check for Xpm ---
dnl
if test "${with_xpm_sign}" = "yes"; then
  if test x"$with_xpm_arg" != x; then
    xpm_cflags="-I${with_xpm_arg}/include"
    xpm_lflags="-L${with_xpm_arg}/lib"
  fi
  AC_CHECK_LIB(Xpm, XpmReadFileToPixmap,
    [ IMAGE_CFLAGS="${xpm_cflags}"
      IMAGE_LIBS="${xpm_lflags} -lXpm"

      AC_DEFINE(CONFIG_XPM, 1, [Define to use libXpm for image rendering])
      no_imlib=yes ],
    [# if test "${with_xpm_sign}" = ""; then
        AC_MSG_ERROR([libXpm can not be found])
     # fi 
    ],
    [ $xpm_lflags ])
    
  image_library=libXpm
fi

dnl --------------------- We need mkfontdir to create fonts.dir for Infadel2 ---
AC_ARG_WITH(mkfontdir,
  [  --with-mkfontdir=path   Path to mkfontdir],
  [ MKFONTDIR=$with_mkfontdir ],
  [ AC_PATH_PROG(MKFONTDIR, mkfontdir,, $PATH:/usr/X11R6/bin) ])

LIBS=$no_x_libs

dnl Path adjustment

AC_ARG_WITH(kdedatadir,
  [  --with-kdedatadir=path  KDE's data directory (\$KDEDIR/share)],
  [ if test x"$with_kdedatadir" = x -o "$with_kdedatadir" = "yes"; then
      AC_MSG_ERROR([Invalid usage of --with-kdedatadir argument])
    else
      kdedatadir=$with_kdedatadir
    fi ],
  [ if test x"$KDEDIR" != x; then
      kdedatadir="${KDEDIR}/share"
    else
      kdedatadir="${datadir}"
    fi ]
)

dnl ======================================================== Some path stuff ===
dnl
AC_ARG_WITH(libdir,
  [  --with-libdir=path      Default data directory (\$datadir/icewm)],
  [ if test x"$with_libdir" = x -o "$with_libdir" = "yes"; then
      AC_MSG_ERROR([Invalid usage of --with-libdir argument])
    else
      libdatadir=$with_libdir
    fi ],
  [ libdatadir='${datadir}/icewm' ])

AC_ARG_WITH(cfgdir,
  [  --with-cfgdir=path      System configuration directory (/etc/icewm)],
  [ if test x"$with_cfgdir" = x -o "$with_cfgdir" = "yes"; then
      AC_MSG_ERROR([Invalid usage of --with-cfgdir argument])
    else
      cfgdatadir=$with_cfgdir
    fi ],
  [ cfgdatadir='/etc/icewm' ])

AC_ARG_WITH(docdir,
  [  --with-docdir=path      Documentation directory (\$prefix/doc)],
  [ if test x"$with_docdir" = x -o "$with_docdir" = "yes"; then
      AC_MSG_ERROR([Invalid usage of --with-docdir argument])
    else
      docdir=$with_docdir
    fi ],
  [ docdir='${datadir}/doc' ])

dnl ============================================================ GNOME stuff ===
dnl
AC_ARG_ENABLE(menus-gnome1,
  [  --enable-menus-gnome1   Display GNOME 1 menus],
  [ if test "${enable_menus_gnome1}" = "yes"; then
      AC_PATH_PROG(GNOME1_CONFIG, gnome-config)

      if test "${GNOME1_CONFIG}" != ""; then
	GNOME_VER=1
	GNOME1_CFLAGS=`$GNOME1_CONFIG --cflags gnome`
	GNOME1_LIBS=`$GNOME1_CONFIG --libs gnome`

	AC_DEFINE(CONFIG_GNOME_MENUS, 1, [Define to make IceWM more GNOME-friendly])

	APPLICATIONS="${APPLICATIONS} icewm-menu-gnome1"
	GWMDIR="`${GNOME1_CONFIG} --datadir`/gnome/wm-properties/"
	CONFIG_GNOME1_MENU_DIR="`${GNOME1_CONFIG} --prefix`/share/gnome/apps/"
      fi

      if test "${GNOME1_CFLAGS}" = ""; then
	AC_MSG_ERROR([gnome-config can not be found.
*** Install the GNOME´s development packages.])
      fi
    fi ])

AC_ARG_ENABLE(menus-gnome2,
  [  --enable-menus-gnome2   Display GNOME 2 menus],
  [ if test "${enable_menus_gnome2}" = "yes"; then
      AC_PATH_PROG(PKG_CONFIG, pkg-config)
    
      if test "${PKG_CONFIG}" != ""; then
	GNOME_VER=2
	GNOME2_CFLAGS=`pkg-config --cflags gnome-desktop-2.0`
	GNOME2_LIBS=`pkg-config --libs gnome-desktop-2.0`

	AC_DEFINE(CONFIG_GNOME_MENUS, 1, [Define to make IceWM more GNOME-friendly])

	APPLICATIONS="${APPLICATIONS} icewm-menu-gnome2"
	GNOME2_PREFIX=`pkg-config --variable=prefix gnome-desktop-2.0`
	GWMDIR="${GNOME2_PREFIX}/share/gnome/wm-properties/"
	CONFIG_GNOME2_MENU_DIR="${GNOME2_PREFIX}/share/gnome/vfolders/"
      fi

      if test "${GNOME2_CFLAGS}" = ""; then
	AC_MSG_ERROR([gnome 2 can not be found via pkg-config.
*** Install the GNOME´s development packages.])
      fi
    fi ])

CONFIG_KDE_MENU_DIR="`kde-config --path apps | sed -e 's/.*://'`" 

AC_SUBST(GNOME_VER)
AC_SUBST(CONFIG_GNOME1_MENU_DIR)
AC_SUBST(CONFIG_GNOME2_MENU_DIR)
AC_SUBST(CONFIG_KDE_MENU_DIR)

AC_DEFINE(WMSPEC_HINTS, 1, [wmspec hints])
AC_DEFINE(GNOME1_HINTS, 1, [GNOME1 hints])
dnl ====================================================== Write out results ===
dnl ---------------------------------------- First adjust some substitutions ---

AC_SUBST(PACKAGE,`sed -ne 's/PACKAGE=//p' VERSION`)
AC_SUBST(VERSION,`sed -ne 's/VERSION=//p' VERSION`)
AC_SUBST(HOSTOS,`uname -sr || echo unknown`)
AC_SUBST(HOSTCPU,`uname -m || echo unknown`)

dnl -------------------------------------------- Compiler flags, definitions ---
AC_SUBST(DEBUG)
AC_SUBST(GCCDEP)
AC_SUBST(CORE_CFLAGS)
AC_SUBST(IMAGE_CFLAGS)
AC_SUBST(AUDIO_CFLAGS)
AC_SUBST(GNOME1_CFLAGS)
AC_SUBST(GNOME2_CFLAGS)

AC_SUBST(CORE_LIBS)
AC_SUBST(IMAGE_LIBS)
AC_SUBST(AUDIO_LIBS)
AC_SUBST(GNOME1_LIBS)
AC_SUBST(GNOME2_LIBS)


ICE_EXPAND(PREFIX,${prefix})
ICE_EXPAND(BINDIR,${bindir})
ICE_EXPAND(LIBDIR,${libdatadir})
ICE_EXPAND(CFGDIR,${cfgdatadir})
ICE_EXPAND(LOCDIR,${localedir})
ICE_EXPAND(KDEDIR,${kdedatadir})
ICE_EXPAND(DOCDIR,${docdir})
ICE_EXPAND(MANDIR,${mandir})

AC_SUBST(PREFIX)
AC_SUBST(BINDIR)
AC_SUBST(LIBDIR)
AC_SUBST(CFGDIR)
AC_SUBST(LOCDIR)
AC_SUBST(KDEDIR)
AC_SUBST(DOCDIR)
AC_SUBST(MANDIR)
AC_SUBST(GWMDIR)

dnl ---------------------------------------------------------- Build targets ---
DEPENDENCIES=""

BASEOBJS=""
BASEBINS=""

for binary in ${APPLICATIONS}; do
  BASEOBJS="${BASEOBJS} \$(${binary}_OBJS)"
  BASEBINS="${BASEBINS} ${binary}\$(EXEEXT)"
done

AC_SUBST(BASEOBJS)
AC_SUBST(BASEBINS)

TESTOBJS=""
TESTBINS=""

for binary in ${TESTCASES}; do
  TESTOBJS="${TESTOBJS} \$(${binary}_OBJS)"
  TESTBINS="${TESTBINS} ${binary}\$(EXEEXT)"
done

AC_SUBST(TESTOBJS)
AC_SUBST(TESTBINS)

dnl -------------------------------------------------------- Install targets ---
TARGETS_INSTALL=`for target in ${TARGETS}; do echo $ECHO_N "install-${target} $ECHO_C"; done`
BINFILES=`for binary in ${APPLICATIONS}; do echo $ECHO_N "\\\$(top_srcdir)/src/${binary}\\\$(EXEEXT) $ECHO_C"; done`

AC_SUBST(TARGETS)
AC_SUBST(TARGETS_INSTALL)
AC_SUBST(APPLICATIONS)
AC_SUBST(TESTCASES)
AC_SUBST(BINFILES)

AC_SUBST(INSTALL)
AC_SUBST(INSTALLDIR,"${INSTALL} -m 755 -d")
AC_SUBST(INSTALLBIN,"${INSTALL_PROGRAM}")
AC_SUBST(INSTALLLIB,"${INSTALL_DATA}")
AC_SUBST(INSTALLETC,"${INSTALL_DATA}")
AC_SUBST(INSTALLMAN,"${INSTALL_DATA}")

dnl --------------------------------------------------------- Generate files ---
AC_CONFIG_COMMANDS(config.status, [
    for binary in ${ac_targets_binaries}; do
      echo "${binary}\$(EXEEXT): \$(${binary}_OBJS)" >> "${srcdir}/src/Makefile"
    done
    
    if test "${ac_depend}" = "yes"; then
      echo >> "${srcdir}/src/Makefile"
      echo '-include $(OBJECTS:.o=.d)' >> "${srcdir}/src/Makefile"
      echo '-include $(genpref_OBJS:.o=.d)' >> "${srcdir}/src/Makefile"
    fi
],[
    ac_targets_binaries="${APPLICATIONS} ${TESTCASES}"
    ac_depend="${enable_depend}"
])

AC_OUTPUT(
	Makefile
	src/Makefile
	po/Makefile
	lib/keys 
        lib/menu
        lib/programs
        lib/toolbar 
        lib/winoptions
)

dnl -------------------------------------------------------- Display results ---
AC_MSG_RESULT()
ICE_MSG_VALUE([Build targets],	TARGETS)
ICE_MSG_VALUE([Applications],	APPLICATIONS)
ICE_MSG_VALUE([Image library],	image_library)
ICE_MSG_VALUE([Audio support],	audio_support)
ICE_MSG_VALUE([Features],	features)
ICE_MSG_VALUE([Paths: PREFIX], prefix)
ICE_MSG_VALUE([       BINDIR], bindir)
ICE_MSG_VALUE([       LOCDIR], localedir)
ICE_MSG_VALUE([       LIBDIR], libdatadir)
ICE_MSG_VALUE([       CFGDIR], cfgdatadir)
ICE_MSG_VALUE([       KDEDIR], kdedatadir)
ICE_MSG_VALUE([       DOCDIR], docdir)
ICE_MSG_VALUE([       MANDIR], mandir)