|
From: <ma...@us...> - 2003-12-12 08:37:51
|
Update of /cvsroot/sharedaemon/ui-wx
In directory sc8-pr-cvs1:/tmp/cvs-serv5639
Modified Files:
Changelog
Added Files:
Makefile.am configure
Log Message:
configure script
--- NEW FILE: Makefile.am ---
all:
@cd src && make all
clean:
@cd src && make clean
distclean:
@cd src && make distclean
--- NEW FILE: configure ---
################################################################################
# This file is part of wxInterface. #
# Copyright (C) 2003 Alo Sarv <ma...@us...> #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
################################################################################
#!/bin/sh
##
# Checks for ccache (compiler cache) availability
#
function check_ccache() {
echo -n -e "checking for ccache...\t\t\t\t";
if test -x /usr/local/bin/ccache; then
ccache=/usr/local/bin/ccache;
echo "yes";
elif test -x /usr/bin/ccache; then
ccache=/usr/bin/ccache;
echo "yes"
elif test -x /local/bin/ccache; then
ccache=/local/bin/ccache;
echo "yes"
elif test -x /bin/ccache; then
ccache=/bin/ccache;
echo "yes"
else
echo "no";
fi;
}
##
# Checks for wx-config in various standard locations and sets $wxconfig variable
# to the location of it if found, or calls not_found() if can't find wx-config.
#
function check_wxconfig() {
echo -n -e "checking for wx-config... \t\t\t";
if test -x $wxconfig; then
wxconfig=$wxconfig;
elif test -x /usr/local/bin/wx-config; then
wxconfig=/usr/local/bin/wx-config;
elif test -x /usr/bin/wx-config; then
wxconfig=/usr/bin/wx-config;
elif test -x /bin/wx-config; then
wxconfig=/bin/wx-config;
elif test -x /local/bin/wx-config; then
wxconfig=/local/bin/wx-config;
elif test -x /wx/dynamic/2.4.2/bin/wx-config; then
wxconfig=/wx/dynamic/2.4.2/bin/wx-config;
elif test -x /wx/dynamic/2.5.0/bin/wx-config; then
wxconfig=/wx/dynamic/2.5.0/bin/wx-config;
else
echo "no";
not_found;
fi;
echo "yes";
}
##
# Checks for wxWindows library version by parsing output of wx-config --version
# and testing it against 2.4.0. Exists script with true if version is >= 2.4.0.
#
function check_wxversion() {
echo -e -n "checking for wxWindows version >= 2.4.0...\t";
wxversion=`$wxconfig --version`
wxversion_major=`echo $wxversion | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
wxversion_minor=`echo $wxversion | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
wxversion_patch=`echo $wxversion | \
sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
if test $wxversion_major -ge 2 -a $wxversion_minor -ge 0; then
echo "yes" \
"($wxversion_major.$wxversion_minor.$wxversion_patch)";
else
echo "no";
wrong_version;
fi;
}
##
# Outputs error message about wx-config not being found, and prints suggestions.
#
function not_found() {
cat <<EOF
wx-config was not found in standard locations. This means that either you do not
have wxWindows library installed for your platform (wxGTK for Linux, wxMac for
Mac OS, wxMSW for MS Windows), you are missing wxWindows developer package or
you have installed wxWindows into non-standard location. In the latter case,
rerun configure with --with-wx-config=/path/to/wx-config.
EOF
exit 1;
}
##
# Outputs error message about too old wxWindows library and exits with false.
#
function wrong_version() {
cat<<EOF
wxWindows library was found, but is too old for usage (v$wxversion_major.\
$wxversion_minor.$wxversion_patch). Please download
latest version for your platform ( wxGTK for Linux, wxMac for Mac OS, wxMSW for
MS Windows ) from http://www.wxwindows.org, install it and rerun configure.
EOF
exit 1;
}
##
# Generates Makefile from Makefile.am
#
gen_makefile() {
if test $show_flags = 1; then
print_cpp_flags=" with flags: `$wxconfig --cxxflags` $cppflags $include";
print_link_flags=" with flags: `$wxconfig --libs`";
fi;
echo "creating Makefile";
cp -f Makefile.am Makefile;
echo "creating src/Makefile";
echo "# Automatically generated by configure - from Makefile.am" \
"do not modify!" > src/Makefile;
sed -e "\
s#@CXX@#$ccache `$wxconfig --cxx`#; \
s#@CXX_FLAGS@#`$wxconfig --cxxflags`#; \
s#@LIBS@#`$wxconfig --libs`#; \
s#@CPP_FLAGS@#$cppflags#; \
s#@INCLUDE@#$include#; \
s#@PRINT_CPP_FLAGS@#$print_cpp_flags#;\
s#@PRINT_LINK_FLAGS@#$print_link_flags#;\
" src/Makefile.am >> src/Makefile;
}
##
# Parses command-line options and sets variables as needed.
#
parse_cmdline() {
# defaults
wxconfig=wx-config;
prefix=/usr/local/bin;
optimise=1;
debug=0;
profile=0;
show_flags=0;
patch_sizer=0;
while test $# -gt 0; do
case $1 in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--help)
print_help;
;;
--with-wx-config=*)
wxconfig=$optarg;
;;
--prefix=*)
prefix=$optarg;
;;
--include-dir=*)
include="$include -I$optarg";
include_dir="$include_dir $optarg"
;;
--enable-optimise)
optimise=1;
;;
--disable-optimise)
optimise=0;
;;
--enable-debug)
debug=1;
;;
--disable-debug)
debug=0;
;;
--enable-profile)
profile=1;
;;
--disable-profile)
profile=0;
;;
--has-patched-wxsizer)
patch_sizer=1;
;;
--show-flags)
show_flags=1;
;;
--hide-flags)
show_flags=0;
;;
*)
print_help;
;;
esac;
shift;
done;
echo -e "--with-wx-config\t\t\t\t$wxconfig";
echo -e "--prefix\t\t\t\t\t$prefix";
echo -e "--include-dir\t\t\t\t\t$include_dir";
echo -e -n "--enable-optimise\t\t\t\t";
if test $optimise = 1; then
echo -e "yes";
cppflags="$cppflags -O3"
else
echo -e "no";
fi;
echo -e -n "--enable-debug\t\t\t\t\t";
if test $debug = 1; then
echo -e "yes";
cppflags="$cppflags -g -ggdb -fno-inline"
else
echo -e "no";
fi;
echo -e -n "--enable-profile\t\t\t\t";
if test $profile = 1; then
echo -e "yes";
cppflags="$cppflags -pg"
else
echo -e "no";
fi;
echo -e -n "--has-patched-wxsizer\t\t\t\t";
if test $patch_sizer = 1; then
echo -e "yes";
cppflags="$cppflags -D__HAVE_REMOVE_GROWABLE_COL__"
else
echo -e "no";
echo -e "\tWarning: Sidebar hiding code will be disabled.";
fi;
echo -e -n "--show-flags\t\t\t\t\t";
if test $show_flags = 1; then
echo -e "yes";
else
echo -e "no";
fi;
}
##
# Outputs a detailed help text on command-line options
#
print_help() {
cat <<EOF
Usage:
--help Print this message and return to shell
--with-wx-config=DIR Specify the location of wx-config script
--enable-optimise Optimize code ( recommended for users)
--enable-debug Enable debugging ( recommended for devs)
--enable-profile Enable profiling ( recommended for devs)
--prefix=DIR Install to directory specified by DIR
--include-dir=DIR Additional include directives as needed
--has-patched-wxsizer wxWindows is patched with flexgridsizer
patch ( enables sidebar hiding code )
--show-flags Enable printing compilation/link flags
EOF
exit 0;
}
##
# Main script execution part.
#
parse_cmdline $@;
check_wxconfig;
check_wxversion;
check_ccache;
gen_makefile;
Index: Changelog
===================================================================
RCS file: /cvsroot/sharedaemon/ui-wx/Changelog,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- Changelog 8 Dec 2003 01:11:15 -0000 1.104
+++ Changelog 12 Dec 2003 08:37:48 -0000 1.105
@@ -21,6 +21,9 @@
# ALL ChangeLog entries end with a dot. #
###############################################################################
+2003/13/12 Alo Sarv
+ * Configure script
+
2003/12/08 Alo Sarv
* Fixed frame size/position saving.
* Fixed wierd behaviour reported by Avi if menubar/preferences are
|