3 # CONFIGURE SCRIPT FOR CITADEL TEXT CLIENT
4 # This file is part of "conf-IG-ure"
5 # Copyright (C) 2016-2019 by Art Cancro
7 # This program is open source software. Use, duplication, and/or
8 # disclosure are subject to the GNU General Purpose License version 3.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
17 echo Running the configure script to create config.mk
20 # Parse the command line arguments
24 k=`echo $a | awk -F= ' { print $1 } '`
25 v=`echo $a | awk -F= ' { print $2 } '`
47 echo $0 : unknown option $k
49 echo Valid options are:
50 echo ' --prefix=PREFIX Install files in PREFIX [/usr/local]'
51 echo ' --bindir=DIR Install executables in DIR [PREFIX/bin]'
52 echo ' --etcdir=DIR Install citadel.rc in DIR [PREFIX/etc]'
53 echo ' --ctdldir=DIR Look for Citadel server in DIR [/usr/local/citadel]'
54 echo ' --with-ssl Force build with OpenSSL support [normally autodetected]'
55 echo ' --without-ssl Force build without OpenSSL support [normally autodetected]'
63 ########################################################################
64 # Set any missing values
65 ########################################################################
67 [ "$PREFIX" = "" ] && PREFIX=/usr/local
68 [ "$BINDIR" = "" ] && BINDIR=${PREFIX}/bin
69 [ "$CTDLDIR" = "" ] && CTDLDIR=/usr/local/citadel
70 [ "$CFLAGS" = "" ] && CFLAGS='-Wformat-truncation=0 -ggdb'
71 [ "$LDFLAGS" = "" ] && LDFLAGS=''
74 ########################################################################
76 ########################################################################
77 [ "$SSL" != "yes" ] && [ "$SSL" != "no" ] && {
78 echo Testing for OpenSSL...
79 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
82 #include <openssl/ssl.h>
83 int main(int argc, char **argv) {
84 SSL_load_error_strings();
89 cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && SSL='yes'
90 rm -f $tempfile 2>/dev/null
91 rm -f $tempcc 2>/dev/null
94 [ "$SSL" = "yes" ] && {
95 CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
96 LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
100 ########################################################################
102 ########################################################################
103 echo Testing for iconv...
104 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
111 int main(int argc, char **argv) {
112 size_t wow = iconv(NULL, NULL, NULL, NULL, NULL);
117 cc $tempcc -o $tempfile && {
119 echo iconv.h is present and requires no additional libraries
121 echo Trying again with -liconv...
122 cc $tempcc -liconv -o $tempfile && {
124 LDFLAGS=${LDFLAGS}' -liconv'
126 echo Citadel Server requires iconv character set conversion.
132 ########################################################################
133 # Output the config.mk
134 ########################################################################
137 echo "CFLAGS := ${CFLAGS}"
138 echo "LDFLAGS := ${LDFLAGS}"
139 echo "PREFIX := ${PREFIX}"
140 echo "BINDIR := ${BINDIR}"
141 echo "CTDLDIR := ${CTDLDIR}"