- make it work without SSL

- switch from -Ds in Makefile to config.h
- small header cleaup
This commit is contained in:
Oswald Buddenhagen 2003-05-07 00:06:37 +00:00
parent ff8991fd00
commit b535af4fc4
14 changed files with 85 additions and 33 deletions

View File

@ -3,9 +3,13 @@ Makefile.in
autom4te.cache autom4te.cache
aclocal.m4 aclocal.m4
build-stamp build-stamp
config.h
config.h.in
config.cache config.cache
config.log config.log
config.status config.status
configure configure
configure.lineno
configure-stamp configure-stamp
isync.spec isync.spec
stamp-h1

View File

@ -1,6 +1,6 @@
SUBDIRS = debian src SUBDIRS = debian src
man_MANS = isync.1 man_MANS = isync.1
EXTRA_DIST = isyncrc.sample isync.spec.in $(man_MANS) EXTRA_DIST = isyncrc.sample isync.spec $(man_MANS)
DISTCLEANFILES = *~ build-stamp configure-stamp DISTCLEANFILES = *~ build-stamp configure-stamp
log: log:

View File

@ -2,6 +2,7 @@
# $Id$ # $Id$
set -e -v set -e -v
aclocal aclocal
autoheader
automake --add-missing automake --add-missing
autoconf autoconf
./configure "$@" ./configure "$@"

View File

@ -1,24 +1,37 @@
AC_INIT(src/isync.h) AC_INIT(src/isync.h)
AM_INIT_AUTOMAKE(isync,0.9) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(isync, 0.9.1)
AM_PROG_CC_STDC AM_PROG_CC_STDC
if test "$GCC" = yes; then if test "$GCC" = yes; then
CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wmissing-prototypes" CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wmissing-prototypes"
fi fi
AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location where OpenSSL is installed],
[if test -d $withval/lib; then
LIBS="$LIBS -L$withval/lib"
CFLAGS="$CFLAGS -I$withval/include"
else
AC_MSG_ERROR(can't find OpenSSL in $withval)
fi])
AC_CHECK_FUNCS(getopt_long) AC_CHECK_FUNCS(getopt_long)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,inet_ntoa) AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(crypto,ERR_error_string) AC_CHECK_LIB(nsl, inet_ntoa)
AC_CHECK_LIB(ssl,SSL_library_init)
ssl=false
AC_ARG_WITH(ssl,
[ --with-ssl=DIR yes/no/OpenSSL installation root [detect]],
[ob_cv_with_ssl=$withval])
if test "x$ob_cv_with_ssl" != xno; then
if test -d "$ob_cv_with_ssl/lib"; then
CPFLAGS="$CPPFLAGS -I$ob_cv_with_ssl/include"
LDFLAGS="$LDFLAGS -L$ob_cv_with_ssl/lib"
fi
AC_CHECK_LIB(crypto, ERR_error_string, [cryptolib=" -lcrypto"])
AC_CHECK_LIB(ssl, SSL_library_init, [
LIBS="-lssl$cryptolib $LIBS"
AC_DEFINE(HAVE_LIBSSL, 1, [Define if you want SSL support])
ssl=true
],[
if test -n "$ob_cv_with_ssl"; then
AC_MSG_ERROR([can't find OpenSSL])
fi
])
fi
AC_CACHE_CHECK(for dbm_open, ac_cv_dbmopen, AC_CACHE_CHECK(for dbm_open, ac_cv_dbmopen,
[ac_cv_dbmopen=no [ac_cv_dbmopen=no
@ -37,10 +50,20 @@ if test $ac_cv_dbmopen = no; then
if test $ac_cv_libdb = yes; then if test $ac_cv_libdb = yes; then
LIBS="$LIBS -ldb" LIBS="$LIBS -ldb"
AC_DEFINE(HAVE_LIBDB) AC_DEFINE(HAVE_LIBDB, 1, [Define if you have libdb])
else else
AC_MSG_ERROR([Could not find dbm_open(), you must install libdb]) AC_MSG_ERROR([Could not find dbm_open(), you must install libdb])
fi fi
fi fi
AC_OUTPUT(Makefile src/Makefile debian/Makefile isync.spec) AC_OUTPUT(Makefile src/Makefile debian/Makefile isync.spec)
if $ssl; then
AC_MSG_RESULT([
Using SSL
])
else
AC_MSG_RESULT([
Not using SSL
])
fi

8
debian/changelog vendored
View File

@ -1,8 +1,14 @@
isync (0.9.1-1) unstable; urgency=medium
* New upstream release
-- Oswald Buddenhagen <ossi@users.sf.net> Wed, 07 May 2003 01:22:00 +0200
isync (0.9-1) unstable; urgency=low isync (0.9-1) unstable; urgency=low
* New upstream release * New upstream release
-- Oswald Buddenhagen <ossi@users.sf.net> Wed, 26 Mar 2003 04:12:00 +0100 -- Oswald Buddenhagen <ossi@users.sf.net> Mon, 05 May 2003 20:15:00 +0200
isync (0.8-1) unstable; urgency=low isync (0.8-1) unstable; urgency=low

View File

@ -22,6 +22,8 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include "isync.h"
#include <unistd.h> #include <unistd.h>
#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>
@ -30,7 +32,6 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "isync.h"
config_t *boxes = 0; config_t *boxes = 0;
@ -45,8 +46,11 @@ static char *
my_strndup (const char *s, size_t nchars) my_strndup (const char *s, size_t nchars)
{ {
char *r = malloc (sizeof (char) * (nchars + 1)); char *r = malloc (sizeof (char) * (nchars + 1));
strncpy (r, s, nchars); if (r)
r[nchars] = 0; {
memcpy (r, s, nchars);
r[nchars] = 0;
}
return r; return r;
} }

View File

@ -21,11 +21,13 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include <assert.h> #include <config.h>
#include "isync.h"
#if HAVE_LIBSSL #if HAVE_LIBSSL
#include "isync.h"
#include <assert.h>
#include <string.h> #include <string.h>
#include <openssl/hmac.h> #include <openssl/hmac.h>

View File

@ -24,13 +24,15 @@
/* /*
* this file contains routines to establish a mutex using a `dotlock' file * this file contains routines to establish a mutex using a `dotlock' file
*/ */
#include "dotlock.h"
#include <unistd.h> #include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#if TESTING #if TESTING
#include <stdio.h> #include <stdio.h>
#endif #endif
#include "dotlock.h"
static struct flock lck = { 0, SEEK_SET, 0, 0, 0 }; static struct flock lck = { 0, SEEK_SET, 0, 0, 0 };

View File

@ -22,12 +22,15 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include "isync.h"
#include <assert.h> #include <assert.h>
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/time.h> #include <sys/time.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
@ -36,9 +39,8 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#if HAVE_LIBSSL #if HAVE_LIBSSL
#include <openssl/err.h> # include <openssl/err.h>
#endif #endif
#include "isync.h"
const char *Flags[] = { const char *Flags[] = {
"\\Seen", "\\Seen",
@ -594,6 +596,7 @@ imap_exec (imap_t * imap, const char *fmt, ...)
/* not reached */ /* not reached */
} }
#ifdef HAVE_LIBSSL
static int static int
start_tls (imap_t *imap, config_t * cfg) start_tls (imap_t *imap, config_t * cfg)
{ {
@ -619,6 +622,7 @@ start_tls (imap_t *imap, config_t * cfg)
puts ("SSL support enabled"); puts ("SSL support enabled");
return 0; return 0;
} }
#endif
imap_t * imap_t *
imap_connect (config_t * cfg) imap_connect (config_t * cfg)

View File

@ -22,6 +22,10 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include <config.h>
#include <sys/types.h>
#if HAVE_LIBDB #if HAVE_LIBDB
# define DB_DBM_HSEARCH 1 # define DB_DBM_HSEARCH 1
# include <db.h> # include <db.h>
@ -29,8 +33,6 @@
# include <ndbm.h> # include <ndbm.h>
#endif #endif
#include <sys/types.h>
#include <stdarg.h>
#if HAVE_LIBSSL #if HAVE_LIBSSL
# include <openssl/ssl.h> # include <openssl/ssl.h>
#endif #endif
@ -47,9 +49,9 @@ typedef struct
typedef struct typedef struct
{ {
Socket_t *sock; Socket_t *sock;
char buf[1024];
int bytes; int bytes;
int offset; int offset;
char buf[1024];
} }
buffer_t; buffer_t;

View File

@ -21,10 +21,11 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include "isync.h"
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "isync.h"
static char * static char *
skip_string (char *s) skip_string (char *s)

View File

@ -22,6 +22,9 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include "isync.h"
#include "dotlock.h"
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -32,8 +35,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include "isync.h"
#include "dotlock.h"
/* 2,<flags> */ /* 2,<flags> */
static void static void

View File

@ -22,6 +22,8 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include "isync.h"
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -33,7 +35,6 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <dirent.h> #include <dirent.h>
#include "isync.h"
int Quiet; int Quiet;

View File

@ -22,6 +22,8 @@
* despite that library's more restrictive license. * despite that library's more restrictive license.
*/ */
#include "isync.h"
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
@ -31,7 +33,6 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "isync.h"
static unsigned int MaildirCount = 0; static unsigned int MaildirCount = 0;