Subversion Repositories wimsdev

Rev

Rev 795 | Blame | Last modification | View Log | RSS feed

# Process this file with autoconf to produce a configure script.
AC_INIT(WIMS, WIMS_VERSION, xiao@unice.fr)
AC_CONFIG_SRCDIR([wims.c])
AC_CONFIG_HEADER([config.h:config.hin])

AC_DEFUN([WIMS_NEED], [
  AC_PATH_PROG($1,$2)
  if test -z "`eval echo '$'$1`"; then
    echo ERROR: WIMS requires $3
    echo Please install this package then restart configure.
    exit 1
  fi
])
AC_DEFUN([WIMS_FAIL], [
  if test "$2" = no; then
    echo
    echo ERROR! Your system does not have $1
    echo WIMS cannot be installed. Please report.
    echo
    exit 1
  fi
])

# Checks for programs.
AC_PROG_LN_S
if test "$LN_S" != "ln -s"; then
  WIMS_FAIL([symbolic links], no)
fi
AC_PROG_AWK
AC_PROG_YACC
AC_PROG_CC(gcc cc)
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_LEX
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CHECK_PROG(STRIP,strip,strip,:)

WIMS_NEED([TEX], [tex], [TeX])
#WIMS_NEED([GP], [gp], [Pari/GP])
#WIMS_NEED([CONVERT], [convert], [ImageMagick])

# Checks for libraries.
SAVE=$LIBS
AC_CHECK_LIB([m], [cos])
AC_CHECK_FUNCS([floor pow rint sqrt])

LIBS=$SAVE
AC_CHECK_LIB([crypt], [crypt])
AC_CHECK_FUNCS([crypt])
CRYPTLIB=$LIBS

LIBS=$SAVE
AC_CHECK_LIB([fl], [main])
FLEXLIB=$LIBS

LIBS=$SAVE
fun=gethostbyname
AC_CHECK_FUNCS($fun)
if test "$ac_cv_func_gethostbyname" = no; then
  AC_CHECK_LIB([nsl], $fun)
  WIMS_FAIL($fun, $ac_cv_lib_gethostbyname)
fi

fun=gethostname
AC_CHECK_FUNCS($fun)
WIMS_FAIL($fun, $ac_cv_func_gethostname)

fun=socket
AC_CHECK_FUNCS($fun)
if test "$ac_cv_func_socket" = no; then 
  AC_CHECK_LIB([socket], [$fun])
  if test "$ac_cv_lib_socket" = no; then 
    AC_CHECK_LIB([socket], [$fun], [], [], [-lnsl])
    WIMS_FAIL($fun, $ac_cv_lib_socket)
  fi
fi

fun=inet_ntoa
AC_CHECK_FUNCS($fun)
if test "$ac_cv_func_inet_ntoa" = no; then 
  AC_CHECK_LIB([socket], [$fun], [], [], [-lnsl])
fi
fun=inet_aton
AC_CHECK_FUNCS($fun)
if test "$ac_cv_func_inet_aton" = no; then 
  AC_CHECK_LIB([resolv], [$fun])
fi
NETLIBS=$LIBS

LIBS=$SAVE

# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_MEMORY_H
AC_CHECK_HEADERS([crypt.h arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h \
stdlib.h string.h sys/socket.h sys/time.h unistd.h utime.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_TYPES(socklen_t, [], [], [
#include <sys/types.h>
#include <sys/socket.h>])

# Runpath
RPATH=
case "$CC+$with_dynamic" in
  gcc+yes) RPATH="-Xlinker -rpath -Xlinker ../lib:../../lib:../../../lib";;
esac

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_LSTAT
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_STRTOD
AC_FUNC_UTIME_NULL
AC_CHECK_FUNCS([dup2 alarm getcwd gethostbyname gethostname gettimeofday \
inet_ntoa memmove memset mkdir regcomp rmdir putenv select socket \
strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr utime])

# setenv ?
AC_CHECK_FUNCS([setenv])
if test "$ac_cv_func_setenv" = no; then
  common=../Common
  SETENV_OBJS=$common/setenv.o
# FIXME: there should not be various xmallocs with different semantics. Only
# SETENV_OBJS should be necessary.
  ALLSETENV_OBJS="$SETENV_OBJS $common/xmalloc.o"
else
  SETENV_OBJS=
  ALLSETENV_OBJS=
fi

# Case insensitive file system?
AC_CHECK_FILE(WIMS.C, D_CASE_INSENSITIVE_FS="-DCASE_INSENSITIVE_FS=1",
                      D_CASE_INSENSITIVE_FS=)
# Static libm?
AC_CHECK_FILE(/usr/lib/libm.a,STATIC_LIB=-static,STATIC_LIB=)

# Configure options
AC_ARG_WITH(units, [  --without-units     Don't compile units-filter (units recognition)],echo Compile units-filter: $with_units, with_units=yes; echo Compile units-filter: yes)
BUILD_UNITS=
if test "$with_units" = "yes"; then
  case "$LEXLIB" in
  -lfl) BUILD_UNITS=units-filter;;
  *) with_units=no; echo "Wait ... flex is not available, Compile units : no";;
  esac
fi

AC_ARG_WITH(chemeq,[  --without-chemeq    Don't compile chemeq (chemical equation analyzer)],echo Compile chemeq: $with_chemeq, with_chemeq=yes; echo Compile chemeq: yes)
BUILD_CHEMEQ=
if test "$with_chemeq" = "yes"; then
  case "$LEXLIB" in
  -lfl) if test "$CXX" = "g++"; then
          case `"$CXX" --version` in
          [ 1*|2.[1-8]*|2.9[1-4]*|2.95.[1-2]) ]
              with_chemeq=no
              echo "Wait ... I need at least g++-2.95.3, Compile chemeq: no" ;;
            *) BUILD_CHEMEQ=chemeq;;
          esac
        else
          with_chemeq=no
          echo "Wait ... g++ is not available, Compile chemeq: no"
        fi;;
  *) with_chemeq=no
     echo "Wait ... flex is not available, Compile chemeq: no";;
  esac
fi

AC_ARG_WITH(wimsd,[  --without-wimsd      Don't compile wimsd (standalone http server)],echo Compile wimsd: $with_wimsd, with_wimsd=yes; echo Compile wimsd: yes)
if test "$with_wimsd" = "yes"; then
  BUILD_WIMSD=wimsd
fi

date=`date +%Y-%m-%d`
DEFINES="-DGNU_SOURCE -DVERSION_DATE=\\\"$date\\\""
AC_SUBST(D_CASE_INSENSITIVE_FS)
AC_SUBST(STATIC_LIB)
AC_SUBST(DEFINES)
AC_SUBST(STRIP)
AC_SUBST(RPATH)
AC_SUBST(BUILD_UNITS)
AC_SUBST(BUILD_CHEMEQ)
AC_SUBST(BUILD_WIMSD)
AC_SUBST(SETENV_OBJS)
AC_SUBST(ALLSETENV_OBJS)
AC_SUBST(NETLIBS)
AC_SUBST(FLEXLIB)
AC_SUBST(CRYPTLIB)

AC_CONFIG_FILES([Flydraw/gd/Makefile
                 Flydraw/Makefile
                 Interfaces/Makefile
                 Lib/Makefile
                 Makefile
                 Misc/Makefile
                 Misc/symtext/Makefile
                 Misc/mathexp/Makefile
                 Misc/chemeq/Makefile
                 Misc/chemeq/src/Makefile
                 Misc/units-filter/src/Makefile
                 Misc/voronoiW/Makefile
                 Misc/bioinfo/Makefile
                 Misc/checkmol/Makefile
                 Misc/whirlgif/Makefile
                 Module/Makefile
                 Module/drawode/Makefile
                 Msg2wims/Makefile
                 Oef2wims/Makefile
                 Wimsd/Makefile
                 Wimslogd/Makefile
                 Texgif/Makefile])
AC_OUTPUT