ale/configure.in
2022-07-30 14:46:04 -03:00

376 lines
12 KiB
Plaintext

# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Copyright 2006 David Hilvert <dhilvert@auricle.dyndns.org>,
# <dhilvert@ugcs.caltech.edu>
# This file is part of the Anti-Lamenessing Engine.
#
# The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Anti-Lamenessing Engine; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Parts of this file were automatically generated by the GNU project's
# configuration generator 'autoscan', part of the 'autoconf' package from the
# 'autotools' family of build and installation tools.
#
# Preliminaries
#
AC_PREREQ(2.60)
AC_INIT(ALE, translit(m4_include(VERSION),'
'), ale@ventricle.dyndns.org)
AC_CONFIG_SRCDIR([ale_accum.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# The strtod check breaks cross-compilation, so disable it.
AC_DEFUN([AC_FUNC_STRTOD],[])
#GNULib startup
gl_EARLY
# Libtool
AC_PROG_LIBTOOL
# For gnulib.
#gl_SOURCE_BASE(gl)
#gl_M4_BASE(m4)
#gl_LIB(lib)
gl_MODULES(strndup)
gl_INIT
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h time.h sys/time.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
# Checks for library functions. (Commented calls cause problems for cross-compilation.)
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
# AC_FUNC_MALLOC
# AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([floor memset pow select sqrt strchr strcspn strdup strndup strspn strtol nrand48 rand_r gettimeofday nanosleep])
if test x$enable_threads != xno; then
# Check for POSIX threads.
ACX_PTHREAD()
fi
# Determine whether multithreading should be used.
AC_ARG_ENABLE(threads, [ --enable-threads enable multithreading: auto, no, yes (default=auto)])
if test x$enable_threads != xno \
&& test x$acx_pthread_ok = xyes; then
PTHREAD_CFLAGS="$PTHREAD_CFLAGS -DUSE_PTHREAD=1"
#
# XXX: This is probably wrong.
#
if test x$PTHREAD_CXX = x; then
PTHREAD_CXX="$CXX"
fi
#
# CC replacement logic from ImageMagick's configuration process
#
if test "$CC" != "$PTHREAD_CC"; then
AC_MSG_WARN([Replacing compiler $CC with compiler $PTHREAD_CC to support pthreads.])
CC="$PTHREAD_CC"
fi
if test "$CXX" != "$PTHREAD_CXX"; then
AC_MSG_WARN([Replacing compiler $CXX with compiler $PTHREAD_CXX to support pthreads.])
CXX="$PTHREAD_CXX"
fi
fi
if test x$enable_threads = xyes \
&& test x$acx_pthread_ok = xno; then
AC_MSG_ERROR([Multithreaded build requested (--enable-threads=yes), but no usable library was found.])
fi
# Determine whether assertions should be enabled.
AC_ARG_ENABLE(assertions, [ --enable-assertions check runtime assertions (default=yes)])
if test x$enable_assertions = xno; then
ASSERT_FLAGS="-DNDEBUG"
else
ASSERT_FLAGS="-DDEBUG"
fi
# Determine whether ImageMagick should be linked
AC_ARG_WITH(imagemagick, [ --with-imagemagick ImageMagick file handling: auto,no,yes (default=auto)])
if test x$with_imagemagick != xno; then
# AC_CHECK_TOOL is somewhat broken for cross-compilation in
# some versions of autoconf, so use a conditional instead.
if test x$host = x$build \
|| test x$host = x; then
AC_CHECK_TOOL(MAGICK_CONFIG, Magick-config, no)
else
AC_CHECK_PROG(MAGICK_CONFIG, ${ac_tool_prefix}Magick-config, ${ac_tool_prefix}Magick-config, no)
fi
if test x$MAGICK_CONFIG != xno; then
# Bugs have been encountered in certain versions of ImageMagick
# older than 6.0.6. Until a test is written to check for these
# bugs, check the version number instead.
#
# Since GraphicsMagick uses different version numbering, accept
# any version number from a GraphicsMagick installation.
IMAGEMAGICK_VERSION=`Magick-config --version`
IMAGEMAGICK_VERSION_A=`echo $IMAGEMAGICK_VERSION | cut -f 1 -d '.'`
IMAGEMAGICK_VERSION_B=`echo $IMAGEMAGICK_VERSION | cut -f 2 -d '.'`
IMAGEMAGICK_VERSION_C=`echo $IMAGEMAGICK_VERSION | cut -f 3 -d '.'`
if test -x `which GraphicsMagick-config` \
|| test $IMAGEMAGICK_VERSION_A -gt 6 \
|| ( test $IMAGEMAGICK_VERSION_A -eq 6 \
&& test $IMAGEMAGICK_VERSION_B -gt 0 ) \
|| ( test $IMAGEMAGICK_VERSION_A -eq 6 \
&& test $IMAGEMAGICK_VERSION_B -eq 0 \
&& test $IMAGEMAGICK_VERSION_C -ge 6 ); then
IMAGEMAGICK_CFLAGS=`$MAGICK_CONFIG --cflags`
IMAGEMAGICK_CPPFLAGS="`$MAGICK_CONFIG --cppflags` -DUSE_MAGICK"
IMAGEMAGICK_LDFLAGS=`$MAGICK_CONFIG --ldflags`
IMAGEMAGICK_LIBS=`$MAGICK_CONFIG --libs`
else
AC_MSG_WARN([not using ImageMagick older than 6.0.6 (found $IMAGEMAGICK_VERSION)])
fi
fi
else
IMAGEMAGICK_CFLAGS=""
IMAGEMAGICK_CPPFLAGS=""
IMAGEMAGICK_LDFLAGS=""
IMAGEMAGICK_LIBS=""
fi
# Fatal error if user flag for ImageMagick could not be satisified
if test x$with_imagemagick = xyes \
&& test x$IMAGEMAGICK_CPPFLAGS = x; then
AC_MSG_ERROR([ImageMagick build requested (--enable-imagemagick=yes), but no suitable version was found.])
fi
# Determine whether FFTW should be linked
AC_ARG_WITH(fftw3, [ --with-fftw3 FFTW3 fourier transforms: auto,no,yes (default=auto)])
if test x$with_fftw3 != xno; then
AC_CHECK_LIB([fftw3], [main], LIBS="-lfftw3 $LIBS" FFTW_CPPFLAGS="-DUSE_FFTW")
fi
# Fatal error if user flag for FFTW could not be satisified
if test x$with_fftw3 = xyes \
&& test x$FFTW_CPPFLAGS = x; then
AC_MSG_ERROR([FFTW3 build requested (--enable-fftw3=yes), but no suitable version was found.])
fi
# Determine the precision of colors that should be used
AC_ARG_WITH(colors, [ --with-colors=[TYPE] use TYPE colors: single,double,fixed32,fixed16 (default=single)])
if test x$with_colors = xsingle \
|| test x$with_colors = x; then
COLOR_CPPFLAGS="-DALE_COLORS=SINGLE"
elif test x$with_colors = xdouble; then
COLOR_CPPFLAGS="-DALE_COLORS=DOUBLE"
elif test x$with_colors = xfixed16; then
COLOR_CPPFLAGS="-DALE_COLORS=FIXED16"
elif test x$with_colors = xfixed32; then
COLOR_CPPFLAGS="-DALE_COLORS=FIXED32"
else
AC_MSG_ERROR(option --with-colors=$with_colors is not currently supported)
fi
# Determine the precision of coordinates that should be used
AC_ARG_WITH(coords, [ --with-coords=[TYPE] use TYPE coords: single,double,fixed32,fixed16 (default=single)])
if test x$with_coords = xsingle \
|| test x$with_coords = x; then
COORD_CPPFLAGS="-DALE_COORDINATES=SINGLE"
elif test x$with_coords = xdouble; then
COORD_CPPFLAGS="-DALE_COORDINATES=DOUBLE"
elif test x$with_coords = xfixed16; then
COORD_CPPFLAGS="-DALE_COORDINATES=FIXED16"
elif test x$with_coords = xfixed32; then
COORD_CPPFLAGS="-DALE_COORDINATES=FIXED32"
else
AC_MSG_ERROR(option --with-coords=$with_coords is not currently supported)
fi
# Determine whether optimizations should be used
AC_ARG_ENABLE(optimization, [ --enable-optimizations use optimization code (default=yes)])
if test x$enable_optimizations = xyes \
|| test x$enable_optimizations = x; then
OPTIMIZATION_CPPFLAGS="-DOPTIMIZATIONS=1"
elif test x$enable_optimizations = xno; then
OPTIMIZATION_CPPFLAGS="-DOPTIMIZATIONS=0"
else
AC_MSG_ERROR(option --enable-optimizations=$enable_optimizations is not currently supported)
fi
# Determine whether hash maps should be used.
AC_ARG_WITH(hashmap, [ --with-hashmap=[TYPE] Use TYPE hash map: no,gnu,std (default=no)])
if test x$with_hashmap = xno \
|| test x$with_hashmap = x; then
STL_CPPFLAGS=""
elif test x$with_hashmap = xgnu; then
AC_CACHE_CHECK(whether GNU hash maps are available, ac_cv_gnu_hash,[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
#include <ext/hash_map>
struct node_hash
{
size_t operator()(int n) const
{
return __gnu_cxx::hash<int>()(n);
}
};
typedef __gnu_cxx::hash_map<int, int, node_hash> int_map_t;
],[
int_map_t foo;
], ac_cv_gnu_hash=yes, ac_cv_gnu_hash=no)
AC_LANG_RESTORE])
if test $ac_cv_gnu_hash = yes; then
STL_CPPFLAGS="-DHASH_MAP_GNU"
else
AC_MSG_ERROR([option --with-hashmap=gnu specified, but this configuration fails.])
fi
elif test x$with_hashmap = xstd; then
AC_CACHE_CHECK(whether std hash maps are available, ac_cv_std_hash,[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([
#include <ext/hash_map>
typedef std::hash_map<int, int> int_map_t;
],[
int_map_t foo;
], ac_cv_std_hash=yes, ac_cv_std_hash=no)
AC_LANG_RESTORE])
if test $ac_cv_std_hash = yes; then
STL_CPPFLAGS="-DHASH_MAP_STD"
else
AC_MSG_ERROR([option --with-hashmap=std specified, but this configuration fails.])
fi
else
AC_MSG_ERROR(option --with-hashmap=$with_hashmap is not currently supported)
fi
# Determine whether ioctl() should be used for determining window dimensions
AC_ARG_ENABLE(getsize, [ --enable-getsize get terminal size: auto,no,yes (default=auto)
(not doing this disables certain UI updates)])
if test x$enable_getsize != xno; then
# Check for Unix facilities.
AC_CHECK_HEADER(sys/ioctl.h, AC_DEFINE([HAVE_SYS_IOCTL_H]))
AC_CHECK_FUNC(ioctl, AC_DEFINE([HAVE_IOCTL], [], [ioctl() function is available.]))
AC_CHECK_DECL(TIOCGWINSZ, have_winsz=yes, have_winsz=no, [#include <sys/ioctl.h>])
if test x$ac_cv_header_sys_ioctl_h = xyes \
&& test x$ac_cv_func_ioctl = xyes \
&& test x$have_winsz = xyes; then
IOCTL_CPPFLAGS="-DUSE_IOCTL"
fi
fi
# Fatal error if IOCTL configuration could not be satisfied
if test x$enable_getsize = xyes \
&& test x$IOCTL_CPPFLAGS = x; then
if test x$ac_cv_header_sys_ioctl_h != xyes; then
AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but sys/ioctl.h was not found.])
fi
if test x$ac_cv_func_ioctl != xyes; then
AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but ioctl() was not found.])
fi
if test x$have_winsz != xyes; then
AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but TIOCGWINSZ was not found.])
fi
AC_MSG_ERROR([ioctl() for window size requested (--enable-getsize=yes), but this configuration fails.])
fi
# Determine whether the --wmx flag should be supported
AC_ARG_ENABLE(wmx, [ --enable-wmx Enable --wmx option: auto,no,yes (default=auto)
(this option requires execlp() and fork())])
if test x$enable_wmx != xno; then
# Check for Unix facilities.
AC_CHECK_HEADER(unistd.h, AC_DEFINE([HAVE_UNISTD_H]))
AC_CHECK_FUNC(execlp, AC_DEFINE([HAVE_EXECLP], [], [execlp() function is available.]))
if test x$ac_cv_func_fork_works = xyes \
&& test x$ac_cv_header_unistd_h = xyes \
&& test x$ac_cv_func_execlp = xyes; then
UNIX_CPPFLAGS="-DUSE_UNIX"
fi
fi
# Fatal error if --wmx configuration could not be satisified
if test x$enable_wmx = xyes \
&& test x$UNIX_CPPFLAGS = x; then
if test x$ac_cv_func_execlp != xyes; then
AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but execlp() was not found.])
fi
if test x$ac_cv_header_unistd_h != xyes; then
AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but unistd.h header was not found.])
fi
if test x$ac_cv_func_fork_works != xyes; then
AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but a working fork() was not found.])
fi
AC_MSG_ERROR([--wmx support requested (--enable-wmx=yes), but this configuration fails.])
fi
OPTION_CPPFLAGS="$ASSERT_FLAGS $IMAGEMAGICK_CPPFLAGS $FFTW_CPPFLAGS $UNIX_CPPFLAGS $IOCTL_CPPFLAGS $COORD_CPPFLAGS $COLOR_CPPFLAGS $OPTIMIZATION_CPPFLAGS $STL_CPPFLAGS"
OPTION_CFLAGS="$IMAGEMAGICK_CFLAGS $PTHREAD_CFLAGS"
OPTION_LDFLAGS="$IMAGEMAGICK_LDFLAGS"
OPTION_LIBS="$PTHREAD_LIBS $IMAGEMAGICK_LIBS"
AC_SUBST(OPTION_CPPFLAGS)
AC_SUBST(OPTION_CFLAGS)
AC_SUBST(OPTION_LDFLAGS)
AC_SUBST(OPTION_LIBS)
AC_CONFIG_FILES([Makefile lib/Makefile])
AC_OUTPUT
# Since the generated Makefile seems to sometimes miss build steps that are
# required due to reconfiguration, 'make clean' here.
AC_MSG_NOTICE(making clean)
make clean &> /dev/null