summaryrefslogtreecommitdiff
path: root/configure.in
blob: fdcbe5907555e711ce2bf50b999d0ef17927b54c (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
211
212
213
214
215
216
dnl Process this file with autoconf to procude a configure script.
AC_INIT(mailbox/mailbox.c)
AM_INIT_AUTOMAKE(mailutils, 0.0.9)
AM_CONFIG_HEADER(config.h)

dnl Check for programs
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LIBTOOL
AC_PROG_YACC
AM_PROG_LEX

MU_MAINTAINER_MODE

dnl Check for arguments
AC_ARG_ENABLE(pam,
 [  --disable-pam           disable pam],
 [case "${enableval}" in
  yes) testpam=yes ;;
  no)  testpam=no ;;
  *)   AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
 esac],[testpam=yes])

AC_ARG_ENABLE(pthread,
 [  --disable-pthread       disable pthread],
 [case "${enableval}" in
  yes) usepthread=yes ;;
  no)  usepthread=no ;;
  *)   AC_MSG_ERROR(bad value ${enableval} for --disable-pthread) ;;
  esac],[usepthread=yes])

AC_ARG_WITH(readline,
 [  --without-readline      do not use readline],
 [case "${withval}" in
  yes) usereadline=yes ;;
  no)  usereadline=no ;;
  *)   AC_MSG_ERROR(bad value ${withval} for --without-readline) ;;
  esac],[usereadline=yes])

AC_ARG_WITH(guile,
 [  --without-guile         do not build guile interface],
 [case "${withval}" in
  yes) useguile=yes ;;
  no)  useguile=no ;;
  *)   AC_MSG_ERROR(bad value ${withval} for --without-guile) ;;
  esac],[useguile=yes])

AC_SUBST(SITE_MAIL_RC)
AC_ARG_WITH(mail-rc,
 [  --with-mail-rc=FILE     use FILE instead of \$sysconfdir/mail.rc],
 [case "${withval}" in
  /*) SITE_MAIL_RC="${withval}";;
  *)  SITE_MAIL_RC="\$(sysconfdir)/${withval}";;
  esac],
 [SITE_MAIL_RC="\$(sysconfdir)/mail.rc"])

AC_ARG_WITH(db2,
 [  --with-db2              use Berkeley DB],
 [case "${withval}" in
  yes) usedb2=yes ;;
  no)  usedb2=no ;;
  *)   AC_MSG_ERROR(bad value ${withval} for --with-db) ;;
  esac],[usedb2=no])

AC_MSG_CHECKING(for log facility)
log_facility="LOG_MAIL"
AC_ARG_WITH(log-facility,
 [  --with-log-facility=facility   enable logging to the given facility],
 AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval,
	log_facility=$withval))
AC_DEFINE_UNQUOTED(LOG_FACILITY, $log_facility)
AC_MSG_RESULT($log_facility)

dnl Check for headers
AC_HEADER_STDC
AC_HEADER_DIRENT
AM_C_PROTOTYPES
AC_CHECK_HEADERS(argp.h errno.h fcntl.h inttypes.h libgen.h limits.h malloc.h \
 paths.h shadow.h stdarg.h stdio.h stdlib.h string.h strings.h sys/file.h \
 syslog.h termios.h termio.h sgtty.h unistd.h )

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_DECL_SYS_SIGLIST
AC_STRUCT_TIMEZONE
sr_STRUCT_TM_ZONE
sr_STRUCT_TM_GMTOFF
sr_STRUCT_TM_ISDST

dnl Check for working functions

jm_FUNC_MALLOC
jm_FUNC_REALLOC
AC_FUNC_ALLOCA
# Not use.
#AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_FNMATCH
if test "$ac_cv_func_fnmatch_works" = "no"; then
: LIBOBJS="$LIBOBJS fnmatch.o"
fi
AC_REPLACE_FUNCS(setenv snprintf strtok_r strncasecmp strcasecmp strsignal \
 vasprintf)
AC_CHECK_FUNCS(mkstemp sigaction sysconf)

dnl Check for libraries
AC_CHECK_FUNCS(argp_parse)
if test x"$ac_cv_func_argp_parse" != xyes; then
	AC_REPLACE_FUNCS(strndup strnlen strchrnul)
	ARGPLIBS="../argp/libargp.a"
	ARGPLIB="libargp.a"
	ARGPINCS='-I$(top_srcdir)/argp'
	AC_SUBST(ARGPLIBS)
	AC_SUBST(ARGPLIB)
	AC_SUBST(ARGPINCS)
fi

dnl Use either PAM or CRYPT, not both.
if test x"$testpam" = x"yes"; then
	AC_CHECK_HEADERS(security/pam_appl.h)
	if test x"$ac_cv_header_security_pam_appl_h" = x"yes"; then
		AC_CHECK_LIB(dl, dlopen, [LDL=-ldl], [LDL=])
		AC_CHECK_LIB(pam, pam_start,
			AUTHLIBS="-lpam $LDL" ac_cv_have_libpam="yes",, $LDL)
		AC_DEFINE(USE_LIBPAM)
		AM_CONDITIONAL(USE_LIBPAM, test x"$ac_cv_have_libpam" != xno)
	fi
fi

if test x"$ac_cv_have_libpam" != x"yes"; then
	AC_CHECK_FUNCS(crypt)
	if test x"$ac_cv_func_crypt" = x"no"; then
		AC_CHECK_LIB(crypt, crypt, AUTHLIBS="-lcrypt",, -lcrypt)
	fi
fi
AC_SUBST(AUTHLIBS)

#When using thread support some platforms need -D_REENTRANT to get the
#right prototypes including errno.
dnl Check threading support
# We have to rearrange things a little, it appears that the new autoconf
# does not like long cascading AC_CHECK_LIB.
if test x"$usepthread" = x"yes"; then
	AC_CHECK_LIB(pthread, pthread_cancel, have_libpthread=yes,
		 have_libpthread=no)
        if test x"$have_libpthread" = x"yes"; then
		AC_CHECK_HEADERS(pthread.h, AC_DEFINE(WITH_PTHREAD))
			LIBS="$LIBS -lpthread"
			AC_DEFINE(_REENTRANT)
			AC_CHECK_FUNCS(pthread_rwlock_init)
	else
		AC_SEARCH_LIBS(pthread_cancel, pthread,
			[AC_CHECK_FUNCS(pthread_rwlock_init)
				AC_CHECK_HEADERS(pthread.h,
					AC_DEFINE(WITH_PTHREAD))
					AC_DEFINE(_REENTRANT)])
	fi
fi

dnl Do we need extra libs for networking?
AC_CHECK_FUNC(gethostbyname, [true],
	AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="-lnsl $LIBS"))

AC_CHECK_FUNC(socket, [true],
	AC_CHECK_LIB(socket, socket, LIBS="-lsocket $LIBS"))

dnl Check for GNU Readline
AC_SUBST(READLINE_LIBS)
if test x"$usereadline" = x"yes"; then
	AC_CHECK_LIB(readline, readline,
		      [AC_CHECK_HEADERS(readline/readline.h,
		       AC_DEFINE(WITH_READLINE))
		       READLINE_LIBS="-lcurses -lreadline"],
			:,
		       -lcurses)
fi

dnl Check for Berkeley DB
if test x"${usedb2}" = x"yes"; then
	AC_CHECK_LIB(db, db_open, [AC_CHECK_HEADERS(db.h, AC_DEFINE(WITH_BDB2))
		LIBS="$LIBS -ldb"])
fi

dnl Check for Guile
AC_SUBST(GUILE_INCLUDES)
AC_SUBST(GUILE_LIBS)
AC_SUBST(GUIMB)	
AC_SUBST(MU_SCM)
AC_SUBST(GUILE_PROCEDURES_TXT)
AC_SUBST(GUILE_BUILT_SOURCES)
if test x"$useguile" = x"yes"; then
	AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH)
	AC_CHECK_HEADER(libguile.h, :, [GUILE_CONFIG=no])     
	if test x$GUILE_CONFIG != xno; then
  		GUILE_INCLUDES=`guile-config compile`
  		GUILE_LIBS=`guile-config link`
		GUIMB=guimb
		MU_SCM=libmu_scm.a
		GUILE_PROCEDURES_TXT=guile-procedures.txt
		GUILE_BUILT_SOURCES='$(DOT_X_FILES) $(DOT_DOC_FILES)'
	fi
fi

dnl Output Makefiles
AC_OUTPUT(Makefile mailutils.spec include/Makefile include/mailutils/Makefile
 m4/Makefile doc/Makefile argp/Makefile lib/Makefile mailbox/Makefile
 imap4d/Makefile mailbox/include/Makefile from/Makefile mail/Makefile
 pop3d/Makefile frm/Makefile sieve/Makefile messages/Makefile
 scripts/Makefile libmu_scm/Makefile guimb/Makefile guimb/scm/Makefile)

Return to:

Send suggestions and report system problems to the System administrator.