aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/obm/Tcl/configure.in
blob: f1fa256c2fdb80b3a2e547c1f4c20d7fba6c9b63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run during Tcl installation
dnl	to configure the system for the local environment.
AC_INIT(tcl.h)
AC_PROG_INSTALL
AC_PROG_RANLIB
CC=${CC-cc}
AC_SUBST(CC)

#--------------------------------------------------------------------
#	Supply substitutes for missing POSIX library procedures, or
#	set flags so Tcl uses alternate procedures.
#--------------------------------------------------------------------

AC_REPLACE_FUNCS(getcwd opendir strerror strstr)
AC_REPLACE_FUNCS(strtol tmpnam waitpid)
AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))

#--------------------------------------------------------------------
#	Supply substitutes for missing POSIX header files.  Special
#	notes:
#	    - Sprite's dirent.h exists but is bogus.
#	    - stdlib.h doesn't define strtol, strtoul, or
#	      strtod insome versions of SunOS
#	    - some versions of string.h don't declare procedures such
#	      as strstr
#--------------------------------------------------------------------

AC_UNISTD_H
AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
#include <dirent.h>], [
DIR *d;
struct dirent *entryPtr;
char *p;
d = opendir("foobar");
entryPtr = readdir(d);
p = entryPtr->d_name;
closedir(d);
], tcl_ok=1, tcl_ok=0)
AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0)
if test $tcl_ok = 0; then
    AC_DEFINE(NO_DIRENT_H)
fi
AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
if test $tcl_ok = 0; then
    AC_DEFINE(NO_STDLIB_H)
fi
AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
if test $tcl_ok = 0; then
    AC_DEFINE(NO_STRING_H)
fi
AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))

#--------------------------------------------------------------------
#	On some systems strstr is broken: it returns a pointer even
#	even if the original string is empty.
#--------------------------------------------------------------------

AC_TEST_PROGRAM([
extern int strstr();
int main()
{
    exit(strstr("\0test", "test") ? 1 : 0);
}
],  , [LIBOBJS="$LIBOBJS strstr.o"])

#--------------------------------------------------------------------
#	Check for strtoul function.  This is tricky because under some
#	versions of AIX strtoul returns an incorrect terminator
#	pointer for the string "0".
#--------------------------------------------------------------------

AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0)
AC_TEST_PROGRAM([
extern int strtoul();
int main()
{
    char *string = "0";
    char *term;
    int value;
    value = strtoul(string, &term, 0);
    if ((value != 0) || (term != (string+1))) {
        exit(1);
    }
    exit(0);
}], , tcl_ok=0)
if test $tcl_ok = 0; then
    LIBOBJS="$LIBOBJS strtoul.o"
fi

#--------------------------------------------------------------------
#	Check for the strtod function.  This is tricky because under
#	some versions of Linux it mis-parses the string "+".
#--------------------------------------------------------------------

AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0)
AC_TEST_PROGRAM([
extern double strtod();
int main()
{
    char *string = "+";
    char *term;
    double value;
    value = strtod(string, &term);
    if (term != string) {
	exit(1);
    }
    exit(0);
}], , tcl_ok=0)
if test $tcl_ok = 0; then
    LIBOBJS="$LIBOBJS strtod.o"
fi

#--------------------------------------------------------------------
#	Check for various typedefs and provide substitutes if
#	they don't exist.
#--------------------------------------------------------------------

AC_MODE_T
AC_PID_T
AC_SIZE_T
AC_UID_T

#--------------------------------------------------------------------
#	If a system doesn't have an opendir function (man, that's old!)
#	then we have to supply a different version of dirent.h which
#	is compatible with the substitute version of opendir that's
#	provided.  This version only works with V7-style directories.
#--------------------------------------------------------------------

AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))

#--------------------------------------------------------------------
#	Check for the existence of sys_errlist (this is only needed if
#	there's no strerror, but I don't know how to conditionalize the
#	check).
#--------------------------------------------------------------------

AC_COMPILE_CHECK(sys_errlist, , [
extern char *sys_errlist[];
extern int sys_nerr;
sys_errlist[sys_nerr-1][0] = 0;
], , AC_DEFINE(NO_SYS_ERRLIST))

#--------------------------------------------------------------------
#	The check below checks whether <sys/wait.h> defines the type
#	"union wait" correctly.  It's needed because of weirdness in
#	HP-UX where "union wait" is defined in both the BSD and SYS-V
#	environments.  Checking the usability of WIFEXITED seems to do
#	the trick.
#--------------------------------------------------------------------

AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
#include <sys/wait.h>], [
union wait x;
WIFEXITED(x);		/* Generates compiler error if WIFEXITED
			 * uses an int. */
], , AC_DEFINE(NO_UNION_WAIT))

#--------------------------------------------------------------------
#	Check to see whether the system supports the matherr function
#	and its associated type "struct exception".
#--------------------------------------------------------------------

AC_COMPILE_CHECK([matherr support], [#include <math.h>], [
struct exception x;
x.type = DOMAIN;
x.type = SING;
], [LIBOBJS="$LIBOBJS tclMtherr.o"; AC_DEFINE(NEED_MATHERR)])

AC_OUTPUT(Makefile)