From b9a1f605a97c2c50b3d08296409aeca4c74d11bc Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 16 Aug 2010 06:05:07 +0000 Subject: More configure work --- config/open-axiom.m4 | 297 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 297 insertions(+) (limited to 'config/open-axiom.m4') diff --git a/config/open-axiom.m4 b/config/open-axiom.m4 index b98b5da2..d92d3334 100644 --- a/config/open-axiom.m4 +++ b/config/open-axiom.m4 @@ -621,3 +621,300 @@ fi AC_SUBST(oa_enable_checking) AC_SUBST(oa_optimize_options) ]) + + +dnl ----------------------------- +dnl -- OPENAXIOM_CHECK_SIGNALS -- +dnl ----------------------------- +dnl The host platform must be able to handle signals. Although, this is +dnl not strictly necessary, that is the way OpenAxiom source code +dnl is currently written. We ask for a POSIX or ISO C semantics, though +dnl we have a strong preference for POSIX-conformant semantics. +AC_DEFUN([OPENAXIOM_CHECK_SIGNALS],[ +AC_CHECK_HEADERS([signal.h], + [], + [AC_MSG_ERROR([OpenAxiom needs signal support.])]) +AC_CHECK_DECLS([sigaction], [], [], + [#include ]) +AC_CHECK_DECLS([kill], [], [], + [#include ]) +]) + + +dnl ----------------------------- +dnl -- OPENAXIOM_CHECK_SOCKETS -- +dnl ----------------------------- +dnl The host environment must be capable of handling communication through +dnl sockets. This is required for interfacing AXIOMsys +dnl and Superman. Notice that ideally, we should decouple +dnl that interface in such a way that we can still build OpenAxiom +dnl when uperman is not needed or a socket library is not +dnl available. +AC_DEFUN([OPENAXIOM_CHECK_SOCKETS],[ +case $host in + *mingw*) + AC_CHECK_HEADERS([winsock2.h], + [axiom_host_has_socket=yes], + []) + oa_c_runtime_extra="-lwsock32" + ;; + *) + AC_CHECK_HEADERS([sys/socket.h], + [axiom_host_has_socket=yes], + []) + ;; +esac +if test x$axiom_host_has_socket != xyes; then \ + AC_MSG_ERROR([OpenAxiom needs suport for sockets.]) +fi +## solaris-based systems tend to hide the socket library. +case $host in + *solaris*) + AC_SEARCH_LIBS([accept], [socket], + [], [AC_MSG_ERROR([socket library not found])]) + AC_SEARCH_LIBS([gethostbyname], [nsl]) + ;; + *) ;; +esac + +AC_EGREP_CPP([has_af_local], + [#if HAVE_SYS_SOCKET_H +# include +#else +# include +#endif +#ifdef AF_LOCAL + has_af_local +#endif + ], + [AC_DEFINE([HAVE_AF_LOCAL], [1], [Host has AF_LOCAL])]) + + +AC_EGREP_CPP([has_af_unix], + [#if HAVE_SYS_SOCKET_H +# include +#else +# include +#endif +#ifdef AF_UNIX + has_af_unix +#endif + ], + [AC_DEFINE([HAVE_AF_UNIX], [1], [Host has AF_UNIX])]) +]) + +dnl -------------------------------- +dnl -- OPENAXIOM_CHECK_FILESYSTEM -- +dnl -------------------------------- +dnl Some parts of OpenAxiom manipulate files and directories. They +dnl more or less directly reflect the underlying platform semantics. +dnl For the moment, we require POSIX semantics, though that does not +dnl seem necessary. That restriction should be removed as soon as possible. +AC_DEFUN([OPENAXIOM_CHECK_FILESYSTEM],[ +AC_CHECK_HEADERS([sys/stat.h], + [], + [AC_MSG_ERROR([OpenAxiom needs ])]) +case $host in + *mingw*) + ;; + *) + AC_CHECK_HEADERS([dirent.h], + [], + [AC_MSG_ERROR([OpenAxiom needs ])]) + ;; +esac + +AC_CHECK_HEADERS([unistd.h], [], + [AC_MSG_ERROR([OpenAxiom needs ])]) +]) + +dnl ----------------------------- +dnl -- OPENAXIOM_CHECK_PROCESS -- +dnl ----------------------------- +AC_DEFUN([OPENAXIOM_CHECK_PROCESS],[ +AC_CHECK_DECLS([getuid, geteuid, getgid, getegid], [], [], + [#include ]) +AC_CHECK_HEADERS([sys/wait.h]) +if test x"$ac_cv_header_sys_wait_h" = xyes; then \ + AC_CHECK_DECLS([wait], + [], + [], + [#include ]) +fi +AC_CHECK_DECLS([fork], + [], + [], + [#include ]) +]) + +dnl ---------------------------------- +dnl -- OPENAXIOM_CHECK_CORE_SUPPORT -- +dnl ---------------------------------- +AC_DEFUN([OPENAXIOM_CHECK_CORE_SUPPORT],[ +oa_c_runtime= +AC_SUBST(oa_c_runtime) + +oa_c_runtime_extra= +AC_SUBST(oa_c_runtime_extra) + +OPENAXIOM_CHECK_FILESYSTEM +OPENAXIOM_CHECK_SIGNALS +OPENAXIOM_CHECK_SOCKETS +OPENAXIOM_CHECK_PROCESS +]) + +dnl ------------------------ +dnl -- OPENAXIOM_CHECK_IO -- +dnl ------------------------ +AC_DEFUN([OPENAXIOM_CHECK_IO],[ +## Does this system have openpty or shall we emulate? +AC_CHECK_HEADERS([sys/ioctl.h pty.h util.h libutil.h termios.h]) +AC_CHECK_DECLS([openpty],[],[], + [#if HAVE_PTY_H +# include +#endif +#if HAVE_UTIL_H +# include +#endif +#if HAVE_SYS_IOCTL_H +# include +#endif +#if HAVE_TERMIOS_H +# include +#endif +#if HAVE_LIBUTIL_H +# include +# include +#endif + ]) +if test x"$ac_cv_have_decl_openpty" = xyes; then \ + AC_SEARCH_LIBS([openpty],[util]) +fi + +axiom_use_sman=1 +if test x"$ac_cv_have_decl_fork" = xyes \ + -a x"$ac_cv_have_decl_wait" = xyes; then \ + oa_c_runtime="$oa_c_runtime terminal_io" + axiom_src_all="$axiom_src_all all-sman all-clef" + axiom_src_subdirs="$axiom_src_subdirs clef sman" + OPENAXIOM_MAKEFILE([src/clef/Makefile]) + OPENAXIOM_MAKEFILE([src/sman/Makefile]) +else + axiom_use_sman=0 + AC_MSG_NOTICE([Superman component is disabled.]) +fi + +AC_DEFINE_UNQUOTED([OPENAXIOM_USE_SMAN], [$axiom_use_sman], + [Whether to use the session manager as driver.]) + +axiom_src_all="all-input $axiom_src_all" +]) + + +dnl ------------------------- +dnl -- OPENAXIOM_CHECK_X11 -- +dnl ------------------------- +dnl One of the thorniest issues with programs that use the X Window System +dnl is portability. There exist many implementations of the X11 +dnl specification, each with its own variations, extensions, and what +dnl not. Designing hand-written makefiles for such programs can be a +dnl daunting task, fraut with all kinds of traps. Fortunately, Autoconf +dnl provides us with some help, namely the macro [[AC_PATH_X]] and +dnl [[AC_PATH_XTRA]]. The former searches the directories where the +dnl X11 include files and the library files reside. The latter is an +dnl enhanced version that: +dnl 1. computes the C compiler flags required by X11; +dnl 2. computes the linker flags required by X11; +dnl 3. checks for special libraries that some systems need in order to +dnl compile X11 programs; +dnl 4. checks for special X11R6 libraries that need to be linked before +dnl the flag [[-lX11]]. +AC_DEFUN([OPENAXIOM_CHECK_X11],[ +AC_PATH_XTRA +## Output directives for the C compiler +AC_SUBST(X_CLFAGS) +## Output directives for the linker +AC_SUBST(X_LIBS) +## Output any extra libraries required by X11 +AC_SUBST(X_EXTRA_LIBS) + +## Finally, output the list of libraries that need to appear before -lX11 +## Some part of OpenAxiom depends on Xpm. That library has kind uncertain +## future. At some point in the past, it was deprecated, to be +## replaced by xpm-nox; then came back again. So, its support may +## vary from system to system. For the moment, we assume that if X11 +## is found then, Xpm is already present. Though, clearly that is a +## very optimistic assumption. Long term, OpenAxiom should get rid of +## dependence on Xpm. A nearly fool-proof test would be probably +## inspired by AC_PATH_XTRA. I don't have time to get to that +## complication right now. Will fix later. +X_PRE_LIBS="-lXpm $X_PRE_LIBS" +AC_SUBST(X_PRE_LIBS) + +## If the system supports X11, then build graphics +axiom_use_x=no +if test -z $no_x; then + axiom_use_x=yes + oa_c_runtime="$oa_c_runtime graphics" + axiom_src_all="$axiom_src_all all-graph" + axiom_src_subdirs="$axiom_src_subdirs graph" + OPENAXIOM_MAKEFILE([src/graph/Makefile]) + OPENAXIOM_MAKEFILE([src/graph/Gdraws/Makefile]) + OPENAXIOM_MAKEFILE([src/graph/view2D/Makefile]) + OPENAXIOM_MAKEFILE([src/graph/view3D/Makefile]) + OPENAXIOM_MAKEFILE([src/graph/viewAlone/Makefile]) + OPENAXIOM_MAKEFILE([src/graph/viewman/Makefile]) +else + AC_MSG_NOTICE([The Garphics component is disabled.]) +fi +AC_SUBST(axiom_src_all) +AC_SUBST(axiom_use_x) +]) + +dnl ------------------------ +dnl -- OPENAXIOM_CHECK_QT -- +dnl ------------------------ +AC_DEFUN([OPENAXIOM_CHECK_QT],[ +# Check for Qt utilities. +AC_CHECK_PROGS([OA_QT_MOC], [moc]) +AC_CHECK_PROGS([OA_QT_QMAKE], [qmake]) +if test -n "$OA_QT_MOC"; then + AC_MSG_CHECKING([Qt version]) + oa_qt_version=`"$OA_QT_MOC" -v 2>&1 | sed -e 's/^.*(\(.*\))$/\1/'` + AC_MSG_RESULT([$oa_qt_version]) + case $oa_qt_version in + *[1-3]\.[0-9]+\.[0-9]+) + AC_MSG_WARN([This version of Qt is too old for OpenAxiom.]) + ;; + esac +fi +]) + +dnl ------------------------------------- +dnl -- OPENAXIOM_CHECK_BROWSER_SUPPORT -- +dnl ------------------------------------- +dnl The HyperDoc component needs string pattern matching. +dnl We require [[]], with POSIX-conformant definition. We used +dnl to key build of HyperDoc component on the availability of X11 +dnl functionalities. That, however, is a severe restriction. Not all +dnl of the HyperDoc components need X11. Some, such as [[htadd]], don't +dnl need X11 at all. Therefore we have lifted part of the restrictions. +dnl See \File{src/hyper/Makefile} for more details. Note that is we don't +dnl build the HyperDoc component, the compilation of algebra files are +dnl drawn in [[Unexpected HT command]] noise. +AC_DEFUN([OPENAXIOM_CHECK_BROWSER_SUPPORT],[ +openaxiom_host_has_regex= +AC_CHECK_HEADER([regex.h], + [openaxiom_host_has_regex=yes], + [openaxiom_host_has_regex=no]) +AC_SUBST(openaxiom_host_has_regex) +]) + +dnl ------------------------------ +dnl -- OPENAXIOM_CHECK_GRAPHICS -- +dnl ------------------------------ +AC_DEFUN([OPENAXIOM_CHECK_GRAPHICS],[ +OPENAXIOM_CHECK_X11 +OPENAXIOM_CHECK_QT +OPENAXIOM_CHECK_BROWSER_SUPPORT +]) -- cgit v1.2.3