1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
dnl Process this file with autoconf 2.61 or later to produce
dnl a configure script.
AC_PREREQ(2.61)
AC_INIT(config.h.in)
AC_CONFIG_HEADERS(config.h)
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_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
dnl If we have gcc, add appropriate options
PA_ADD_CFLAGS([-W])
PA_ADD_CFLAGS([-Wall])
PA_ADD_CFLAGS([-std=c99])
PA_ADD_CFLAGS([-pedantic])
dnl Look for programs...
AC_CHECK_PROGS(NROFF, nroff, echo)
AC_CHECK_PROGS(ACRODIST, acrodist, false)
AC_CHECK_PROGS(PS2PDF, ps2pdf, false)
AC_CHECK_PROGS(PSTOPDF, pstopdf, false)
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
dnl Check for <inttypes.h> or add a substitute version
AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
dnl The standard header for str*casecmp is <strings.h>
AC_CHECK_HEADERS(strings.h)
dnl Look for <stdbool.h>
AC_CHECK_HEADERS(stdbool.h)
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 Checks for library functions.
AC_SUBST(XOBJS)
AC_CHECK_FUNCS(strcspn, ,
AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
AC_CHECK_FUNCS(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(strncasecmp strnicmp)
AC_CHECK_FUNCS(strsep)
AC_CHECK_FUNCS(getuid)
AC_CHECK_FUNCS(getgid)
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)
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
fi
AC_OUTPUT_COMMANDS([mkdir -p output])
AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)
|