996
|
1 dnl -*- autoconf -*-
|
|
2 dnl Process this file with autoconf to produce a configure script.
|
|
3
|
|
4 dnl Yes, that is a valid email address. If your mailer doesn't support nested
|
|
5 dnl comments, then get a better mailer.
|
|
6 AC_INIT([C-INTERCAL],[0.29],[[ais523(524\)x\((525)y)@bham.ac.uk]],[ick])
|
|
7 AC_CONFIG_SRCDIR([src/abcess.h])
|
|
8 AC_CONFIG_HEADER([config.h:src/configh.in])
|
|
9 AC_CONFIG_AUX_DIR([buildaux])
|
|
10 AM_INIT_AUTOMAKE([foreign dist-bzip2 dist-lzma tar-pax check-news
|
|
11 no-texinfo.tex])
|
|
12
|
|
13 dnl Information about this version of INTERCAL.
|
|
14 PACKAGE_VERSION=0.29
|
|
15
|
|
16 dnl Checks for programs.
|
|
17 AC_PROG_YACC
|
|
18 AC_PROG_CC
|
|
19 AM_PROG_LEX
|
|
20 AC_PROG_RANLIB
|
|
21 AC_PROG_LN_S
|
|
22 AC_CHECK_TOOL([AR],[ar])
|
|
23 AC_SUBST(AR)
|
|
24
|
|
25 dnl Checks for libraries.
|
|
26
|
|
27 dnl Checks for header files.
|
|
28 AC_HEADER_STDC
|
|
29 AC_CHECK_HEADERS([sys/time.h unistd.h stdarg.h])
|
|
30 AC_CHECK_HEADERS([stdint.h],[HAVE_STDINT_H=1])
|
|
31 AC_SUBST(HAVE_STDINT_H)
|
|
32
|
|
33 dnl Checks for typedefs, structures, and compiler characteristics.
|
|
34 dnl This Autoconf input is compatible with pre-C99 Autoconf, so to
|
|
35 dnl check for long long AC_CHECK_SIZEOF is used to test for a nonzero result,
|
|
36 dnl likewise for _Bool.
|
|
37 AC_C_CONST
|
|
38 AC_C_VOLATILE
|
|
39 AC_CHECK_SIZEOF([long long int],[0])
|
|
40 AC_CHECK_SIZEOF([_Bool],[0])
|
|
41 AC_CHECK_SIZEOF([sig_atomic_t],[0],[[#include <signal.h>]])
|
|
42 AC_HEADER_TIME
|
|
43 AC_EXEEXT
|
|
44 AC_OBJEXT
|
|
45 AC_SYS_INTERPRETER
|
|
46 AC_TYPE_SIGNAL
|
|
47 AC_TYPE_SIZE_T
|
|
48 AC_TYPE_UINT16_T
|
|
49 AC_TYPE_UINT32_T
|
|
50
|
|
51 AC_MSG_CHECKING([[whether yyrestart() is needed]])
|
|
52 # Write a lex program that will cause an error if yyrestart exists.
|
|
53 echo '%%
|
|
54 %%
|
|
55 float yyrestart(int, ...);' | $LEX
|
|
56 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "${LEX_OUTPUT_ROOT}.c"
|
|
57 ]], [[exit(0);]])],[AC_MSG_RESULT(no)],[AC_DEFINE([NEED_YYRESTART],dnl
|
|
58 [],[Define if yyrestart() is necessary to yyparse a new file.])
|
|
59 AC_MSG_RESULT(yes)])
|
|
60 rm -f ${LEX_OUTPUT_ROOT}.c
|
|
61
|
|
62 if test "$interpval" != "no"; then
|
|
63 AC_DEFINE([HAVE_SYS_INTERPRETER], [], [Define if #! works on your system.])
|
|
64 fi
|
|
65 AC_DEFINE_UNQUOTED([EXEEXT],"$EXEEXT",[Extension to use on executable files.])
|
|
66
|
|
67 dnl Checks for library functions.
|
|
68 AC_CHECK_FUNCS(gettimeofday gethrtime strdup strtol strtoul snprintf vsnprintf)
|
|
69 ICK_SAVECFLAGS=$CFLAGS
|
|
70 CFLAGS="$CFLAGS -lrt"
|
|
71 AC_CHECK_FUNCS(clock_gettime)
|
|
72 CFLAGS=$ICK_SAVECFLAGS
|
|
73
|
|
74 dnl Substitutions.
|
|
75 INCLUDE_HIDDEN_FROM_AUTOMAKE="include"
|
|
76 AC_SUBST(PACKAGE_VERSION)
|
|
77 AC_SUBST(INCLUDE_HIDDEN_FROM_AUTOMAKE)
|
|
78
|
|
79 AC_CONFIG_FILES([Makefile:buildaux/Makefile.in coopt.sh:src/cooptsh.in host.mak:buildaux/hostmak.in])
|
|
80 AC_OUTPUT
|
|
81 # After the output, chmod coopt.sh to be executable.
|
|
82 chmod a+x coopt.sh
|
|
83
|
|
84 # Use prebuilt files if necessary, after config.h is generated.
|
|
85 # Automake is capable of handling the files in question, but they need to
|
|
86 # be in the directory configure was run in.
|
|
87 if test ! -n "$LEX"; then
|
|
88 cp $srcdir/prebuilt/lexer.c $ac_pwd/lexer.c
|
|
89 AC_MSG_WARN([No version of lex was found; using prebuilt lexer.])
|
|
90 AC_MSG_WARN([Changes to src/lexer.l will be ignored.])
|
|
91 fi
|
|
92 if test ! -n "$YACC"; then
|
|
93 cp $srcdir/prebuilt/parser.c $ac_pwd/parser.c
|
|
94 cp $srcdir/prebuilt/parser.h $ac_pwd/parser.h
|
|
95 cp $srcdir/prebuilt/oil-oil.c $ac_pwd/oil-oil.c
|
|
96 AC_MSG_WARN([No version of yacc was found; using prebuilt parser.])
|
|
97 AC_MSG_WARN([Changes to src/parser.y and src/oil.y will be ingored.])
|
|
98 fi
|
|
99
|
|
100 # Configure again, for the build system, if necessary.
|
|
101 # It's simpler the second time round as we don't care about things like
|
|
102 # installation dirs, just about how to do things like run the compiler.
|
|
103 if test "$cross_compiling" != yes; then
|
|
104 cp config.h bconfig.h
|
|
105 exit 0
|
|
106 fi
|
|
107
|
|
108 cd $ac_pwd;
|
|
109
|
|
110 # This trick for unsetting variables comes from the autoconf manual
|
|
111
|
|
112 # "|| exit" suppresses any "Segmentation fault" message.
|
|
113 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
|
|
114 unset=unset
|
|
115 else
|
|
116 unset=false
|
|
117 fi
|
|
118
|
|
119 AC_DEFUN([GEN_BUILD_CMD_LINE],[
|
|
120 BUILD_$1_ARG="FOO=BAR"
|
|
121 if test ! "x$[]$1_FOR_BUILD" == x;
|
|
122 then
|
|
123 BUILD_$1_ARG="$1=$[]$1_FOR_BUILD";
|
|
124 fi
|
|
125 $1=foo
|
|
126 $unset $1 || $1=''])
|
|
127
|
|
128 GEN_BUILD_CMD_LINE(CC)
|
|
129 GEN_BUILD_CMD_LINE(CFLAGS)
|
|
130 GEN_BUILD_CMD_LINE(LDFLAGS)
|
|
131 GEN_BUILD_CMD_LINE(LIBS)
|
|
132 GEN_BUILD_CMD_LINE(CPPFLAGS)
|
|
133 GEN_BUILD_CMD_LINE(CPP)
|
|
134
|
|
135 BUILD_MACHINE_ARG="FOO=BAR"
|
|
136 if test ! "x$build_alias" == x;
|
|
137 then
|
|
138 BUILD_MACHINE_ARG="--build=$build_alias"
|
|
139 fi
|
|
140
|
|
141 # Run the new configure script.
|
|
142 mv config.status config.status.save
|
|
143 (env -i "PATH=$PATH" $srcdir/buildaux/buildconfig "$BUILD_MACHINE_ARG" "$BUILD_CC_ARG" "$BUILD_CFLAGS_ARG" "$BUILD_LDFLAGS_ARG" "$BUILD_LIBS_ARG" "$BUILD_CPPFLAGS_ARG" "$BUILD_CPP_ARG")
|
|
144 mv config.status config.status.build
|
|
145 mv config.status.save config.status
|
|
146
|