OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [readline/] [examples/] [rlfe/] [configure.in] - Blame information for rev 841

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
dnl Process this file with autoconf to produce a configure script.
2
 
3
m4_include([../../../config/override.m4])
4
 
5
AC_INIT(rlfe.c)
6
AC_CONFIG_HEADER(config.h)
7
VERSION=0.4
8
AC_SUBST(VERSION)
9
 
10
dnl
11
dnl Define some useful macros
12
dnl
13
AC_DEFUN([AC_PROGRAM_SOURCE],
14
[AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <
15
#include "confdefs.h"
16
[$1]
17
_CUT_HERE_
18
[$2]
19
EOF
20
eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out"
21
. ./conftest.out
22
rm -f conftest*
23
])dnl
24
dnl
25
define(AC_NOTE,
26
[echo "$1" 1>&AC_FD_MSG
27
])dnl
28
 
29
old_CFLAGS="$CFLAGS"
30
AC_PROG_CC
31
AC_PROG_CPP
32
AC_PROG_GCC_TRADITIONAL
33
AC_ISC_POSIX
34
 
35
AC_TRY_RUN(main(){exit(0);},,[
36
if test $CC != cc ; then
37
AC_NOTE(Your $CC failed - restarting with CC=cc)
38
AC_NOTE()
39
CC=cc
40
export CC
41
exec $0 $configure_args
42
fi
43
])
44
 
45
AC_TRY_RUN(main(){exit(0);},,
46
exec 5>&2
47
eval $ac_link
48
AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
49
AC_NOTE($ac_compile)
50
AC_MSG_ERROR(Can't run the compiler - sorry))
51
 
52
AC_TRY_RUN([
53
main()
54
{
55
  int __something_strange_();
56
  __something_strange_(0);
57
}
58
],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
59
 
60
AC_PROG_AWK
61
 
62
if test -f etc/toolcheck; then
63
AC_CHECKING(for buggy tools)
64
sh etc/toolcheck 1>&AC_FD_MSG
65
fi
66
 
67
dnl
68
dnl    ****  special unix variants  ****
69
dnl
70
 
71
AC_CHECKING(for System V)
72
AC_TRY_COMPILE(
73
[#include 
74
#include 
75
#include ], [int x = SIGCHLD | FNDELAY;], , AC_DEFINE(SYSV))
76
 
77
AC_CHECKING(for Solaris 2.x)
78
AC_EGREP_CPP(yes,
79
[#if defined(SVR4) && defined(sun)
80
  yes
81
#endif
82
], LIBS="$LIBS -lsocket -lnsl -lkstat")
83
 
84
dnl
85
dnl    ****  select()  ****
86
dnl
87
 
88
AC_CHECKING(select)
89
AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
90
LIBS="$LIBS -lnet -lnsl"
91
AC_CHECKING(select with $LIBS)
92
AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],,
93
AC_MSG_ERROR(!!! no select - no screen))
94
)
95
dnl
96
dnl    ****  check the select implementation ****
97
dnl
98
 
99
AC_CHECKING(select return value)
100
AC_TRY_RUN([
101
#include 
102
#include 
103
#include 
104
 
105
char *nam = "/tmp/conftest$$";
106
 
107
#ifdef NAMEDPIPE
108
 
109
#ifndef O_NONBLOCK
110
#define O_NONBLOCK O_NDELAY
111
#endif
112
#ifndef S_IFIFO
113
#define S_IFIFO 0010000
114
#endif
115
 
116
 
117
main()
118
{
119
#ifdef FD_SET
120
  fd_set f;
121
#else
122
  int f;
123
#endif
124
 
125
#ifdef __FreeBSD__
126
/* From Andrew A. Chernov (ache@astral.msk.su):
127
 * opening RDWR fifo fails in BSD 4.4, but select return values are
128
 * right.
129
 */
130
  exit(0);
131
#endif
132
  (void)alarm(5);
133
#ifdef POSIX
134
  if (mkfifo(nam, 0777))
135
#else
136
  if (mknod(nam, S_IFIFO|0777, 0))
137
#endif
138
    exit(1);
139
  close(0);
140
  if (open(nam, O_RDWR | O_NONBLOCK))
141
    exit(1);
142
  if (write(0, "TEST", 4) == -1)
143
    exit(1);
144
 
145
#else
146
 
147
#include 
148
#include 
149
#include 
150
 
151
main()
152
{
153
  int s1, s2, l;
154
  struct sockaddr_un a;
155
#ifdef FD_SET
156
  fd_set f;
157
#else
158
  int f;
159
#endif
160
 
161
  (void)alarm(5);
162
  if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
163
    exit(1);
164
  a.sun_family = AF_UNIX;
165
  strcpy(a.sun_path, nam);
166
  (void) unlink(nam);
167
  if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
168
    exit(1);
169
  if (listen(s1, 2))
170
    exit(1);
171
  if (fork() == 0)
172
    {
173
      if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
174
        kill(getppid(), 3);
175
      (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
176
      if (write(s2, "HELLO", 5) == -1)
177
        kill(getppid(), 3);
178
      exit(0);
179
    }
180
  l = sizeof(a);
181
  close(0);
182
  if (accept(s1, (struct sockaddr *)&a, &l))
183
    exit(1);
184
#endif
185
 
186
 
187
#ifdef FD_SET
188
  FD_SET(0, &f);
189
#else
190
  f = 1;
191
#endif
192
  if (select(1, &f, 0, 0, 0) == -1)
193
    exit(1);
194
  if (select(1, &f, &f, 0, 0) != 2)
195
    exit(1);
196
  exit(0);
197
}
198
],AC_NOTE(- select is ok),
199
AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
200
 
201
dnl
202
dnl    ****  termcap or terminfo  ****
203
dnl
204
AC_CHECKING(for tgetent)
205
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
206
olibs="$LIBS"
207
LIBS="-lcurses $olibs"
208
AC_CHECKING(libcurses)
209
AC_TRY_LINK(,[
210
#ifdef __hpux
211
__sorry_hpux_libcurses_is_totally_broken_in_10_10();
212
#else
213
tgetent((char *)0, (char *)0);
214
#endif
215
],,
216
LIBS="-ltermcap $olibs"
217
AC_CHECKING(libtermcap)
218
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
219
LIBS="-ltermlib $olibs"
220
AC_CHECKING(libtermlib)
221
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
222
LIBS="-lncurses $olibs"
223
AC_CHECKING(libncurses)
224
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
225
AC_MSG_ERROR(!!! no tgetent - no screen))))))
226
 
227
AC_TRY_RUN([
228
main()
229
{
230
 exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
231
}], AC_NOTE(- you use the termcap database),
232
AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
233
AC_CHECKING(ospeed)
234
AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
235
 
236
dnl
237
dnl    ****  PTY specific things  ****
238
dnl
239
AC_CHECKING(for /dev/ptc)
240
if test -r /dev/ptc; then
241
AC_DEFINE(HAVE_DEV_PTC)
242
fi
243
 
244
AC_CHECKING(for SVR4 ptys)
245
sysvr4ptys=
246
if test -c /dev/ptmx ; then
247
AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
248
sysvr4ptys=1])
249
fi
250
 
251
AC_CHECK_FUNCS(getpt)
252
 
253
dnl check for openpty()
254
if test -z "$sysvr4ptys"; then
255
AC_CHECK_FUNCS(openpty,,
256
[AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])])
257
fi
258
 
259
AC_CHECKING(for ptyranges)
260
if test -d /dev/ptym ; then
261
pdir='/dev/ptym'
262
else
263
pdir='/dev'
264
fi
265
dnl SCO uses ptyp%d
266
AC_EGREP_CPP(yes,
267
[#ifdef M_UNIX
268
   yes;
269
#endif
270
], ptys=`echo /dev/ptyp??`, ptys=`echo $pdir/pty??`)
271
dnl if test -c /dev/ptyp19; then
272
dnl ptys=`echo /dev/ptyp??`
273
dnl else
274
dnl ptys=`echo $pdir/pty??`
275
dnl fi
276
if test "$ptys" != "$pdir/pty??" ; then
277
p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
278
p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g'  | sort -u | tr -d '\012'`
279
AC_DEFINE_UNQUOTED(PTYRANGE0,"$p0")
280
AC_DEFINE_UNQUOTED(PTYRANGE1,"$p1")
281
fi
282
 
283
dnl    ****  pty mode/group handling ****
284
dnl
285
dnl support provided by Luke Mewburn , 931222
286
AC_ARG_WITH(pty-mode, [  --with-pty-mode=mode    default mode for ptys], [ ptymode="${withval}" ])
287
AC_ARG_WITH(pty-group, [  --with-pty-group=group  default group for ptys], [ ptygrp="${withval}" ])
288
test -n "$ptymode" || ptymode=0620
289
if test -n "$ptygrp" ; then
290
AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
291
AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
292
else
293
 
294
AC_CHECKING(default tty permissions/group)
295
rm -f conftest_grp
296
AC_TRY_RUN([
297
#include 
298
#include 
299
#include 
300
main()
301
{
302
  struct stat sb;
303
  char *x,*ttyname();
304
  int om, m;
305
  FILE *fp;
306
 
307
  if (!(x = ttyname(0))) exit(1);
308
  if (stat(x, &sb)) exit(1);
309
  om = sb.st_mode;
310
  if (om & 002) exit(0);
311
  m = system("mesg y");
312
  if (m == -1 || m == 127) exit(1);
313
  if (stat(x, &sb)) exit(1);
314
  m = sb.st_mode;
315
  if (chmod(x, om)) exit(1);
316
  if (m & 002) exit(0);
317
  if (sb.st_gid == getgid()) exit(1);
318
  if (!(fp=fopen("conftest_grp", "w")))
319
    exit(1);
320
  fprintf(fp, "%d\n", sb.st_gid);
321
  fclose(fp);
322
  exit(0);
323
}
324
],[
325
    if test -f conftest_grp; then
326
        ptygrp=`cat conftest_grp`
327
        AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
328
        AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
329
        AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
330
    else
331
        AC_NOTE(- ptys are world accessable)
332
    fi
333
],[
334
    WRITEPATH=''
335
    XTERMPATH=''
336
    AC_PATH_PROG(WRITEPATH, write)
337
    AC_PATH_PROG(XTERMPATH, xterm)
338
    found=
339
    if test -n "$WRITEPATH$XTERMPATH"; then
340
      findfollow=
341
      lsfollow=
342
      found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null`
343
      if test -n "$found"; then
344
        findfollow=-follow
345
        lsfollow=L
346
      fi
347
      if test -n "$XTERMPATH"; then
348
        ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'`
349
        if test tty != "$ptygrpn"; then
350
          XTERMPATH=
351
        fi
352
      fi
353
    fi
354
    if test -n "$WRITEPATH$XTERMPATH"; then
355
      found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print`
356
      if test -n "$found"; then
357
        ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'`
358
        AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
359
        AC_DEFINE_UNQUOTED(PTYMODE, $ptymode)
360
        AC_DEFINE_UNQUOTED(PTYGROUP,$ptygrp)
361
      else
362
        AC_NOTE(- ptys are world accessable)
363
      fi
364
    else
365
      AC_NOTE(- can't determine - assume ptys are world accessable)
366
    fi
367
  ]
368
)
369
rm -f conftest_grp
370
fi
371
 
372
dnl
373
dnl    ****  signal handling  ****
374
dnl
375
if test -n "$posix" ; then
376
 
377
dnl POSIX has reliable signals with void return type.
378
AC_NOTE(assuming posix signal definition)
379
AC_DEFINE(SIGVOID)
380
 
381
else
382
 
383
AC_CHECKING(return type of signal handlers)
384
AC_TRY_COMPILE(
385
[#include 
386
#include 
387
#ifdef signal
388
#undef signal
389
#endif
390
extern void (*signal ()) ();], [int i;], AC_DEFINE(SIGVOID))
391
AC_CHECKING(sigset)
392
AC_TRY_LINK([
393
#include 
394
#include 
395
],[
396
#ifdef SIGVOID
397
sigset(0, (void (*)())0);
398
#else
399
sigset(0, (int (*)())0);
400
#endif
401
], AC_DEFINE(USESIGSET))
402
AC_CHECKING(signal implementation)
403
AC_TRY_RUN([
404
#include 
405
#include 
406
 
407
#ifndef SIGCLD
408
#define SIGCLD SIGCHLD
409
#endif
410
#ifdef USESIGSET
411
#define signal sigset
412
#endif
413
 
414
int got;
415
 
416
#ifdef SIGVOID
417
void
418
#endif
419
hand()
420
{
421
  got++;
422
}
423
 
424
main()
425
{
426
  /* on hpux we use sigvec to get bsd signals */
427
#ifdef __hpux
428
  (void)signal(SIGCLD, hand);
429
  kill(getpid(), SIGCLD);
430
  kill(getpid(), SIGCLD);
431
  if (got < 2)
432
    exit(1);
433
#endif
434
  exit(0);
435
}
436
],,AC_DEFINE(SYSVSIGS))
437
 
438
fi
439
 
440
AC_OUTPUT(Makefile)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.