[go: up one dir, main page]

Menu

[fb16dc]: / configure.in  Maximize  Restore  History

Download this file

291 lines (227 with data), 8.6 kB

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

#-------------------------------------------------------------------
#
# Process this file with autoconf to produce a configure script.
#
#-------------------------------------------------------------------

AC_INIT(scwm/scwm.c)
AC_PREREQ(2.4)

AC_CONFIG_HEADER(include/config.h)

# We need to honor CFLAGS if its set
# e.g., 
# CFLAGS="-g -O -I/uns/include" LDFLAGS=-L/uns/lib ./configure  --prefix=/uns
if test "$CFLAGS" = ""; then
  CFLAGS="-O -g -Wall"
fi


#-------------------------------------------------------------------
#
# Remove the ./config.cache file and rerun configure if
# the cache file belong to a different architecture
#
#-------------------------------------------------------------------

AC_CHECK_PROG(UNAME_A, uname -a, [uname -a], "")
if test "$UNAME_A" = ""; then
    AC_CHECK_PROG(UNAME_A, uname, [uname], "")
fi

if test "$UNAME_A" != ""; then
    uname=`$UNAME_A`
    AC_MSG_CHECKING('checking cached value of \$uname')
    AC_CACHE_VAL(ac_cv_prog_uname, [nocached=1 ac_cv_prog_uname=`$UNAME_A`])
    if test "$nocached" = "1"; then
        AC_MSG_RESULT(no)
    else
        AC_MSG_RESULT(yes)
    fi

    if test "$uname" != "$ac_cv_prog_uname"; then
        echo "Running on a different architecture. Can't use cached values"
        echo "Removing config.cache and running configure again"
        rm -f config.cache
        exec $CMDLINE
    fi
fi


#-------------------------------------------------------------------
#
# Checks for programs.
#
#-------------------------------------------------------------------

AC_CHECK_PROG(AR, ar, ar cr, ar cr)
AC_CHECK_PROG(MAKEDEPEND, makedepend, makedepend, makedepend)
AC_CHECK_PROG(RM, rm, rm -f, rm -f)
AC_PROG_RANLIB
AC_PROG_MAKE_SET
AC_PROG_CC


#-------------------------------------------------------------------
#
# Check for OS specific
#
#-------------------------------------------------------------------

AC_AIX


#-------------------------------------------------------------------
#
# Checks for standard programs.
#
#-------------------------------------------------------------------

AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S


#-------------------------------------------------------------------
#
# Check for the existence of various libraries.  The order here
# is important, so that then end up in the right order in the
# command line generated by make.  The -lsocket and -lnsl libraries
# require a couple of special tricks:
#
#   1. Use "connect" and "accept" to check for -lsocket, and
#      "gethostbyname" to check for -lnsl.
#   2. Use each function name only once:  can't redo a check because
#      autoconf caches the results of the last check and won't redo it.
#   3. Use -lnsl and -lsocket only if they supply procedures that
#      aren't already present in the normal libraries.  This is because
#      IRIX 5.2 has libraries, but they aren't needed and they're
#      bogus:  they goof up name resolution if used.
#   4. On some SVR4 systems, can't use -lsocket without -lnsl too.
#      To get around this problem, check for both libraries together
#      if -lsocket doesn't work by itself.
#
# Need to check for Xpm and rplay
#
#-------------------------------------------------------------------

AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])

scwm_checkBoth=0
AC_CHECK_FUNC(connect, scwm_checkSocket=0, scwm_checkSocket=1)
if test "$scwm_checkSocket" = 1; then
    AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", scwm_checkBoth=1)
fi
if test "scwm_checkBoth" = 1; then
    scwm_oldLibs=$LIBS
    LIBS="$LIBS -lsocket -lnsl"
    AC_CHECK_FUNC(accept, scw,_checkNsl=0, [LIBS=$scwm_oldLibs])
fi

AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))


AC_CHECK_LIB(m, main)
AC_CHECK_LIB(dl, main)

AC_CHECK_LIB(termcap, main)
AC_CHECK_LIB(readline, main)

AC_CHECK_LIB(qthreads,main,[
LIBS="-lqthreads $LIBS"
],[
AC_CHECK_LIB(qt, qt_null)
],$LIBS)

dnl FIXGJB: this needs to put an extern "C" on the function prototype
AC_CHECK_LIB(guile, scm_handle_by_message_noexit,[
LIBS="-lguile $LIBS"
guile_scheme_prefix=`guile -c "(display (cdr (assq 'pkgdatadir %guile-build-info))) (newline)"`
],[
AC_MSG_ERROR(Can not find Guile 1.2 or later on the system)
], $LIBS)

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

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

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

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

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

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


# AC_CHECK_LIB(Xpm,XpmFree); /* ?? */

#-------------------------------------------------------------------
#
# Checks for header files.
#
#-------------------------------------------------------------------

AC_HEADER_STDC

#-------------------------------------------------------------------
#
# Check for getopt
#
#-------------------------------------------------------------------

AC_CHECK_HEADERS(getopt.h, AC_DEFINE(HAVE_GETOPT_H))
AC_CHECK_FUNCS(getopt_long, AC_DEFINE(HAVE_GETOPT_LONG))

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

AC_C_CONST
AC_C_INLINE


#-------------------------------------------------------------------
#
# Checks for library functions.
#
#-------------------------------------------------------------------

# AC_CHECK_FUNCS(select)
AC_CHECK_FUNCS(gethostname waitpid sysconf uname)
AC_CHECK_FUNCS(strerror strcasecmp strncasecmp)
AC_CHECK_FUNC(usleep, AC_DEFINE(HAVE_USLEEP))

#===================================================================


#-------------------------------------------------------------------
# 
# Check for X11
#
#-------------------------------------------------------------------

AC_PATH_X


#-------------------------------------------------------------------
#
# Hard coded scwm config stuff
#
#-------------------------------------------------------------------

dnl These defines really should be going into config.h, rather than
dnl being passed by the makefile.

scwm_name="scwm"
scwm_rc=".scwmrc"

dnl The shell quoting game sure is fun...

scwm_image_load_path="(\\\\\\\"$x_includes/X11/bitmaps\\\\\\\" \\\\\\\"$x_includes/X11/pixmaps\\\\\\\" \\\\\\\"$x_libs/X11/mini-icons\\\\\\\" \\\\\\\"\${prefix}/include/X11/pixmaps\\\\\\\" \\\\\\\"\${prefix}/include/X11/bitmaps\\\\\\\" \\\\\\\"\${prefix}/lib/X11/mini-icons\\\\\\\")"

scwm_icons="$x_includes/X11/bitmaps:$x_includes/X11/pixmaps:\${prefix}/icons"
scwm_dir="\${prefix}/lib/X11/$scwm_name"
scwm_scheme_mod_dir="\${prefix}/share/${scwm_name}-modules"
scwm_load_path=$scwm_scheme_mod_dir

if test "x$x_libraries" != x ; then
  x_libraries="-L$x_libraries"
fi
if test "x$x_includes" != x ; then
  x_includes="-I$x_includes"
fi


#-------------------------------------------------------------------
#
# export variables
#
#-------------------------------------------------------------------

AC_SUBST(LIBS)
AC_SUBST(x_libraries)
AC_SUBST(x_includes)
AC_SUBST(scwm_image_load_path)
AC_SUBST(scwm_icons)
AC_SUBST(scwm_name)
AC_SUBST(scwm_rc)
AC_SUBST(scwm_dir)
AC_SUBST(guile_scheme_prefix)
AC_SUBST(scwm_scheme_mod_dir)
AC_SUBST(scwm_load_path)

#-------------------------------------------------------------------
#
# Output makefiles.
#
#-------------------------------------------------------------------

AC_OUTPUT(Makefile \
          scwm/Makefile \
dnl          icons/Makefile \
	  utilities/Makefile \
	  utilities/scwmsend/Makefile \
	  utilities/libscwmexec/Makefile \
	  utilities/scwmexec/Makefile \
	  utilities/scwmrepl/Makefile \
dnl          mini-icons/Makefile \
          sample.scwmrc/Makefile \
          scheme/Makefile \
          app/Makefile \
)