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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [readline/] [examples/] [rlfe/] [configure.in] - Blame information for rev 866

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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