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.
11 echo Running the configure script to create config.mk
14 ########################################################################
15 # Parse the command line arguments
16 ########################################################################
20 k=`echo $a | awk -F= ' { print $1 } '`
21 v=`echo $a | awk -F= ' { print $2 } '`
25 echo $0 : '--prefix is not supported. you are probably looking for --ctdldir'
32 echo $0 : unknown option $k
34 echo Valid options are:
35 echo ' --ctdldir=DIR Install Citadel server to DIR [/usr/local/citadel]'
43 ########################################################################
44 # Set any missing values
45 ########################################################################
47 # Accept PREFIX as a substitute for CTDLDIR, but only if CTDLDIR is not already set
48 [ "$CTDLDIR" = "" ] && [ "$PREFIX" != "" ] && CTDLDIR=$PREFIX
50 # Configure the directory into which Citadel Server will be installed.
51 [ "$CTDLDIR" = "" ] && CTDLDIR=/usr/local/citadel
53 # Permit override of CFLAGS and LDFLAGS using environment variables
54 [ "$CFLAGS" = "" ] && CFLAGS='-ggdb'
55 [ "$LDFLAGS" = "" ] && LDFLAGS=''
58 ########################################################################
60 ########################################################################
61 echo Testing for OpenSSL...
62 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
65 #include <openssl/ssl.h>
66 int main(int argc, char **argv) {
67 SSL_load_error_strings();
71 cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && {
72 CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
73 LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
75 echo Citadel Server requires OpenSSL which is not present.
80 ########################################################################
82 ########################################################################
83 echo Testing for iconv...
84 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
91 int main(int argc, char **argv) {
92 size_t wow = iconv(NULL, NULL, NULL, NULL, NULL);
97 cc $tempcc -o $tempfile && {
99 echo iconv.h is present and requires no additional libraries
101 echo Trying again with -liconv...
102 cc $tempcc -liconv -o $tempfile && {
104 LDFLAGS=${LDFLAGS}' -liconv'
106 echo Citadel Server requires iconv character set conversion.
112 ########################################################################
113 # FIXME do a real build id here
114 ########################################################################
115 CFLAGS=${CFLAGS}' -DBUILD_ID=\"'$( date +%y%03j)'\"'
116 CFLAGS=${CFLAGS}' -DCTDLDIR=\"'${CTDLDIR}'\"'
119 ########################################################################
120 # Output the config.mk
121 ########################################################################
123 echo '# config.mk is generated by configure'
124 echo "CTDLDIR := ${CTDLDIR}"
125 echo "CFLAGS := ${CFLAGS}"
126 echo "LDFLAGS := ${LDFLAGS}"