H. Peter Anvin | 1170eb6 | 2002-05-19 02:26:38 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf 2.53 or later to produce |
| 2 | dnl a configure script. |
| 3 | AC_PREREQ(2.53) |
| 4 | AC_REVISION([$Id$]) |
H. Peter Anvin | eea6b7a | 2003-09-08 20:02:10 +0000 | [diff] [blame] | 5 | AC_INIT(config.h.in) |
H. Peter Anvin | 2ef2f06 | 2003-09-01 04:19:37 +0000 | [diff] [blame] | 6 | AC_CONFIG_HEADERS(config.h) |
H. Peter Anvin | 87bc619 | 2002-04-30 20:53:16 +0000 | [diff] [blame] | 7 | |
| 8 | dnl Check for broken VPATH handling on older NetBSD makes. |
| 9 | AC_DEFUN(AC_PROG_MAKE_VPATHOK, |
| 10 | [AC_MSG_CHECKING(whether ${MAKE-make} has sane VPATH handling) |
| 11 | set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'` |
| 12 | AC_CACHE_VAL(ac_cv_prog_make_vpathok, |
| 13 | [mkdir conftestdir |
| 14 | cat > conftestdir/conftestmake <<\EOF |
| 15 | VPATH = .. |
| 16 | conftestfoo: conftestbar |
| 17 | @echo ac_make2temp=ok |
| 18 | conftestbar: conftestbaz |
| 19 | @echo ac_maketemp=broken |
| 20 | @touch conftestbar |
| 21 | EOF |
| 22 | echo > conftestbaz # these two lines need to be... |
| 23 | echo > conftestbar # ... in this order not the other |
| 24 | changequote(, )dnl |
| 25 | unset ac_maketemp |
| 26 | unset ac_make2temp |
| 27 | # GNU make sometimes prints "make[1]: Entering...", which would confuse us. |
| 28 | eval `cd conftestdir; ${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` |
| 29 | changequote([, ])dnl |
| 30 | if test -n "$ac_maketemp"; then |
| 31 | ac_cv_prog_make_vpathok=no |
| 32 | else |
| 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 |
| 38 | fi |
| 39 | rm -rf conftestdir |
| 40 | rm -f conftestbar conftestbaz])dnl |
| 41 | if test $ac_cv_prog_make_vpathok = yes; then |
| 42 | AC_MSG_RESULT(yes) |
| 43 | else |
| 44 | AC_MSG_RESULT(no) |
| 45 | fi |
| 46 | ]) |
| 47 | |
| 48 | AC_PREFIX_PROGRAM(nasm) |
| 49 | |
| 50 | dnl Checks for programs. |
| 51 | AC_PROG_CC |
| 52 | AC_PROG_LN_S |
| 53 | AC_PROG_MAKE_SET |
| 54 | if 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 |
| 57 | else |
| 58 | AC_PROG_MAKE_VPATHOK |
| 59 | fi |
| 60 | AC_PROG_INSTALL |
| 61 | |
| 62 | if test "$GCC" = "yes"; then |
Ed Beroset | a5d2945 | 2004-12-15 23:02:20 +0000 | [diff] [blame^] | 63 | GCCFLAGS="-Wall -std=c99 -pedantic" |
H. Peter Anvin | 87bc619 | 2002-04-30 20:53:16 +0000 | [diff] [blame] | 64 | else |
| 65 | GCCFLAGS= |
| 66 | fi |
| 67 | AC_SUBST(GCCFLAGS) |
| 68 | |
H. Peter Anvin | 620515a | 2002-04-30 20:57:38 +0000 | [diff] [blame] | 69 | dnl Look for "nroff" or "groff" |
H. Peter Anvin | ef7468f | 2002-04-30 20:57:59 +0000 | [diff] [blame] | 70 | AC_CHECK_PROGS(NROFF, nroff, echo) |
H. Peter Anvin | 620515a | 2002-04-30 20:57:38 +0000 | [diff] [blame] | 71 | AC_SUBST(NROFF) |
| 72 | |
H. Peter Anvin | 87bc619 | 2002-04-30 20:53:16 +0000 | [diff] [blame] | 73 | dnl Checks for header files. |
| 74 | AC_HEADER_STDC |
| 75 | if test $ac_cv_header_stdc = no; then |
| 76 | AC_MSG_ERROR([NASM requires ANSI C header files to compile]) |
| 77 | fi |
| 78 | |
| 79 | AC_CHECK_HEADERS(limits.h) |
| 80 | if test $ac_cv_header_limits_h = no; then |
| 81 | AC_MSG_ERROR([NASM requires '<limits.h>' to compile]) |
| 82 | fi |
| 83 | |
| 84 | dnl Checks for typedefs, structures, and compiler characteristics. |
| 85 | AC_C_CONST |
| 86 | if test $ac_cv_c_const = no; then |
| 87 | AC_MSG_ERROR([NASM requires ANSI C (specifically, working "const")]) |
| 88 | fi |
| 89 | |
| 90 | AC_TYPE_SIZE_T |
| 91 | if test $ac_cv_type_size_t = no; then |
| 92 | AC_MSG_ERROR([NASM requires ANSI C (specifically, "size_t")]) |
| 93 | fi |
| 94 | |
| 95 | dnl Checks for library functions. |
| 96 | AC_FUNC_VPRINTF |
| 97 | if test $ac_cv_func_vprintf = no; then |
| 98 | AC_MSG_ERROR([NASM requires ANSI C (specifically, "vprintf" and friends)]) |
| 99 | fi |
| 100 | |
| 101 | AC_CHECK_FUNCS(strcspn) |
| 102 | if test $ac_cv_func_strcspn = no; then |
| 103 | AC_MSG_ERROR([NASM requires ANSI C (specifically, "strcspn")]) |
| 104 | fi |
| 105 | |
| 106 | AC_CHECK_FUNCS(strspn) |
| 107 | if test $ac_cv_func_strspn = no; then |
| 108 | AC_MSG_ERROR([NASM requires ANSI C (specifically, "strspn")]) |
| 109 | fi |
| 110 | |
Ed Beroset | a5d2945 | 2004-12-15 23:02:20 +0000 | [diff] [blame^] | 111 | AC_CHECK_FUNCS(snprintf) |
| 112 | if test $ac_cv_func_snprintf = no; then |
| 113 | AC_MSG_ERROR([NASM requires ISO C99 (specifically, "snprintf")]) |
| 114 | fi |
| 115 | |
| 116 | AC_CHECK_FUNCS(vsnprintf) |
| 117 | if test $ac_cv_func_snprintf = no; then |
| 118 | AC_MSG_ERROR([NASM requires ISO C99 (specifically, "vsnprintf")]) |
| 119 | fi |
| 120 | |
H. Peter Anvin | 87bc619 | 2002-04-30 20:53:16 +0000 | [diff] [blame] | 121 | if test $ac_cv_prog_make_vpathok = no; then |
| 122 | echo Copying generated srcs into build directory to compensate for VPATH breakage |
H. Peter Anvin | 1170eb6 | 2002-05-19 02:26:38 +0000 | [diff] [blame] | 123 | 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 Anvin | 87bc619 | 2002-04-30 20:53:16 +0000 | [diff] [blame] | 126 | fi |
| 127 | |
H. Peter Anvin | 4b563af | 2002-05-04 00:15:02 +0000 | [diff] [blame] | 128 | AC_OUTPUT_COMMANDS([mkdir -p output]) |
H. Peter Anvin | 0fcdade | 2002-05-19 01:57:54 +0000 | [diff] [blame] | 129 | AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile) |