2008-06-09 11:53:29 +08:00
|
|
|
dnl Process this file with autoconf 2.61 or later to produce
|
2002-05-19 10:26:38 +08:00
|
|
|
dnl a configure script.
|
2016-02-19 04:09:31 +08:00
|
|
|
AC_PREREQ(2.63)
|
2003-09-09 04:02:10 +08:00
|
|
|
AC_INIT(config.h.in)
|
2003-09-01 12:19:37 +08:00
|
|
|
AC_CONFIG_HEADERS(config.h)
|
2002-05-01 04:53:16 +08: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.
|
2007-10-14 14:12:46 +08:00
|
|
|
dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future
|
2008-06-09 11:53:29 +08:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
2016-02-19 03:57:53 +08:00
|
|
|
AC_SYS_LARGEFILE
|
2002-05-01 04:53:16 +08:00
|
|
|
AC_PROG_CC
|
|
|
|
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
|
|
|
|
|
2014-12-20 16:35:51 +08:00
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_CONST
|
2015-11-05 03:29:09 +08:00
|
|
|
AC_C_INLINE
|
2014-12-20 16:35:51 +08:00
|
|
|
AC_C_RESTRICT
|
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
PA_WORKING_BOOL
|
|
|
|
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).])
|
|
|
|
|
2007-04-16 06:45:25 +08:00
|
|
|
dnl If we have gcc, add appropriate options
|
|
|
|
PA_ADD_CFLAGS([-W])
|
|
|
|
PA_ADD_CFLAGS([-Wall])
|
|
|
|
PA_ADD_CFLAGS([-std=c99])
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2008-06-20 02:39:23 +08:00
|
|
|
dnl Look for programs...
|
2013-05-18 03:02:49 +08:00
|
|
|
AC_CHECK_PROGS(NROFF, nroff, false)
|
2013-10-24 20:22:19 +08:00
|
|
|
AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
|
|
|
|
AC_CHECK_PROGS(XMLTO, xmlto, false)
|
2008-06-20 02:39:23 +08:00
|
|
|
AC_CHECK_PROGS(ACRODIST, acrodist, false)
|
|
|
|
AC_CHECK_PROGS(PS2PDF, ps2pdf, false)
|
|
|
|
AC_CHECK_PROGS(PSTOPDF, pstopdf, false)
|
2002-05-01 04:57:38 +08:00
|
|
|
|
2013-10-24 20:22:19 +08:00
|
|
|
dnl Check for progs needed for manpage generation
|
|
|
|
if test $ASCIIDOC = false; then
|
|
|
|
AC_MSG_WARN([No acsciidoc package found])
|
|
|
|
fi
|
|
|
|
if test $XMLTO = false; then
|
|
|
|
AC_MSG_WARN([No xmlto package found])
|
|
|
|
fi
|
|
|
|
|
2002-05-01 04:53:16 +08:00
|
|
|
dnl Checks for header files.
|
|
|
|
AC_HEADER_STDC
|
|
|
|
if test $ac_cv_header_stdc = no; then
|
|
|
|
AC_MSG_ERROR([NASM requires ANSI C header files to compile])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS(limits.h)
|
|
|
|
if test $ac_cv_header_limits_h = no; then
|
|
|
|
AC_MSG_ERROR([NASM requires '<limits.h>' to compile])
|
|
|
|
fi
|
|
|
|
|
2007-06-22 03:00:12 +08:00
|
|
|
dnl Check for <inttypes.h> or add a substitute version
|
|
|
|
AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
|
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
dnl The standard header for str*casecmp is <strings.h>
|
|
|
|
AC_CHECK_HEADERS(strings.h)
|
|
|
|
|
2007-10-11 05:58:45 +08:00
|
|
|
dnl Look for <stdbool.h>
|
|
|
|
AC_CHECK_HEADERS(stdbool.h)
|
|
|
|
|
2016-01-27 04:01:34 +08:00
|
|
|
dnl Look for <unistd.h>
|
|
|
|
AC_CHECK_HEADERS(unistd.h)
|
|
|
|
|
|
|
|
dnl Look for <sys/param.h>
|
|
|
|
AC_CHECK_HEADERS(sys/param.h)
|
|
|
|
|
2002-05-01 04:53:16 +08:00
|
|
|
dnl Checks for library functions.
|
2007-09-29 11:17:12 +08:00
|
|
|
AC_SUBST(XOBJS)
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2007-09-18 04:53:14 +08:00
|
|
|
AC_CHECK_FUNCS(strcspn, ,
|
|
|
|
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2007-09-18 04:53:14 +08:00
|
|
|
AC_CHECK_FUNCS(strspn, ,
|
|
|
|
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
|
2002-05-01 04:53:16 +08:00
|
|
|
|
2007-09-18 04:53:14 +08:00
|
|
|
missing=true
|
2007-09-29 01:50:20 +08:00
|
|
|
AC_CHECK_FUNCS([vsnprintf _vsnprintf], missing=false)
|
2007-09-18 04:53:14 +08:00
|
|
|
if $missing; then
|
2007-09-29 01:50:20 +08:00
|
|
|
XOBJS="$XOBJS lib/vsnprintf.o"
|
2004-12-16 07:02:20 +08:00
|
|
|
fi
|
|
|
|
|
2007-09-18 04:53:14 +08:00
|
|
|
missing=true
|
2007-09-29 01:50:20 +08:00
|
|
|
AC_CHECK_FUNCS([snprintf _snprintf], missing=false)
|
2007-09-18 04:53:14 +08:00
|
|
|
if $missing; then
|
2007-09-29 01:50:20 +08:00
|
|
|
XOBJS="$XOBJS lib/snprintf.o"
|
2004-12-16 07:02:20 +08:00
|
|
|
fi
|
|
|
|
|
2007-10-03 12:53:51 +08:00
|
|
|
AC_CHECK_FUNCS(strcasecmp stricmp)
|
|
|
|
AC_CHECK_FUNCS(strncasecmp strnicmp)
|
|
|
|
AC_CHECK_FUNCS(strsep)
|
2009-08-11 06:56:52 +08:00
|
|
|
AC_CHECK_FUNCS(strlcpy)
|
2007-10-03 12:53:51 +08:00
|
|
|
|
2007-04-13 00:54:50 +08:00
|
|
|
AC_CHECK_FUNCS(getuid)
|
|
|
|
AC_CHECK_FUNCS(getgid)
|
|
|
|
|
2016-01-27 04:01:34 +08:00
|
|
|
AC_CHECK_FUNCS(realpath)
|
|
|
|
AC_CHECK_FUNCS(canonicalize_file_name)
|
|
|
|
AC_CHECK_FUNCS(_fullpath)
|
|
|
|
AC_CHECK_FUNCS(pathconf)
|
|
|
|
|
2007-10-27 09:49:29 +08:00
|
|
|
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)
|
2009-08-11 06:56:52 +08:00
|
|
|
AC_CHECK_DECLS(strlcpy)
|
2007-10-27 09:49:29 +08:00
|
|
|
|
2002-05-01 04:53:16 +08:00
|
|
|
if test $ac_cv_prog_make_vpathok = no; then
|
|
|
|
echo Copying generated srcs into build directory to compensate for VPATH breakage
|
2002-05-19 10:26:38 +08:00
|
|
|
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-05-01 04:53:16 +08:00
|
|
|
fi
|
|
|
|
|
2010-11-11 16:18:44 +08:00
|
|
|
dnl
|
|
|
|
dnl support cchace
|
|
|
|
dnl
|
2016-02-19 04:09:31 +08:00
|
|
|
AC_ARG_ENABLE([ccache],
|
|
|
|
[AC_HELP_STRING([--with-ccache], [compile with ccache])],
|
|
|
|
[CC="ccache $CC"],
|
|
|
|
[])
|
2010-11-11 16:18:44 +08:00
|
|
|
|
2016-02-13 15:49:49 +08:00
|
|
|
PA_ADD_CFLAGS([-pedantic])
|
2016-02-19 04:09:31 +08:00
|
|
|
AC_ARG_ENABLE([werror],
|
|
|
|
[AC_HELP_STRING([--enable-werror],
|
|
|
|
[compile with -Werror to error out on any warning])],
|
|
|
|
[PA_ADD_CFLAGS([-Werror])],
|
|
|
|
[PA_ADD_CFLAGS([-Werror=implicit])
|
2016-02-13 15:49:49 +08:00
|
|
|
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])
|
2016-02-19 04:09:31 +08:00
|
|
|
PA_ADD_CFLAGS([-Werror=vla])])
|
2016-02-13 15:49:49 +08:00
|
|
|
|
2002-05-04 08:15:02 +08:00
|
|
|
AC_OUTPUT_COMMANDS([mkdir -p output])
|
2002-05-19 09:57:54 +08:00
|
|
|
AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)
|