+dnl check that no more than one toolkit is given and that if none are given that
+dnl we have a default one
+
+AC_MSG_CHECKING(for toolkit)
+
+# In Wine, we need to default to MSW, not GTK or MOTIF
+if test "$wxUSE_WINE" = "yes"; then
+ DEFAULT_DEFAULT_wxUSE_GTK=0
+ DEFAULT_DEFAULT_wxUSE_MOTIF=0
+ DEFAULT_DEFAULT_wxUSE_MSW=1
+ wxUSE_SHARED=no
+ CC=${CC:-winegcc}
+ CXX=${CXX:-wineg++}
+fi
+
+
+if test "$wxUSE_GUI" = "yes"; then
+
+ if test "$USE_BEOS" = 1; then
+ AC_MSG_ERROR([BeOS GUI is not supported yet, use --disable-gui])
+ fi
+
+ if test "$TOOLKIT_GIVEN" = 1; then
+ dnl convert "yes", "any" or a number to 1 and "no" to 0
+ for toolkit in $ALL_TOOLKITS; do
+ var=wxUSE_$toolkit
+ eval "value=\$${var}"
+ if test "x$value" = "xno"; then
+ eval "$var=0"
+ elif test "x$value" != "x"; then
+ eval "$var=1"
+ fi
+
+ if test "x$value" != "x" -a "x$value" != "xyes" -a "x$value" != "xno"; then
+ eval "wx${toolkit}_VERSION=$value"
+ fi
+ done
+ else
+ dnl try to guess the most apropriate toolkit for this platform
+ for toolkit in $ALL_TOOLKITS; do
+ var=DEFAULT_DEFAULT_wxUSE_$toolkit
+ eval "wxUSE_$toolkit=\$${var}"
+ done
+ fi
+
+ dnl we suppose that expr is available (maybe there is a better way to do
+ dnl this? what about using ALL_TOOLKITS? TODO)
+ NUM_TOOLKITS=`expr ${wxUSE_COCOA:-0} + ${wxUSE_GTK:-0} + ${wxUSE_MAC:-0} \
+ + ${wxUSE_MGL:-0} + ${wxUSE_DFB:-0} + ${wxUSE_MICROWIN:-0} \
+ + ${wxUSE_MOTIF:-0} + ${wxUSE_MSW:-0} + ${wxUSE_X11:-0}`
+
+ dnl Allow wxUSE_PM only for OS/2 with EMX.
+ case "${host}" in
+ *-pc-os2_emx | *-pc-os2-emx )
+ NUM_TOOLKITS=`expr ${NUM_TOOLKITS} + ${wxUSE_PM:-0}`
+ esac
+
+ case "$NUM_TOOLKITS" in
+ 1)
+ ;;
+ 0)
+ AC_MSG_ERROR(Please specify a toolkit -- cannot determine the default for ${host})
+ ;;
+ *)
+ AC_MSG_ERROR(Please specify at most one toolkit)
+ esac
+
+ # to be removed when --disable-gtk2 isn't needed
+ if test "x$wxUSE_GTK2" = "xyes"; then
+ wxGTK_VERSION=2
+ elif test "x$wxUSE_GTK2" = "xno"; then
+ wxGTK_VERSION=1
+ fi
+
+ for toolkit in $ALL_TOOLKITS; do
+ var=wxUSE_$toolkit
+ eval "value=\$${var}"
+ if test "$value" = 1; then
+ toolkit_echo=`echo $toolkit | tr '[[A-Z]]' '[[a-z]]'`
+ AC_MSG_RESULT($toolkit_echo)
+ fi
+ done
+else
+ if test "x$host_alias" != "x"; then
+ AC_MSG_RESULT(base ($host_alias hosted) only)
+ else
+ AC_MSG_RESULT(base only)
+ fi
+fi
+