Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 869371
Collapse All | Expand All

(-)screen-4.9.0/configure.ac (-84 / +197 lines)
Lines 157-166 if test -n "$ULTRIX"; then Link Here
157
fi
157
fi
158
AC_CHECKING(for POSIX.1)
158
AC_CHECKING(for POSIX.1)
159
AC_EGREP_CPP(YES_IS_DEFINED,
159
AC_EGREP_CPP(YES_IS_DEFINED,
160
[#include <sys/types.h>
160
[#include <sys/types.h>
161
#include <unistd.h>
161
#include <unistd.h>
162
int
162
main () {
163
main () {
163
#ifdef _POSIX_VERSION
164
#ifdef _POSIX_VERSION
164
  YES_IS_DEFINED;
165
  YES_IS_DEFINED;
165
#endif
166
#endif
166
], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
167
], AC_NOTE(- you have a POSIX system) AC_DEFINE(POSIX) posix=1)
Lines 231-240 dnl Link Here
231
232
232
AC_CHECKING(BSD job jontrol)
233
AC_CHECKING(BSD job jontrol)
233
AC_TRY_LINK(
234
AC_TRY_LINK(
234
[#include <sys/types.h>
235
[#include <sys/types.h>
235
#include <sys/ioctl.h>
236
#include <sys/ioctl.h>
237
#include <unistd.h>
236
], [
238
], [
237
#ifdef POSIX
239
#ifdef POSIX
238
tcsetpgrp(0, 0);
240
tcsetpgrp(0, 0);
239
#else
241
#else
240
int x = TIOCSPGRP;
242
int x = TIOCSPGRP;
Lines 248-295 int y = TIOCNOTTY; Link Here
248
250
249
dnl
251
dnl
250
dnl    ****  setresuid(), setreuid(), seteuid()  ****
252
dnl    ****  setresuid(), setreuid(), seteuid()  ****
251
dnl
253
dnl
252
AC_CHECKING(setresuid)
254
AC_CHECKING(setresuid)
253
AC_TRY_LINK(,[
255
AC_TRY_LINK(
256
[#include <unistd.h>
257
], [
254
setresuid(0, 0, 0);
258
setresuid(0, 0, 0);
255
], AC_DEFINE(HAVE_SETRESUID))
259
], AC_DEFINE(HAVE_SETRESUID))
256
AC_CHECKING(setreuid)
260
AC_CHECKING(setreuid)
257
AC_TRY_LINK(,[
261
AC_TRY_LINK(
262
[#include <unistd.h>
263
], [
258
setreuid(0, 0);
264
setreuid(0, 0);
259
], AC_DEFINE(HAVE_SETREUID))
265
], AC_DEFINE(HAVE_SETREUID))
260
dnl
266
dnl
261
dnl seteuid() check:
267
dnl seteuid() check:
262
dnl   linux seteuid was broken before V1.1.11
268
dnl   linux seteuid was broken before V1.1.11
263
dnl   NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
269
dnl   NeXT, AUX, ISC, and ultrix are still broken (no saved uid support)
264
dnl   Solaris seteuid doesn't change the saved uid, bad for
270
dnl   Solaris seteuid doesn't change the saved uid, bad for
265
dnl     multiuser screen sessions
271
dnl     multiuser screen sessions
266
AC_CHECKING(seteuid)
272
AC_CHECKING(seteuid)
267
AC_TRY_LINK(,[
273
AC_TRY_LINK(
274
[#include <unistd.h>
275
],[
268
#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
276
#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
269
seteuid_is_broken(0);
277
int seteuid_is_broken(int); seteuid_is_broken(0);
270
#else
278
#else
271
seteuid(0);
279
seteuid(0);
272
#endif
280
#endif
273
], AC_DEFINE(HAVE_SETEUID))
281
], AC_DEFINE(HAVE_SETEUID))
274
282
275
dnl execvpe
283
dnl execvpe
276
AC_CHECKING(execvpe)
284
AC_CHECKING(execvpe)
277
AC_TRY_LINK(,[
285
AC_TRY_LINK(
286
[#include <unistd.h>
287
],[
278
    execvpe(0, 0, 0);
288
    execvpe(0, 0, 0);
279
], AC_DEFINE(HAVE_EXECVPE)
289
], AC_DEFINE(HAVE_EXECVPE)
280
CFLAGS="$CFLAGS -D_GNU_SOURCE")
290
CFLAGS="$CFLAGS -D_GNU_SOURCE")
281
291
282
dnl
292
dnl
283
dnl    ****  select()  ****
293
dnl    ****  select()  ****
284
dnl
294
dnl
285
295
286
AC_CHECKING(select)
296
AC_CHECKING(select)
287
AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, 
297
AC_TRY_LINK(
298
[#include <sys/select.h>
299
],[
300
    select(0, 0, 0, 0, 0);
301
],, 
288
LIBS="$LIBS -lnet -lnsl"
302
LIBS="$LIBS -lnet -lnsl"
289
AC_CHECKING(select with $LIBS)
303
AC_CHECKING(select with $LIBS)
290
AC_TRY_LINK(,[select(0, 0, 0, 0, 0);],, 
304
AC_TRY_LINK(
305
[#include <sys/select.h>
306
],[
307
    select(0, 0, 0, 0, 0);
308
],, 
291
AC_MSG_ERROR(!!! no select - no screen))
309
AC_MSG_ERROR(!!! no select - no screen))
292
)
310
)
293
dnl
311
dnl
294
dnl    ****  FIFO tests  ****
312
dnl    ****  FIFO tests  ****
295
dnl
313
dnl
Lines 314-324 AC_TRY_RUN([ Link Here
314
#define S_IFIFO 0010000
332
#define S_IFIFO 0010000
315
#endif
333
#endif
316
334
317
char *fin = "/tmp/conftest$$";
335
char *fin = "/tmp/conftest$$";
318
336
319
main()
337
int main()
320
{
338
{
321
  struct stat stb;
339
  struct stat stb;
322
  fd_set f;
340
  fd_set f;
323
341
324
  (void)alarm(5);
342
  (void)alarm(5);
Lines 326-365 main() Link Here
326
#ifdef POSIX
344
#ifdef POSIX
327
  if (mkfifo(fin, 0777))
345
  if (mkfifo(fin, 0777))
328
#else
346
#else
329
  if (mknod(fin, S_IFIFO|0777, 0))
347
  if (mknod(fin, S_IFIFO|0777, 0))
330
#endif
348
#endif
331
    exit(1);
349
    return 1;
332
  if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
350
  if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO)
333
    exit(1);
351
    return 1;
334
  close(0);
352
  close(0);
335
#ifdef __386BSD__
353
#ifdef __386BSD__
336
  /*
354
  /*
337
   * The next test fails under 386BSD, but screen works using fifos.
355
   * The next test fails under 386BSD, but screen works using fifos.
338
   * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
356
   * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for
339
   * the select() configuration test.
357
   * the select() configuration test.
340
   */
358
   */
341
  exit(0);
359
  return 0;
342
#endif
360
#endif
343
  if (open(fin, O_RDONLY | O_NONBLOCK))
361
  if (open(fin, O_RDONLY | O_NONBLOCK))
344
    exit(1);
362
    return 1;
345
  if (fork() == 0)
363
  if (fork() == 0)
346
    {
364
    {
347
      close(0);
365
      close(0);
348
      if (open(fin, O_WRONLY | O_NONBLOCK))
366
      if (open(fin, O_WRONLY | O_NONBLOCK))
349
	exit(1);
367
        return 1;
350
      close(0);
368
      close(0);
351
      if (open(fin, O_WRONLY | O_NONBLOCK))
369
      if (open(fin, O_WRONLY | O_NONBLOCK))
352
	exit(1);
370
        return 1;
353
      if (write(0, "TEST", 4) == -1)
371
      if (write(0, "TEST", 4) == -1)
354
	exit(1);
372
        return 1;
355
      exit(0);
373
      return 0;
356
    }
374
    }
357
  FD_SET(0, &f);
375
  FD_SET(0, &f);
358
  if (select(1, &f, 0, 0, 0) == -1)
376
  if (select(1, &f, 0, 0, 0) == -1)
359
    exit(1);
377
    return 1;
360
  exit(0);
378
  return 0;
361
}
379
}
362
], AC_NOTE(- your fifos are usable) fifo=1,
380
], AC_NOTE(- your fifos are usable) fifo=1,
363
AC_NOTE(- your fifos are not usable),
381
AC_NOTE(- your fifos are not usable),
364
AC_NOTE(- skipping check because we are cross compiling; assuming fifos are usable) fifo=1)
382
AC_NOTE(- skipping check because we are cross compiling; assuming fifos are usable) fifo=1)
365
rm -f /tmp/conftest*
383
rm -f /tmp/conftest*
Lines 385-414 AC_TRY_RUN([ Link Here
385
#define S_IFIFO 0010000
403
#define S_IFIFO 0010000
386
#endif
404
#endif
387
405
388
char *fin = "/tmp/conftest$$";
406
char *fin = "/tmp/conftest$$";
389
407
408
int
390
main()
409
main()
391
{
410
{
392
  struct timeval tv;
411
  struct timeval tv;
393
  fd_set f;
412
  fd_set f;
394
413
395
#ifdef POSIX
414
#ifdef POSIX
396
  if (mkfifo(fin, 0600))
415
  if (mkfifo(fin, 0600))
397
#else
416
#else
398
  if (mknod(fin, S_IFIFO|0600, 0))
417
  if (mknod(fin, S_IFIFO|0600, 0))
399
#endif
418
#endif
400
    exit(1);
419
    return 1;
401
  close(0);
420
  close(0);
402
  if (open(fin, O_RDONLY|O_NONBLOCK))
421
  if (open(fin, O_RDONLY|O_NONBLOCK))
403
    exit(1);
422
    return 1;
404
  FD_SET(0, &f);
423
  FD_SET(0, &f);
405
  tv.tv_sec = 1;
424
  tv.tv_sec = 1;
406
  tv.tv_usec = 0;
425
  tv.tv_usec = 0;
407
  if (select(1, &f, 0, 0, &tv))
426
  if (select(1, &f, 0, 0, &tv))
408
    exit(1);
427
    return 1;
409
  exit(0);
428
  return 0;
410
}
429
}
411
], AC_NOTE(- your implementation is ok), 
430
], AC_NOTE(- your implementation is ok), 
412
AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1,
431
AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1,
413
AC_NOTE(- skipping check because we are cross compiling; assuming fifo implementation is ok))
432
AC_NOTE(- skipping check because we are cross compiling; assuming fifo implementation is ok))
414
rm -f /tmp/conftest*
433
rm -f /tmp/conftest*
Lines 432-477 AC_TRY_RUN([ Link Here
432
455
433
#include <sys/stat.h>
456
#include <sys/stat.h>
434
#include <fcntl.h>
457
#include <fcntl.h>
435
#include <sys/socket.h>
458
#include <sys/socket.h>
436
#include <sys/un.h>
459
#include <sys/un.h>
460
#include <signal.h>
437
461
438
char *son = "/tmp/conftest$$";
462
char *son = "/tmp/conftest$$";
439
463
464
int
440
main()
465
main()
441
{
466
{
442
  int s1, s2, l;
467
  int s1, s2, l;
443
  struct sockaddr_un a;
468
  struct sockaddr_un a;
444
  fd_set f;
469
  fd_set f;
445
470
446
  (void)alarm(5);
471
  (void)alarm(5);
447
  if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
472
  if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
448
    exit(1);
473
    return 1;
449
  a.sun_family = AF_UNIX;
474
  a.sun_family = AF_UNIX;
450
  strcpy(a.sun_path, son);
475
  strcpy(a.sun_path, son);
451
  (void) unlink(son);
476
  (void) unlink(son);
452
  if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
477
  if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1)
453
    exit(1);
478
    return 1;
454
  if (listen(s1, 2))
479
  if (listen(s1, 2))
455
    exit(1);
480
    return 1;
456
  if (fork() == 0)
481
  if (fork() == 0)
457
    {
482
    {
458
      if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
483
      if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
459
	kill(getppid(), 3);
484
	kill(getppid(), 3);
460
      (void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2);
485
      (void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2);
461
      if (write(s2, "HELLO", 5) == -1)
486
      if (write(s2, "HELLO", 5) == -1)
462
	kill(getppid(), 3);
487
	kill(getppid(), 3);
463
      exit(0);
488
      return 0;
464
    }
489
    }
465
  l = sizeof(a);
490
  l = sizeof(a);
466
  close(0);
491
  close(0);
467
  if (accept(s1, &a, &l))
492
  if (accept(s1, &a, &l))
468
    exit(1);
493
    return 1;
469
  FD_SET(0, &f);
494
  FD_SET(0, &f);
470
  if (select(1, &f, 0, 0, 0) == -1)
495
  if (select(1, &f, 0, 0, 0) == -1)
471
    exit(1);
496
    return 1;
472
  exit(0);
497
  return 0;
473
}
498
}
474
], AC_NOTE(- your sockets are usable) sock=1,
499
], AC_NOTE(- your sockets are usable) sock=1,
475
AC_NOTE(- your sockets are not usable),
500
AC_NOTE(- your sockets are not usable),
476
AC_NOTE(- skipping check because we are cross compiling; assuming sockets are usable) sock=1)
501
AC_NOTE(- skipping check because we are cross compiling; assuming sockets are usable) sock=1)
477
rm -f /tmp/conftest*
502
rm -f /tmp/conftest*
Lines 491-516 AC_TRY_RUN([ Link Here
491
#include <sys/socket.h>
516
#include <sys/socket.h>
492
#include <sys/un.h>
517
#include <sys/un.h>
493
518
494
char *son = "/tmp/conftest$$";
519
char *son = "/tmp/conftest$$";
495
520
521
int
496
main()
522
main()
497
{
523
{
498
  int s;
524
  int s;
499
  struct stat stb;
525
  struct stat stb;
500
  struct sockaddr_un a;
526
  struct sockaddr_un a;
501
  if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
527
  if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
502
    exit(0);
528
    return 0;
503
  a.sun_family = AF_UNIX;
529
  a.sun_family = AF_UNIX;
504
  strcpy(a.sun_path, son);
530
  strcpy(a.sun_path, son);
505
  (void) unlink(son);
531
  (void) unlink(son);
506
  if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
532
  if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1)
507
    exit(0);
533
    return 0;
508
  if (stat(son, &stb))
534
  if (stat(son, &stb))
509
    exit(1);
535
    return 1;
510
  close(s);
536
  close(s);
511
  exit(0);
537
  return 0;
512
}
538
}
513
],AC_NOTE(- you are normal),
539
],AC_NOTE(- you are normal),
514
AC_NOTE(- unix domain sockets are not kept in the filesystem)
540
AC_NOTE(- unix domain sockets are not kept in the filesystem)
515
AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1,
541
AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1,
516
AC_NOTE(- skipping check because we are cross compiling; assuming sockets are normal))
542
AC_NOTE(- skipping check because we are cross compiling; assuming sockets are normal))
Lines 545-666 char *nam = "/tmp/conftest$$"; Link Here
545
#endif
571
#endif
546
#ifndef S_IFIFO
572
#ifndef S_IFIFO
547
#define S_IFIFO 0010000
573
#define S_IFIFO 0010000
548
#endif
574
#endif
549
575
576
int
550
main()
577
main()
551
{
578
{
552
  fd_set f;
579
  fd_set f;
553
580
554
#ifdef __FreeBSD__
581
#ifdef __FreeBSD__
555
/* From Andrew A. Chernov (ache@astral.msk.su):
582
/* From Andrew A. Chernov (ache@astral.msk.su):
556
 * opening RDWR fifo fails in BSD 4.4, but select return values are
583
 * opening RDWR fifo fails in BSD 4.4, but select return values are
557
 * right.
584
 * right.
558
 */
585
 */
559
  exit(0);
586
  return 0;
560
#endif
587
#endif
561
  (void)alarm(5);
588
  (void)alarm(5);
562
#ifdef POSIX
589
#ifdef POSIX
563
  if (mkfifo(nam, 0777))
590
  if (mkfifo(nam, 0777))
564
#else
591
#else
565
  if (mknod(nam, S_IFIFO|0777, 0))
592
  if (mknod(nam, S_IFIFO|0777, 0))
566
#endif
593
#endif
567
    exit(1);
594
    return 1;
568
  close(0);
595
  close(0);
569
  if (open(nam, O_RDWR | O_NONBLOCK))
596
  if (open(nam, O_RDWR | O_NONBLOCK))
570
    exit(1);
597
    return 1;
571
  if (write(0, "TEST", 4) == -1)
598
  if (write(0, "TEST", 4) == -1)
572
    exit(1);
599
    return 1;
573
600
574
#else
601
#else
575
602
576
#include <sys/types.h>
603
#include <sys/types.h>
577
#include <sys/socket.h>
604
#include <sys/socket.h>
578
#include <sys/un.h>
605
#include <sys/un.h>
606
#include <signal.h>
579
607
608
int
580
main()
609
main()
581
{
610
{
582
  int s1, s2, l;
611
  int s1, s2, l;
583
  struct sockaddr_un a;
612
  struct sockaddr_un a;
584
  fd_set f;
613
  fd_set f;
585
614
586
  (void)alarm(5);
615
  (void)alarm(5);
587
  if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
616
  if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
588
    exit(1);
617
    return 1;
589
  a.sun_family = AF_UNIX;
618
  a.sun_family = AF_UNIX;
590
  strcpy(a.sun_path, nam);
619
  strcpy(a.sun_path, nam);
591
  (void) unlink(nam);
620
  (void) unlink(nam);
592
  if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
621
  if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1)
593
    exit(1);
622
    return 1;
594
  if (listen(s1, 2))
623
  if (listen(s1, 2))
595
    exit(1);
624
    return 1;
596
  if (fork() == 0)
625
  if (fork() == 0)
597
    {
626
    {
598
      if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
627
      if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
599
	kill(getppid(), 3);
628
	kill(getppid(), 3);
600
      (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
629
      (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2);
601
      if (write(s2, "HELLO", 5) == -1)
630
      if (write(s2, "HELLO", 5) == -1)
602
	kill(getppid(), 3);
631
	kill(getppid(), 3);
603
      exit(0);
632
      return 0;
604
    }
633
    }
605
  l = sizeof(a);
634
  l = sizeof(a);
606
  close(0);
635
  close(0);
607
  if (accept(s1, (struct sockaddr *)&a, &l))
636
  if (accept(s1, (struct sockaddr *)&a, &l))
608
    exit(1);
637
    return 1;
609
#endif
638
#endif
610
639
611
640
612
  FD_SET(0, &f);
641
  FD_SET(0, &f);
613
  if (select(1, &f, 0, 0, 0) == -1)
642
  if (select(1, &f, 0, 0, 0) == -1)
614
    exit(1);
643
    return 1;
615
  if (select(1, &f, &f, 0, 0) != 2)
644
  if (select(1, &f, &f, 0, 0) != 2)
616
    exit(1);
645
    return 1;
617
  exit(0);
646
  return 0;
618
}
647
}
619
],AC_NOTE(- select is ok),
648
],AC_NOTE(- select is ok),
620
AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN),
649
AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN),
621
AC_NOTE(- skipping check because we are cross compiling; assuming select is ok))
650
AC_NOTE(- skipping check because we are cross compiling; assuming select is ok))
622
651
623
dnl
652
dnl
624
dnl    ****  termcap or terminfo  ****
653
dnl    ****  termcap or terminfo  ****
625
dnl
654
dnl
626
AC_CHECKING(for tgetent)
655
AC_CHECKING(for tgetent)
627
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
656
AC_TRY_LINK([
657
    #include <curses.h>
658
    #include <term.h>
659
], [
660
    tgetent((char *)0, (char *)0);
661
],,
628
olibs="$LIBS"
662
olibs="$LIBS"
629
LIBS="-lcurses $olibs"
663
LIBS="-lcurses $olibs"
630
AC_CHECKING(libcurses)
664
AC_CHECKING(libcurses)
631
AC_TRY_LINK(,[
665
AC_TRY_LINK([#include <curses.h>
666
    #include <term.h>
667
],[
632
#ifdef __hpux
668
#ifdef __hpux
633
__sorry_hpux_libcurses_is_totally_broken_in_10_10();
669
__sorry_hpux_libcurses_is_totally_broken_in_10_10();
634
#else
670
#else
635
tgetent((char *)0, (char *)0);
671
tgetent((char *)0, (char *)0);
636
#endif
672
#endif
637
],,
673
],,
638
LIBS="-ltermcap $olibs"
674
LIBS="-ltermcap $olibs"
639
AC_CHECKING(libtermcap)
675
AC_CHECKING(libtermcap)
640
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
676
AC_TRY_LINK(
677
[#include <curses.h>
678
    #include <term.h>
679
],[
680
    tgetent((char *)0, (char *)0);
681
],,
641
LIBS="-ltermlib $olibs"
682
LIBS="-ltermlib $olibs"
642
AC_CHECKING(libtermlib)
683
AC_CHECKING(libtermlib)
643
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
684
AC_TRY_LINK(
685
[#include <curses.h>
686
    #include <term.h>
687
],[
688
    tgetent((char *)0, (char *)0);
689
],,
644
LIBS="-lncursesw $olibs"
690
LIBS="-lncursesw $olibs"
645
AC_CHECKING(libncursesw)
691
AC_CHECKING(libncursesw)
646
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
692
AC_TRY_LINK(
693
[#include <curses.h>
694
    #include <term.h>
695
],[
696
    tgetent((char *)0, (char *)0);
697
],,
647
LIBS="-ltinfow $olibs"
698
LIBS="-ltinfow $olibs"
648
AC_CHECKING(libtinfow)
699
AC_CHECKING(libtinfow)
649
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
700
AC_TRY_LINK(
701
[#include <curses.h>
702
    #include <term.h>
703
],[
704
    tgetent((char *)0, (char *)0);
705
],,
650
LIBS="-lncurses $olibs"
706
LIBS="-lncurses $olibs"
651
AC_CHECKING(libncurses)
707
AC_CHECKING(libncurses)
652
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
708
AC_TRY_LINK(
709
[#include <curses.h>
710
    #include <term.h>
711
],[
712
    tgetent((char *)0, (char *)0);
713
],,
653
LIBS="-ltinfo $olibs"
714
LIBS="-ltinfo $olibs"
654
AC_CHECKING(libtinfo)
715
AC_CHECKING(libtinfo)
655
AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
716
AC_TRY_LINK(
717
[#include <curses.h>
718
    #include <term.h>
719
],[
720
    tgetent((char *)0, (char *)0);
721
],,
656
AC_MSG_ERROR(!!! no tgetent - no screen)))))))))
722
AC_MSG_ERROR(!!! no tgetent - no screen)))))))))
657
723
658
AC_TRY_RUN([
724
AC_TRY_RUN([
725
#include <curses.h>
726
#include <string.h>
727
#include <term.h>
728
729
int
659
main()
730
main()
660
{
731
{
661
 exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
732
 return(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
662
}], AC_NOTE(- you use the termcap database),
733
}], AC_NOTE(- you use the termcap database),
663
AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO),
734
AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO),
664
AC_NOTE(- skipping check because we are cross compiling; assuming terminfo database is used) AC_DEFINE(TERMINFO))
735
AC_NOTE(- skipping check because we are cross compiling; assuming terminfo database is used) AC_DEFINE(TERMINFO))
665
AC_CHECKING(ospeed)
736
AC_CHECKING(ospeed)
666
AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
737
AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
Lines 677-687 fi Link Here
677
748
678
if test "$cross_compiling" = no ; then
749
if test "$cross_compiling" = no ; then
679
AC_CHECKING(for SVR4 ptys)
750
AC_CHECKING(for SVR4 ptys)
680
sysvr4ptys=
751
sysvr4ptys=
681
if test -c /dev/ptmx ; then
752
if test -c /dev/ptmx ; then
682
AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
753
AC_TRY_LINK([
754
    #include <stdlib.h>
755
], [
756
    ptsname(0);grantpt(0);unlockpt(0);
757
],[AC_DEFINE(HAVE_SVR4_PTYS)
683
sysvr4ptys=1])
758
sysvr4ptys=1])
684
fi
759
fi
685
fi
760
fi
686
761
687
AC_CHECK_FUNCS(getpt)
762
AC_CHECK_FUNCS(getpt)
Lines 733-765 AC_CHECKING(default tty permissions/group) Link Here
733
rm -f conftest_grp
808
rm -f conftest_grp
734
AC_TRY_RUN([
809
AC_TRY_RUN([
735
#include <sys/types.h>
810
#include <sys/types.h>
736
#include <sys/stat.h>
811
#include <sys/stat.h>
737
#include <stdio.h>
812
#include <stdio.h>
813
#include <stdlib.h>
814
#include <unistd.h>
815
int
738
main()
816
main()
739
{
817
{
740
  struct stat sb;
818
  struct stat sb;
741
  char *x,*ttyname();
819
  char *x,*ttyname();
742
  int om, m;
820
  int om, m;
743
  FILE *fp;
821
  FILE *fp;
744
822
745
  if (!(x = ttyname(0))) exit(1);
823
  if (!(x = ttyname(0))) return 1;
746
  if (stat(x, &sb)) exit(1);
824
  if (stat(x, &sb)) return 1;
747
  om = sb.st_mode;
825
  om = sb.st_mode;
748
  if (om & 002) exit(0);
826
  if (om & 002) return 0;
749
  m = system("mesg y");
827
  m = system("mesg y");
750
  if (m == -1 || m == 127) exit(1);
828
  if (m == -1 || m == 127) return 1;
751
  if (stat(x, &sb)) exit(1);
829
  if (stat(x, &sb)) return 1;
752
  m = sb.st_mode;
830
  m = sb.st_mode;
753
  if (chmod(x, om)) exit(1);
831
  if (chmod(x, om)) return 1;
754
  if (m & 002) exit(0);
832
  if (m & 002) return 0;
755
  if (sb.st_gid == getgid()) exit(1);
833
  if (sb.st_gid == getgid()) return 1;
756
  if (!(fp=fopen("conftest_grp", "w")))
834
  if (!(fp=fopen("conftest_grp", "w")))
757
    exit(1);
835
    return 1;
758
  fprintf(fp, "%d\n", sb.st_gid);
836
  fprintf(fp, "%d\n", sb.st_gid);
759
  fclose(fp);
837
  fclose(fp);
760
  exit(0);
838
  return 0;
761
}
839
}
762
],[
840
],[
763
    if test -f conftest_grp; then
841
    if test -f conftest_grp; then
764
	ptygrp=`cat conftest_grp`
842
	ptygrp=`cat conftest_grp`
765
	AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
843
	AC_NOTE([- pty mode: $ptymode, group: $ptygrp])
Lines 869-885 AC_CHECKING(for libutil(s)) Link Here
869
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
942
test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
870
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
943
test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
871
fi
944
fi
872
945
873
AC_CHECKING(getloadavg)
946
AC_CHECKING(getloadavg)
874
AC_TRY_LINK(,[getloadavg((double *)0, 0);],
947
AC_TRY_LINK(
948
[
949
    #include <stdlib.h>
950
],[
951
    getloadavg((double *)0, 0);],
875
AC_DEFINE(LOADAV_GETLOADAVG) load=1,
952
AC_DEFINE(LOADAV_GETLOADAVG) load=1,
876
if test "$cross_compiling" = no && test -f /usr/lib/libkvm.a ; then
953
if test "$cross_compiling" = no && test -f /usr/lib/libkvm.a ; then
877
olibs="$LIBS"
954
olibs="$LIBS"
878
LIBS="$LIBS -lkvm"
955
LIBS="$LIBS -lkvm"
879
AC_CHECKING(getloadavg with -lkvm)
956
AC_CHECKING(getloadavg with -lkvm)
880
AC_TRY_LINK(,[getloadavg((double *)0, 0);],
957
AC_TRY_LINK(
958
[
959
    #include <stdlib.h>
960
],[
961
    getloadavg((double *)0, 0);],
881
AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
962
AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
882
fi
963
fi
883
)
964
)
884
965
885
if test -z "$load" ; then
966
if test -z "$load" ; then
Lines 931-940 else Link Here
931
1012
932
$nlist64
1013
$nlist64
933
1014
934
struct nlist nl[2];
1015
struct nlist nl[2];
935
1016
1017
int
936
main()
1018
main()
937
{
1019
{
938
#if !defined(_AUX_SOURCE) && !defined(AUX)
1020
#if !defined(_AUX_SOURCE) && !defined(AUX)
939
# ifdef NLIST_NAME_UNION
1021
# ifdef NLIST_NAME_UNION
940
  nl[0].n_un.n_name = "$av";
1022
  nl[0].n_un.n_name = "$av";
Lines 944-955 main() Link Here
944
#else
1026
#else
945
  strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
1027
  strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name));
946
#endif
1028
#endif
947
  nlist(LOADAV_UNIX, nl);
1029
  nlist(LOADAV_UNIX, nl);
948
  if (nl[0].n_value == 0)
1030
  if (nl[0].n_value == 0)
949
    exit(1);
1031
    return 1;
950
  exit(0);
1032
  return 0;
951
}
1033
}
952
  ],avensym=$av;break)
1034
  ],avensym=$av;break)
953
  if test "$av" = _Loadavg; then
1035
  if test "$av" = _Loadavg; then
954
    nlist64='#define nlist nlist64'
1036
    nlist64='#define nlist nlist64'
955
  fi
1037
  fi
Lines 1068-1088 void Link Here
1068
hand()
1150
hand()
1069
{
1151
{
1070
  got++;
1152
  got++;
1071
}
1153
}
1072
1154
1155
int
1073
main()
1156
main()
1074
{
1157
{
1075
  /* on hpux we use sigvec to get bsd signals */
1158
  /* on hpux we use sigvec to get bsd signals */
1076
#ifdef __hpux
1159
#ifdef __hpux
1077
  (void)signal(SIGCLD, hand);
1160
  (void)signal(SIGCLD, hand);
1078
  kill(getpid(), SIGCLD);
1161
  kill(getpid(), SIGCLD);
1079
  kill(getpid(), SIGCLD);
1162
  kill(getpid(), SIGCLD);
1080
  if (got < 2)
1163
  if (got < 2)
1081
    exit(1);
1164
    return 1;
1082
#endif
1165
#endif
1083
  exit(0);
1166
  return 0;
1084
}
1167
}
1085
],,AC_DEFINE(SYSVSIGS),:)
1168
],,AC_DEFINE(SYSVSIGS),:)
1086
1169
1087
fi
1170
fi
1088
1171
Lines 1107-1120 oldlibs="$LIBS" Link Here
1107
LIBS="$LIBS -lsun"
1190
LIBS="$LIBS -lsun"
1108
AC_CHECKING(IRIX sun library)
1191
AC_CHECKING(IRIX sun library)
1109
AC_TRY_LINK(,,,LIBS="$oldlibs")
1192
AC_TRY_LINK(,,,LIBS="$oldlibs")
1110
1193
1111
AC_CHECKING(syslog)
1194
AC_CHECKING(syslog)
1112
AC_TRY_LINK(,[closelog();], , [oldlibs="$LIBS"
1195
AC_TRY_LINK(
1196
[#include <syslog.h>
1197
], [
1198
    closelog();
1199
], , [oldlibs="$LIBS"
1113
LIBS="$LIBS -lbsd"
1200
LIBS="$LIBS -lbsd"
1114
AC_CHECKING(syslog in libbsd.a)
1201
AC_CHECKING(syslog in libbsd.a)
1115
AC_TRY_LINK(, [closelog();], AC_NOTE(- found.), [LIBS="$oldlibs"
1202
AC_TRY_LINK(
1203
[#include <syslog.h>
1204
], [
1205
    closelog();
1206
], AC_NOTE(- found.), [LIBS="$oldlibs"
1116
AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
1207
AC_NOTE(- bad news: syslog missing.) AC_DEFINE(NOSYSLOG)])])
1117
1208
1118
AC_EGREP_CPP(YES_IS_DEFINED,
1209
AC_EGREP_CPP(YES_IS_DEFINED,
1119
[#ifdef M_UNIX
1210
[#ifdef M_UNIX
1120
   YES_IS_DEFINED;
1211
   YES_IS_DEFINED;
Lines 1147-1212 fi Link Here
1147
dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
1238
dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
1148
AC_CHECKING(getspnam)
1239
AC_CHECKING(getspnam)
1149
AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
1240
AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
1150
1241
1151
AC_CHECKING(getttyent)
1242
AC_CHECKING(getttyent)
1152
AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
1243
AC_TRY_LINK(
1244
[
1245
    #include <ttyent.h>
1246
],[
1247
    getttyent();
1248
], AC_DEFINE(GETTTYENT))
1153
1249
1154
AC_CHECKING(fdwalk)
1250
AC_CHECKING(fdwalk)
1155
AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
1251
AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
1156
1252
1157
AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
1253
AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
1158
AC_TRY_RUN([
1254
AC_TRY_RUN([
1255
#include <string.h>
1256
1257
int
1159
main() {
1258
main() {
1160
  char buf[10];
1259
  char buf[10];
1161
  strcpy(buf, "abcdefghi");
1260
  strcpy(buf, "abcdefghi");
1162
  bcopy(buf, buf + 2, 3);
1261
  bcopy(buf, buf + 2, 3);
1163
  if (strncmp(buf, "ababcf", 6))
1262
  if (strncmp(buf, "ababcf", 6))
1164
    exit(1);
1263
    return 1;
1165
  strcpy(buf, "abcdefghi");
1264
  strcpy(buf, "abcdefghi");
1166
  bcopy(buf + 2, buf, 3);
1265
  bcopy(buf + 2, buf, 3);
1167
  if (strncmp(buf, "cdedef", 6))
1266
  if (strncmp(buf, "cdedef", 6))
1168
    exit(1);
1267
    return 1;
1169
  exit(0); /* libc version works properly.  */
1268
  return 0; /* libc version works properly.  */
1170
}], AC_DEFINE(USEBCOPY),,:)
1269
}], AC_DEFINE(USEBCOPY),,:)
1171
1270
1172
AC_TRY_RUN([
1271
AC_TRY_RUN([
1272
#include <string.h>
1273
1173
#define bcopy(s,d,l) memmove(d,s,l)
1274
#define bcopy(s,d,l) memmove(d,s,l)
1275
int
1174
main() {
1276
main() {
1175
  char buf[10];
1277
  char buf[10];
1176
  strcpy(buf, "abcdefghi");
1278
  strcpy(buf, "abcdefghi");
1177
  bcopy(buf, buf + 2, 3);
1279
  bcopy(buf, buf + 2, 3);
1178
  if (strncmp(buf, "ababcf", 6))
1280
  if (strncmp(buf, "ababcf", 6))
1179
    exit(1);
1281
    return 1;
1180
  strcpy(buf, "abcdefghi");
1282
  strcpy(buf, "abcdefghi");
1181
  bcopy(buf + 2, buf, 3);
1283
  bcopy(buf + 2, buf, 3);
1182
  if (strncmp(buf, "cdedef", 6))
1284
  if (strncmp(buf, "cdedef", 6))
1183
    exit(1);
1285
    return 1;
1184
  exit(0); /* libc version works properly.  */
1286
  return 0; /* libc version works properly.  */
1185
}], AC_DEFINE(USEMEMMOVE),,
1287
}], AC_DEFINE(USEMEMMOVE),,
1186
  AC_NOTE(- skipping check because we are cross compiling; use memmove) AC_DEFINE(USEMEMMOVE))
1288
  AC_NOTE(- skipping check because we are cross compiling; use memmove) AC_DEFINE(USEMEMMOVE))
1187
1289
1188
1290
1189
AC_TRY_RUN([
1291
AC_TRY_RUN([
1292
#include <string.h>
1293
1190
#define bcopy(s,d,l) memcpy(d,s,l)
1294
#define bcopy(s,d,l) memcpy(d,s,l)
1295
int
1191
main() {
1296
main() {
1192
  char buf[10];
1297
  char buf[10];
1193
  strcpy(buf, "abcdefghi");
1298
  strcpy(buf, "abcdefghi");
1194
  bcopy(buf, buf + 2, 3);
1299
  bcopy(buf, buf + 2, 3);
1195
  if (strncmp(buf, "ababcf", 6))
1300
  if (strncmp(buf, "ababcf", 6))
1196
    exit(1);
1301
    return 1;
1197
  strcpy(buf, "abcdefghi");
1302
  strcpy(buf, "abcdefghi");
1198
  bcopy(buf + 2, buf, 3);
1303
  bcopy(buf + 2, buf, 3);
1199
  if (strncmp(buf, "cdedef", 6))
1304
  if (strncmp(buf, "cdedef", 6))
1200
    exit(1);
1305
    return 1;
1201
  exit(0); /* libc version works properly.  */
1306
  return 0; /* libc version works properly.  */
1202
}], AC_DEFINE(USEMEMCPY),,:)
1307
}], AC_DEFINE(USEMEMCPY),,:)
1203
1308
1204
AC_SYS_LONG_FILE_NAMES
1309
AC_SYS_LONG_FILE_NAMES
1205
1310
1206
AC_MSG_CHECKING(for vsprintf)
1311
AC_MSG_CHECKING(for vsprintf)
1207
AC_TRY_LINK([#include <stdarg.h>],[va_list valist; vsprintf(0,0,valist);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
1312
AC_TRY_LINK(
1313
[
1314
    #include <stdarg.h>
1315
    #include <stdio.h>
1316
],
1317
[
1318
    va_list valist; vsprintf(0,0,valist);
1319
], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
1208
1320
1209
AC_HEADER_DIRENT
1321
AC_HEADER_DIRENT
1210
1322
1211
AC_MSG_CHECKING(for setenv)
1323
AC_MSG_CHECKING(for setenv)
1212
if test -z "$ac_setenv_args"; then
1324
if test -z "$ac_setenv_args"; then

Return to bug 869371