Fix bug in ctdlload import of email addresses.
[citadel.git] / textclient / configure
index c6f893664e58073c31a8b96d305602a2a6f72a4a..eba03f83dafb4a5db738a8e1e3a59cdcba4e3545 100755 (executable)
@@ -1,5 +1,12 @@
 #!/bin/sh
 
+# CONFIGURE SCRIPT FOR CITADEL TEXT CLIENT
+# This file is part of "conf-IG-ure"
+# Copyright (C) 2016-2019 by Art Cancro
+#
+# This program is open source software.  Use, duplication, and/or
+# disclosure are subject to the GNU General Purpose License version 3.
+
 echo 
 echo 
 echo Running the configure script to create config.mk
@@ -19,6 +26,9 @@ do
                --bindir)
                        BINDIR=$v
                ;;
+               --etcdir)
+                       ETCDIR=$v
+               ;;
                --ctdldir)
                        CTDLDIR=$v
                ;;
@@ -34,24 +44,31 @@ do
                        echo Valid options are:
                        echo '  --prefix=PREFIX         Install files in PREFIX [/usr/local]'
                        echo '  --bindir=DIR            Install executables in DIR [PREFIX/bin]'
+                       echo '  --etcdir=DIR            Install citadel.rc in DIR [PREFIX/etc]'
                        echo '  --ctdldir=DIR           Look for Citadel server in DIR [/usr/local/citadel]'
-                       echo '  --with-ssl              Force build with OpenSSL support [normally autodetected'
-                       echo '  --without-ssl           Force build without OpenSSL support [normally autodetected'
+                       echo '  --with-ssl              Force build with OpenSSL support [normally autodetected]'
+                       echo '  --without-ssl           Force build without OpenSSL support [normally autodetected]'
                        exit 1
                ;;
        esac
        shift
 done
 
+
+########################################################################
 # Set any missing values
+########################################################################
 
 [ "$PREFIX" = "" ]     && PREFIX=/usr/local
 [ "$BINDIR" = "" ]     && BINDIR=${PREFIX}/bin
 [ "$CTDLDIR" = "" ]    && CTDLDIR=/usr/local/citadel
-[ "$CFLAGS" = "" ]     && CFLAGS='-ggdb'
+[ "$CFLAGS" = "" ]     && CFLAGS='-Wformat-truncation=0 -ggdb'
 [ "$LDFLAGS" = "" ]    && LDFLAGS=''
 
+
+########################################################################
 # Test for OpenSSL
+########################################################################
 [ "$SSL" != "yes" ] && [ "$SSL" != "no" ] && {
        echo Testing for OpenSSL...
        tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
@@ -71,10 +88,49 @@ int main(int argc, char **argv) {
 echo SSL: $SSL
 [ "$SSL" = "yes" ] && {
        CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
-       LDFLAGS=${LDFLAGS}' -lssl -lcrypto'
+       LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
+}
+
+
+########################################################################
+# 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.
+               rm -f $tempfile 2>/dev/null
+               rm -f $tempcc 2>/dev/null
+               exit 1
+       }
 }
+rm -f $tempfile 2>/dev/null
+rm -f $tempcc 2>/dev/null
+
 
+########################################################################
 # Output the config.mk
+########################################################################
 
 (
        echo "CFLAGS := ${CFLAGS}"