aboutsummaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 8042a20ef662c5dc33e7639a177b2016185da4b7 (plain)
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
dnl Autoconfigure input file for popclient
dnl Carl Harris, ceharris@mal.com
dnl
dnl Process this file with autoconf to produce a configure script.
dnl

AC_INIT(popclient.h)		dnl A distinctive file to look for in srcdir. 
AC_CONFIG_HEADER(config.h)

# We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS)
test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)

AC_CANONICAL_HOST

AC_MSG_CHECKING(system mailbox directory)
if test -d /var/mail
then
	AC_DEFINE(USERFOLDER, "/var/mail/%s")
	userfolder='/var/mail/$u'
elif test -d /usr/mail
then
	AC_DEFINE(USERFOLDER, "/usr/mail/%s")
	userfolder='/usr/mail/$u'
elif test -d /usr/spool/mail
then
	AC_DEFINE(USERFOLDER, "/usr/spool/mail/%s")
	userfolder='/usr/spool/mail/$u'
elif test -d /var/spool/mail
then
	AC_DEFINE(USERFOLDER, "/var/spool/mail/%s")
	userfolder='/var/mail/$u'
else
	userfolder="can't find one, will fall back on system MDA."
fi
AC_MSG_RESULT($userfolder)

AC_MSG_CHECKING(delivery agent for $host)
case $host in
   *-*-*bsd*)
	AC_DEFINE(DEF_MDA,"/usr/libexec/mail.local %s")
	mdacmd="/usr/libexec/mail.local \$u"
	;;

   *-*-aix*)
	AC_DEFINE(DEF_MDA,"/usr/bin/bellmail %s")
	mdacmd="/usr/bin/bellmail \$u"
	;;

   *-*-sco*)
	AC_DEFINE(DEF_MDA,"/usr/mmdf/bin/deliver %s")
	mdacmd="/usr/mmdf/bin/deliver \$u"
	AC_DEFINE(BINMAIL_TERM, "\001\001\001\001\n")
	;;

   *-*-hpux*)
	AC_DEFINE(DEF_MDA,"/bin/rmail -d %s")
	mdacmd="/bin/rmail -d \$u"
	;;

   *)
	if test -x "/usr/bin/deliver %s"
	then
		AC_DEFINE(DEF_MDA,"/usr/bin/deliver %s")
		mdacmd="/usr/bin/deliver \$u"
	else
		# Do *not* use the -t option!  We explicitly want only
		# local delivery to the recepients named on the command line.
		AC_DEFINE(DEF_MDA,"/usr/lib/sendmail -oem -fpopmail %s")
		mdacmd="/usr/lib/sendmail -fpopmail \$u"
	fi
	;;
esac
AC_MSG_RESULT($mdacmd)


AC_MSG_CHECKING(whether we want APOP support)
AC_ARG_WITH(APOP,
            [  --with-APOP              should we include APOP support?],
            [EXTRASRC="$EXTRASRC \$(srcdir)/md5c.c \$(srcdir)/md5ify.c"
             EXTRAOBJ="$EXTRAOBJ md5c.o md5ify.o" 
             AC_DEFINE(HAVE_APOP_SUPPORT)
             AC_MSG_RESULT(yes)],
             AC_MSG_RESULT(no))

AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_CPP			dnl Later checks need this.
AC_PROG_CC_C_O
AC_AIX
AC_ISC_POSIX
AC_MINIX
AC_HEADER_STDC
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h memory.h) 

AC_C_CONST			dnl getopt needs this.

AC_PROG_LEX
AC_PROG_YACC
AC_SUBST(LIBOBJS)

AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,inet_addr)



AC_CHECK_FUNC(bzero, AC_DEFINE(HAVE_BZERO), 
   AC_CHECK_FUNC(memset, [AC_DEFINE(HAVE_MEMSET) 
                          AC_DEFINE(HAVE_MEMCPY)], 
                 [EXTRASRC="$EXTRASRC \$(srcdir)/bzero.c"
                  EXTRAOBJ="$EXTRALIB bzero.o"]))

AC_CHECK_FUNC(strdup, AC_DEFINE(HAVE_STRDUP), 
              [EXTRASRC="$EXTRASRC \$(srcdir)/strdup.c"
               EXTRAOBJ="$EXTRAOBJ strdup.o"])
             
AC_CHECK_FUNC(strcasecmp, AC_DEFINE(HAVE_STRCASECMP), 
              [EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
               EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
             
AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
              [EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
               EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])

AC_FUNC_ALLOCA
if test -n "$ALLOCA" 
then
  EXTRASRC="$EXTRASRC \$(srcdir)/alloca.c"
  EXTRAOBJ="$EXTRAOBJ alloca.o"
fi

dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs

AC_SUBST(EXTRASRC)
AC_SUBST(EXTRAOBJ)

AC_CHECK_FUNCS(dup2 strerror tcsetattr stty setsid flock)

dnl AC_FUNC_SETVBUF_REVERSED

dnl Check for usuable void pointer type
AC_MSG_CHECKING(use of void pointer type)
AC_TRY_COMPILE([],
   [char *p;
    void *xmalloc();
    p = (char *) xmalloc(1);
   ],
 [AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
 AC_MSG_RESULT(no))

dnl Check for usable function prototypes
AC_MSG_CHECKING(use of function prototypes);
AC_TRY_COMPILE([], 
   [int x;
    int myProtoFn (int arg); 
    x = 0;
    x = myProtoFn(x);
   ],
 [AC_DEFINE(HAVE_PROTOTYPES) AC_MSG_RESULT(yes)],
 AC_MSG_RESULT(no))
                
dnl Check out the wait reality.
AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_FUNCS(waitpid wait3)
AC_MSG_CHECKING(for union wait);
AC_TRY_LINK([#include <sys/types.h>
#include <sys/wait.h>],
	 	 [union wait status; int pid; pid = wait (&status);
#ifdef WEXITSTATUS
/* Some POSIXoid systems have both the new-style macros and the old
   union wait type, and they do not work together.  If union wait
   conflicts with WEXITSTATUS et al, we don't want to use it at all.  */
if (WEXITSTATUS (status) != 0) pid = -1;
#endif
#ifdef HAVE_WAITPID
/* Make sure union wait works with waitpid.  */
pid = waitpid (-1, &status, 0);
#endif
],
  [AC_DEFINE(HAVE_UNION_WAIT) AC_MSG_RESULT(yes)],
  AC_MSG_RESULT(no))

AC_MSG_CHECKING(sys_siglist declaration in signal.h or unistd.h)
AC_TRY_LINK([#include <signal.h>
/* NetBSD declares sys_siglist in <unistd.h>.  */
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif], [char *msg = *(sys_siglist + 1);],
  [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
  AC_MSG_RESULT(no))

# The presence of the following is not meant to imply
# that popclient necessarily works on those systems.
dnl AC_DYNIX_SEQ
dnl AC_XENIX_DIR
dnl AC_IRIX_SUN

AC_OUTPUT(Makefile, [
# Makefile uses this timestamp file to know when to remake Makefile,
# build.sh, and glob/Makefile.
touch stamp-config])

dnl Local Variables:
dnl comment-start: "dnl "
dnl comment-end: ""
dnl comment-start-skip: "\\bdnl\\b\\s *"
dnl compile-command: "make configure config.h.in"
dnl End: