2004-07-18 07:19:34 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
# Location of wx:
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
update_prefixes()
|
|
|
|
{
|
|
|
|
includedir="@includedir@"
|
|
|
|
libdir="@libdir@"
|
|
|
|
}
|
|
|
|
prefix="@prefix@"
|
|
|
|
exec_prefix="@exec_prefix@"
|
|
|
|
update_prefixes
|
|
|
|
|
|
|
|
srcdir="@top_srcdir@"
|
|
|
|
builddir="@top_builddir_wxconfig@"
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
# Wrapper script:
|
|
|
|
# -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
exec_prefix_set=no
|
|
|
|
|
|
|
|
# return the absolute path prepending builddir to it if needed
|
|
|
|
makeabs()
|
|
|
|
{
|
|
|
|
path=$1
|
|
|
|
# TODO: this only works under Unix and even there it could be
|
|
|
|
# enhanced to remove ".." and "."
|
|
|
|
if [ `echo $path | sed 's/^\(.\).*/\1/'` != "/" ]; then
|
|
|
|
if [ $path = "." ]; then
|
|
|
|
path=$builddir
|
|
|
|
else
|
|
|
|
path="$builddir/$path"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo $path
|
|
|
|
}
|
|
|
|
|
|
|
|
# these determine wx-config script to use:
|
2004-07-21 06:17:51 -04:00
|
|
|
m_toolkit='.*'
|
2004-07-20 04:44:17 -04:00
|
|
|
m_univ='\(univ\)\?'
|
2004-07-21 06:17:51 -04:00
|
|
|
m_unicode='\(unicode\|ansi\)'
|
|
|
|
m_debug='\(debug\|release\)'
|
2004-07-20 04:44:17 -04:00
|
|
|
m_version='[0-9]\+\.[0-9]\+'
|
2004-07-21 06:17:51 -04:00
|
|
|
m_host=''
|
2004-07-18 07:19:34 -04:00
|
|
|
|
|
|
|
# lists all wx-config scripts that match criteria specified above
|
|
|
|
list_wx_config_scripts()
|
|
|
|
{
|
2004-07-21 06:17:51 -04:00
|
|
|
mask="^${m_toolkit}${m_univ}-${m_unicode}-${m_debug}-${m_version}${m_host}$"
|
|
|
|
|
2004-07-18 07:19:34 -04:00
|
|
|
# if wx-config was called via wx$TOOLCHAIN_NAME-config symlink,
|
|
|
|
# try to extract the mask from it:
|
|
|
|
myname=`basename $0`
|
|
|
|
if test $myname != wx-config ; then
|
|
|
|
toolchain=`echo $myname | sed 's/wx\(.*\)-config/\1/'`
|
|
|
|
if test -f ${libdir}/wx/config/${toolchain} ; then
|
|
|
|
mask=$toolchain
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -d ${libdir}/wx/config ; then
|
2004-07-20 04:44:17 -04:00
|
|
|
(cd ${libdir}/wx/config/ && ls -1 | grep "$mask" 2>/dev/null)
|
2004-07-18 07:19:34 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# find first wx-config script that matches criteria
|
|
|
|
find_wx_config_script()
|
|
|
|
{
|
|
|
|
all_scripts=`list_wx_config_scripts`
|
|
|
|
# unless wxBase was explicitly requested, try to find a GUI version:
|
|
|
|
if test "$m_toolkit" != "base" ; then
|
|
|
|
script=`echo $all_scripts | tr ' ' '\n' | grep -v '^base' | head -n 1`
|
|
|
|
if test "x$script" != "x" ; then
|
|
|
|
echo ${libdir}/wx/config/${script}
|
2004-07-19 16:52:36 -04:00
|
|
|
exit 0
|
2004-07-18 07:19:34 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# otherwise (or if no GUI script was found), use alphabetically 1st script:
|
|
|
|
script=`echo $all_scripts | head -n 1`
|
|
|
|
if test -z "$script" ; then
|
|
|
|
echo "no suitable wx-config script found" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo ${libdir}/wx/config/${script}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# handle options:
|
|
|
|
|
|
|
|
# arguments to pass to the real wx-config script:
|
|
|
|
args=""
|
|
|
|
|
|
|
|
for i in $*; do
|
|
|
|
case "$i" in
|
|
|
|
-*=*) optarg=`echo "$i" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
|
|
|
*) optarg= ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case $i in
|
|
|
|
--inplace)
|
|
|
|
prefix=`makeabs $srcdir`
|
|
|
|
exec_prefix=`makeabs $builddir`
|
|
|
|
exec_prefix_set=yes
|
|
|
|
update_prefixes
|
|
|
|
args="$args --inplace"
|
|
|
|
;;
|
|
|
|
--prefix=*)
|
|
|
|
prefix=$optarg
|
|
|
|
if test $exec_prefix_set = no ; then
|
|
|
|
exec_prefix=$optarg
|
|
|
|
fi
|
|
|
|
update_prefixes
|
|
|
|
;;
|
|
|
|
--exec-prefix=*)
|
|
|
|
exec_prefix=$optarg
|
|
|
|
exec_prefix_set=yes
|
|
|
|
update_prefixes
|
|
|
|
;;
|
|
|
|
|
|
|
|
--list)
|
|
|
|
# list available wx versions:
|
|
|
|
list_wx_config_scripts
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
|
|
|
|
--toolkit=*)
|
|
|
|
m_toolkit=$optarg
|
|
|
|
;;
|
|
|
|
--version=*)
|
|
|
|
m_version=$optarg
|
|
|
|
;;
|
|
|
|
--unicode=*)
|
|
|
|
if test "x$optarg" = "xyes" ; then
|
2004-07-21 06:17:51 -04:00
|
|
|
m_unicode="unicode"
|
2004-07-18 07:19:34 -04:00
|
|
|
else
|
2004-07-21 06:17:51 -04:00
|
|
|
m_unicode="ansi"
|
2004-07-18 07:19:34 -04:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--unicode)
|
2004-07-21 06:17:51 -04:00
|
|
|
m_unicode="unicode"
|
2004-07-18 07:19:34 -04:00
|
|
|
;;
|
|
|
|
--debug=*)
|
|
|
|
if test "x$optarg" = "xyes" ; then
|
2004-07-21 06:17:51 -04:00
|
|
|
m_debug="debug"
|
2004-07-18 07:19:34 -04:00
|
|
|
else
|
2004-07-21 06:17:51 -04:00
|
|
|
m_debug="release"
|
2004-07-18 07:19:34 -04:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--debug)
|
2004-07-21 06:17:51 -04:00
|
|
|
m_debug="debug"
|
2004-07-18 07:19:34 -04:00
|
|
|
;;
|
|
|
|
--universal=*)
|
|
|
|
if test "x$optarg" = "xyes" ; then
|
|
|
|
m_univ="univ"
|
|
|
|
else
|
|
|
|
m_univ=""
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
--universal)
|
|
|
|
m_univ="univ"
|
|
|
|
;;
|
2004-07-21 06:17:51 -04:00
|
|
|
--host=*)
|
|
|
|
m_host="-$optarg"
|
|
|
|
;;
|
2004-07-18 07:19:34 -04:00
|
|
|
*)
|
|
|
|
args="$args $i"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
args="$args --prefix=$prefix --exec-prefix=$exec_prefix"
|
|
|
|
|
|
|
|
script=`find_wx_config_script`;
|
|
|
|
if test "x$script" != "x" ; then
|
|
|
|
$script $args
|
|
|
|
exit $?
|
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|