[go: up one dir, main page]

Menu

[c3711d]: / configure.in  Maximize  Restore  History

Download this file

741 lines (592 with data), 19.7 kB

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

dnl $Id$
dnl configure.in
dnl Autoconf script for SCWM
dnl (C) 1998, 1999 Maciej Stachowiak and Greg J. Badros


dnl ## Initialize autoconf ##
AC_INIT(scwm/scwm.c)
AC_PREREQ(2.4)

dnl ## Initialize automake ##
AM_INIT_AUTOMAKE(scwm, 0.99.2)
AM_MAINTAINER_MODE
AM_CONFIG_HEADER(include/config.h)

## This will try to create the named directory if it does not exist
AC_DEFUN(SCWM_ARG_PATH,
[
  AC_ARG_WITH($1,[$2],[
    if test -z "${withval}" || test "yes" = "${withval}" || test "no" = "${withval}"; then
      AC_MSG_ERROR(missing pathname argument to --with-$1)
    else
      if test ! -d "${withval}"; then
        AC_MSG_WARN(directory for --with-$1: ${withval} does not exist -- creating)
	mkdir -p ${withval} || mkdirhier ${withval}
      fi
      $3
    fi],
    $4)
])

## This does not permit non-existing directories
AC_DEFUN(SCWM_ARG_PATH_MAYBE_EMPTY,
[
  AC_ARG_WITH($1,[$2],[
    if test ! -z "${withval}" && test ! "yes" = "${withval}" && test ! "no" = ${withval} && test ! -d "${withval}"; then
      AC_MSG_ERROR(invalid pathname argument to --with-$1: ${withval})
    else
      $3
    fi],
    $4)
])

dnl ## Checks for programs ##

AC_ARG_ENABLE(cflags,
[  --enable-cflags=FLAGS   Set CFLAGS to FLAGS [-g -O2]],
[case "$enableval" in
   yes|no) echo "Please specify a parameter for --enable-cflags"
	   exit;;
 esac
 CFLAGS="$enableval"; export CFLAGS
])

AC_ARG_ENABLE(cppflags,
[  --enable-cppflags=FLAGS   Set CPPFLAGS to FLAGS [-g -O2]],
[case "$enableval" in
   yes|no) echo "Please specify a parameter for --enable-cppflags"
	   exit;;
 esac
 CPPFLAGS="$enableval"; export CPPFLAGS
])

AC_ARG_ENABLE(cxxflags,
[  --enable-cxxflags=FLAGS   Set CXXFLAGS to FLAGS [-g -O2]],
[case "$enableval" in
   yes|no) echo "Please specify a parameter for --enable-cxxflags"
	   exit;;
 esac
 CXXFLAGS="$enableval"; export CXXFLAGS
])


AC_PROG_CC
AC_PROG_CXX

AC_CHECK_PROGS(GTAR, gnutar gtar tar, "no")

AC_DEFUN(scwm_TAR_IS_GNU_TAR,
[AC_MSG_CHECKING(whether $GTAR is GNU tar)
AC_CACHE_VAL(scwm_cv_TAR_IS_GNU_TAR,
[
if $GTAR --version >/dev/null 2>&1
then
  scwm_cv_TAR_IS_GNU_TAR="yes";
else
  scwm_cv_TAR_IS_GNU_TAR="no";
fi])dnl
TAR_IS_GNU_TAR="$scwm_cv_TAR_IS_GNU_TAR";
if test "yes" = "$TAR_IS_GNU_TAR"
then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi
])

scwm_TAR_IS_GNU_TAR

if test "no" = "$TAR_IS_GNU_TAR"; then
	TAR_CF="$GTAR cf";
	TAR_SUFFIX="tar";
else
	TAR_CF="$GTAR zcf";
	TAR_SUFFIX="tar.gz";
fi

AC_SUBST(TAR_CF)
AC_SUBST(TAR_SUFFIX)

dnl Ensure compiler sanity on pathological platforms
AC_ISC_POSIX
AC_AIX
AC_MINIX
dnl Use ANSI mode
AM_PROG_CC_STDC

AM_PROG_LIBTOOL

if test "NONE" = "$prefix"; then
    PREFIX_INCLUDES="-I$ac_default_prefix/include"
else
    PREFIX_INCLUDES="-I$prefix/include"
fi
AC_SUBST(PREFIX_INCLUDES)


dnl # check for build-guile #

GUILE_BIN_DIR=""
GUILE_INCLUDES=""

guile_lib_path=""

if test "NONE" = "$exec_prefix"; then
	if test "NONE" = "$prefix"; then
		guile_lib_path="$ac_default_prefix/lib"
	else
		guile_lib_path="$prefix/lib"
	fi
else
        guile_lib_path="$exec_prefix/lib"
fi
if test "NONE" = "$prefix"; then
        GUILE_INCLUDES="-I$ac_default_prefix/include"
else
        GUILE_INCLUDES="-I$prefix/include"
fi

SCWM_ARG_PATH(guile-prefix,
[  --with-guile-prefix=DIR Expect guile to be installed in DIR [optional]],
[
	AC_MSG_CHECKING(where to expect to find guile)
	guile_prefix="${withval}"
	GUILE_BIN_DIR="${guile_prefix}/bin"
	GUILE_INCLUDES="-I${guile_prefix}/include"
	guile_lib_path="${guile_prefix}/lib"
	
	AC_MSG_RESULT("${guile_prefix}")
])

SCWM_ARG_PATH(guile-exec-prefix,
[  --with-guile-exec-prefix=DIR 
                          Expect guile binaries to be installed in DIR 
                          [optional]],
[
	AC_MSG_CHECKING(where to expect to find guile binaries)
	guile_exec_prefix="${withval}"
	GUILE_BIN_DIR="${guile_exec_prefix}"
	
	AC_MSG_RESULT("${guile_exec_prefix}")
])

if test -z "${GUILE_BIN_DIR}"; then
	AC_PATH_PROGS(GUILE_CONFIG, guile-config build-guile, no)
else
	AC_PATH_PROGS(GUILE_CONFIG, guile-config build-guile, no, ${GUILE_BIN_DIR})
fi


if test "no" != "$GUILE_CONFIG"; then
  AC_MSG_CHECKING(whether guile-config or build-guile works)
  if (${GUILE_CONFIG} link) >/dev/null 2>&1; then
    GUILE_CONFIG_works=yes
  else
    GUILE_CONFIG_works=no
  fi
  AC_MSG_RESULT($GUILE_CONFIG_works)
else
  GUILE_CONFIG_works=no
fi

if test -z "${GUILE_BIN_DIR}"; then
	AC_PATH_PROG(GUILE, guile, no)
else
	AC_PATH_PROG(GUILE, guile, no, ${GUILE_BIN_DIR})
fi

AC_SUBST(GUILE)

AC_PATH_PROGS(PERL, perl perl5, no)

AC_SUBST(PERL)

dnl ## Find paths ##

AC_PATH_X
AC_PATH_XTRA
AM_PATH_LISPDIR

SCWM_ARG_PATH(lispdir,
[  --with-lispdir=DIR      Install Emacs Lisp files in DIR 
                          [PREFIX/share/site-lisp]],
[
	AC_MSG_CHECKING(where .elc files should go)
	lispdir="${withval}"
	AC_MSG_RESULT("${lispdir}")
])

PROPLIST_INCLUDES=""
PROPLIST_LIBS=""
PROPLIST_OBJECTS=""

SCWM_ARG_PATH_MAYBE_EMPTY(proplist,
[  --with-proplist=DIR   Use libPropList installation from DIR
                         can omit DIR to use $prefix ],
[
	AC_DEFINE(USE_PROPLIST)
	AC_DEFINE(CL_NO_TRACE)
	HAVE_PROPLIST="yes"
	AC_MSG_CHECKING(where to expect to find libPropList headers and library)
	if test -z "${withval}" || test "yes" = "${withval}"; then
	   AC_MSG_RESULT("defaulting to the prefix = ${prefix}")
	   withval=${prefix}
	else
	   AC_MSG_RESULT("${withval}")
        fi
	PROPLIST_INCLUDES="-I${withval}/include"
	case "$ac_R_nospace" in
	"yes") prop_lib_path="-L${withval}/lib -R${withval}/lib" ;;
	"no")  prop_lib_path="-L${withval}/lib -R ${withval}/lib" ;;
	*)     prop_lib_path="-L${withval}/lib" ;;
	esac
	PROPLIST_LIBS="$prop_lib_path -lPropList"
])

AM_CONDITIONAL(HAVE_PROPLIST, test "$HAVE_PROPLIST" = yes)


AC_SUBST(PROPLIST_INCLUDES)
AC_SUBST(PROPLIST_LIBS)
AC_SUBST(PROPLIST_OBJECTS)


## check for GTL library that cassowary might need

AC_LANG_SAVE
AC_LANG_CPLUSPLUS
dnl below is a hack using -L prefixes with -lGTL in the 
dnl extra libs position to be sure that it looks in the right place
old_libs=$LIBS
LIBS="-L${prefix}/lib -L${exec_prefix}/lib -lGTL"
GTL_LIB=""
dnl AC_CHECK_LIB(GTL, GML_init, [
AC_TRY_LINK_FUNC(GML_init, [
GTL_LIB="-lGTL"
dnl AC_DEFINE(HAVE_GTL)
], no_gtl_lib=yes)
LIBS="${old_libs}"


## check for cassowary library

CASSOWARY_INCLUDES=""
CASSOWARY_LIBS=""
CASSOWARY_OBJECTS=""

SCWM_ARG_PATH_MAYBE_EMPTY(cassowary,
[  --with-cassowary=DIR   Use Cassowary constraint solver from DIR
                         can omit DIR to use $prefix ],
[
    if test "no" = "${withval}"; then
	AC_MSG_RESULT("****** Cassowary constraint solver is *not* being used")
    else
	AC_DEFINE(USE_CASSOWARY)
	AC_DEFINE(CL_NO_TRACE)
	AC_MSG_CHECKING(where to expect to find cassowary headers and library)
	if test -z "${withval}" || test "yes" = "${withval}"; then
	   AC_MSG_RESULT("defaulting to the prefix = ${prefix}")
	   withval=${prefix}
	else
	   AC_MSG_RESULT("${withval}")
 	fi
	CASSOWARY_INCLUDES="-I${withval}/include"
	cassolibdir="${withval}/lib"
	case "$ac_R_nospace" in
	"yes") cas_lib_path="-L${cassolibdir} -R${cassolibdir}" ;;
	"no")  cas_lib_path="-L${cassolibdir} -R ${cassolibdir}" ;;
	*)     cas_lib_path="-L${cassolibdir}" ;;
	esac
	## Was ${GTL_LIB} below
	CASSOWARY_LIBS="$cas_lib_path -lconstraints -lcassowary -lstdc++ `cassowary-config --gtllibs || echo ""`"
	CASSOWARY_OBJECTS='$(cassowary_objs)'
    fi
])

AC_SUBST(CASSOWARY_INCLUDES)
AC_SUBST(CASSOWARY_LIBS)
AC_SUBST(CASSOWARY_OBJECTS)

AC_LANG_RESTORE


dnl ## Checks for libraries ##


dnl # X Window system checks #

if test -z "$x_includes"; then
  x_includes="/usr/include"
fi

saved_cflags="$CFLAGS"
saved_ldflags="$LDFLAGS"

CFLAGS="$X_CFLAGS"
LDFLAGS="$X_LDFLAGS $X_LIBS"
orig_x_libs="$x_libs"

dnl # check for math library
AC_CHECK_LIB(m, main)

dnl # Check for the X11 library ##

AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)


dnl # Check for the Xext library (needed for Shape extention) ##
XEXT_LIB=""
AC_CHECK_LIB(Xext, XShapeCombineMask, [
XEXT_LIB="-lXext"
AC_DEFINE(HAVE_SHAPE)
], no_xext_lib=yes, $x_libs)

dnl # Check for the XTest library (needed for better simulated event support, quoting) ##
XTST_LIB=""
have_xtest=no
AC_CHECK_LIB(Xtst, XTestQueryExtension, [
XTST_LIB="-lXtst"
AC_DEFINE(HAVE_XTEST)
have_xtest=yes
], AC_MSG_WARN(libXtst not found -- simulated events will not be supported)
,$x_libs $XEXT_LIB)
AM_CONDITIONAL(HAVE_XTEST, test "$have_xtest" = yes)


dnl # Check for the Xpm library #
XPM_LIB=""
AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, [
XPM_LIB="-lXpm"
AC_DEFINE(HAVE_LIBXPM)
], AC_MSG_WARN(libXpm not found -- try ftp://ftp.x.org/contrib/libraries/xpm-3.4k.tar.gz)
, $x_libs)


dnl # Check for the Xmu library #
XMU_LIB=""
AC_CHECK_LIB(Xmu, XmuPrintDefaultErrorMessage, [
XMU_LIB="-lXmu"
AC_DEFINE(HAVE_LIBXMU)
], , $x_libs)

dnl # check if X11 library was compiled with X_LOCALE definition
AC_CHECK_LIB(X11, _Xsetlocale, [ AC_DEFINE(X_LOCALE) ], [], $x_libs)

dnl # Check for libSM, libIce
SM_LIB=""
SESSION_MANAGER_OBJECTS=""

AC_CHECK_LIB(SM, SmcOpenConnection, [
  AC_CHECK_HEADERS(X11/SM/SMlib.h, [
    AC_CHECK_LIB(ICE, IceAddConnectionWatch, [
      SM_LIB="-lSM -lICE"
      SESSION_MANAGER_OBJECTS='$(session_manager_objs)'
      AC_DEFINE(HAVE_LIBSM_LIBICE)
    ], AC_MSG_WARN(libICE not found -- no session manager support)
    , $x_libs)
  ], AC_MSG_WARN(SMlib.h not found -- no session manager support))
], AC_MSG_WARN(libSM not found -- no session manager support)
, $x_libs -lICE)

AC_ARG_ENABLE(esd, [  --disable-esd       Do not use ESD even if it exists],
		    enable_esd=no,
		    enable_esd=yes)

if test x"$enable_esd" = x"no"; then
	AC_MSG_RESULT(Not using ESD due to --disable-esd option)
	AM_CONDITIONAL(HAVE_ESD, false)
else
	AM_PATH_ESD(0.2.7, HAVE_ESD=yes, HAVE_ESD=no)
	AM_CONDITIONAL(HAVE_ESD, test "$HAVE_ESD" = yes)
fi

AM_PATH_GTK(1.0.0, HAVE_GTK=yes, HAVE_GTK=no)

AM_CONDITIONAL(HAVE_GTK, test $HAVE_GTK = yes)
AM_CONDITIONAL(HAVE_GNOME_CORBA, test "$HAVE_GNOME_CORBA" = yes)

AC_SUBST(SESSION_MANAGER_OBJECTS)

x_cflags="$X_CFLAGS"
x_ldflags="$X_LDFLAGS $X_LIBS"

AC_SUBST(x_cflags)
AC_SUBST(x_includes)
AC_SUBST(x_ldflags)
AC_SUBST(x_libs)
AC_SUBST(XEXT_LIB)
AC_SUBST(XTST_LIB)
AC_SUBST(XPM_LIB)
AC_SUBST(XMU_LIB)
AC_SUBST(SM_LIB)

CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"

dnl # Check for readline library #


AC_CHECK_LIB(termcap, tgoto, [
	AC_CHECK_LIB(readline, readline, [
	READLINE_LIB="-lreadline -ltermcap"
	AC_DEFINE(HAVE_READLINE)
	AC_CHECK_LIB(readline, add_history, AC_DEFINE(HAVE_HISTORY),,"-ltermcap")
	], READLINE_LIB="", "-ltermcap")  
], AC_CHECK_LIB(ncurses, tgoto, [
	AC_CHECK_LIB(readline, readline, [
		READLINE_LIB="-lreadline -lncurses"
		AC_DEFINE(HAVE_READLINE)
		AC_CHECK_LIB(readline, add_history, AC_DEFINE(HAVE_HISTORY),,"-lncurses")
	], READLINE_LIB="", "-lncurses")
], READLINE_LIB=""))


AC_SUBST(READLINE_LIB)


dnl # Guile checks #

SCWM_ARG_PATH(guile-include-prefix,
[  --with-guile-include-prefix=DIR 
                          Expect guile header files to be installed in DIR 
                          [optional]],
[
	AC_MSG_CHECKING(where to expect guile header files)
	guile_include_prefix="${withval}"
	GUILE_INCLUDES="-I${guile_include_prefix}"
	
	AC_MSG_RESULT("${guile_include_prefix}")
])

SCWM_ARG_PATH(guile-lib-prefix,
[  --with-guile-lib-prefix=DIR 
                          Expect guile libraries to be installed in DIR 
                          [optional]],
[
	AC_MSG_CHECKING(where to expect guile libraries)
	guile_lib_prefix="${withval}"
	GUILE_LIB_PRE="-L${guile_lib_prefix}"
	
	AC_MSG_RESULT("${guile_lib_prefix}")
])


case "$ac_R_nospace" in 
"yes") GUILE_LIBS_PRE="-L${guile_lib_path} -R${guile_lib_path}" ;;
"no")  GUILE_LIBS_PRE="-L${guile_lib_path} -R ${guile_lib_path}" ;;
*)     GUILE_LIBS_PRE="-L${guile_lib_path}" ;;
esac

DL_SUPPORT=false

dnl FIXJTL: readline is sometimes needed too; hopefully anybody with
dnl a guile with readline support has a working guile-config or build-guile
if test "yes" = "$GUILE_CONFIG_works"; then
  AC_MSG_CHECKING(for guile libraries)
  GUILE_LIBS="${GUILE_LIBS_PRE} `${GUILE_CONFIG} link`"
  AC_MSG_RESULT($GUILE_LIBS)
else
  AC_CHECK_LIB(m, sin, GUILE_LIBS="-lm",, $GUILE_LIBS_PRE)
  AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS",, $GUILE_LIBS_PRE)
  AC_CHECK_LIB(qt, main, GUILE_LIBS="-lqt $GUILE_LIBS",, $GUILE_LIBS_PRE)
  AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS";DL_SUPPORT=true,, $GUILE_LIBS_PRE)
  AC_CHECK_LIB(c, dlopen, GUILE_LIBS="$GUILE_LIBS";DL_SUPPORT=true,, $GUILE_LIBS_PRE)

  AC_CHECK_LIB(guile, scm_handle_by_message_noexit, GUILE_LIBS="${GUILE_LIBS_PRE} -lguile ${GUILE_LIBS}", [
  	AC_MSG_ERROR(Can not find Guile 1.2 or later on the system)
  ], $GUILE_LIBS_PRE $GUILE_LIBS)
fi

AC_SUBST(GUILE_INCLUDES)
AC_SUBST(GUILE_LIBS)
AM_CONDITIONAL(DL_SUPPORT, test "DL_SUPPORT" = true)

dnl ## Checks for header files ##

AC_STDC_HEADERS
AC_CHECK_HEADERS(getopt.h, AC_DEFINE(HAVE_GETOPT_H))
AC_CHECK_HEADERS(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H))


dnl ## Check for library functions ##

# AC_CHECK_FUNCS(select)
AC_CHECK_FUNCS(getopt_long)
AC_CHECK_FUNCS(gethostname waitpid sysconf uname)
AC_CHECK_FUNCS(strerror strcasecmp strncasecmp)
AC_CHECK_FUNCS(usleep)
AC_CHECK_FUNCS(setlinebuf setvbuf)
AC_CHECK_FUNCS(setenv)

dnl # Check for bleeding-edge guile funcs

dnl This checks (roughly) if the guile lib is a sufficiently recent snapshot
dnl to have a scm_eval_string that is safe against re-entry by continuations. 
dnl I was to lazy to write a real test macro so I just check for a function
dnl that was added soon after.
AC_CHECK_LIB(guile, scm_done_malloc, AC_DEFINE(HAVE_SAFE_SCM_EVAL_STRING), ,$GUILE_LIBS)

dnl This checks if the new printer functions are available, and should 
dnl be used instead of the old ones.
AC_CHECK_LIB(guile, scm_puts, AC_DEFINE(HAVE_SCM_PUTS), ,$GUILE_LIBS)

dnl This checks if we have gh_vref or gh_vector_ref
AC_CHECK_LIB(guile, gh_vector_ref, AC_DEFINE(HAVE_GH_VECTOR_REF), ,$GUILE_LIBS)

dnl This checks if we have gh_vset or gh_vector_set
AC_CHECK_LIB(guile, gh_vector_set_x, AC_DEFINE(HAVE_GH_VECTOR_SET_X), ,$GUILE_LIBS)

dnl This checks if we have a guile with readline support
AC_CHECK_LIB(guile, scm_readline, AC_DEFINE(HAVE_SCM_READLINE), ,$GUILE_LIBS)

dnl This checks if we have a guile with gh_length, not gh_list_length
AC_CHECK_LIB(guile, gh_length, AC_DEFINE(HAVE_GH_LENGTH), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_parse_path, AC_DEFINE(HAVE_SCM_PARSE_PATH), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_internal_select, AC_DEFINE(HAVE_SCM_INTERNAL_SELECT), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_internal_cwdr, AC_DEFINE(HAVE_SCM_INTERNAL_CWDR), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_internal_stack_catch, AC_DEFINE(HAVE_SCM_INTERNAL_STACK_CATCH), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_internal_parse_path, AC_DEFINE(HAVE_SCM_INTERNAL_PARSE_PATH), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_load_startup_files, AC_DEFINE(HAVE_SCM_LOAD_STARTUP_FILES), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_make_hook, AC_DEFINE(HAVE_SCM_MAKE_HOOK), ,$GUILE_LIBS)

AC_CHECK_LIB(guile, scm_strport_to_string, AC_DEFINE(HAVE_SCM_STRPORT_TO_STRING), ,$GUILE_LIBS)

dnl check for scm_the_last_fluid in place of scm_the_last_stack_var

saved_LIBS="${LIBS}"
LIBS="${LIBS} ${GUILE_LIBS}"
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${GUILE_INCLUDES}"
AC_MSG_CHECKING(for scm_the_last_stack_fluid in -lguile)
AC_TRY_LINK([
#include <guile/gh.h>
],[
return scm_the_last_stack_fluid;
], [
AC_DEFINE(HAVE_SCM_THE_LAST_STACK_FLUID)
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])

LIBS="${saved_LIBS}"
CFLAGS="${saved_CFLAGS}"


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

AC_C_CONST
AC_C_INLINE

dnl check for imlib
AM_PATH_IMLIB


AC_ARG_ENABLE(imlib, [  --disable-imlib       Do not use IMLIB library even if it exists],
		    enable_imlib=no,
		    enable_imlib=yes)

if test x"$enable_imlib" = x"no"; then
	AC_MSG_RESULT(Not using imlib due to --disable-imlib option)
elif test ! -z "$IMLIB_LIBS"  ; then
        LIBS="$LIBS $IMLIB_LIBS"
##        CFLAGS="$CFLAGS $IMLIB_CFLAGS"  # this does not affect anything --07/01/99 gjb
        USE_IMLIB="true"
	AC_DEFINE(USE_IMLIB)
fi


dnl ## Define directories ##

scwm_load_path=${datadir}/${PACKAGE}/modules
scwm_schemedir=${scwm_load_path}/app/scwm
scwm_themedir=${datadir}/${PACKAGE}/themes
scwm_bin_load_path=${libdir}/${PACKAGE}/modules
scwm_moduledir=${scwm_bin_load_path}/app/scwm
scwm_utildir=${libdir}/${PACKAGE}/util
scwm_pixmapdir=${datadir}/${PACKAGE}/pixmaps


SCWM_ARG_PATH(scwmrcdir,
[  --with-scwmrcdir=DIR    Install configuration files in DIR 
                          [DATADIR/scwm/scwmrc]],
[
	AC_MSG_CHECKING(where configuration files should go; e.g., system.scwmrc)
	scwmrcdir="${withval}"
	AC_MSG_RESULT("${scwmrcdir}")
],
[
	scwmrcdir="${datadir}/${PACKAGE}/scwmrc"
])

# open the parentheses
scwm_image_load_path="(\\\"${scwm_pixmapdir}\\\" ";

for i in \
   ${x_includes}/X11/bitmaps \
   ${x_includes}/X11/pixmaps \
   ${orig_x_libs}/X11/mini-icons \
   ${includedir}/X11/pixmaps \
   ${includedir}/X11/bitmaps \
   ${libdir}/X11/mini-icons \
   @prefix@/share/pixmaps \
   @prefix@/share/icons \
   @prefix@/share/icons/mini \
; do
   if test -d $i; then
      # add the directory to the list as a string
      scwm_image_load_path="$scwm_image_load_path \\\"$i\\\""
   fi
done

# close the parentheses
scwm_image_load_path="${scwm_image_load_path})";


AC_SUBST(scwm_load_path)
AC_SUBST(scwm_bin_load_path)
AC_SUBST(scwm_schemedir)
AC_SUBST(scwm_themedir)
AC_SUBST(scwm_pixmapdir)
AC_SUBST(scwm_moduledir)
AC_SUBST(scwmrcdir)
AC_SUBST(scwm_image_load_path)
AC_SUBST(scwm_utildir)


dnl # Check for optional settings #

AC_MSG_CHECKING(whether to enable multibyte support)
AC_ARG_ENABLE(multibyte,
[  --enable-multibyte      Handle multibyte strings for window titles, etc],
[
	if test "yes" = "$enableval"; then
		AC_DEFINE(I18N)
	fi

	AC_MSG_RESULT($enableval);
],
[
	AC_MSG_RESULT(no);
])


I18N_LIB=""
if test x"$enable_multibyte" = x"yes" ; then
       # check if system has xpg4 library ( for FreeBSD )
       AC_CHECK_LIB(xpg4, _xpg4_setrunelocale, [
       I18N_LIB="-lxpg4"
       ],[])
fi
AC_SUBST(I18N_LIB)



CPPEXTRAFLAGS=""
AC_ARG_ENABLE(warnings,
[  --enable-warnings       Turn on most compiler warnings (may require gcc)]
,[if test "yes" = "$enableval"; then
   CPPEXTRAFLAGS="-Wall -W -Wno-sign-compare"
  fi
])
AC_SUBST(CPPEXTRAFLAGS)

AC_OUTPUT(Makefile \
          scwm.spec \
          sample.scwmrc/Makefile \
          scwm/Makefile \
          scheme/Makefile \
          pixmaps/Makefile \
          app/Makefile \
	  corba/Makefile \
	  modules/Makefile \
	  modules/background/Makefile \
	  modules/c-animation/Makefile \
	  modules/corba/Makefile \
	  modules/esdsound/Makefile \
	  modules/overlay-plane/Makefile \
	  modules/pie-menus/Makefile \
	  modules/scwmgtkhelper/Makefile \
	  modules/xlib-drawing/Makefile \
	  modules/xpm-menus/Makefile \
	  modules/proplist/Makefile \
	  modules/xtest/Makefile \
          utilities/Makefile \
          utilities/libscwmexec/Makefile \
          utilities/scwmexec/Makefile \
          utilities/scwmrepl/Makefile \
          utilities/pidproperty/Makefile \
          utilities/run-renamed/Makefile \
          utilities/dev/Makefile \
          utilities/emacs/Makefile \
          utilities/misc/Makefile \
          doc/Makefile \
	  themes/Makefile \
	  utilities/dev/scwmdoc \
	  utilities/dev/scwmdoc.scm \
	  utilities/dev/scwm-usage-counter \
	  utilities/dev/X-error-describe \
	  utilities/dev/create-dependency-dot-graph \
)