Description: Improve configure probes related to wxWidgets
 Determine wxGTK vs wxMac by looking at output of wx-config --cppflags
 rather than probing for particular libraries, the names of which can
 vary (for example, depending on the GTK+ major version in use).
 .
 Don't hard code --version=3.0 in wx-config arguments.  That way the
 user can specify a different version via alternatives or explicitly on the
 configure command line, e.g.:
 .
 ./configure wxconfig='/usr/bin/wx-config --version=3.1'
 .
 Remove probes for GTK and glib, which don't seem to be needed.
Author: Olly Betts <olly@survex.com>
Bug-Debian: https://bugs.debian.org/933471
Forwarded: no
Last-Update: 2019-08-01

--- a/configure.ac
+++ b/configure.ac
@@ -71,21 +71,15 @@
 AC_CHECK_LIB(readline, main, [readline=true; 
                  AC_DEFINE([HAVE_READLINE],1,[Readline library])],
 		 [readline=false], [-lcurses])	
-wxwin=false
-AC_CHECK_LIB(gtk-x11-2.0, main, [hasx11gtk2=true], [])
-if test "x$hasx11gtk2" = "x" ; then
-  AC_MSG_NOTICE([Does not have X11 GTK2])
-  AC_DEFUN([AM_PATH_GLIB_2_0], [])
-  AC_DEFUN([AM_PATH_GTK_2_0], [])
-fi
-if test "$hasx11gtk2" = "true" ; then
-  AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR(You should get glib 2.0.0 or better.))
-  AM_PATH_GTK_2_0(2.0.0,havegtk_am=yes,havegtk_am=no)
-  CFLAGS="${CFLAGS} ${g76GTK_CFLAGS} ${GLIB_CFLAGS}"
+wxwin=true
+case `$wxconfig --cppflags 2> /dev/null` in
+  *-D__WXGTK__*) wx_gtk=true ;;
+  *-D__WXMAC__*) wx_mac=true ;;
+  "") wxwin=false ;;
+esac
+if test "$wxwin" = true ; then
+  AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])
 fi
-
-AC_CHECK_LIB(wx_gtk2u_core-3.0, main, [wxwin=true; wx_gtk=true; AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])], [], [-L/usr/lib64 -L/usr/lib ${GTK_LIBS} ${GLIB_LIBS} ])
-AC_CHECK_LIB(wx_mac_core-3.0, main, [wxwin=true; wx_mac=true; AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])])
 AC_CHECK_LIB(fftw3, fftw_malloc, [fftw=true; AC_DEFINE(HAVE_FFTW,1,[FFTW library])], [fftw=false], [-L/usr/lib64 -L/usr/lib])
 AC_CHECK_LIB(GL, main, [libgl=true], [libgl=false], [-L/usr/X11R6/lib -L/usr/X11R6/lib64])
 AC_CHECK_LIB(pthread, main, [pthread=true], [pthread=false])
@@ -384,12 +378,7 @@
        if test "$debug" = "true"; then
          wxdebug="--debug"
        fi  
-      if test "x$wx_gtk" != "x" ; then
-       ctlib_graphics="$ctlib_graphics `$wxconfig $wxdebug --version=3.0  --libs std,gl` ${GTK_LIBS} ${GLIB_LIBS}"
-       
-      elif test "x$wx_mac" != "x" ; then
-        ctlib_graphics="$ctlib_graphics `$wxconfig $wxdebug --version=3.0 --libs std,gl`"
-      fi
+       ctlib_graphics="$ctlib_graphics `$wxconfig $wxdebug --libs std,gl`"
     fi
   fi
   if test "$wxwin" = "true" ; then
@@ -462,8 +451,8 @@
 
 if test "$wxwin" = "true" ; then
   if test "$wx_gtk" = "true"  -o "$wx_mac" = "true" ; then
-    wxcflags=`$wxconfig $wxdebug --cxxflags --version=3.0`
-    #wxlibs=`$wxconfig --libs`
+    wxcflags=`$wxconfig $wxdebug --cxxflags`
+    wxlibs=`$wxconfig --libs`
   else
 	wxcflags="-D__WXMSW__ -D__WIN32__ -D__GNUWIN32__"
         wxlibs="-lwx -lglui -ljpeg -lxpm -lzlib -ltiff"
