blob: b5fb0e19990a42223d86899b37ed03eebae8b2de [file] [log] [blame]
H. Peter Anvin87bc6192002-04-30 20:53:16 +00001dnl Process this file with autoconf to produce a configure script.
2AC_INIT(nasm.c)
3
4dnl Check for broken VPATH handling on older NetBSD makes.
5AC_DEFUN(AC_PROG_MAKE_VPATHOK,
6[AC_MSG_CHECKING(whether ${MAKE-make} has sane VPATH handling)
7set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
8AC_CACHE_VAL(ac_cv_prog_make_vpathok,
9[mkdir conftestdir
10cat > conftestdir/conftestmake <<\EOF
11VPATH = ..
12conftestfoo: conftestbar
13 @echo ac_make2temp=ok
14conftestbar: conftestbaz
15 @echo ac_maketemp=broken
16 @touch conftestbar
17EOF
18echo > conftestbaz # these two lines need to be...
19echo > conftestbar # ... in this order not the other
20changequote(, )dnl
21unset ac_maketemp
22unset ac_make2temp
23# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
24eval `cd conftestdir; ${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
25changequote([, ])dnl
26if test -n "$ac_maketemp"; then
27 ac_cv_prog_make_vpathok=no
28else
29 if test -n "$ac_make2temp"; then
30 ac_cv_prog_make_vpathok=yes
31 else
32 ac_cv_prog_make_vpathok=no
33 fi
34fi
35rm -rf conftestdir
36rm -f conftestbar conftestbaz])dnl
37if test $ac_cv_prog_make_vpathok = yes; then
38 AC_MSG_RESULT(yes)
39else
40 AC_MSG_RESULT(no)
41fi
42])
43
44AC_PREFIX_PROGRAM(nasm)
45
46dnl Checks for programs.
47AC_PROG_CC
48AC_PROG_LN_S
49AC_PROG_MAKE_SET
50if test -f nasm.c; then
51 # we're building in the source dir, so we don't need this check at all
52 ac_cv_prog_make_vpathok=yes
53else
54 AC_PROG_MAKE_VPATHOK
55fi
56AC_PROG_INSTALL
57
58if test "$GCC" = "yes"; then
59 GCCFLAGS="-Wall -ansi -pedantic"
60else
61 GCCFLAGS=
62fi
63AC_SUBST(GCCFLAGS)
64
65dnl Checks for header files.
66AC_HEADER_STDC
67if test $ac_cv_header_stdc = no; then
68 AC_MSG_ERROR([NASM requires ANSI C header files to compile])
69fi
70
71AC_CHECK_HEADERS(limits.h)
72if test $ac_cv_header_limits_h = no; then
73 AC_MSG_ERROR([NASM requires '<limits.h>' to compile])
74fi
75
76dnl Checks for typedefs, structures, and compiler characteristics.
77AC_C_CONST
78if test $ac_cv_c_const = no; then
79 AC_MSG_ERROR([NASM requires ANSI C (specifically, working "const")])
80fi
81
82AC_TYPE_SIZE_T
83if test $ac_cv_type_size_t = no; then
84 AC_MSG_ERROR([NASM requires ANSI C (specifically, "size_t")])
85fi
86
87dnl Checks for library functions.
88AC_FUNC_VPRINTF
89if test $ac_cv_func_vprintf = no; then
90 AC_MSG_ERROR([NASM requires ANSI C (specifically, "vprintf" and friends)])
91fi
92
93AC_CHECK_FUNCS(strcspn)
94if test $ac_cv_func_strcspn = no; then
95 AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")])
96fi
97
98AC_CHECK_FUNCS(strspn)
99if test $ac_cv_func_strspn = no; then
100 AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")])
101fi
102
103if test $ac_cv_prog_make_vpathok = no; then
104 echo Copying generated srcs into build directory to compensate for VPATH breakage
105 if test ! -f insnsa.c; then cp -p ${srcdir}/insnsa.c .; fi
106 if test ! -f insnsd.c; then cp -p ${srcdir}/insnsd.c .; fi
107 if test ! -f macros.c; then cp -p ${srcdir}/macros.c .; fi
108fi
109
110AC_OUTPUT(Makefile rdoff/Makefile)