[go: up one dir, main page]

Menu

[c2a8ba]: / configure.in  Maximize  Restore  History

Download this file

397 lines (326 with data), 11.9 kB

dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/icerun.cc)
AC_PREREQ([2.13])
AC_CONFIG_HEADER(src/config.h)

dnl Checking for C in hope that it understands C++ too
ice_PROG_CXX_LIGHT

dnl Setting language to C++
AC_LANG_CPLUSPLUS
AC_PROG_CXX

dnl If both CC and CXX are GNU compilers, it is better to use CC
dnl for linking. Also check how to turn off RTTI and exception handling
if test x"$ac_cv_prog_gxx" != x; then
  AC_PROG_CC
  if test x"$ac_cv_prog_gcc" != x; then
    CXX_LINK=${CC}
  fi
  ice_CXX_FLAG_ACCEPT(no_rtti, -fno-rtti)
  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

if test x"$ac_cv_prog_gxx" != x; then
  ice_CXX_FLAG_ACCEPT(warn_xxx, -Wall -Wpointer-arith -Wconversion -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Winline -Woverloaded-virtual -W)
  ice_CXX_FLAG_ACCEPT(permissive, -fpermissive)
fi

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

AC_SUBST(CXX_LINK)

AC_CYGWIN
AC_PROG_INSTALL

dnl Checks for things which don't require X

dnl Checks for header files.
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(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)]) ])

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

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_FUNC_SELECT_ARGTYPES

dnl Configuring features
TARGETS='base docs'

dnl Checking for X11
AC_PATH_XTRA

if test x"$no_x" != x; then
  AC_MSG_ERROR([X Window System not found])
fi

AC_ARG_ENABLE(debug,
  [  --enable-debug          Use this option if you want to debug IceWM],
  [ if test "$enable_debug" != "no"; then
      AC_DEFINE(DEBUG, 1, [Define if you want to debug IceWM])
      DEBUG="-g -DDEBUG"
    else
      DEBUG=
    fi ])

dnl =========================================================== I18N Support ===
dnl
AC_ARG_ENABLE(i18n,
  [  --enable-i18n           Enable internationalization],
  [ if test "$enable_i18n" != "no"; then
      AC_DEFINE(I18N, 1, [Define to enable internationalization])
    fi ])

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

if test "$enable_nls" != "no"; then
  AC_CHECK_LIB(intl, gettext)

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

  localedir='${datadir}/locale'
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.])
      
      AC_ARG_WITH(icesound,
	[  --with-icesound=LIST    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|YIFF|y|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_CHECK_HEADERS(esd.h,
	    AC_CHECK_LIB(esd, esd_open_sound,
	      [ AC_DEFINE(ENABLE_ESD, 1, [Define to enable ESD support.])
		AUDIO_LIBS="${AUDIO_LIBS} -lesd"
		CONFIG_ESD=yes ]));;

	  *)
	    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
	TARGETS=$TARGETS' icesound'
      fi
    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 use X shared memory extension])
  if test "$enable_sm" != "no"; then
    AC_CHECK_LIB(ICE, IceConnectionNumber,
      [ AC_DEFINE(SM, 1, [Define to enable X shared memory extension]) ],
      [ AC_MSG_WARN([Unable to use X shared memory extension]) ])
  fi

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(SHAPE, 1, [Define to enable X shape extension]) ],
      [ AC_MSG_WARN([Unable to use X shape extension]) ])
  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(lite,
  [  --enable-lite           Build lightweight version of IceWM],,
  [ enable_lite=no ])
  if test "${enable_lite}" = "no"; then
    AC_DEFINE(CONFIG_TOOLTIP, 		1,	[Tooltips])
    AC_DEFINE(CONFIG_TASKBAR, 		1,	[Taskbar])
    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])
    AC_DEFINE(CONFIG_ADDRESSBAR,	1,	[Address bar])
    AC_DEFINE(CONFIG_WINLIST,		1,	[OS/2 like window list])
    AC_DEFINE(CONFIG_WINMENU,		1,	[Window menu])
    
    TARGETS=$TARGETS' icehelp'
  else
    AC_DEFINE(LITE, 			1,	[Lite version])
  fi

dnl ============================================================ GNOME menus ===
dnl
ice_ARG_WITH(gnome_menus,
  [  --with-gnome-menus[=path] Be more GNOME-friendly [path to gnome-config]],
  [ if test "${with_gnome_menus_sign}" = "yes"; then
      AC_PATH_PROG(GNOME_CONFIG, gnome-config, ,${with_gnome_arg-${PATH}})
    
      if test "${GNOME_CONFIG}" != ""; then
	GNOME_CFLAGS=`$GNOME_CONFIG --cflags gnome`
	GNOME_LIBS=`$GNOME_CONFIG --libs gnome`

	AC_DEFINE(GNOME, 1, [Define to make IceWM more GNOME-friendly])
      else
	AC_MSG_ERROR([gnome-config can not be found])
      fi
    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]])

dnl --------------------- Checking for Xpm unless we are forced to use Imlib ---
dnl
if test "${with_imlib_sign}" != "yes"; then
  if test "${with_xpm_sign}" = "no"; then
    AC_MSG_ERROR([You have to enable libXpm or Imlib])
  else
    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
else
  if test "${with_xpm_sign}" = "yes"; then
    AC_MSG_ERROR([libXpm and Imlib can not be used in the same time])
  fi
fi

dnl ----------------------------- Without libXpm we have to use Imlib or die ---
dnl
if test "${no_imlib}" != "yes"; then
  if test "${with_imlib_sign}" = "no"; then
    AC_MSG_ERROR([libXpm can not be found, you have to enable Imlib])
  fi

  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])
  fi

  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

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 ])

AC_ARG_WITH(libdir,
  [  --with-libdir=path      Default configuration directory (\$libdir/X11/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='${libdir}/X11/icewm' ])

AC_ARG_WITH(cfgdir,
  [  --with-cfgdir=path      System configuration directory (\$sysconfdir/X11/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='${sysconfdir}/X11/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='${prefix}/doc' ])

dnl Done! Write out what we have found...

for t in $TARGETS; do
  TARGETS_INSTALL="$TARGETS_INSTALL install-$t"
done

AC_SUBST(TARGETS)
AC_SUBST(TARGETS_INSTALL)

AC_SUBST(DEBUG)

AC_SUBST(CORE_CFLAGS)
AC_SUBST(IMAGE_CFLAGS)
AC_SUBST(AUDIO_CFLAGS)
AC_SUBST(GNOME_CFLAGS)

AC_SUBST(CORE_LIBS)
AC_SUBST(IMAGE_LIBS)
AC_SUBST(AUDIO_LIBS)
AC_SUBST(GNOME_LIBS)

AC_SUBST(datadir)
AC_SUBST(localedir)
AC_SUBST(libdatadir)
AC_SUBST(cfgdatadir)
AC_SUBST(kdedatadir)
AC_SUBST(docdir)

AC_OUTPUT(
	Makefile
	sysdep.inc:sysdep.in
	install.inc:install.in
)

AC_MSG_RESULT("")
ice_MSG_VALUE(Build targets, TARGETS)
ice_MSG_VALUE(Image library, image_library)
ice_MSG_VALUE(Audio support, audio_support)
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)