File: configure.in

package info (click to toggle)
nwrite 1.9.2-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 164 kB
  • ctags: 99
  • sloc: ansic: 927; sh: 152; makefile: 86
file content (87 lines) | stat: -rw-r--r-- 2,094 bytes parent folder | download | duplicates (4)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nwrite.c)
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(fcntl.h limits.h paths.h sys/file.h sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strchr strdup snprintf)

dnl Check for configurable options
AC_ARG_ENABLE(clear-procs, 
[  --enable-clear-procs    allow users to clear arguents so they are not
                            visible in ps (if your OS allows users to do so)],
AC_DEFINE(CLEAR_PROCS))

AC_ARG_ENABLE(gzipped-man, 
[  --enable-gzipped-man    gzip man pages before installing],
MANGZ="-gz", MANGZ="")
AC_SUBST(MANGZ)

dnl Check who can write to ttys

# Get current mesg status
AC_MSG_CHECKING("current mesg status")
mesg
if test $? = 0 ; then
  restore_mesg="y"
else
  restore_mesg="n"
fi

AC_CACHE_CHECK("if anyone can write to a mesg y tty",
	nwrite_cv_sys_tty_world_writable,
[
echo "Changing to mesg y" 1>&5
mesg y 1>&5
tty_path=`tty`
tty_perms=`ls -lL $tty_path | awk '{print $1}' | sed 's/^........\(.\).$/\1/'`
echo "tty_path=$tty_path tty_perms=$tty_perms" 1>&5
if test "$tty_perms" = "w" ; then
  nwrite_cv_sys_tty_world_writable="yes"
else
  nwrite_cv_sys_tty_world_writable="no"
fi

echo "Restoring original status" 1>&5
mesg $restore_mesg 1>&5
])

if test "$nwrite_cv_sys_tty_world_writable" = "yes" ; then
  INSTALLFLAGS="-m 755"
  AC_DEFINE(TTYS_WORLD_WRITABLE, FALSE)
else
  INSTALLFLAGS="-g tty -m 755"
  AC_DEFINE(TTYS_WORLD_WRITABLE, FALSE)
fi
AC_SUBST(INSTALLFLAGS)

AC_CACHE_CHECK("if tty names start with pts/ or tty",
  nwrite_cv_sys_tty_path,
  nwrite_cv_sys_tty_path=`tty | sed -e 's|/dev/||' -e 's|pts/.*$|pts/|' -e 's|tty.*$|tty|'`)

case $nwrite_cv_sys_tty_path in 
  tty)
    AC_DEFINE(TTY_PREFIX,"tty")
      ;;
  pts/)
    AC_DEFINE(TTY_PREFIX,"pts/")
      ;;
esac

AC_OUTPUT(Makefile)