qse/ase/configure.ac
2008-06-29 00:14:04 +00:00

313 lines
7.8 KiB
Plaintext

#
# $Id: configure.ac,v 1.5 2007/05/25 07:54:15 bacon Exp $
#
AC_PREREQ(2.53)
AC_INIT([ase],[0.5.0],[bacon@abiyo.net])
AC_CONFIG_HEADER([include/ase/config.h])
AC_CONFIG_AUX_DIR(autoconf)
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AC_CHECK_TOOL(RANLIB, ranlib)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(GREP, grep)
AC_CHECK_TOOL(RM, rm)
AC_CHECK_TOOL(CJ, gcj)
AC_SUBST(LIBTOOL_DEPS)
# Overrides the default CFLAGS setting
if test "$ac_test_CFLAGS" = "set"
then
CFLAGS=$ac_save_CFLAGS
else
if test "$GCC" = "yes"
then
CFLAGS="-O2"
else
CFLAGS=
fi
fi
if test "$ac_test_CXXFLAGS" = "set"
then
CXXFLAGS=$ac_save_CXXFLAGS
else
if test "$GCC" = "yes"
then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
if test "$ac_test_CJFLAGS" = "set"
then
CJFLAGS=$ac_save_CJFLAGS
else
if test "$CJ" = "gcj"
then
CJFLAGS="-O2"
else
CJFLAGS=
fi
fi
# Do we need libm for math functions?
AC_MSG_CHECKING([for libm math function in std libs])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <math.h>
]], [[
double x;
pow(x, x);
return 0;
]])],[needlibm=no],[needlibm=yes])
if test "$needlibm" = "yes"; then
AC_MSG_RESULT([no])
AC_CHECK_LIB([m], [pow],
LIBM="-lm",
AC_MSG_ERROR([libm is needed and is not available]))
else
AC_MSG_RESULT([yes])
fi
# Checks for header files.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN(
[AC_DEFINE([ASE_ENDIAN_BIG],[],[Big Endian])],
[AC_DEFINE([ASE_ENDIAN_LITTLE],[],[Little Endian])],
[AC_DEFINE([ASE_ENDIAN_UNKNOWN],[],[Unknown Endian])])
# Checks for data types
#AC_CHECK_TYPE(long long, [AC_DEFINE([ASE_HAVE_LONG_LONG],[],[long long])])
#AC_CHECK_TYPE(long double, [AC_DEFINE([ASE_HAVE_LONG_DOUBLE],[],[long double])])
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(__int8)
AC_CHECK_SIZEOF(__int16)
AC_CHECK_SIZEOF(__int32)
AC_CHECK_SIZEOF(__int64)
AC_CHECK_SIZEOF(__int128)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_CHECK_SIZEOF(wchar_t)
AC_DEFINE([ASE_SIZEOF_CHAR], [], [sizeof(char)])
AC_DEFINE([ASE_SIZEOF_SHORT], [], [sizeof(short)])
AC_DEFINE([ASE_SIZEOF_INT], [], [sizeof(int)])
AC_DEFINE([ASE_SIZEOF_LONG], [], [sizeof(long)])
AC_DEFINE([ASE_SIZEOF_LONG_LONG], [], [sizeof(long long)])
AC_DEFINE([ASE_SIZEOF___INT8], [], [sizeof(__int8)])
AC_DEFINE([ASE_SIZEOF___INT16], [], [sizeof(__int16)])
AC_DEFINE([ASE_SIZEOF___INT32], [], [sizeof(__int32)])
AC_DEFINE([ASE_SIZEOF___INT64], [], [sizeof(__int64)])
AC_DEFINE([ASE_SIZEOF___INT128], [], [sizeof(__int128)])
AC_DEFINE([ASE_SIZEOF_VOID_P], [], [sizeof(void*)])
AC_DEFINE([ASE_SIZEOF_FLOAT], [], [sizeof(float)])
AC_DEFINE([ASE_SIZEOF_DOUBLE], [], [sizeof(double)])
AC_DEFINE([ASE_SIZEOF_LONG_DOUBLE], [], [sizeof(long double)])
AC_DEFINE([ASE_SIZEOF_WCHAR_T], [], [sizeof(wchar_t)])
AC_DEFINE_UNQUOTED(ASE_SIZEOF_CHAR,${ac_cv_sizeof_char})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_SHORT,${ac_cv_sizeof_short})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_INT,${ac_cv_sizeof_int})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_LONG,${ac_cv_sizeof_long})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_LONG_LONG,${ac_cv_sizeof_long_long})
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT8,${ac_cv_sizeof___int8})
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT16,${ac_cv_sizeof___int16})
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT32,${ac_cv_sizeof___int32})
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT64,${ac_cv_sizeof___int64})
AC_DEFINE_UNQUOTED(ASE_SIZEOF___INT128,${ac_cv_sizeof___int128})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_VOID_P,${ac_cv_sizeof_void_p})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_FLOAT,${ac_cv_sizeof_float})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_DOUBLE,${ac_cv_sizeof_double})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_LONG_DOUBLE,${ac_cv_sizeof_long_double})
AC_DEFINE_UNQUOTED(ASE_SIZEOF_WCHAR_T,${ac_cv_sizeof_wchar_t})
AC_DEFINE([ASE_PKGNAME], [], [package name])
AC_DEFINE([ASE_PKGVERSION], [], [package version])
AC_DEFINE([ASE_PKGAUTHOR], [], [author's email address])
AC_DEFINE_UNQUOTED(ASE_PKGNAME,"${PACKAGE}")
AC_DEFINE_UNQUOTED(ASE_PKGVERSION,"${VERSION}")
AC_DEFINE_UNQUOTED(ASE_PKGAUTHOR,"${PACKAGE_BUGREPORT}")
# Defines extra options
AC_ARG_ENABLE([wchar], [AC_HELP_STRING([--enable-wchar],
[use wchar_t a default charater type when enabled (default. yes)])],
enable_wchar_is=$enableval,enable_wchar_is=yes)
if test "$enable_wchar_is" = "yes"
then
AC_DEFINE([ASE_CHAR_IS_WCHAR],[],[char is wchar])
else
AC_DEFINE([ASE_CHAR_IS_MCHAR],[],[char is mchar])
fi
AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
[build the library in the debug mode (default. no)])],
enable_debug_is=$enableval,enable_debug_is=no)
if test "$enable_debug_is" = "yes"
then
[CFLAGS="$CFLAGS -g -D_DEBUG -UNDEBUG"]
[CXXFLAGS="$CXXFLAGS -g -D_DEBUG -UNDEBUG"]
[CJFLAGS="$CJFLAGS -g"]
AC_SUBST(BUILDMODE, "debug")
else
[CFLAGS="$CFLAGS -DNDEBUG -U_DEBUG"]
[CXXFLAGS="$CXXFLAGS -DNDEBUG -U_DEBUG"]
[CJFLAGS="$CJFLAGS"]
AC_SUBST(BUILDMODE, "release")
fi
# Configure makefiles
AC_ARG_ENABLE([reentrant], [AC_HELP_STRING([--enable-reentrant],
[define _REENTRANT (default. yes)])],
enable_reentrant_is=$enableval,enable_reentrant_is=yes)
if test "$enable_reentrant_is" = "yes"
then
[CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"]
[CXXFLAGS="$CXXFLAGS -D_REENTRANT -D_THREAD_SAFE"]
fi
# Java & JNI Configuration
AC_PATH_PROG(JAVAC_PATH, javac, :)
AC_PATH_PROG(JAR_PATH, jar, :)
if test "$JAVAC_PATH" != ":"
then
CUR_JAVAC_PATH="$JAVAC_PATH"
while ls -ld "$CUR_JAVAC_PATH" 2>/dev/null | grep " -> " >/dev/null
do
AC_MSG_CHECKING(symlink for $CUR_JAVAC_PATH)
REAL_JAVAC_PATH=`ls -ld "$CUR_JAVAC_PATH" | sed 's/.* -> //'`
case "$REAL_JAVAC_PATH" in
/*) CUR_JAVAC_PATH="$REAL_JAVAC_PATH";;
*) CUR_JAVAC_PATH=`echo "X$CUR_JAVAC_PATH" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$REAL_JAVAC_PATH";;
esac
AC_MSG_RESULT($CUR_JAVAC_PATH)
done
# check if the javavm wrapper is in use
case "$REAL_JAVAC_PATH" in
*/javavm)
JAVA_DIR="$REAL_JAVAC_PATH"
while true
do
JAVA_DIR=`echo "$JAVA_DIR" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
if test "$JAVA_DIR" = ""
then
break
fi
AC_MSG_CHECKING($JAVA_DIR/etc/javavms)
if test -f "$JAVA_DIR/etc/javavms"
then
# takes the first jvm configured
CUR_JAVAC_PATH=`cat $JAVA_DIR/etc/javavms | head -1`
AC_MSG_RESULT($CUR_JAVAC_PATH)
break;
else
AC_MSG_RESULT(no)
fi
done
;;
esac
JAVA_DIR="$CUR_JAVAC_PATH"
while true
do
JAVA_DIR=`echo "$JAVA_DIR" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
if test "$JAVA_DIR" = ""
then
break
fi
AC_MSG_CHECKING($JAVA_DIR/include/jni.h)
if test -f "$JAVA_DIR/include/jni.h"
then
AC_MSG_RESULT(yes)
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $JAVA_DIR/include"
break;
else
AC_MSG_RESULT(no)
fi
done
for i in $JNI_INCLUDE_DIRS
do
JNI_MD_H=`find "$i" -name jni_md.h -print`
if test "$JNI_MD_H" != ""
then
tmp=`echo "$JNI_MD_H" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
JNI_MD_INCLUDE_DIRS="$JNI_MD_INCLUDE_DIRS $tmp"
fi
done
JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $JNI_MD_INCLUDE_DIRS"
for i in $JNI_INCLUDE_DIRS
do
CFLAGS_JNI="$CFLAGS_JNI -I$i"
done
BUILD_JNI="jni"
else
JAVAC_PATH=""
CFLAGS_JNI=""
BUILD_JNI=""
fi
if test "$CJ" != ""
then
BUILD_CJ="cj"
else
BUILD_CJ=
fi
AC_SUBST(LIBM, $LIBM)
AC_SUBST(CFLAGS_JNI, $CFLAGS_JNI)
AC_SUBST(JAVAC, $JAVAC_PATH)
AC_SUBST(JAR, $JAR_PATH)
AC_SUBST(BUILD_JNI, $BUILD_JNI)
AC_SUBST(CJFLAGS, $CJFLAGS)
AC_SUBST(BUILD_CJ, $BUILD_CJ)
AC_CONFIG_FILES([
makefile
include/makefile
include/ase/makefile
include/ase/cmn/makefile
include/ase/awk/makefile
include/ase/lsp/makefile
include/ase/tgp/makefile
include/ase/utl/makefile
lib/makefile
lib/cmn/makefile
lib/awk/makefile
lib/lsp/makefile
lib/tgp/makefile
lib/utl/makefile
cmd/makefile
cmd/awk/makefile
cmd/lsp/makefile
cmd/tgp/makefile])
AC_OUTPUT