nasm/configure.ac

222 lines
6.4 KiB
Text
Raw Normal View History

dnl Process this file with autoconf 2.63 or later to produce
dnl a configure script.
AC_PREREQ(2.63)
AC_INIT(config/config.h.in)
AC_CONFIG_HEADERS(config/config.h)
2002-04-30 20:53:16 +00:00
dnl Check for broken VPATH handling on older NetBSD makes.
AC_DEFUN(AC_PROG_MAKE_VPATHOK,
[AC_MSG_CHECKING(whether ${MAKE-make} has sane VPATH handling)
set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
AC_CACHE_VAL(ac_cv_prog_make_vpathok,
[mkdir conftestdir
cat > conftestdir/conftestmake <<\EOF
VPATH = ..
conftestfoo: conftestbar
@echo ac_make2temp=ok
conftestbar: conftestbaz
@echo ac_maketemp=broken
@touch conftestbar
EOF
echo > conftestbaz # these two lines need to be...
echo > conftestbar # ... in this order not the other
changequote(, )dnl
unset ac_maketemp
unset ac_make2temp
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `cd conftestdir; ${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
changequote([, ])dnl
if test -n "$ac_maketemp"; then
ac_cv_prog_make_vpathok=no
else
if test -n "$ac_make2temp"; then
ac_cv_prog_make_vpathok=yes
else
ac_cv_prog_make_vpathok=no
fi
fi
rm -rf conftestdir
rm -f conftestbar conftestbaz])dnl
if test $ac_cv_prog_make_vpathok = yes; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
AC_PREFIX_PROGRAM(nasm)
dnl Checks for programs.
dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
2002-04-30 20:53:16 +00:00
AC_PROG_CC
AC_PROG_CC_STDC
2002-04-30 20:53:16 +00:00
AC_PROG_LN_S
AC_PROG_MAKE_SET
if test -f nasm.c; then
# we're building in the source dir, so we don't need this check at all
ac_cv_prog_make_vpathok=yes
else
AC_PROG_MAKE_VPATHOK
fi
AC_PROG_INSTALL
dnl Check for library extension
PA_LIBEXT
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_TYPE_SIZE_T
AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN),,)
AH_TEMPLATE(WORDS_BIGENDIAN,
[Define to 1 if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX).])
AH_TEMPLATE(WORDS_LITTLEENDIAN,
[Define to 1 if your processor stores words with the least significant
byte first (like Intel and VAX, unlike Motorola and SPARC).])
dnl Force gcc and gcc-compatible compilers treat signed integers
dnl as 2's complement
PA_ADD_CFLAGS([-fwrapv])
2002-04-30 20:53:16 +00:00
dnl Don't put things in common if we can avoid it. We don't want to
dnl assume all compilers support common, and this will help find those
dnl problems. This also works around an OSX linker problem.
PA_ADD_CFLAGS([-fno-common])
dnl Look for programs...
AC_CHECK_PROGS(NROFF, nroff, false)
AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
AC_CHECK_PROGS(XMLTO, xmlto, false)
AC_CHECK_PROGS(ACRODIST, acrodist, false)
AC_CHECK_PROGS(PS2PDF, ps2pdf, false)
AC_CHECK_PROGS(PSTOPDF, pstopdf, false)
2002-04-30 20:57:38 +00:00
dnl Check for progs needed for manpage generation
if test $ASCIIDOC = false; then
AC_MSG_WARN([No asciidoc package found])
fi
if test $XMLTO = false; then
AC_MSG_WARN([No xmlto package found])
fi
dnl Check for host compiler tools
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(STRIP, strip)
2002-04-30 20:53:16 +00:00
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(inttypes.h)
AC_CHECK_HEADERS(strings.h)
AC_HEADER_STDBOOL
AC_CHECK_HEADERS(io.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/stat.h)
2002-04-30 20:53:16 +00:00
dnl Checks for library functions.
AC_CHECK_FUNCS(strcasecmp stricmp)
AC_CHECK_FUNCS(strncasecmp strnicmp)
AC_CHECK_FUNCS(strsep)
AC_CHECK_FUNCS(strnlen)
AC_CHECK_FUNCS(getuid)
AC_CHECK_FUNCS(getgid)
AC_CHECK_FUNCS(realpath)
AC_CHECK_FUNCS(canonicalize_file_name)
AC_CHECK_FUNCS(_fullpath)
AC_CHECK_FUNCS(pathconf)
AC_FUNC_FSEEKO
AC_CHECK_FUNCS([_fseeki64])
AC_CHECK_FUNCS([ftruncate _chsize _chsize_s])
AC_CHECK_FUNCS([fileno _fileno])
AC_CHECK_FUNCS(_filelengthi64)
AC_CHECK_FUNCS([stat _stati64])
AC_CHECK_FUNCS(fstat)
AC_CHECK_FUNCS(mmap)
AC_CHECK_FUNCS(getpagesize)
AC_CHECK_FUNCS(sysconf)
AC_CHECK_FUNCS([access _access faccessat])
PA_HAVE_FUNC(__builtin_ctz, (0U))
PA_HAVE_FUNC(__builtin_ctzl, (0UL))
PA_HAVE_FUNC(__builtin_ctzll, (0ULL))
dnl Functions for which we have replacements available in lib/
AC_CHECK_FUNCS([vsnprintf _vsnprintf])
AC_CHECK_FUNCS([snprintf _snprintf])
AC_CHECK_FUNCS([strlcpy])
dnl Check for functions that might not be declared in the headers for
dnl various idiotic reasons (mostly because of library authors
dnl abusing the meaning of __STRICT_ANSI__)
AC_CHECK_DECLS(strcasecmp)
AC_CHECK_DECLS(stricmp)
AC_CHECK_DECLS(strncasecmp)
AC_CHECK_DECLS(strnicmp)
AC_CHECK_DECLS(strsep)
AC_CHECK_DECLS(strlcpy)
AC_CHECK_DECLS(strnlen)
dnl Check for missing types
AC_TYPE_UINTPTR_T
2002-04-30 20:53:16 +00:00
if test $ac_cv_prog_make_vpathok = no; then
echo Copying generated srcs into build directory to compensate for VPATH breakage
for file in macros.c insnsa.c insnsd.c insnsn.c insnsi.h version.h version.mac; do
if test ! -f $file; then cp -p ${srcdir}/${file} .; fi
done
2002-04-30 20:53:16 +00:00
fi
dnl
dnl support cchace
dnl
AC_ARG_ENABLE([ccache],
[AC_HELP_STRING([--with-ccache], [compile with ccache])],
[CC="ccache $CC"],
[])
dnl If we have gcc, add appropriate code cleanliness options
PA_ADD_CFLAGS([-W])
PA_ADD_CFLAGS([-Wall])
PA_ADD_CFLAGS([-std=c99])
PA_ADD_CFLAGS([-pedantic])
dnl LLVM doesn't error out on invalid -W options unless this option is
dnl specified first. Enable this so this script can actually discover
dnl which -W options are possible for this compiler.
PA_ADD_CFLAGS([-Werror=unknown-warning-option])
dnl Suppress format warning on Windows targets due to their <inttypes.h>
PA_ADD_CFLAGS([-Wpedantic-ms-format],[-Wno-pedantic-ms-format])
PA_ADD_CFLAGS([-Wc90-c99-compat])
PA_ADD_CFLAGS([-Wlong-long],[-Wno-long-long])
dnl PA_ADD_CFLAGS([-Wwrite-strings])
AC_ARG_ENABLE([werror],
[AC_HELP_STRING([--enable-werror],
[compile with -Werror to error out on any warning])],
[], [enable_werror=no])
AS_IF([test x"$enable_werror" != xno],
[PA_ADD_CFLAGS([-Werror])],
[PA_ADD_CFLAGS([-Werror=implicit])
PA_ADD_CFLAGS([-Werror=missing-braces])
PA_ADD_CFLAGS([-Werror=return-type])
PA_ADD_CFLAGS([-Werror=trigraphs])
PA_ADD_CFLAGS([-Werror=pointer-arith])
PA_ADD_CFLAGS([-Werror=strict-prototypes])
PA_ADD_CFLAGS([-Werror=missing-prototypes])
PA_ADD_CFLAGS([-Werror=missing-declarations])
PA_ADD_CFLAGS([-Werror=comment])
PA_ADD_CFLAGS([-Werror=vla])])
AC_OUTPUT_COMMANDS([mkdir -p config nasmlib nsis output stdlib x86 asm disasm])
AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)