mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
Portability improvements and autoconf modernization
Improve the portability of the code and modernize our use of autoconf. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
76
Makefile.in
76
Makefile.in
@@ -22,9 +22,13 @@ INTERNAL_CFLAGS = -I$(srcdir) -I.
|
|||||||
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
PERL = perl -I$(srcdir)/perllib
|
PERL = perl
|
||||||
|
PERLFLAGS = -I$(srcdir)/perllib
|
||||||
|
|
||||||
XOBJS = @XOBJS@
|
RUNPERL = $(PERL) $(PERLFLAGS)
|
||||||
|
|
||||||
|
LIBOBJDIR = @LIBOBJDIR@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
@@ -102,11 +106,11 @@ NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
|
|||||||
|
|
||||||
all: nasm$(X) ndisasm$(X) manpages rdf
|
all: nasm$(X) ndisasm$(X) manpages rdf
|
||||||
|
|
||||||
nasm$(X): $(NASM) $(XOBJS)
|
nasm$(X): $(NASM) $(LIBOBJS)
|
||||||
$(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(XOBJS) $(LIBS)
|
$(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(LIBOBJS) $(LIBS)
|
||||||
|
|
||||||
ndisasm$(X): $(NDISASM) $(XOBJS)
|
ndisasm$(X): $(NDISASM) $(LIBOBJS)
|
||||||
$(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(XOBJS) $(LIBS)
|
$(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(LIBOBJS) $(LIBS)
|
||||||
|
|
||||||
# These source files are automagically generated from a single
|
# These source files are automagically generated from a single
|
||||||
# instruction-table file by a Perl script. They're distributed,
|
# instruction-table file by a Perl script. They're distributed,
|
||||||
@@ -115,79 +119,79 @@ ndisasm$(X): $(NDISASM) $(XOBJS)
|
|||||||
INSDEP = insns.dat insns.pl insns-iflags.pl
|
INSDEP = insns.dat insns.pl insns-iflags.pl
|
||||||
|
|
||||||
iflag.c: $(INSDEP)
|
iflag.c: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat
|
||||||
iflaggen.h: $(INSDEP)
|
iflaggen.h: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -fh $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -fh $(srcdir)/insns.dat
|
||||||
insnsb.c: $(INSDEP)
|
insnsb.c: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
|
||||||
insnsa.c: $(INSDEP)
|
insnsa.c: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
|
||||||
insnsd.c: $(INSDEP)
|
insnsd.c: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
|
||||||
insnsi.h: $(INSDEP)
|
insnsi.h: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
|
||||||
insnsn.c: $(INSDEP)
|
insnsn.c: $(INSDEP)
|
||||||
$(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
|
$(RUNPERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
|
||||||
|
|
||||||
# These files contains all the standard macros that are derived from
|
# These files contains all the standard macros that are derived from
|
||||||
# the version number.
|
# the version number.
|
||||||
version.h: version version.pl
|
version.h: version version.pl
|
||||||
$(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
|
$(RUNPERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
|
||||||
version.mac: version version.pl
|
version.mac: version version.pl
|
||||||
$(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
|
$(RUNPERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
|
||||||
version.sed: version version.pl
|
version.sed: version version.pl
|
||||||
$(PERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
|
$(RUNPERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
|
||||||
version.mak: version version.pl
|
version.mak: version version.pl
|
||||||
$(PERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
|
$(RUNPERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
|
||||||
version.nsh: version version.pl
|
version.nsh: version version.pl
|
||||||
$(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh
|
$(RUNPERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh
|
||||||
|
|
||||||
# This source file is generated from the standard macros file
|
# This source file is generated from the standard macros file
|
||||||
# `standard.mac' by another Perl script. Again, it's part of the
|
# `standard.mac' by another Perl script. Again, it's part of the
|
||||||
# standard distribution.
|
# standard distribution.
|
||||||
macros.c: macros.pl pptok.ph standard.mac version.mac \
|
macros.c: macros.pl pptok.ph standard.mac version.mac \
|
||||||
$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
|
$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
|
||||||
$(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
|
$(RUNPERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
|
||||||
$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
|
$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
|
||||||
|
|
||||||
# These source files are generated from regs.dat by yet another
|
# These source files are generated from regs.dat by yet another
|
||||||
# perl script.
|
# perl script.
|
||||||
regs.c: regs.dat regs.pl
|
regs.c: regs.dat regs.pl
|
||||||
$(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
|
$(RUNPERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
|
||||||
regflags.c: regs.dat regs.pl
|
regflags.c: regs.dat regs.pl
|
||||||
$(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
|
$(RUNPERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
|
||||||
regdis.c: regs.dat regs.pl
|
regdis.c: regs.dat regs.pl
|
||||||
$(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
|
$(RUNPERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
|
||||||
regdis.h: regs.dat regs.pl
|
regdis.h: regs.dat regs.pl
|
||||||
$(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
|
$(RUNPERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
|
||||||
regvals.c: regs.dat regs.pl
|
regvals.c: regs.dat regs.pl
|
||||||
$(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
|
$(RUNPERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
|
||||||
regs.h: regs.dat regs.pl
|
regs.h: regs.dat regs.pl
|
||||||
$(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
|
$(RUNPERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
|
||||||
|
|
||||||
# Assembler token hash
|
# Assembler token hash
|
||||||
tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
|
tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
|
$(RUNPERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
|
||||||
$(srcdir)/tokens.dat > tokhash.c
|
$(srcdir)/tokens.dat > tokhash.c
|
||||||
|
|
||||||
# Assembler token metadata
|
# Assembler token metadata
|
||||||
tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
|
tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
|
$(RUNPERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
|
||||||
$(srcdir)/tokens.dat > tokens.h
|
$(srcdir)/tokens.dat > tokens.h
|
||||||
|
|
||||||
# Preprocessor token hash
|
# Preprocessor token hash
|
||||||
pptok.h: pptok.dat pptok.pl perllib/phash.ph
|
pptok.h: pptok.dat pptok.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
|
$(RUNPERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
|
||||||
pptok.c: pptok.dat pptok.pl perllib/phash.ph
|
pptok.c: pptok.dat pptok.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
|
$(RUNPERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
|
||||||
pptok.ph: pptok.dat pptok.pl perllib/phash.ph
|
pptok.ph: pptok.dat pptok.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
|
$(RUNPERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
|
||||||
|
|
||||||
# Directives hash
|
# Directives hash
|
||||||
directiv.h: directiv.dat directiv.pl perllib/phash.ph
|
directiv.h: directiv.dat directiv.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
|
$(RUNPERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
|
||||||
directiv.c: directiv.dat directiv.pl perllib/phash.ph
|
directiv.c: directiv.dat directiv.pl perllib/phash.ph
|
||||||
$(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
|
$(RUNPERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
|
||||||
|
|
||||||
# This target generates all files that require perl.
|
# This target generates all files that require perl.
|
||||||
# This allows easier generation of distribution (see dist target).
|
# This allows easier generation of distribution (see dist target).
|
||||||
@@ -284,18 +288,18 @@ splint:
|
|||||||
splint -weak *.c
|
splint -weak *.c
|
||||||
|
|
||||||
test: nasm$(X)
|
test: nasm$(X)
|
||||||
cd test && $(PERL) performtest.pl --nasm=../nasm *.asm
|
cd test && $(RUNPERL) performtest.pl --nasm=../nasm *.asm
|
||||||
|
|
||||||
golden: nasm$(X)
|
golden: nasm$(X)
|
||||||
cd test && $(PERL) performtest.pl --golden --nasm=../nasm *.asm
|
cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm
|
||||||
|
|
||||||
#
|
#
|
||||||
# This build dependencies in *ALL* makefiles. Partially for that reason,
|
# This build dependencies in *ALL* makefiles. Partially for that reason,
|
||||||
# it's expected to be invoked manually.
|
# it's expected to be invoked manually.
|
||||||
#
|
#
|
||||||
alldeps: perlreq
|
alldeps: perlreq
|
||||||
$(PERL) syncfiles.pl Makefile.in Mkfiles/*.mak
|
$(RUNPERL) syncfiles.pl Makefile.in Mkfiles/*.mak
|
||||||
$(PERL) mkdep.pl -M Makefile.in Mkfiles/*.mak -- \
|
$(RUNPERL) mkdep.pl -M Makefile.in Mkfiles/*.mak -- \
|
||||||
. output lib
|
. output lib
|
||||||
./config.status
|
./config.status
|
||||||
|
|
||||||
|
45
aclocal.m4
vendored
45
aclocal.m4
vendored
@@ -14,25 +14,32 @@ AC_DEFUN(PA_ADD_CFLAGS,
|
|||||||
CFLAGS="$pa_add_cflags__old_cflags")])
|
CFLAGS="$pa_add_cflags__old_cflags")])
|
||||||
|
|
||||||
dnl --------------------------------------------------------------------------
|
dnl --------------------------------------------------------------------------
|
||||||
dnl PA_WORKING_STDBOOL
|
dnl PA_HAVE_FUNC
|
||||||
dnl
|
dnl
|
||||||
dnl See if we have a working <stdbool.h> and bool support; in particular,
|
dnl Look for a function with the specified arguments which could be
|
||||||
dnl OpenWatcom 1.8 has a broken _Bool type that we don't want to use.
|
dnl a builtin/intrinsic function.
|
||||||
dnl --------------------------------------------------------------------------
|
dnl --------------------------------------------------------------------------
|
||||||
AC_DEFUN(PA_WORKING_BOOL,
|
AC_DEFUN(PA_HAVE_FUNC,
|
||||||
[AC_MSG_CHECKING([if $CC has a working bool type])
|
[AC_MSG_CHECKING([for $1])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
AC_TRY_LINK([], [(void)$1$2;],
|
||||||
#ifndef __cplusplus
|
AC_MSG_RESULT([yes])
|
||||||
#include <stdbool.h>
|
AC_DEFINE(m4_toupper([HAVE_$1]), [1],
|
||||||
#endif
|
[Define to 1 if you have the `$1' intrinsic function.]),
|
||||||
int foo(bool x, int y)
|
AC_MSG_RESULT([no]))])
|
||||||
{
|
|
||||||
return x+y;
|
|
||||||
}
|
|
||||||
])],
|
|
||||||
[AC_MSG_RESULT([yes])
|
|
||||||
AC_DEFINE(HAVE_WORKING_BOOL, 1,
|
|
||||||
[Define to 1 if your compiler has a correct implementation of bool])],
|
|
||||||
[AC_MSG_RESULT([no])])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
dnl --------------------------------------------------------------------------
|
||||||
|
dnl PA_REPLACE_FUNC
|
||||||
|
dnl
|
||||||
|
dnl Look for a function and possible alternatives, unlike AC_REPLACE_FUNCS
|
||||||
|
dnl this will only add *one* replacement to LIBOBJS if no alternative is
|
||||||
|
dnl found.
|
||||||
|
dnl --------------------------------------------------------------------------
|
||||||
|
AC_DEFUN(PA_REPLACE_FUNC_WITH,
|
||||||
|
[pa_replace_func__$2_missing=true
|
||||||
|
AC_CHECK_FUNCS([$1], [pa_replace_func__$2_missing=false], [])
|
||||||
|
if $pa_replace_func__$2_missing; then
|
||||||
|
AC_LIBOBJ([$2])
|
||||||
|
fi])
|
||||||
|
|
||||||
|
AC_DEFUN(PA_REPLACE_FUNC,
|
||||||
|
[PA_REPLACE_FUNC_WITH([$1], m4_car(m4_unquote(m4_split(m4_normalize[$1]))))])
|
||||||
|
15
compiler.h
15
compiler.h
@@ -69,15 +69,6 @@
|
|||||||
#define __STDC_LIMIT_MACROS 1
|
#define __STDC_LIMIT_MACROS 1
|
||||||
#define __STDC_FORMAT_MACROS 1
|
#define __STDC_FORMAT_MACROS 1
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
# if __GNUC__ >= 4
|
|
||||||
# define HAVE_GNUC_4
|
|
||||||
# endif
|
|
||||||
# if __GNUC__ >= 3
|
|
||||||
# define HAVE_GNUC_3
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
# define _unused __attribute__((unused))
|
# define _unused __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
@@ -110,8 +101,12 @@ size_t strlcpy(char *, const char *, size_t);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus /* C++ has false, true, bool as keywords */
|
#ifndef __cplusplus /* C++ has false, true, bool as keywords */
|
||||||
# if defined(HAVE_STDBOOL_H) && defined(HAVE_WORKING_BOOL)
|
# ifdef HAVE_STDBOOL_H
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
|
# elif defined(HAVE__BOOL)
|
||||||
|
# typedef _Bool bool
|
||||||
|
# define false 0
|
||||||
|
# define true 1
|
||||||
# else
|
# else
|
||||||
/* This is sort of dangerous, since casts will behave different than
|
/* This is sort of dangerous, since casts will behave different than
|
||||||
casting to the standard boolean type. Always use !!, not (bool). */
|
casting to the standard boolean type. Always use !!, not (bool). */
|
||||||
|
46
configure.in
46
configure.in
@@ -1,6 +1,6 @@
|
|||||||
dnl Process this file with autoconf 2.61 or later to produce
|
dnl Process this file with autoconf 2.63 or later to produce
|
||||||
dnl a configure script.
|
dnl a configure script.
|
||||||
AC_PREREQ(2.61)
|
AC_PREREQ(2.63)
|
||||||
AC_INIT(config.h.in)
|
AC_INIT(config.h.in)
|
||||||
AC_CONFIG_HEADERS(config.h)
|
AC_CONFIG_HEADERS(config.h)
|
||||||
|
|
||||||
@@ -48,8 +48,9 @@ AC_PREFIX_PROGRAM(nasm)
|
|||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future
|
dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
AC_PROG_CC_STDC
|
||||||
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
if test -f nasm.c; then
|
if test -f nasm.c; then
|
||||||
@@ -65,7 +66,6 @@ AC_C_CONST
|
|||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AC_C_RESTRICT
|
AC_C_RESTRICT
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
PA_WORKING_BOOL
|
|
||||||
AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN))
|
AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN))
|
||||||
AH_TEMPLATE(WORDS_BIGENDIAN,
|
AH_TEMPLATE(WORDS_BIGENDIAN,
|
||||||
[Define to 1 if your processor stores words with the most significant
|
[Define to 1 if your processor stores words with the most significant
|
||||||
@@ -74,11 +74,6 @@ AH_TEMPLATE(WORDS_LITTLEENDIAN,
|
|||||||
[Define to 1 if your processor stores words with the least significant
|
[Define to 1 if your processor stores words with the least significant
|
||||||
byte first (like Intel and VAX, unlike Motorola and SPARC).])
|
byte first (like Intel and VAX, unlike Motorola and SPARC).])
|
||||||
|
|
||||||
dnl If we have gcc, add appropriate options
|
|
||||||
PA_ADD_CFLAGS([-W])
|
|
||||||
PA_ADD_CFLAGS([-Wall])
|
|
||||||
PA_ADD_CFLAGS([-std=c99])
|
|
||||||
|
|
||||||
dnl Look for programs...
|
dnl Look for programs...
|
||||||
AC_CHECK_PROGS(NROFF, nroff, false)
|
AC_CHECK_PROGS(NROFF, nroff, false)
|
||||||
AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
|
AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
|
||||||
@@ -113,7 +108,7 @@ dnl The standard header for str*casecmp is <strings.h>
|
|||||||
AC_CHECK_HEADERS(strings.h)
|
AC_CHECK_HEADERS(strings.h)
|
||||||
|
|
||||||
dnl Look for <stdbool.h>
|
dnl Look for <stdbool.h>
|
||||||
AC_CHECK_HEADERS(stdbool.h)
|
AC_HEADER_STDBOOL
|
||||||
|
|
||||||
dnl Look for <unistd.h>
|
dnl Look for <unistd.h>
|
||||||
AC_CHECK_HEADERS(unistd.h)
|
AC_CHECK_HEADERS(unistd.h)
|
||||||
@@ -122,30 +117,14 @@ dnl Look for <sys/param.h>
|
|||||||
AC_CHECK_HEADERS(sys/param.h)
|
AC_CHECK_HEADERS(sys/param.h)
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_SUBST(XOBJS)
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS(strcspn, ,
|
AC_CHECK_FUNCS(strcspn, ,
|
||||||
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
|
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
|
||||||
|
|
||||||
AC_CHECK_FUNCS(strspn, ,
|
AC_CHECK_FUNCS(strspn, ,
|
||||||
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
|
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
|
||||||
|
|
||||||
missing=true
|
|
||||||
AC_CHECK_FUNCS([vsnprintf _vsnprintf], missing=false)
|
|
||||||
if $missing; then
|
|
||||||
XOBJS="$XOBJS lib/vsnprintf.o"
|
|
||||||
fi
|
|
||||||
|
|
||||||
missing=true
|
|
||||||
AC_CHECK_FUNCS([snprintf _snprintf], missing=false)
|
|
||||||
if $missing; then
|
|
||||||
XOBJS="$XOBJS lib/snprintf.o"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS(strcasecmp stricmp)
|
AC_CHECK_FUNCS(strcasecmp stricmp)
|
||||||
AC_CHECK_FUNCS(strncasecmp strnicmp)
|
AC_CHECK_FUNCS(strncasecmp strnicmp)
|
||||||
AC_CHECK_FUNCS(strsep)
|
|
||||||
AC_CHECK_FUNCS(strlcpy)
|
|
||||||
|
|
||||||
AC_CHECK_FUNCS(getuid)
|
AC_CHECK_FUNCS(getuid)
|
||||||
AC_CHECK_FUNCS(getgid)
|
AC_CHECK_FUNCS(getgid)
|
||||||
@@ -155,6 +134,18 @@ AC_CHECK_FUNCS(canonicalize_file_name)
|
|||||||
AC_CHECK_FUNCS(_fullpath)
|
AC_CHECK_FUNCS(_fullpath)
|
||||||
AC_CHECK_FUNCS(pathconf)
|
AC_CHECK_FUNCS(pathconf)
|
||||||
|
|
||||||
|
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_CONFIG_LIBOBJ_DIR([lib])
|
||||||
|
AC_SUBST([LIBOBJDIR], [lib/])
|
||||||
|
PA_REPLACE_FUNC([vsnprintf _vsnprintf])
|
||||||
|
PA_REPLACE_FUNC([snprintf _snprintf])
|
||||||
|
PA_REPLACE_FUNC([strlcpy])
|
||||||
|
PA_REPLACE_FUNC([strsep])
|
||||||
|
|
||||||
dnl Check for functions that might not be declared in the headers for
|
dnl Check for functions that might not be declared in the headers for
|
||||||
dnl various idiotic reasons (mostly because of library authors
|
dnl various idiotic reasons (mostly because of library authors
|
||||||
dnl abusing the meaning of __STRICT_ANSI__)
|
dnl abusing the meaning of __STRICT_ANSI__)
|
||||||
@@ -181,6 +172,9 @@ AC_ARG_WITH([ccache],
|
|||||||
[CC="ccache $CC"],
|
[CC="ccache $CC"],
|
||||||
[])
|
[])
|
||||||
|
|
||||||
|
dnl If we have gcc, add appropriate options
|
||||||
|
PA_ADD_CFLAGS([-W])
|
||||||
|
PA_ADD_CFLAGS([-Wall])
|
||||||
PA_ADD_CFLAGS([-pedantic])
|
PA_ADD_CFLAGS([-pedantic])
|
||||||
PA_ADD_CFLAGS([-Werror=implicit])
|
PA_ADD_CFLAGS([-Werror=implicit])
|
||||||
PA_ADD_CFLAGS([-Werror=missing-braces])
|
PA_ADD_CFLAGS([-Werror=missing-braces])
|
||||||
|
7
ilog2.c
7
ilog2.c
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2010 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__x86_64__)
|
#if defined(__GNUC__) && defined(__x86_64__)
|
||||||
|
|
||||||
int ilog2_32(uint32_t v)
|
int ilog2_32(uint32_t v)
|
||||||
@@ -67,7 +68,7 @@ int ilog2_32(uint32_t v)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_GNUC_4)
|
#elif defined(HAVE___BUILTIN_CTZ) && INT_MAX >= 2147483647
|
||||||
|
|
||||||
int ilog2_32(uint32_t v)
|
int ilog2_32(uint32_t v)
|
||||||
{
|
{
|
||||||
@@ -106,7 +107,7 @@ int ilog2_64(uint64_t v)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(HAVE_GNUC_4)
|
#elif defined(HAVE__BUILTIN_CTZLL) && LLONG_MAX >= 9223372036854775807L
|
||||||
|
|
||||||
int ilog2_64(uint64_t v)
|
int ilog2_64(uint64_t v)
|
||||||
{
|
{
|
||||||
|
@@ -14,8 +14,6 @@
|
|||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user