blob: fab51402f814b00f9f445ea4329138c14d14faad [file] [log] [blame]
H. Peter Anvin1170eb62002-05-19 02:26:38 +00001dnl Process this file with autoconf 2.53 or later to produce
2dnl a configure script.
3AC_PREREQ(2.53)
4AC_REVISION([$Id$])
H. Peter Anvineea6b7a2003-09-08 20:02:10 +00005AC_INIT(config.h.in)
H. Peter Anvin2ef2f062003-09-01 04:19:37 +00006AC_CONFIG_HEADERS(config.h)
H. Peter Anvin87bc6192002-04-30 20:53:16 +00007
8dnl Check for broken VPATH handling on older NetBSD makes.
9AC_DEFUN(AC_PROG_MAKE_VPATHOK,
10[AC_MSG_CHECKING(whether ${MAKE-make} has sane VPATH handling)
11set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`
12AC_CACHE_VAL(ac_cv_prog_make_vpathok,
13[mkdir conftestdir
14cat > conftestdir/conftestmake <<\EOF
15VPATH = ..
16conftestfoo: conftestbar
17 @echo ac_make2temp=ok
18conftestbar: conftestbaz
19 @echo ac_maketemp=broken
20 @touch conftestbar
21EOF
22echo > conftestbaz # these two lines need to be...
23echo > conftestbar # ... in this order not the other
24changequote(, )dnl
25unset ac_maketemp
26unset ac_make2temp
27# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
28eval `cd conftestdir; ${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
29changequote([, ])dnl
30if test -n "$ac_maketemp"; then
31 ac_cv_prog_make_vpathok=no
32else
33 if test -n "$ac_make2temp"; then
34 ac_cv_prog_make_vpathok=yes
35 else
36 ac_cv_prog_make_vpathok=no
37 fi
38fi
39rm -rf conftestdir
40rm -f conftestbar conftestbaz])dnl
41if test $ac_cv_prog_make_vpathok = yes; then
42 AC_MSG_RESULT(yes)
43else
44 AC_MSG_RESULT(no)
45fi
46])
47
48AC_PREFIX_PROGRAM(nasm)
49
50dnl Checks for programs.
51AC_PROG_CC
52AC_PROG_LN_S
53AC_PROG_MAKE_SET
54if test -f nasm.c; then
55 # we're building in the source dir, so we don't need this check at all
56 ac_cv_prog_make_vpathok=yes
57else
58 AC_PROG_MAKE_VPATHOK
59fi
60AC_PROG_INSTALL
61
62if test "$GCC" = "yes"; then
Ed Beroseta5d29452004-12-15 23:02:20 +000063 GCCFLAGS="-Wall -std=c99 -pedantic"
H. Peter Anvin87bc6192002-04-30 20:53:16 +000064else
65 GCCFLAGS=
66fi
67AC_SUBST(GCCFLAGS)
68
H. Peter Anvin620515a2002-04-30 20:57:38 +000069dnl Look for "nroff" or "groff"
H. Peter Anvinef7468f2002-04-30 20:57:59 +000070AC_CHECK_PROGS(NROFF, nroff, echo)
H. Peter Anvin620515a2002-04-30 20:57:38 +000071AC_SUBST(NROFF)
72
H. Peter Anvin87bc6192002-04-30 20:53:16 +000073dnl Checks for header files.
74AC_HEADER_STDC
75if test $ac_cv_header_stdc = no; then
76 AC_MSG_ERROR([NASM requires ANSI C header files to compile])
77fi
78
79AC_CHECK_HEADERS(limits.h)
80if test $ac_cv_header_limits_h = no; then
81 AC_MSG_ERROR([NASM requires '<limits.h>' to compile])
82fi
83
84dnl Checks for typedefs, structures, and compiler characteristics.
85AC_C_CONST
86if test $ac_cv_c_const = no; then
87 AC_MSG_ERROR([NASM requires ANSI C (specifically, working "const")])
88fi
89
90AC_TYPE_SIZE_T
91if test $ac_cv_type_size_t = no; then
92 AC_MSG_ERROR([NASM requires ANSI C (specifically, "size_t")])
93fi
94
95dnl Checks for library functions.
96AC_FUNC_VPRINTF
97if test $ac_cv_func_vprintf = no; then
98 AC_MSG_ERROR([NASM requires ANSI C (specifically, "vprintf" and friends)])
99fi
100
101AC_CHECK_FUNCS(strcspn)
102if test $ac_cv_func_strcspn = no; then
103 AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")])
104fi
105
106AC_CHECK_FUNCS(strspn)
107if test $ac_cv_func_strspn = no; then
108 AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")])
109fi
110
Ed Beroseta5d29452004-12-15 23:02:20 +0000111AC_CHECK_FUNCS(snprintf)
112if test $ac_cv_func_snprintf = no; then
113 AC_MSG_ERROR([NASM requires ISO C99 (specifically, "snprintf")])
114fi
115
116AC_CHECK_FUNCS(vsnprintf)
117if test $ac_cv_func_snprintf = no; then
118 AC_MSG_ERROR([NASM requires ISO C99 (specifically, "vsnprintf")])
119fi
120
H. Peter Anvin87bc6192002-04-30 20:53:16 +0000121if test $ac_cv_prog_make_vpathok = no; then
122 echo Copying generated srcs into build directory to compensate for VPATH breakage
H. Peter Anvin1170eb62002-05-19 02:26:38 +0000123 for file in macros.c insnsa.c insnsd.c insnsn.c insnsi.h version.h version.mac; do
124 if test ! -f $file; then cp -p ${srcdir}/${file} .; fi
125 done
H. Peter Anvin87bc6192002-04-30 20:53:16 +0000126fi
127
H. Peter Anvin4b563af2002-05-04 00:15:02 +0000128AC_OUTPUT_COMMANDS([mkdir -p output])
H. Peter Anvin0fcdade2002-05-19 01:57:54 +0000129AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile)