3 # CONFIGURE SCRIPT FOR CITADEL SERVER
4 # This file is part of "conf-IG-ure"
5 # Copyright (C) 2016-2022 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.
16 echo Running the configure script to create config.mk
19 ########################################################################
20 # Parse the command line arguments
21 ########################################################################
25 k=`echo $a | awk -F= ' { print $1 } '`
26 v=`echo $a | awk -F= ' { print $2 } '`
36 echo $0 : unknown option $k
38 echo Valid options are:
39 echo ' --ctdldir=DIR Install Citadel server to DIR [/usr/local/citadel]'
47 ########################################################################
48 # Set any missing values
49 ########################################################################
51 # Accept PREFIX as a substitute for CTDLDIR, but only if CTDLDIR is not already set
52 [ "$CTDLDIR" = "" ] && [ "$PREFIX" != "" ] && CTDLDIR=$PREFIX
54 # Configure the directory into which Citadel Server will be installed.
55 [ "$CTDLDIR" = "" ] && CTDLDIR=/usr/local/citadel
57 # Permit override of CFLAGS and LDFLAGS using environment variables
58 [ "$CFLAGS" = "" ] && CFLAGS='-ggdb -Wno-discarded-qualifiers'
59 [ "$LDFLAGS" = "" ] && LDFLAGS=''
62 ########################################################################
64 ########################################################################
65 echo Testing for OpenSSL...
66 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
69 #include <openssl/ssl.h>
70 int main(int argc, char **argv) {
71 SSL_load_error_strings();
75 cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && {
76 CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
77 LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
79 echo Citadel Server requires OpenSSL which is not present.
84 ########################################################################
86 ########################################################################
87 echo Testing for iconv...
88 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
95 int main(int argc, char **argv) {
96 size_t wow = iconv(NULL, NULL, NULL, NULL, NULL);
101 cc $tempcc -o $tempfile && {
103 echo iconv.h is present and requires no additional libraries
105 echo Trying again with -liconv...
106 cc $tempcc -liconv -o $tempfile && {
108 LDFLAGS=${LDFLAGS}' -liconv'
110 echo Citadel Server requires iconv character set conversion.
116 ########################################################################
117 # FIXME do a real build id here
118 ########################################################################
119 CFLAGS=${CFLAGS}' -DBUILD_ID=\"unknown\"'
122 ########################################################################
123 # Output the config.mk
124 ########################################################################
126 echo '# config.mk is generated by configure'
127 echo "CTDLDIR := ${CTDLDIR}"
128 echo "CFLAGS := ${CFLAGS}"
129 echo "LDFLAGS := ${LDFLAGS}"