summaryrefslogtreecommitdiff
path: root/Config
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2008-12-17 20:18:40 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2008-12-17 20:18:40 +0000
commit81b7aa657110db03ceb861d8206fc6e805ede9c8 (patch)
tree8437f5ce65de3e27e5e02196711bd770aa86b7f5 /Config
parentfd45a3ad4219bffcf2f68fcc1dce3ff33b531b89 (diff)
Massive cleanup of the CMakeLists.txt files to finalize them.
Edited configuration scripts for *nix and Windows to use CMake as well as support both in-source and out-of-source builds. Changed directory structure for *nix to match Windows to remove some conditionals in both CMake and Anope itself. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1841 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'Config')
-rwxr-xr-xConfig203
1 files changed, 91 insertions, 112 deletions
diff --git a/Config b/Config
index 37fb95300..36ae5b34e 100755
--- a/Config
+++ b/Config
@@ -2,7 +2,7 @@
#
# Configuration script for Services.
#
-# Anope (c) 2003-2007 Anope team
+# Anope (c) 2003-2008 Anope team
# Contact us at dev@anope.org
#
# This program is free but copyrighted software; see the file COPYING for
@@ -26,10 +26,10 @@ exists () { # because some shells don't have test -e
}
Load_Cache () {
- if [ -f config.cache -a -r config.cache -a ! "$IGNORE_CACHE" ] ; then
- echo "Using defaults from config.cache. To ignore, ./Config -nocache"
+ if [ -f $SOURCE_DIR/config.cache -a -r $SOURCE_DIR/config.cache -a ! "$IGNORE_CACHE" ] ; then
+ echo "Using defaults from config.cache. To ignore, $SOURCE_DIR/Config -nocache"
echo ""
- . config.cache
+ . $SOURCE_DIR/config.cache
CAN_QUICK="yes"
else
CAN_QUICK="no"
@@ -37,20 +37,15 @@ Load_Cache () {
}
Run_CMake () {
- WITH_BIN=""
- WITH_DATA=""
+ WITH_INST=""
WITH_RUN=""
WITH_PERM=""
BUILD_TYPE=""
RUN_CC_PL=""
+ GEN_TYPE=""
- if [ "$BINDEST" != "" ] ; then
- WITH_BIN="-DBINDIR:STRING=$BINDEST"
- WITH_DATA="-DDATADIR:STRING=$DATDEST"
- fi
-
- if [ "$DATDEST" != "" ] ; then
- WITH_DATA="-DDATADIR:STRING=$DATDEST"
+ if [ "$INSTDEST" != "" ] ; then
+ WITH_INST="-DINSTDIR:STRING=$INSTDEST"
fi
if [ "$RUNGROUP" != "" ] ; then
@@ -73,21 +68,30 @@ Run_CMake () {
RUN_CC_PL="-DUSE_RUN_CC_PL:BOOLEAN=OFF"
fi
- echo "cmake $WITH_BIN $WITH_DATA $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL ."
+ case `uname -s` in
+ MINGW*)
+ GEN_TYPE="-G\"MSYS Makefiles\""
+ ;;
+ esac
+
+ echo "cmake $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $SOURCE_DIR"
- cmake $WITH_BIN $WITH_DATA $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL .
+ cmake $WITH_INST $WITH_RUN $WITH_PERM $BUILD_TYPE $RUN_CC_PL $SOURCE_DIR
+
+ echo ""
+ echo "Now run make to build Anope."
}
ECHO2SUF=''
if [ "`echo -n a ; echo -n b`" = "ab" ] ; then
ECHO2='echo -n'
elif [ "`echo 'a\c' ; echo 'b\c'`" = "ab" ] ; then
- ECHO2='echo' ; ECHO2SUF='\c'
+ ECHO2='echo' ; ECHO2SUF='\c'
elif [ "`printf 'a' 2>&1 ; printf 'b' 2>&1`" = "ab" ] ; then
- ECHO2='printf "%s"'
+ ECHO2='printf "%s"'
else
- # oh well...
- ECHO2='echo'
+ # oh well...
+ ECHO2='echo'
fi
export ECHO2 ECHO2SUF
@@ -95,53 +99,61 @@ export ECHO2 ECHO2SUF
# Init values
###########################################################################
-BINDEST=$HOME/services
-DATDEST=$HOME/services
+INSTDEST=$HOME/services
RUNGROUP=
UMASK=
DEBUG="no"
USE_RUN_CC_PL="no"
CAN_QUICK="no"
+SOURCE_DIR=`dirname $0`
###########################################################################
# Check out the options
###########################################################################
while [ $# -ge 1 ] ; do
- if [ $1 = "--help" ] ; then
- echo "Config utility for Anope"
- echo "------------------------"
- echo "Syntax: ./Config [options]"
- echo "-nocache Ignore settings saved in config.cache"
- echo "-nointro Skip intro (disclaimer, etc)"
- echo "-quick Skip questions, go straight to cmake"
- exit 0
- elif [ $1 = "-nocache" ] ; then
- IGNORE_CACHE="1"
- elif [ $1 = "-nointro" ] ; then
- NO_INTRO="1"
- elif [ $1 = "-quick" -o $1 = "-q" ] ; then
- Load_Cache
- if [ "$CAN_QUICK" = "yes" ] ; then
- Run_CMake
- else
- echo ""
- echo "Can't find cache file (config.cache), aborting..."
- fi
- exit 0
+ if [ $1 = "--help" ] ; then
+ echo "Config utility for Anope"
+ echo "------------------------"
+ echo "Syntax: ./Config [options]"
+ echo "-nocache Ignore settings saved in config.cache"
+ echo "-nointro Skip intro (disclaimer, etc)"
+ echo "-quick Skip questions, go straight to cmake"
+ exit 0
+ elif [ $1 = "-nocache" ] ; then
+ IGNORE_CACHE="1"
+ elif [ $1 = "-nointro" ] ; then
+ NO_INTRO="1"
+ elif [ $1 = "-quick" -o $1 = "-q" ] ; then
+ Load_Cache
+ if [ "$CAN_QUICK" = "yes" ] ; then
+ Run_CMake
+ else
+ echo ""
+ echo "Can't find cache file (config.cache), aborting..."
fi
- shift 1
+ exit 0
+ fi
+ shift 1
done
###########################################################################
if [ ! "$NO_INTRO" ] ; then
- clear
- . ./version.log
- cat .BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | more
- echo ""
+ case `uname -s` in
+ MINGW*)
+ PAGER=less
+ ;;
+ *)
+ PAGER=more
+ clear
+ ;;
+ esac
+ . $SOURCE_DIR/version.log
+ cat $SOURCE_DIR/.BANNER | sed "s/CURVER/$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH$VERSION_EXTRA/" | sed "s@SOURCE_DIR@$SOURCE_DIR@" | $PAGER
+ echo ""
else
- echo ""
+ echo ""
fi
echo "Beginning Services configuration."
@@ -152,7 +164,7 @@ echo ""
###########################################################################
if [ ! "$IGNORE_CACHE" ] ; then
- Load_Cache
+ Load_Cache
fi
# Ask the user anything we need to know ahead of time.
@@ -165,10 +177,10 @@ ok=0
echo "Note: press Return for the default, or enter a new value."
echo "In what directory do you want the binaries to be installed?"
while [ $ok -eq 0 ] ; do
- echo2 "[$BINDEST] "
+ echo2 "[$INSTDEST] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ ! "$INPUT" ] ; then
- INPUT=$BINDEST
+ INPUT=$INSTDEST
fi
if [ ! -d "$INPUT" ] ; then
if exists "$INPUT" ; then
@@ -189,46 +201,12 @@ while [ $ok -eq 0 ] ; do
ok=1
fi
done
-BINDEST=$INPUT
-DATDEST=$INPUT
+INSTDEST=$INPUT
echo ""
####
-ok=0
-echo "Where do you want the data files to be installed?"
-while [ $ok -eq 0 ] ; do
- echo2 "[$DATDEST] "
- if read INPUT ; then : ; else echo "" ; exit 1 ; fi
- if [ ! "$INPUT" ] ; then
- INPUT=$DATDEST
- fi
- if [ ! -d "$INPUT" ] ; then
- if exists "$INPUT" ; then
- echo "$INPUT exists, but is not a directory!"
- else
- echo "$INPUT does not exist. Create it?"
- echo2 "[y] "
- read YN
- if [ "$YN" != "n" ] ; then
- if mkdir -p $INPUT ; then
- ok=1
- fi
- fi
- fi
- elif exists "$INPUT/include/services.h" ; then
- echo "You cannot use the Services source directory as a target directory."
- else
- ok=1
- fi
-done
-DATDEST=$INPUT
-echo ""
-
-####
-
-
OLD_RUNGROUP="$RUNGROUP"
if [ "$RUNGROUP" ] ; then
echo "Which group should all Services data files be owned by? (If Services"
@@ -242,41 +220,41 @@ fi
echo2 "[$RUNGROUP] "
if read INPUT ; then : ; else echo "" ; exit 1 ; fi
if [ "$INPUT" ] ; then
- if [ "$INPUT" = "none" ] ; then
- RUNGROUP=""
- else
- RUNGROUP="$INPUT"
- fi
+ if [ "$INPUT" = "none" ] ; then
+ RUNGROUP=""
+ else
+ RUNGROUP="$INPUT"
+ fi
fi
echo ""
####
if [ ! "$UMASK" -o "$RUNGROUP" != "$OLD_RUNGROUP" ] ; then
- if [ "$RUNGROUP" ] ; then
- UMASK=007
- else
- UMASK=077
- fi
+ if [ "$RUNGROUP" ] ; then
+ UMASK=007
+ else
+ UMASK=077
+ fi
fi
ok=0
echo "What should the default umask for data files be (in octal)?"
echo "(077 = only accessible by owner; 007 = accessible by owner and group)"
while [ $ok -eq 0 ] ; do
- echo2 "[$UMASK] "
- if read INPUT ; then : ; else echo "" ; exit 1 ; fi
- if [ ! "$INPUT" ] ; then
- INPUT=$UMASK
- fi
- if [ `echo "$INPUT" | grep -c '[^0-7]'` -gt 0 ] ; then
- echo "$UMASK is not a valid octal number!"
- else
- if [ "`echo $INPUT | cut -c1`" != "0" ] ; then
- INPUT=0$INPUT
- fi
- ok=1
+ echo2 "[$UMASK] "
+ if read INPUT ; then : ; else echo "" ; exit 1 ; fi
+ if [ ! "$INPUT" ] ; then
+ INPUT=$UMASK
+ fi
+ if [ `echo "$INPUT" | grep -c '[^0-7]'` -gt 0 ] ; then
+ echo "$UMASK is not a valid octal number!"
+ else
+ if [ "`echo $INPUT | cut -c1`" != "0" ] ; then
+ INPUT=0$INPUT
fi
+ ok=1
+ fi
done
UMASK=$INPUT
echo ""
@@ -309,6 +287,8 @@ echo "You can optionally have the build run through run-cc.pl, which will"
echo "cause warnings and errors (if any) to be colored yellow and run,"
echo "respectively. This relies on Perl being installed, so if you say yes"
echo "to this without Perl, the option will be ignored."
+echo "NOTE: If you are using MinGW, it is NOT recommended to say yes to"
+echo "this, it may fail."
echo "Would you like to utilize run-cc.pl?"
echo2 "[$TEMP_YN] "
read YN
@@ -329,9 +309,8 @@ echo ""
echo2 "Saving configuration results in config.cache... "
-cat <<EOT >config.cache
-BINDEST="$BINDEST"
-DATDEST="$DATDEST"
+cat <<EOT >$SOURCE_DIR/config.cache
+INSTDEST="$INSTDEST"
RUNGROUP="$RUNGROUP"
UMASK=$UMASK
DEBUG="$DEBUG"
@@ -341,7 +320,7 @@ echo "done."
################################################################################
-# Build the configure string
+# Build the CMake string
################################################################################
Run_CMake