2002-03-18 09:07:16 +00:00
# Process this file with autoconf to produce a configure script.
#
# autoconf setup
#
2004-08-14 23:07:58 +00:00
AC_PREREQ(2.53)
2011-08-27 09:25:30 -07:00
AC_INIT([yasm],
m4_esyscmd([./YASM-VERSION-GEN.sh && tr -d '\n' <YASM-VERSION-FILE]),
[bug-yasm@tortall.net])
2003-03-13 06:55:46 +00:00
#AC_CONFIG_SRCDIR([src/main.c])
2002-03-18 09:07:16 +00:00
AC_CONFIG_AUX_DIR(config)
2010-01-07 07:00:05 +00:00
AC_CONFIG_HEADER([config.h])
2002-03-18 09:07:16 +00:00
2014-08-10 10:26:16 -07:00
AM_INIT_AUTOMAKE([1.9.6 foreign subdir-objects])
2002-05-29 05:25:32 +00:00
AM_MAINTAINER_MODE
2002-03-18 09:07:16 +00:00
#
# autoconf command-line options
#
2003-03-13 04:03:59 +00:00
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Turn on debugging and compile time warnings]),
2002-03-18 09:07:16 +00:00
[case "${enableval}" in
2003-03-13 04:03:59 +00:00
yes) debugging="yes" ;;
no) debugging="no" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac])
2002-03-18 09:07:16 +00:00
AC_ARG_ENABLE(warnerror,
2003-03-13 03:08:45 +00:00
AC_HELP_STRING([--enable-warnerror],[Treat GCC warnings as errors]),
2002-03-18 09:07:16 +00:00
[case "${enableval}" in
2003-03-13 04:03:59 +00:00
yes) warnerror="yes" ;;
no) warnerror="no" ;;
2002-03-18 09:07:16 +00:00
*) AC_MSG_ERROR([bad value ${enableval} for --enable-warnerror]) ;;
2003-03-13 04:03:59 +00:00
esac])
2002-03-18 09:07:16 +00:00
AC_ARG_ENABLE(profiling,
2003-03-13 03:08:45 +00:00
AC_HELP_STRING([--enable-profiling],[Enable profiling (requires GCC)]),
2002-03-18 09:07:16 +00:00
[case "${enableval}" in
2003-03-13 04:03:59 +00:00
yes) profiling="yes" ;;
no) profiling="no" ;;
2002-03-18 09:07:16 +00:00
*) AC_MSG_ERROR([bad value ${enableval} for --enable-profiling]) ;;
2003-03-13 04:03:59 +00:00
esac])
2002-03-18 09:07:16 +00:00
2002-10-04 09:18:23 +00:00
AC_ARG_ENABLE(gcov,
2003-03-13 03:08:45 +00:00
AC_HELP_STRING([--enable-gcov],[Enable gcov code coverage (requires GCC)]),
2002-10-04 09:18:23 +00:00
[case "${enableval}" in
2003-03-13 04:03:59 +00:00
yes) gcov="yes" ;;
no) gcov="no" ;;
2002-10-04 09:18:23 +00:00
*) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;;
2003-03-13 04:03:59 +00:00
esac])
2002-10-04 09:18:23 +00:00
2006-04-04 06:07:32 +00:00
AC_ARG_ENABLE(python,
2007-09-13 02:53:30 +00:00
AC_HELP_STRING([--enable-python],[Enable Python-requiring portions of build]),
2006-04-04 06:07:32 +00:00
[case "${enableval}" in
yes) enable_python="yes" ;;
no) enable_python="no" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
esac], enable_python="auto")
2007-09-13 02:53:30 +00:00
AC_ARG_ENABLE(python-bindings,
AC_HELP_STRING([--enable-python-bindings],[Build Python bindings]),
[case "${enableval}" in
yes) enable_python_bindings="yes" ;;
no) enable_python_bindings="no" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-python-bindings]) ;;
2008-04-12 00:56:30 +00:00
esac], enable_python_bindings="no")
2007-09-13 02:53:30 +00:00
2002-03-18 09:07:16 +00:00
#
# Checks for programs.
#
2007-09-20 04:24:46 +00:00
AC_PROG_CPP
2002-03-18 09:07:16 +00:00
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LN_S
2010-01-07 07:00:05 +00:00
#automake default ARFLAGS to "cru"
AC_CHECK_TOOLS(AR,[$AR ar],[ar])
2004-12-01 07:49:18 +00:00
AC_PROG_RANLIB
2002-03-18 09:07:16 +00:00
# REQUIRE a standard (ANSI/ISO) C compiler
if test "$ac_cv_prog_cc_stdc" = no; then
AC_MSG_ERROR([A standard (ANSI/ISO C89) C compiler is required.])
fi
2004-09-07 07:39:26 +00:00
# Check for xmlto (for rendering manpages, needed only for development)
AC_CHECK_PROGS([XMLTO], [$XMLTO xmlto], [:])
if test "$XMLTO" = ":"; then
AC_MSG_WARN([xmlto not found, manpages will not be rebuilt.])
fi
AM_CONDITIONAL(BUILD_MAN, test "$XMLTO" != ":")
2002-03-18 09:07:16 +00:00
# Check for compiler output filename suffixes.
AC_OBJEXT
AC_EXEEXT
#
# Checks for libraries.
#
2002-10-22 07:45:45 +00:00
AM_WITH_DMALLOC
2002-03-18 09:07:16 +00:00
#
# Checks for header files.
#
2010-02-13 08:42:27 +00:00
AC_CHECK_HEADERS([strings.h libgen.h unistd.h direct.h sys/stat.h])
2002-03-18 09:07:16 +00:00
#
# Checks for typedefs, structures, and compiler characteristics.
#
AC_C_CONST
AC_C_INLINE
AC_C_PROTOTYPES
AC_TYPE_SIZE_T
2007-02-18 20:42:55 +00:00
AX_CREATE_STDINT_H([libyasm-stdint.h])
2002-03-18 09:07:16 +00:00
#
# Checks for library functions.
#
2007-07-13 20:56:28 +00:00
AC_CHECK_FUNCS([abort toascii vsnprintf])
2006-02-10 05:34:31 +00:00
AC_CHECK_FUNCS([strsep mergesort getcwd])
Add core TASM syntax support.
Contributed by: Samuel Thibault <samuel.thibault@ens-lyon.org>
It is built on top of the NASM parser and preproc, with the following
notable extensions for TASM syntax:
- case insensitive symbols and filenames,
- support for segment and size of labels, which permits to avoid giving
them on each memory dereference,
- support for data reservation (i.e. e.g. "var dd ?"),
- support for multiples (i.e. e.g. "var dd 1 dup 10"),
- little endian string integer constants,
- additional expression operators: shl, shr, and, or, low, high,
- additional offset keyword,
- additional fword and df,
- support for doubled quotes within quotes,
- support for array-like and structure-like notations: t[eax] and
[var].field,
- support for tasm directives: macro, rept, irp, locals, proc, struc,
segment, assume.
Notes:
- Almost all extensions are only effective when tasm_compatible_mode is
set, so we should have very reduced possible breakage.
- Because the "and" keyword can be an expression operator and an
instruction name, the data pseudo-instructions explicitly switch the
lexer state to INSTRUCTION state to fix the ambiguity.
- In gen_x86_insn.py, several instructions (namely lds and lea) now take
relaxed memory sizes. The reason is that in the case of tasm, the size
of the actual pointed data is passed up to there, and thus any type of
data should be accepted.
With all of this, loadlin can be compiled by yasm with quite reduced
modifications.
A new TASM-like frontend is also included.
svn path=/trunk/yasm/; revision=2130
2008-10-07 05:38:11 +00:00
AC_CHECK_FUNCS([popen ftruncate])
2002-03-18 09:07:16 +00:00
# Look for the case-insensitive comparison functions
2007-07-13 20:56:28 +00:00
AC_CHECK_FUNCS([strcasecmp strncasecmp stricmp _stricmp strcmpi])
2002-03-18 09:07:16 +00:00
#
# Check for gettext() and other i18n/l10n things.
#
ALL_LINGUAS=""
2002-04-15 04:20:38 +00:00
AM_GNU_GETTEXT([external])
2002-03-18 09:07:16 +00:00
# autoheader templates for AM_GNU_GETTEXT checks.
AH_TEMPLATE([ENABLE_NLS], [])
AH_TEMPLATE([HAVE_CATGETS], [])
AH_TEMPLATE([HAVE_GETTEXT], [])
AH_TEMPLATE([HAVE_LC_MESSAGES], [])
AH_TEMPLATE([HAVE_STPCPY], [])
# Check for GNU C Library
2007-07-13 20:56:28 +00:00
AH_TEMPLATE([HAVE_GNU_C_LIBRARY], [Define to 1 if you have the GNU C Library])
2002-03-18 09:07:16 +00:00
AC_CACHE_CHECK([for GNU C Library], yasm_cv_header_gnulib,
AC_EGREP_CPP(gnulib,
[#include <features.h>
#ifdef __GNU_LIBRARY__
gnulib
#endif
], yasm_cv_header_gnulib=yes, yasm_cv_header_gnulib=no))
if test "$yasm_cv_header_gnulib" = yes; then
AC_DEFINE([HAVE_GNU_C_LIBRARY])
fi
# Force x86 architecture only for now.
ARCH=x86
AC_SUBST([ARCH])
2006-04-05 02:26:19 +00:00
AC_SUBST([GCC])
2002-03-18 09:07:16 +00:00
2003-03-13 04:03:59 +00:00
# Require things for --enable-maintainer-mode option.
if test "$USE_MAINTAINER_MODE" = "yes"; then
# Enable debugging
if test "$debugging" != "no"; then
debugging=yes
fi
# Enable more warnings
if test "$GCC" = "yes"; then
2005-01-22 01:18:08 +00:00
MORE_CFLAGS="$MORE_CFLAGS -W"
MORE_CFLAGS="$MORE_CFLAGS -Waggregate-return"
MORE_CFLAGS="$MORE_CFLAGS -Wbad-function-cast"
MORE_CFLAGS="$MORE_CFLAGS -Wcast-align"
MORE_CFLAGS="$MORE_CFLAGS -Wcast-qual"
MORE_CFLAGS="$MORE_CFLAGS -Wchar-subscripts"
2007-12-06 05:46:02 +00:00
# MORE_CFLAGS="$MORE_CFLAGS -Wconversion"
2005-01-25 06:44:42 +00:00
# MORE_CFLAGS="$MORE_CFLAGS -Wdeclaration-after-statement"
# MORE_CFLAGS="$MORE_CFLAGS -Wendif-labels"
2005-01-22 01:18:08 +00:00
MORE_CFLAGS="$MORE_CFLAGS -Winline"
MORE_CFLAGS="$MORE_CFLAGS -Wmissing-declarations"
MORE_CFLAGS="$MORE_CFLAGS -Wmissing-prototypes"
MORE_CFLAGS="$MORE_CFLAGS -Wnested-externs"
MORE_CFLAGS="$MORE_CFLAGS -Wpointer-arith"
MORE_CFLAGS="$MORE_CFLAGS -Wreturn-type"
MORE_CFLAGS="$MORE_CFLAGS -Wshadow"
MORE_CFLAGS="$MORE_CFLAGS -Wsign-compare"
MORE_CFLAGS="$MORE_CFLAGS -Wstrict-prototypes"
MORE_CFLAGS="$MORE_CFLAGS -Wswitch"
MORE_CFLAGS="$MORE_CFLAGS -Wwrite-strings"
MORE_CFLAGS="$MORE_CFLAGS -Wno-undef"
2007-03-05 08:43:00 +00:00
# MORE_CFLAGS="$MORE_CFLAGS -Wno-unused"
MORE_CFLAGS="$MORE_CFLAGS -Wno-unused-parameter"
2003-03-13 04:03:59 +00:00
fi
2002-03-18 09:07:16 +00:00
fi
#
# Add some more CFLAGS for various options.
#
2003-03-13 04:03:59 +00:00
if test "$debugging" = "no" ; then
changequote(,)
CFLAGS="`echo $CFLAGS' ' | sed -e 's/-g[0-9] //g' | sed -e 's/-g//g'`"
changequote([,])
2002-03-18 09:07:16 +00:00
fi
# Turn warnings into errors
2003-03-13 04:03:59 +00:00
if test "$warnerror" = "yes"; then
if test "$GCC" = "yes"; then
2003-07-26 02:32:04 +00:00
MORE_CFLAGS="$MORE_CFLAGS -Werror"
2003-03-13 04:03:59 +00:00
fi
2002-03-18 09:07:16 +00:00
fi
# Enable output of profiling information
2003-03-13 04:03:59 +00:00
if test "$profiling" = "yes"; then
if test "$GCC" = "yes"; then
MORE_CFLAGS="$MORE_CFLAGS -pg"
fi
2002-03-18 09:07:16 +00:00
fi
2002-10-04 09:18:23 +00:00
# Enable output of gcov information
2003-03-13 04:03:59 +00:00
if test "$gcov" = "yes"; then
if test "$GCC" = "yes"; then
MORE_CFLAGS="$MORE_CFLAGS -fprofile-arcs -ftest-coverage"
fi
2002-10-04 09:18:23 +00:00
fi
2003-03-13 04:03:59 +00:00
# If we're using GCC, then we can turn on -ansi -pedantic -Wall too.
2007-02-13 06:29:01 +00:00
if test "$USE_MAINTAINER_MODE" = "yes"; then
if test "$GCC" = yes; then
MORE_CFLAGS="-ansi -pedantic -Wall $MORE_CFLAGS"
fi
2002-03-18 09:07:16 +00:00
fi
2003-03-13 04:03:59 +00:00
AC_SUBST(MORE_CFLAGS)
2002-03-18 09:07:16 +00:00
2004-08-14 23:07:58 +00:00
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
AC_ARG_VAR(CCLD_FOR_BUILD,[build system C linker frontend])
2010-01-07 07:00:05 +00:00
if test "${build}" != "${host}" ; then
CC_FOR_BUILD=${CC_FOR_BUILD-cc}
CCLD_FOR_BUILD=${CCLD_FOR_BUILD-cc}
else
CC_FOR_BUILD="\$(CC)"
CCLD_FOR_BUILD="\$(CC)"
fi
2004-08-14 23:07:58 +00:00
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CCLD_FOR_BUILD)
2010-01-07 07:00:05 +00:00
AC_ARG_VAR(CPP_FOR_HOST,[host system C preprocessor])
if test "$build" != "$target" || test "$build" != "$host"; then
CPP_PROG="${CPP_FOR_HOST-cc -E}"
else
CPP_PROG="${CPP}"
fi
AC_DEFINE_UNQUOTED([CPP_PROG], "${CPP_PROG}", [Command name to run C preprocessor])
2004-08-14 23:07:58 +00:00
2007-09-13 02:53:30 +00:00
# Detect if we have Python
2006-04-04 06:07:32 +00:00
if test x$enable_python = xno; then
have_python=no
else
2007-09-13 02:53:30 +00:00
AC_MSG_NOTICE([Checking for Python])
2006-04-04 06:07:32 +00:00
have_python=no
2006-05-03 02:47:01 +00:00
AM_PATH_PYTHON(2.4,[],[AC_MSG_WARN([Python not found])])
2006-04-04 06:07:32 +00:00
2006-05-03 02:47:01 +00:00
if test -z "$PYTHON" || test "$PYTHON" = : ; then
have_python=no
2006-04-04 06:07:32 +00:00
else
2007-09-13 02:53:30 +00:00
have_python=yes
fi
if test x$have_python = xno ; then
if test x$enable_python = xyes ; then
AC_MSG_ERROR([Python explicitly requested, but a suitable Python version was not found])
else
AC_MSG_WARN([Could not find a suitable version of Python])
fi
fi
fi
# Detect if we can build Python bindings
2010-01-01 20:55:07 +00:00
# (needs Python, Python headers, and Cython)
2007-09-13 02:53:30 +00:00
if test x$enable_python_bindings = xno; then
have_python_bindings=no
else
AC_MSG_NOTICE([Checking to see if we can build Python bindings])
have_python_bindings=no
if test x$have_python = xyes; then
2010-01-01 20:55:07 +00:00
AC_MSG_CHECKING([for Cython >= 0.11.3])
CYTHON_CHECK_VERSION(0.11.3, [AC_MSG_RESULT(yes)
have_cython=yes],
2007-01-31 04:08:27 +00:00
[AC_MSG_RESULT(no)
2010-01-01 20:55:07 +00:00
have_cython=no])
2006-04-04 06:07:32 +00:00
AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
2010-01-01 20:55:07 +00:00
if test x$have_cython = xyes -a x$have_python_headers = xyes ; then
2007-09-13 02:53:30 +00:00
have_python_bindings=yes
2006-04-04 06:07:32 +00:00
fi
fi
2007-09-13 02:53:30 +00:00
if test x$have_python_bindings = xno ; then
if test x$enable_python_bindings = xyes ; then
2010-01-01 20:55:07 +00:00
AC_MSG_ERROR([Building Python bindings explicitly requested, but can't build Python bindings because either Cython, Python headers or a suitable Python version was not found])
2006-04-04 06:07:32 +00:00
else
2010-01-01 20:55:07 +00:00
AC_MSG_WARN([Couldn't find either Cython, the Python headers or a suitable version of Python, not building Python bindings])
2006-04-04 06:07:32 +00:00
fi
2007-09-13 02:53:30 +00:00
fi
2006-04-04 06:07:32 +00:00
fi
AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
2007-09-13 02:53:30 +00:00
AM_CONDITIONAL(HAVE_PYTHON_BINDINGS, test x$have_python_bindings = xyes)
2004-08-14 23:07:58 +00:00
2002-03-18 09:07:16 +00:00
AC_CONFIG_FILES([Makefile
po/Makefile.in
])
AC_OUTPUT