--ctdldir)
CTDLDIR=$v
;;
- --with-ssl)
- SSL=yes
- ;;
- --without-ssl)
- SSL=no
- ;;
*)
echo $0 : unknown option $k
echo
echo Valid options are:
echo ' --ctdldir=DIR Install Citadel server to DIR [/usr/local/citadel]'
- echo ' --with-ssl Force build with OpenSSL support [normally autodetected]'
- echo ' --without-ssl Force build without OpenSSL support [normally autodetected]'
exit 1
;;
esac
[ "$CFLAGS" = "" ] && CFLAGS='-ggdb -Werror -Wfatal-errors -Wno-discarded-qualifiers'
[ "$LDFLAGS" = "" ] && LDFLAGS=''
+########################################################################
# Test for OpenSSL
-[ "$SSL" != "yes" ] && [ "$SSL" != "no" ] && {
- echo Testing for OpenSSL...
- tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
- tempcc=${tempfile}.c
- cat >$tempcc <<!
+########################################################################
+echo Testing for OpenSSL...
+tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
+tempcc=${tempfile}.c
+cat >$tempcc <<!
#include <openssl/ssl.h>
int main(int argc, char **argv) {
SSL_load_error_strings();
exit(0);
}
!
- SSL='no';
- cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && SSL='yes'
- rm -f $tempfile 2>/dev/null
- rm -f $tempcc 2>/dev/null
-}
-echo SSL: $SSL
-[ "$SSL" = "yes" ] && {
+cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && {
CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
+} || {
+ echo Citadel Server requires OpenSSL which is not present.
+ exit 2
}
+
+########################################################################
+# Test for iconv
+########################################################################
+echo Testing for iconv...
+tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
+tempcc=${tempfile}.c
+cat >$tempcc <<!
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <iconv.h>
+int main(int argc, char **argv) {
+ size_t wow = iconv(NULL, NULL, NULL, NULL, NULL);
+ return(0);
+}
+!
+
+cc $tempcc -o $tempfile && {
+ ICONV='yes'
+ echo iconv.h is present and requires no additional libraries
+} || {
+ echo Trying again with -liconv...
+ cc $tempcc -liconv -o $tempfile && {
+ ICONV='yes'
+ LDFLAGS=${LDFLAGS}' -liconv'
+ } || {
+ echo Citadel Server requires iconv character set conversion.
+ exit 1
+ }
+}
+
+
# FIXME do a real build id here
CFLAGS=${CFLAGS}' -DBUILD_ID=\"unknown\"'