#!/bin/sh
####################################################################################################
#作者:胡昌文
#时间:2008-09-28
#MSN:
###################################################################################################
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo "Please Input the options in the following!"
echo " Modified By GTSC Hu Changwen"
echo " Any problem,Please Connact me:wtcmaster@126.com"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo ""
for data in ldap mysql sasl ssl
do
echo "======================================="
echo "Start to define $data options:"
#define the function named ldap()
fun ()
{
echo "Please input the include directory of $data:[/usr/local/include]"
read data_include
if [ "$data_include" = "" ];then
data_include="/usr/local/include"
fi
echo "Please input the lib directory of ${data}:[/usr/local/lib]"
read data_lib
if [ "$data_lib" = "" ];then
data_lib="/usr/local/lib"
fi
}
#define makefile options
makefile ()
{
if [ "$data" = ldap ]; then
option="${option} -I${data_include} -DHAS_LDAP"
options="${options} -L${data_lib} -lldap -llber"
elif [ "$data" = mysql ]; then
option="${option} -I${data_include} -DHAS_MYSQL"
options="${options} -L${data_lib} -lmysqlclient -lz -lm"
elif [ "$data" = sasl ]; then
option="${option} -I${data_include} -DUSE_SASL_AUTH -DUSE_CYRUS_SASL"
options="${options} -L${data_lib} -lsasl2"
elif [ "$data" = ssl ]; then
option="${option} -I${data_include} -DHAS_SSL"
options="${options} -L${data_lib} -lcrypto -lssl"
fi
}
#define whether support mysql
echo "Do you want to have your postmail system support ${data}? [Yes,No]"
while read data_res;do
if [ "$data_res" = yes ]; then
fun
makefile
break 1
else if [ "$data_res" = no ]; then
echo "Don't Support mysql!"
break 1
fi
fi
echo "Do you want to have your postmail system support ${data}? [Yes,No]"
done
done
echo "-------------------------------------------------------------------------------------------"
echo ""
make -f Makefile.init makefiles CCARGS="$option" AUXLIBS="$options"