File:  [Public] / Amaya / configure.in
Revision 1.4: download - view: text, annotated - select for diffs
Tue May 13 15:41:04 1997 UTC (27 years, 1 month ago) by cvs
Branches: MAIN
CVS tags: HEAD
Added detection of Motif includes and libraries, added support for
#ID in CSS, Daniel.

dnl
dnl Process this file with autoconf to produce a configure script.
dnl Autoconf script for Amaya and Thot.
dnl Daniel Veillard, 1997
dnl

dnl  ***************************************************************
dnl
dnl    GENERIC AUTOCONF STUFF : GUESS INFORMATIONS ON SYSTEM SETUP
dnl
dnl  ***************************************************************

AC_PREREQ(2.2)
AC_INIT(thotlib/internals/h/constpiv.h)
AC_REVISION

dnl
dnl Checks for platform information
dnl

AC_CANONICAL_SYSTEM
AC_CONFIG_HEADER(config.h)

dnl
dnl Initializing Automake
dnl

AC_PROG_MAKE_SET
AC_ARG_PROGRAM

dnl
dnl Checks for programs.
dnl

AC_PROG_YACC
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LEX
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PATH_PROG(CP, cp, /bin/cp, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(MV, mv, /bin/mv, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(RM, rm, /bin/rm, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(MKDIR, mkdir, /bin/mkdir, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(ECHO, echo, /bin/echo, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(CAT, cat, /bin/cat, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(CHMOD, chmod, /bin/chmod, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(SED, sed, /bin/sed, $PATH:/bin:/usr/bin:/usr/ucb/bin)
AC_PATH_PROG(AR, ar, /usr/bin/ar, $PATH:/bin:/usr/bin:/usr/ucb/bin)

dnl
dnl Checks for libraries.
dnl

AC_CHECK_LIB(socket, socket, )
AC_CHECK_LIB(inet, connect)
AC_CHECK_LIB(nsl, t_accept)
AC_CHECK_LIB(dl, dlopen)
AC_PATH_X
AC_PATH_XTRA

dnl
dnl Checking for Motif libraries and includes
dnl
dnl Borrowed from Lesstif configure.in
dnl Lesstif is a Great Project (TM)
dnl

AC_DEFUN(AC_PATH_MOTIF_DIRECT,
[test -z "$motif_direct_test_library" && motif_direct_test_library=Xm
test -z "$motif_direct_test_function" && motif_direct_test_function=XmCreatePushButton
test -z "$motif_direct_test_include" && motif_direct_test_include=Xm/Xm.h
  for ac_dir in               \
    /usr/include/Motif1.2     \
    /usr/Motif1.2/include     \
                              \
    /usr/motif/include        \
                              \
    /usr/X11R6/include        \
    /usr/X11R5/include        \
                              \
    /usr/include/X11R6        \
    /usr/include/X11R5        \
                              \
    /usr/local/X11R6/include  \
    /usr/local/X11R5/include  \
                              \
    /usr/local/include/X11R6  \
    /usr/local/include/X11R5  \
                              \
    /usr/X11/include          \
    /usr/include/X11          \
    /usr/local/X11/include    \
    /usr/local/include/X11    \
                              \
    /usr/X386/include         \
    /usr/x386/include         \
    /usr/XFree86/include/X11  \
                              \
    /usr/dt/include           \
                              \
    /usr/include              \
    /usr/local/include        \
    /usr/unsupported/include  \
    /usr/athena/include       \
    /usr/local/x11r5/include  \
    /usr/lpp/Xamples/include  \
    ; \
  do
    if test -r "$ac_dir/$motif_direct_test_include"; then
      no_motif= ac_motif_includes=$ac_dir
      break
    fi
  done

# Check for the libraries.
# See if we find them without any special options.
# Don't add to $LIBS permanently.
ac_save_LIBS="$LIBS"
LIBS="-l$motif_direct_test_library $LIBS"
# First see if replacing the include by lib works.
for ac_dir in `echo "$ac_motif_includes" | sed s/include/lib/` \
    /usr/lib/Motif1.2     \
    /usr/Motif1.2/lib     \
                          \
    /usr/motif/lib        \
                          \
    /usr/X11R6/lib        \
    /usr/X11R5/lib        \
                          \
    /usr/lib/X11R6        \
    /usr/lib/X11R5        \
                          \
    /usr/local/X11R6/lib  \
    /usr/local/X11R5/lib  \
                          \
    /usr/local/lib/X11R6  \
    /usr/local/lib/X11R5  \
                          \
    /usr/X11/lib          \
    /usr/lib/X11          \
    /usr/local/X11/lib    \
                          \
    /usr/X386/lib         \
    /usr/x386/lib         \
    /usr/XFree86/lib/X11  \
                          \
    /usr/lib              \
    /usr/local/lib        \
    /usr/unsupported/lib  \
    /usr/athena/lib       \
    /usr/local/x11r5/lib  \
    /usr/lpp/Xamples/lib  \
    ; \
do
  for ac_extension in a so sl; do
    if test -r $ac_dir/lib${motif_direct_test_library}.$ac_extension; then
      no_motif= ac_motif_libraries=$ac_dir
      break 2
    fi
  done
done])

AC_DEFUN(AC_PATH_MOTIF,
[AC_REQUIRE_CPP()dnl

motif_includes=NONE
motif_libraries=NONE

AC_MSG_CHECKING(for Motif)
AC_ARG_WITH(motif, [  --with-motif            enable Motif tests])
if test "x$with_motif" = xno; then
  no_motif=yes
else
  if test "x$motif_includes" != xNONE && test "x$motif_libraries" != xNONE; then
    no_motif=
  else
AC_CACHE_VAL(ac_cv_path_motif,
[# One or both of these vars are not set, and there is no cached value.
no_motif=yes
AC_PATH_MOTIF_DIRECT

if test "$no_motif" = yes; then
  ac_cv_path_motif="no_motif=yes"
else
  ac_cv_path_motif="no_motif= ac_motif_includes=$ac_motif_includes ac_motif_libraries=$ac_motif_libraries"
fi])dnl
  fi
  eval "$ac_cv_path_motif"
fi # with_motif != no

if test "$no_motif" = yes; then
  AC_MSG_RESULT(no)
else
  test "x$motif_includes" = xNONE && motif_includes=$ac_motif_includes
  test "x$motif_libraries" = xNONE && motif_libraries=$ac_motif_libraries
  ac_cv_path_motif="no_motif= ac_motif_includes=$motif_includes ac_motif_libraries=$motif_libraries"
  AC_MSG_RESULT([libraries $motif_libraries, headers $motif_includes])
  MOTIF_INCLUDES="$motif_includes"
  AC_SUBST(MOTIF_INCLUDES)
  MOTIF_LIBRARIES="$motif_libraries"
  AC_SUBST(MOTIF_LIBRARIES)
fi
])

AC_PATH_MOTIF

dnl
dnl Checks for header files.
dnl

AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT

AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(sys/types.h types.h)
AC_CHECK_HEADERS(sys/unistd.h unistd.h)
AC_CHECK_HEADERS(sys/fcntl.h fcntl.h)
AC_CHECK_HEADERS(sys/limits.h limits.h)
AC_CHECK_HEADERS(sys/stat.h stat.h)
AC_CHECK_HEADERS(sys/file.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(sys/time.h time.h)
AC_CHECK_HEADERS(sys/systeminfo.h)
AC_CHECK_HEADERS(string.h strings.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(sys/socket.h socket.h)
AC_CHECK_HEADERS(appkit/appkit.h appkit.h)
AC_CHECK_HEADERS(netinet/in.h in.h)
AC_CHECK_HEADERS(dn.h)
AC_CHECK_HEADERS(sys/ipc.h)
AC_CHECK_HEADERS(net/errno.h sys/errno.h errno.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(arpa/inet.h inet.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(manifest.h)
AC_CHECK_HEADERS(bsdtypes.h)
AC_CHECK_HEADERS(stdefs.h)
AC_CHECK_HEADERS(bsdtime.h)
AC_CHECK_HEADERS(sys/select.h select.h)
AC_CHECK_HEADERS(dnetdb.h)
AC_CHECK_HEADERS(libc.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_HEADERS(memory.h)
AC_CHECK_HEADERS(unixlib.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(cursesX.h curses.h)
AC_CHECK_HEADERS(sys/resource.h resource.h)
AC_HEADER_DIRENT
AC_CHECK_HEADERS(dir.h direct.h) dnl AC_HEADER_DIRENT only checks for some..
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_STAT

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

AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_TYPE_UID_T

dnl
dnl Checks for library functions.
dnl

AC_FUNC_ALLOCA
AC_TYPE_GETGROUPS
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getcwd gethostname gettimeofday getwd mkdir mktime putenv select socket strdup strerror strftime strstr strtod strtol uname)

dnl  ***************************************************************
dnl
dnl    SPECIFIC STUFF : CONFIGURATION OPTIONS FOR THOT AND AMAYA
dnl
dnl  ***************************************************************

THOT_VER="2.1a"
AMAYA_VER="1.0a"
KAFFE_VER="0.8.4"
LIBWWW_VER="5.0a"

dnl
dnl Check when building with Insure from Parasoft
dnl

AC_ARG_WITH(thot, --{with|without}-insure : Uses Insure Parasoft debugger)
if test "$with_insure" = "no" ; then
    build_thot="no"
fi

dnl
dnl Check for availability of amaya and thot editor sources
dnl

AC_ARG_WITH(thot, --{with|without}-thot : Build the Thot editor or not)
AC_ARG_WITH(amaya, --{with |without}-amaya : Build the Amaya HTML browser/editor or not)

build_thot="yes"
build_amaya="yes"

if test "$with_thot" = "no" ; then
    build_thot="no"
fi
if test "$with_amaya" = "no" ; then
    build_amaya="no"
fi

if test ! -f $srcdir/thot/Makefile.in ; then
    AC_MSG_WARN(Thot editor sources not found, disabling Thot build !)
    build_thot="no"
fi
   
if test ! -f $srcdir/amaya/Makefile.in ; then
    AC_MSG_WARN(Amaya browser/editor sources not found, disabling Amaya build !)
    build_amaya="no"
fi

dnl
dnl Check for external, Thot related programs
dnl

build_misc="no"
if test "$build_thot" = "yes" ;  then
    if test -f $srcdir/misc/Makefile.in ; then
	build_misc="yes"
	build_annotations="no"
	if test -f $srcdir/misc/annotations/Makefile.in ; then
	    build_annotations="yes"
	fi
	if test -f $srcdir/misc/util/Makefile.in ; then
	    build_util="yes"
	    build_tableaux="no"
	    build_transform="no"
	    build_versions="no"
	    if test -f $srcdir/misc/util/tableaux/Makefile.in ; then
		build_tableaux="yes"
	    fi
	    if test -f $srcdir/misc/util/transform/Makefile.in ; then
		build_transform="yes"
	    fi
	    if test -f $srcdir/misc/util/versions/Makefile.in ; then
		build_versions="yes"
	    fi
	fi
    fi
fi

dnl
dnl Check for additionnal packages kaffe-xxx or libwww
dnl use AC_CONFIG_SUBDIRS to launch configure in the subdir
dnl

AC_ARG_ENABLE(java, --{enable|disable}-java : With or without Kaffe Java virtual machine)
AC_ARG_ENABLE(plugin, --{enable|disable}-plugin : With or without support for Netscape Plug-Ins)

if test "$enable_java" = "no" ; then
    with_java="no"
else
    with_java="yes"
fi
if test "$enable_plugin" = "yes" ; then
    with_plugin="yes"
else
    with_plugin="no"
fi

if test "$build_amaya" = "yes" ; then 
    if test ! -f $srcdir/kaffe-$KAFFE_VER/Makefile.in ; then
	if test "$with_java" = "yes" ; then
	    AC_MSG_WARN(kaffe-$KAFFE_VER sources not found, disabling Java !)
	    with_java="no"
	fi
    fi

    if test ! -f $srcdir/classes/thotlib.zip ; then
	if test "$with_java" = "yes" ; then
	    AC_MSG_WARN(Java classes not found, disabling Java !)
	    with_java="no"
	fi
    fi

    if test ! -f $srcdir/w3c-libwww-$LIBWWW_VER/Makefile.in ; then
	if test "$with_java" = "no" ; then
	    AC_MSG_WARN(w3c-libwww-$LIBWWW_VER sources not found !!)
	    AC_MSG_WARN(Disabling Amaya build !)
	    build_amaya="no"
	fi
    fi

    if test "$with_java" = "yes" -a "$with_plugin" = "yes" ; then
       AC_MSG_WARN(Amaya configured with both Java and Plugins support)
       AC_MSG_WARN(Beware this combination doesn't work well)
    fi
fi

dnl
dnl The options for each library or binary
dnl

THOT_OPTIONS=
AMAYA_OPTIONS="-DCOUGAR"
PLUGIN_OPTIONS="-DPLUGIN_TRACE -DXP_UNIX"
dnl JAVA_OPTIONS="-DDEBUG_KAFFE -DDEBUG_LOCK -DDEBUG_SELECT -DDEBUG_SELECT_CHANNELS -DDEBUG_TIMING -DSYNC_DNS"
JAVA_OPTIONS=
ANNOTATIONS_OPTIONS=
IMGLIBS="-ljpeg -lpng -lz"
EXTRA_LIBS=

dnl
dnl Set up the PATHs needed
dnl

API="\$(THOTDIR)/thotlib/include"
VAR="\$(THOTDIR)/thotlib/internals/var"
INCL="\$(THOTDIR)/thotlib/internals/h"
FUNC="\$(THOTDIR)/thotlib/internals/f"
SCHEMAS="\$(THOTDIR)/schemas"
SCHEMASOPERA="\$(THOTDIR)/schemasOPERA"
JPEGINCL="-I\$(THOTDIR)/libjpeg"
PNGINCL="-I\$(THOTDIR)/libpng -I\$(THOTDIR)/libpng/zlib"

dnl
dnl Set up the include variables.
dnl

THOTINCLUDES="-I$API -I$VAR -I$INCL -I$FUNC -I$SCHEMAS -I$SCHEMASOPERA $JPEGINCL $PNGINCL"
APIINCLUDES=-I$API 
if test "$VPATHOPT" = "" ; then
	VPATHOPT="VPATH"
fi

dnl
dnl Exports the current values of the variables.
dnl

AC_SUBST(THOT_VER)
AC_SUBST(AMAYA_VER)
AC_SUBST(LIBWWW_VER)
AC_SUBST(KAFFE_VER)

AC_SUBST(THOTINCLUDES)
AC_SUBST(APIINCLUDES)
AC_SUBST(VPATHOPT)

AC_SUBST(THOT_OPTIONS)
AC_SUBST(AMAYA_OPTIONS)
AC_SUBST(PLUGIN_OPTIONS)
AC_SUBST(JAVA_OPTIONS)
AC_SUBST(ANNOTATIONS_OPTIONS)
AC_SUBST(IMGLIBS)
AC_SUBST(EXTRA_LIBS)

dnl
dnl Include the option Makefile.xxx fragment for plugin and or Java options
dnl

if test "$with_plugin" = "yes" ; then
    AC_SUBST_FILE(plugin_frag)dnl
    plugin_frag=$srcdir/pluginlib/Makefile.plugin
else
    AC_SUBST_FILE(plugin_frag)
    plugin_frag=/dev/null
fi

if test "$with_java" = "yes" ; then
    AC_SUBST_FILE(java_frag)dnl
    java_frag=$srcdir/javalib/Makefile.java
    AC_SUBST_FILE(www_frag)
    www_frag=/dev/null
else
    AC_SUBST_FILE(java_frag)
    java_frag=/dev/null
    AC_SUBST_FILE(www_frag)dnl
    www_frag=$srcdir/amaya/Makefile.libwww
fi

dnl  ***************************************************************
dnl
dnl      FINAL STEP : PRODUCE ALL THE MAKEFILES AND CONFIG FILES
dnl
dnl  ***************************************************************

EXTRA_MAKEFILE_IN=
make_output="Makefile Options.orig:Options.in tools/Makefile \
       libjpeg/Makefile libpng/Makefile libpng/zlib/Makefile \
       tools/mkdep/Makefile \
       tools/cextract-1.7/Makefile thotlib/Makefile \
       thotlib/include/Makefile batch/Makefile tablelib/Makefile \
       drawlib/Makefile indexlib/Makefile"

if test "$build_amaya" = "yes" ; then

    make_output="$make_output amaya/Makefile \
tools/javastub/Makefile tools/dns_daemon/Makefile javalib/Makefile \
pluginlib/Makefile"

    EXTRA_MAKEFILE_IN="$srcdir/amaya/Makefile.in \
$srcdir/amaya/Makefile.libwww \
$srcdir/tools/javastub/Makefile.in \
$srcdir/tools/dns_daemon/Makefile.in \
$srcdir/javalib/Makefile.in \
$srcdir/pluginlib/Makefile.in \
$srcdir/pluginlib/Makefile.plugin"

fi

if test "$build_thot" = "yes" ; then

    make_output="$make_output thot/Makefile"
    EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/thot/Makefile.in"

    if test "$build_misc" = "yes" ; then

	make_output="$make_output misc/Makefile"
	EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/misc/Makefile.in"

	if test "$build_annotations" = "yes" ; then

	    make_output="$make_output misc/annotations/Makefile"
	    EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/misc/annotations/Makefile.in"

	fi
	if test "$build_util" = "yes" ; then

	    make_output="$make_output misc/util/Makefile"
	    EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/misc/util/Makefile.in"

	    if test "$build_tableaux" = "yes" ; then

		make_output="$make_output misc/util/tableaux/Makefile"
		EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/misc/util/tableaux/Makefile.in"

	    fi
	    if test "$build_transform" = "yes" ; then

		make_output="$make_output misc/util/transform/Makefile"
		EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/misc/util/transform/Makefile.in"

	    fi
	    if test "$build_versions" = "yes" ; then

		make_output="$make_output misc/util/versions/Makefile"
		EXTRA_MAKEFILE_IN="$EXTRA_MAKEFILE_IN \
$srcdir/misc/util/versions/Makefile.in"

	    fi
	fi
    fi
fi

AC_SUBST(EXTRA_MAKEFILE_IN)
AC_OUTPUT($make_output , echo timestamp > stamp-h)

if test "$build_thot" = "yes" ; then
    if test "$build_amaya" = "yes" ; then
	echo Amaya and Thot packages are now configured
    else
	echo Thot package is now configured
    fi
else
    if test "$build_amaya" = "yes" ; then
	echo Amaya package is now configured
    else
	echo Nor Amaya nor Thot package found, get the corresponding archive
    fi

fi

if test "$build_amaya" = "yes" ; then
    if test "$with_java" = "yes" ; then
	echo Amaya configured with Java support
    else
	echo Amaya configured with libWWW
    fi
    if test "$with_plugin" = "yes" ; then
	echo Amaya configured with Plugins support
    fi
fi

echo "Now start \"make all\" (GNU make preferably) to build the binaries"

Webmaster