output: outmac -- Fix few nits during merge
[nasm.git] / configure.in
blobf3274263fa8d80c6e8e29585a86ac5878fb294c8
1 dnl Process this file with autoconf 2.61 or later to produce
2 dnl a configure script.
3 AC_PREREQ(2.61)
4 AC_INIT(config.h.in)
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,
12 [mkdir conftestdir
13 cat > conftestdir/conftestmake <<\EOF
14 VPATH = ..
15 conftestfoo: conftestbar
16         @echo ac_make2temp=ok
17 conftestbar: conftestbaz
18         @echo ac_maketemp=broken
19         @touch conftestbar
20 EOF
21 echo > conftestbaz # these two lines need to be...
22 echo > conftestbar # ... in this order not the other
23 changequote(, )dnl
24 unset ac_maketemp
25 unset ac_make2temp
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=`
28 changequote([, ])dnl
29 if test -n "$ac_maketemp"; then
30   ac_cv_prog_make_vpathok=no
31 else
32   if test -n "$ac_make2temp"; then
33     ac_cv_prog_make_vpathok=yes
34   else
35     ac_cv_prog_make_vpathok=no
36   fi
38 rm -rf conftestdir
39 rm -f conftestbar conftestbaz])dnl
40 if test $ac_cv_prog_make_vpathok = yes; then
41   AC_MSG_RESULT(yes)
42 else
43   AC_MSG_RESULT(no)
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
52 AC_PROG_CC
53 AC_PROG_LN_S
54 AC_PROG_MAKE_SET
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
58 else
59   AC_PROG_MAKE_VPATHOK
61 AC_PROG_INSTALL
63 dnl Checks for typedefs, structures, and compiler characteristics.
64 AC_C_CONST
65 AC_C_INLINE
66 AC_C_RESTRICT
67 AC_TYPE_SIZE_T
68 PA_WORKING_BOOL
69 AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN))
70 AH_TEMPLATE(WORDS_BIGENDIAN,
71 [Define to 1 if your processor stores words with the most significant
72 byte first (like Motorola and SPARC, unlike Intel and VAX).])
73 AH_TEMPLATE(WORDS_LITTLEENDIAN,
74 [Define to 1 if your processor stores words with the least significant
75 byte first (like Intel and VAX, unlike Motorola and SPARC).])
77 dnl If we have gcc, add appropriate options
78 PA_ADD_CFLAGS([-W])
79 PA_ADD_CFLAGS([-Wall])
80 PA_ADD_CFLAGS([-std=c99])
81 PA_ADD_CFLAGS([-pedantic])
82 PA_ADD_CFLAGS([-Werror=implicit])
83 PA_ADD_CFLAGS([-Werror=missing-braces])
84 PA_ADD_CFLAGS([-Werror=return-type])
85 PA_ADD_CFLAGS([-Werror=trigraphs])
86 PA_ADD_CFLAGS([-Werror=pointer-arith])
87 PA_ADD_CFLAGS([-Werror=strict-prototypes])
88 PA_ADD_CFLAGS([-Werror=missing-prototypes])
89 PA_ADD_CFLAGS([-Werror=missing-declarations])
90 PA_ADD_CFLAGS([-Werror=comment])
91 PA_ADD_CFLAGS([-Werror=vla])
93 dnl Look for programs...
94 AC_CHECK_PROGS(NROFF,    nroff,    false)
95 AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
96 AC_CHECK_PROGS(XMLTO,    xmlto,    false)
97 AC_CHECK_PROGS(ACRODIST, acrodist, false)
98 AC_CHECK_PROGS(PS2PDF,   ps2pdf,   false)
99 AC_CHECK_PROGS(PSTOPDF,  pstopdf,  false)
101 dnl Check for progs needed for manpage generation
102 if test $ASCIIDOC = false; then
103   AC_MSG_WARN([No acsciidoc package found])
105 if test $XMLTO = false; then
106   AC_MSG_WARN([No xmlto package found])
109 dnl Checks for header files.
110 AC_HEADER_STDC
111 if test $ac_cv_header_stdc = no; then
112   AC_MSG_ERROR([NASM requires ANSI C header files to compile])
115 AC_CHECK_HEADERS(limits.h)
116 if test $ac_cv_header_limits_h = no; then
117   AC_MSG_ERROR([NASM requires '<limits.h>' to compile])
120 dnl Check for <inttypes.h> or add a substitute version
121 AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
123 dnl The standard header for str*casecmp is <strings.h>
124 AC_CHECK_HEADERS(strings.h)
126 dnl Look for <stdbool.h>
127 AC_CHECK_HEADERS(stdbool.h)
129 dnl Look for <unistd.h>
130 AC_CHECK_HEADERS(unistd.h)
132 dnl Look for <sys/param.h>
133 AC_CHECK_HEADERS(sys/param.h)
135 dnl Checks for library functions.
136 AC_SUBST(XOBJS)
138 AC_CHECK_FUNCS(strcspn, ,
139   AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
141 AC_CHECK_FUNCS(strspn, ,
142   AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
144 missing=true
145 AC_CHECK_FUNCS([vsnprintf _vsnprintf], missing=false)
146 if $missing; then
147    XOBJS="$XOBJS lib/vsnprintf.o"
150 missing=true
151 AC_CHECK_FUNCS([snprintf _snprintf], missing=false)
152 if $missing; then
153    XOBJS="$XOBJS lib/snprintf.o"
156 AC_CHECK_FUNCS(strcasecmp stricmp)
157 AC_CHECK_FUNCS(strncasecmp strnicmp)
158 AC_CHECK_FUNCS(strsep)
159 AC_CHECK_FUNCS(strlcpy)
161 AC_CHECK_FUNCS(getuid)
162 AC_CHECK_FUNCS(getgid)
164 AC_CHECK_FUNCS(realpath)
165 AC_CHECK_FUNCS(canonicalize_file_name)
166 AC_CHECK_FUNCS(_fullpath)
167 AC_CHECK_FUNCS(pathconf)
169 dnl Check for functions that might not be declared in the headers for
170 dnl various idiotic reasons (mostly because of library authors
171 dnl abusing the meaning of __STRICT_ANSI__)
172 AC_CHECK_DECLS(strcasecmp)
173 AC_CHECK_DECLS(stricmp)
174 AC_CHECK_DECLS(strncasecmp)
175 AC_CHECK_DECLS(strnicmp)
176 AC_CHECK_DECLS(strsep)
177 AC_CHECK_DECLS(strlcpy)
179 if test $ac_cv_prog_make_vpathok = no; then
180   echo Copying generated srcs into build directory to compensate for VPATH breakage
181   for file in macros.c insnsa.c insnsd.c insnsn.c insnsi.h version.h version.mac; do
182     if test ! -f $file; then cp -p ${srcdir}/${file} .; fi
183   done
187 dnl support cchace
189 AC_ARG_WITH([ccache],
190             [AC_HELP_STRING([--with-ccache],
191                             [Compile with ccache])],
192           [CC="ccache $CC"],
193           [])
195 AC_OUTPUT_COMMANDS([mkdir -p output])
196 AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)