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.
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 } '`
44 echo $0 : unknown option $k
46 echo Valid options are:
47 echo ' --prefix=PREFIX Install files in PREFIX [/usr/local]'
48 echo ' --bindir=DIR Install executables in DIR [PREFIX/bin]'
49 echo ' --ctdldir=DIR Look for Citadel server in DIR [/usr/local/citadel]'
50 echo ' --with-ssl Force build with OpenSSL support [normally autodetected]'
51 echo ' --without-ssl Force build without OpenSSL support [normally autodetected]'
58 # Set any missing values (FIXME remove the ultra-fatal -W options when finished converting from autotools)
60 [ "$PREFIX" = "" ] && PREFIX=/usr/local/citadel
61 [ "$BINDIR" = "" ] && BINDIR=${PREFIX}
62 [ "$CTDLDIR" = "" ] && CTDLDIR=${PREFIX}
63 [ "$CFLAGS" = "" ] && CFLAGS='-ggdb -Werror -Wfatal-errors -Wno-discarded-qualifiers'
64 [ "$LDFLAGS" = "" ] && LDFLAGS=''
67 [ "$SSL" != "yes" ] && [ "$SSL" != "no" ] && {
68 echo Testing for OpenSSL...
69 tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
72 #include <openssl/ssl.h>
73 int main(int argc, char **argv) {
74 SSL_load_error_strings();
79 cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && SSL='yes'
80 rm -f $tempfile 2>/dev/null
81 rm -f $tempcc 2>/dev/null
84 [ "$SSL" = "yes" ] && {
85 CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
86 LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
89 # FIXME do a real build id here
90 CFLAGS=${CFLAGS}' -DBUILD_ID=\"unknown\"'
92 # Output the config.mk
95 echo "CFLAGS := ${CFLAGS}"
96 echo "LDFLAGS := ${LDFLAGS}"
97 echo "PREFIX := ${PREFIX}"
98 echo "BINDIR := ${BINDIR}"
99 echo "CTDLDIR := ${CTDLDIR}"