eterm/configure.in

388 lines
11 KiB
Plaintext
Raw Normal View History

dnl# $Id$
AC_INIT(src/feature.h.in)
AM_INIT_AUTOMAKE(Eterm, 0.8.9)
dnl# Set some basic variables
DATE="21 January 1999"
AC_SUBST(DATE)
AUTHORS="Tuomo Venalainen (vendu@cc.hut.fi) and Michael Jennings (mej@tcserv.com)"
AC_SUBST(AUTHORS)
dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
if test ! -z "${CFLAGS}" -o ! -z "${CCOPTS}"; then
CFLAGS_GIVEN=1
else
CFLAGS_GIVEN=0
fi
if test -z "${CFLAGS}"; then
if test -z "${CCOPTS}"; then
CCOPTS="-O"
fi
CFLAGS="$CCOPTS"
fi
AC_ARG_WITH(cc, [ --with-cc=compiler force Eterm to build with a particular compiler (like pgcc, egcs, etc.)],
CC=$withval,
if test -z "$CC"; then
CC=check
fi
)
if test "$CC" = "check"; then
dnl# Check for Pentium compilers
AC_CHECK_PROG(EGCS, egcs, egcs)
AC_CHECK_PROG(PGCC, pgcc, pgcc)
if test ! -z "$EGCS"; then
CC=$EGCS
elif test ! -z "$PGCC"; then
CC=$PGCC
else
unset CC
fi
fi
AC_PROG_CC
AC_PROG_CPP
dnl# These must be run after AC_PROG_CC but before any other macros that use
dnl# the C compiler
AC_AIX
AC_ISC_POSIX
AC_MINIX
dnl# At least make the attempt to support CygWin32
AC_CYGWIN
AC_ARG_PROGRAM
AM_PROG_LIBTOOL
dnl# Where are we?
AC_MSG_CHECKING(for distribution root)
DIST_ROOT=`pwd`
AC_SUBST(DIST_ROOT)
AC_MSG_RESULT($DIST_ROOT)
AC_GCC_TRADITIONAL
dnl # If using gcc, use -O2. If -g works with it, use that too
if test "${CFLAGS_GIVEN}" -ne 1; then
if test "$GCC" = "yes"; then
if test "$ac_cv_prog_cc_g" = "yes"; then
CCOPTS='-g -O2'
else
CCOPTS='-O2'
fi
CFLAGS="$CCOPTS"
fi
fi
AC_PROG_INSTALL
dnl# Check for host system type
AC_CANONICAL_HOST
dnl# Check the sanity of what we've done so far
AM_SANITY_CHECK
dnl# Most people don't want the developer-only clutter
AM_MAINTAINER_MODE
dnl# If it's there, what the hell?
AM_WITH_DMALLOC
dnl# Look for needed programs
AC_CHECK_PROG(SED, sed, sed, false)
AC_CHECK_PROG(RM, rm, rm, true)
AC_CHECK_PROG(CP, cp, cp, false)
AC_CHECK_PROG(CHMOD, chmod, chmod, true)
AC_CHECK_PROG(TAR, tar, tar, tar)
AC_CHECK_PROG(MKDIR, mkdir, mkdir, false)
AC_CHECK_PROG(CTAGS, ctags, ctags, true)
AC_CHECK_PROG(AR, ar, ar, false)
AC_CHECK_PROG(MV, mv, mv, true)
AC_LN_S
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
dnl AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_PATH_XTRA
if test "$ac_cv_lib_socket_connect" = "yes" ; then
SUBLIBS="-lsocket"
fi
if test "$ac_cv_lib_nsl_gethostbyname" = "yes" ; then
SUBLIBS="$SUBLIBS -lnsl"
fi
dnl# Checks for header files.
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h termios.h \
sys/ioctl.h sys/select.h sys/time.h \
sys/sockio.h sys/byteorder.h \
utmpx.h unistd.h bsd/signal.h regex.h \
regexp.h stdarg.h)
AC_HEADER_TIME
dnl# Missing typedefs and replacements
AC_TYPE_MODE_T
AC_CHECK_TYPE(off_t, long)
AC_TYPE_PID_T
AC_TYPE_UID_T
dnl# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(atexit _exit unsetenv setutent seteuid memmove putenv strsep setresuid setresgid memmem usleep snprintf)
dnl# Check for the need for -lutil on BSD systems
AC_CHECK_FUNC(login,
AC_DEFINE(HAVE_LOGIN)
, AC_CHECK_LIB(util, login, LIBS="$LIBS -lutil" ;
AC_DEFINE(HAVE_LOGIN)
))
AC_CHECK_FUNC(logout,
AC_DEFINE(HAVE_LOGOUT)
, AC_CHECK_LIB(util, logout, LIBS="$LIBS -lutil" ;
AC_DEFINE(HAVE_LOGOUT)
))
AC_CHECK_FUNC(getpwuid, , AC_CHECK_LIB(sun, getpwuid, LIBS="$LIBS -lsun"))
dnl# Check for POSIX threads library
dnl# Don't comment this back in before multithreading actually works,
dnl# so people don't need thread-safe X libs to be able to run unthreaded
dnl# Eterm :) -vendu
#AC_CHECK_LIB(pthread, pthread_create, CFLAGS="$CFLAGS -D_REENTRANT";
# THREADLIBS="-lpthread", ,
# -D_REENTRANT -L/usr/lib -L/lib -L/usr/local/lib)
dnl# Did they want debugging?
AC_MSG_CHECKING(for debugging level)
AC_ARG_WITH(debugging, [ --with-debugging[=num] enable debugging output, num is an optional level],
if test "$withval" = "yes"; then
withval=4
else
:
fi
if test "$withval" != "no"; then
echo "$withval"
AC_DEFINE_UNQUOTED(DEBUG, $withval)
else
echo "no debugging"
fi, echo "4"
AC_DEFINE_UNQUOTED(DEBUG, 4)
)
dnl# Check for support for menus
AC_MSG_CHECKING(whether or not to enable menubar support)
AC_ARG_ENABLE(menus, [ --disable-menus disable support for menubars (support enabled by default)],
if test "$enableval" != "no"; then
echo "yes" ; MENUSED="";
else echo "no" ; MENUSED='s/define MENUBAR_MAX .*/define MENUBAR_MAX 0/g';
fi, echo "yes" ; MENUSED="")
dnl# Check for graphics libraries.
dnl# Force Imlib flags - see below. -vendu
AC_MSG_CHECKING(whether or not to enable pixmap support)
AC_ARG_WITH(imlib,
[ --with-imlib[=DIR] compile with Imlib support (Imlib residing in DIR/lib) [default]
--without-imlib compile with pixmap support disabled],
if test "$withval" != "no"; then
echo "yes" ; CFLAGS="$CFLAGS -I${withval}/include -L${withval}/lib";
GRLIBS="-lImlib" ; PIXMAPSED="";
else echo "no" ; PIXMAPSED='s/define PIXMAP_SUPPORT/undef PIXMAP_SUPPORT/g';
GRLIBS="";
fi, echo "yes" ; GRLIBS="-lImlib" ; PIXMAPSED="")
AC_CHECK_LIB(X11, XOpenDisplay, X_LIBS="$X_LIBS -lX11", [
echo "ERROR: You need libX11 to build Eterm. Verify that you have libX11.a or";
echo " libX11.so installed and that it is located in the X libraries";
echo " directory shown above. If it is in a different directory, try using";
echo " the --x-libraries parameter to configure.";
AC_MSG_ERROR([Fatal: libX11 not found.])], $X_LIBS $SUBLIBS)
AC_CHECK_LIB(Xext, XextAddDisplay, X_LIBS="-lXext $X_LIBS", [
echo "ERROR: You need libXext to build Eterm. Verify that you have libXext.a or";
echo " libXext.so installed and that it is located in the X libraries";
echo " directory shown above. If it is in a different directory, try using";
echo " the --x-libraries parameter to configure.";
AC_MSG_ERROR([Fatal: libXext not found.])], $X_LIBS $SUBLIBS)
AC_CHECK_LIB(Xext, XShapeQueryExtension, AC_DEFINE(HAVE_X_SHAPE_EXT), , $X_LIBS $SUBLIBS)
if test -z "$PIXMAPSED"; then
AC_CHECK_PROG(IMLIB_CONFIG, imlib-config, imlib-config, no)
if test "$IMLIB_CONFIG" != "no"; then
if test "$prefix" = "NONE"; then
AC_MSG_CHECKING(imlib-config for prefix)
prefix="`$IMLIB_CONFIG --prefix`"
AC_MSG_RESULT($prefix)
fi
AC_MSG_CHECKING(imlib-config for the value of CFLAGS)
CFLAGS="$CFLAGS `$IMLIB_CONFIG --cflags`"
AC_MSG_RESULT($CFLAGS)
AC_MSG_CHECKING(imlib-config for the value of GRLIBS)
GRLIBS="$GRLIBS `$IMLIB_CONFIG --libs`"
AC_MSG_RESULT($GRLIBS)
SAVE_LIBS="$LIBS"
LIBS="$GRLIBS"
AC_MSG_CHECKING(the sanity of new compile/link flags)
AC_TRY_LINK(, , echo "yes", echo "no" ; IMLIB_CONFIG="no" ;
AC_WARN(Compile/link failed. Reverting to manual method.)
)
LIBS="$SAVE_LIBS"
fi
if test "$IMLIB_CONFIG" = "no"; then
AC_CHECK_LIB(png, png_get_valid, GRLIBS="$GRLIBS -lpng -lz -lm", ,
$SUBLIBS $X_LIBS -lz -lm)
AC_CHECK_LIB(jpeg, jpeg_read_scanlines, GRLIBS="$GRLIBS -ljpeg", ,
$SUBLIBS $X_LIBS)
AC_CHECK_LIB(tiff, TIFFOpen, GRLIBS="$GRLIBS -ltiff", ,
$SUBLIBS $X_LIBS -lm)
AC_CHECK_LIB(gif, DGifOpenFileName, GRLIBS="$GRLIBS -lgif", ,
$SUBLIBS $X_LIBS)
AC_CHECK_LIB(ungif, DGifOpenFileName, GRLIBS="$GRLIBS -lungif", ,
$SUBLIBS $X_LIBS)
AC_CHECK_LIB(Imlib, Imlib_init, , [
echo "WARNING: Imlib was not found or did not correctly link.";
echo " Please check config.log to see what the error was.";
echo " I will attempt to continue, but things may go wrong.";
AC_MSG_WARN([WARNING: libImlib not found. Attempting to continue anyway.])],
$GRLIBS $SUBLIBS $X_LIBS)
fi
fi
AC_PREFIX(Eterm)
AC_PREFIX(gcc)
dnl Stack Tracing toys
AC_ARG_ENABLE(stack-trace, [ --disable-stack-trace disable stack trace on abnormal termination],
if test "$enableval" = "no"; then
AC_DEFINE(NO_STACK_TRACE)
NO_STACK_TRACE=1
fi
)
if test "$NO_STACK_TRACE" != "1"; then
AC_PATH_PROG(DBX, dbx, no)
if test "$DBX" != "no"; then
AC_DEFINE_UNQUOTED(DBX, "$DBX")
fi
AC_PATH_PROG(GDB, gdb, no)
if test "$GDB" != "no"; then
AC_DEFINE_UNQUOTED(GDB, "$GDB")
fi
AC_PATH_PROG(PSTACK, pstack, no, $PATH:/usr/proc/bin:/usr/sbin)
if test "$PSTACK" != "no"; then
AC_DEFINE_UNQUOTED(PSTACK, "$PSTACK")
fi
AC_CHECK_LIB(cl, U_STACK_TRACE, LIBS="$LIBS -lcl")
fi
AC_MSG_CHECKING(for Linux 2.1 or higher)
OS_NAME=`uname -s`
if test "$OS_NAME" = "Linux"; then
OS_REV=`uname -r`
OS_MAJOR=`echo $OS_REV | cut -d. -f1`
OS_MINOR=`echo $OS_REV | cut -d. -f2`
if test "$OS_MAJOR" -ge "2" -a "$OS_MINOR" -ge "1"; then
AC_MSG_RESULT(yes)
AC_DEFINE(NEED_LINUX_HACK)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
fi
dnl# Enable/disable humor
AC_ARG_WITH(sense-of-humor, [ --without-sense-of-humor Specify this if you have no sense of humor],
if test "$withval" = "no"; then
HUMOR=none
fi)
if test -z "$HUMOR"; then
AC_CHECK_LIB(Kenny, life_signs, , [
echo " Oh my god, they killed Kenny! You bastards!"
])
fi
CFLAGS=${CFLAGS--O}
LDFLAGS=${LDFLAGS--O}
CPPFLAGS="$CPPFLAGS"
AC_SUBST(CC)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBS)
AC_SUBST(THREADLIBS)
AC_SUBST(GRLIBS)
basedir=.
FEATURE_CMD="$SED -e \"s%@PREFIX@%${prefix}%g\" -e \"s%@DATADIR@%${datadir}%g\" -e \"$PIXMAPSED\" -e \"$MENUSED\" "'${DIST_ROOT}'"/src/feature.h.in > "'${DIST_ROOT}'"/src/feature.h"
AC_SUBST(FEATURE_CMD)
dnl# common parts of the Makefile
dnl# MCOMMON=./Make.common
dnl# AC_SUBST_FILE(MCOMMON)
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile \
bg/Makefile \
doc/Makefile \
utils/Makefile \
libmej/Makefile \
src/Makefile \
src/graphics/Makefile \
themes/Makefile \
Eterm.spec \
)
dnl If we're not building with Imlib support, don't build Esetroot
if test -n "$PIXMAPSED"; then
sed -e 's/^bin_PROGRAMS.*$//g' doc/Makefile > doc/Makefile.new
mv doc/Makefile.new doc/Makefile
fi
echo "creating src/feature.h"
eval ${FEATURE_CMD}.new
if cmp -s ${DIST_ROOT}/src/feature.h.new ${DIST_ROOT}/src/feature.h 2>/dev/null ; then
echo "feature.h is unchanged"
rm -f ${DIST_ROOT}/src/feature.h.new
else
mv ${DIST_ROOT}/src/feature.h.new ${DIST_ROOT}/src/feature.h
fi
echo "
Configuration:
Source code location: ${srcdir}
Compiler: ${CC} ${CFLAGS}
Host System Type: ${host}
Graphics libraries: ${GRLIBS}
X Windows libs/paths: ${X_LIBS}
Install path: ${prefix}
See src/feature.h for further configuration information."
echo