1 dnl Process this file with autoconf 2.61 or later to produce
2 dnl a configure script.
5 AC_CONFIG_HEADERS(config.h)
7 dnl Check for broken VPATH handling on older NetBSD makes.
8 AC_DEFUN(AC_PROG_MAKE_VPATHOK,
9 [AC_MSG_CHECKING(whether ${MAKE-make} has sane VPATH handling)
10 set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
11 AC_CACHE_VAL(ac_cv_prog_make_vpathok,
13 cat > conftestdir/conftestmake <<\EOF
15 conftestfoo: conftestbar
17 conftestbar: conftestbaz
18 @echo ac_maketemp=broken
21 echo > conftestbaz # these two lines need to be...
22 echo > conftestbar # ... in this order not the other
26 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
27 eval `cd conftestdir; ${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
29 if test -n "$ac_maketemp"; then
30 ac_cv_prog_make_vpathok=no
32 if test -n "$ac_make2temp"; then
33 ac_cv_prog_make_vpathok=yes
35 ac_cv_prog_make_vpathok=no
39 rm -f conftestbar conftestbaz])dnl
40 if test $ac_cv_prog_make_vpathok = yes; then
47 AC_PREFIX_PROGRAM(nasm)
49 dnl Checks for programs.
50 dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future
51 AC_USE_SYSTEM_EXTENSIONS
55 if test -f nasm.c; then
56 # we're building in the source dir, so we don't need this check at all
57 ac_cv_prog_make_vpathok=yes
63 dnl If we have gcc, add appropriate options
65 PA_ADD_CFLAGS([-Wall])
66 PA_ADD_CFLAGS([-std=c99])
67 PA_ADD_CFLAGS([-pedantic])
68 PA_ADD_CFLAGS([-Werror=implicit])
69 PA_ADD_CFLAGS([-Werror=missing-braces])
70 PA_ADD_CFLAGS([-Werror=return-type])
71 PA_ADD_CFLAGS([-Werror=trigraphs])
72 PA_ADD_CFLAGS([-Werror=trigraphs])
73 PA_ADD_CFLAGS([-Werror=pointer-arith])
74 PA_ADD_CFLAGS([-Werror=strict-prototypes])
75 PA_ADD_CFLAGS([-Werror=missing-prototypes])
76 PA_ADD_CFLAGS([-Werror=missing-declarations])
77 PA_ADD_CFLAGS([-Werror=comment])
78 PA_ADD_CFLAGS([-Werror=vla])
80 dnl Look for programs...
81 AC_CHECK_PROGS(NROFF, nroff, false)
82 AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
83 AC_CHECK_PROGS(XMLTO, xmlto, false)
84 AC_CHECK_PROGS(ACRODIST, acrodist, false)
85 AC_CHECK_PROGS(PS2PDF, ps2pdf, false)
86 AC_CHECK_PROGS(PSTOPDF, pstopdf, false)
88 dnl Check for progs needed for manpage generation
89 if test $ASCIIDOC = false; then
90 AC_MSG_WARN([No acsciidoc package found])
92 if test $XMLTO = false; then
93 AC_MSG_WARN([No xmlto package found])
96 dnl Checks for header files.
98 if test $ac_cv_header_stdc = no; then
99 AC_MSG_ERROR([NASM requires ANSI C header files to compile])
102 AC_CHECK_HEADERS(limits.h)
103 if test $ac_cv_header_limits_h = no; then
104 AC_MSG_ERROR([NASM requires '<limits.h>' to compile])
107 dnl Check for <inttypes.h> or add a substitute version
108 AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
110 dnl The standard header for str*casecmp is <strings.h>
111 AC_CHECK_HEADERS(strings.h)
113 dnl Look for <stdbool.h>
114 AC_CHECK_HEADERS(stdbool.h)
116 dnl Checks for typedefs, structures, and compiler characteristics.
122 AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN))
123 AH_TEMPLATE(WORDS_BIGENDIAN,
124 [Define to 1 if your processor stores words with the most significant
125 byte first (like Motorola and SPARC, unlike Intel and VAX).])
126 AH_TEMPLATE(WORDS_LITTLEENDIAN,
127 [Define to 1 if your processor stores words with the least significant
128 byte first (like Intel and VAX, unlike Motorola and SPARC).])
130 dnl Checks for library functions.
133 AC_CHECK_FUNCS(strcspn, ,
134 AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
136 AC_CHECK_FUNCS(strspn, ,
137 AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
140 AC_CHECK_FUNCS([vsnprintf _vsnprintf], missing=false)
142 XOBJS="$XOBJS lib/vsnprintf.o"
146 AC_CHECK_FUNCS([snprintf _snprintf], missing=false)
148 XOBJS="$XOBJS lib/snprintf.o"
151 AC_CHECK_FUNCS(strcasecmp stricmp)
152 AC_CHECK_FUNCS(strncasecmp strnicmp)
153 AC_CHECK_FUNCS(strsep)
154 AC_CHECK_FUNCS(strlcpy)
156 AC_CHECK_FUNCS(getuid)
157 AC_CHECK_FUNCS(getgid)
159 dnl Check for functions that might not be declared in the headers for
160 dnl various idiotic reasons (mostly because of library authors
161 dnl abusing the meaning of __STRICT_ANSI__)
162 AC_CHECK_DECLS(strcasecmp)
163 AC_CHECK_DECLS(stricmp)
164 AC_CHECK_DECLS(strncasecmp)
165 AC_CHECK_DECLS(strnicmp)
166 AC_CHECK_DECLS(strsep)
167 AC_CHECK_DECLS(strlcpy)
169 if test $ac_cv_prog_make_vpathok = no; then
170 echo Copying generated srcs into build directory to compensate for VPATH breakage
171 for file in macros.c insnsa.c insnsd.c insnsn.c insnsi.h version.h version.mac; do
172 if test ! -f $file; then cp -p ${srcdir}/${file} .; fi
179 AC_ARG_WITH([ccache],
180 [AC_HELP_STRING([--with-ccache],
181 [Compile with ccache])],
185 AC_OUTPUT_COMMANDS([mkdir -p output])
186 AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)