MPX: Adapt GAS's mib syntax with an index reg only
[platform/upstream/nasm.git] / configure.in
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)
6
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
37 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)
44 fi
45 ])
46
47 AC_PREFIX_PROGRAM(nasm)
48
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
60 fi
61 AC_PROG_INSTALL
62
63 dnl If we have gcc, add appropriate options
64 PA_ADD_CFLAGS([-W])
65 PA_ADD_CFLAGS([-Wall])
66 PA_ADD_CFLAGS([-std=c99])
67 PA_ADD_CFLAGS([-pedantic])
68
69 dnl Look for programs...
70 AC_CHECK_PROGS(NROFF,    nroff,    false)
71 AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
72 AC_CHECK_PROGS(XMLTO,    xmlto,    false)
73 AC_CHECK_PROGS(ACRODIST, acrodist, false)
74 AC_CHECK_PROGS(PS2PDF,   ps2pdf,   false)
75 AC_CHECK_PROGS(PSTOPDF,  pstopdf,  false)
76
77 dnl Check for progs needed for manpage generation
78 if test $ASCIIDOC = false; then
79   AC_MSG_WARN([No acsciidoc package found])
80 fi
81 if test $XMLTO = false; then
82   AC_MSG_WARN([No xmlto package found])
83 fi
84
85 dnl Checks for header files.
86 AC_HEADER_STDC
87 if test $ac_cv_header_stdc = no; then
88   AC_MSG_ERROR([NASM requires ANSI C header files to compile])
89 fi
90
91 AC_CHECK_HEADERS(limits.h)
92 if test $ac_cv_header_limits_h = no; then
93   AC_MSG_ERROR([NASM requires '<limits.h>' to compile])
94 fi
95
96 dnl Check for <inttypes.h> or add a substitute version
97 AC_CHECK_HEADERS(inttypes.h, , CFLAGS="$CFLAGS -I\$(top_srcdir)/inttypes")
98
99 dnl The standard header for str*casecmp is <strings.h>
100 AC_CHECK_HEADERS(strings.h)
101
102 dnl Look for <stdbool.h>
103 AC_CHECK_HEADERS(stdbool.h)
104
105 dnl Checks for typedefs, structures, and compiler characteristics.
106 AC_C_CONST
107 AC_C_INLINE
108 AC_C_RESTRICT
109 AC_TYPE_SIZE_T
110 PA_WORKING_BOOL
111 AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN))
112 AH_TEMPLATE(WORDS_BIGENDIAN,
113 [Define to 1 if your processor stores words with the most significant
114 byte first (like Motorola and SPARC, unlike Intel and VAX).])
115 AH_TEMPLATE(WORDS_LITTLEENDIAN,
116 [Define to 1 if your processor stores words with the least significant
117 byte first (like Intel and VAX, unlike Motorola and SPARC).])
118
119 dnl Checks for library functions.
120 AC_SUBST(XOBJS)
121
122 AC_CHECK_FUNCS(strcspn, ,
123   AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]))
124
125 AC_CHECK_FUNCS(strspn, ,
126   AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]))
127
128 missing=true
129 AC_CHECK_FUNCS([vsnprintf _vsnprintf], missing=false)
130 if $missing; then
131    XOBJS="$XOBJS lib/vsnprintf.o"
132 fi
133
134 missing=true
135 AC_CHECK_FUNCS([snprintf _snprintf], missing=false)
136 if $missing; then
137    XOBJS="$XOBJS lib/snprintf.o"
138 fi
139
140 AC_CHECK_FUNCS(strcasecmp stricmp)
141 AC_CHECK_FUNCS(strncasecmp strnicmp)
142 AC_CHECK_FUNCS(strsep)
143 AC_CHECK_FUNCS(strlcpy)
144
145 AC_CHECK_FUNCS(getuid)
146 AC_CHECK_FUNCS(getgid)
147
148 dnl Check for functions that might not be declared in the headers for
149 dnl various idiotic reasons (mostly because of library authors
150 dnl abusing the meaning of __STRICT_ANSI__)
151 AC_CHECK_DECLS(strcasecmp)
152 AC_CHECK_DECLS(stricmp)
153 AC_CHECK_DECLS(strncasecmp)
154 AC_CHECK_DECLS(strnicmp)
155 AC_CHECK_DECLS(strsep)
156 AC_CHECK_DECLS(strlcpy)
157
158 if test $ac_cv_prog_make_vpathok = no; then
159   echo Copying generated srcs into build directory to compensate for VPATH breakage
160   for file in macros.c insnsa.c insnsd.c insnsn.c insnsi.h version.h version.mac; do
161     if test ! -f $file; then cp -p ${srcdir}/${file} .; fi
162   done
163 fi
164
165 dnl
166 dnl support cchace
167 dnl
168 AC_ARG_WITH([ccache],
169             [AC_HELP_STRING([--with-ccache],
170                             [Compile with ccache])],
171           [CC="ccache $CC"],
172           [])
173
174 AC_OUTPUT_COMMANDS([mkdir -p output])
175 AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)