#! /bin/sh /usr/share/dpatch/dpatch-run
## 05-autoconf-fox.dpatch by Thomas Girard <thomas.g.girard@free.fr>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: add autoconf support for Fox

@DPATCH@
--- ACE_wrappers.orig/m4/ace.m4
+++ ACE_wrappers/m4/ace.m4
@@ -501,6 +501,7 @@
  ACE_ENABLE_QT_REACTOR
  ACE_ENABLE_TK_REACTOR
  ACE_ENABLE_XT_REACTOR
+ ACE_ENABLE_FOX_REACTOR
 
  # placeholder for WxWindows/wxWidgets support
  AM_CONDITIONAL([BUILD_WXWINDOWS], false)
@@ -1543,4 +1544,58 @@
                [test X$ace_user_enable_xt_reactor = Xyes])
 ])
 
+# ACE_PATH_FOX
+#---------------------------------------------------------------------------
+AC_DEFUN([ACE_PATH_FOX],
+[AC_ARG_WITH([fox-config],
+ AS_HELP_STRING([--with-fox-config=PATH],
+                [path to fox-config [[automatic]]]),
+ [ ac_fox_config="${withval}" ])
+ if test X"${ac_fox_config}" = X; then
+   AC_PATH_PROG([FOXCONFIG], [fox-config], [], [])
+ else
+  AC_MSG_CHECKING([whether ${ac_fox_config} exists])
+   if test -f "${ac_fox_config}"; then
+     FOXCONFIG="${ac_fox_config}"
+     AC_MSG_RESULT([yes])
+   else
+     AC_MSG_RESULT([no])
+   fi
+ fi
+ if test X"${FOXCONFIG}" != X; then
+   ACE_FOX_CPPFLAGS=-I/usr/include/fox-1.6
+   ACE_FOX_LIBS=-lFOX-1.6
+   AC_SUBST(ACE_FOX_CPPFLAGS)
+   AC_SUBST(ACE_FOX_LIBS)
+ fi
+])
 
+# ACE_ENABLE_FOX_REACTOR
+#---------------------------------------------------------------------------
+AC_DEFUN([ACE_ENABLE_FOX_REACTOR],
+[AC_REQUIRE([ACE_PATH_FOX])
+AC_ARG_ENABLE([fox-reactor],
+               AS_HELP_STRING([--enable-fox-reactor],
+                              [build support for the FoxReactor [[no]]]),
+               [case "${enableval}" in
+                 yes)
+                   AS_IF([test X"${FOXCONFIG}" != X],
+                         [ace_user_enable_fox_reactor=yes],
+                         [AC_MSG_ERROR([ACE_FoxReactor cannot be enabled: fox-config not found.])])
+                   ;;
+                 no)
+                   ace_user_enable_fox_reactor=no
+                   ;;
+                 *)
+                   AC_MSG_ERROR([bad value ${enableval} for --enable-fox-reactor])
+		   ;;
+	       esac],
+               [
+                 ace_user_enable_fox_reactor=no
+               ])
+AM_CONDITIONAL([BUILD_FOX], [test X$ace_user_enable_fox_reactor = Xyes])
+AM_CONDITIONAL([BUILD_ACE_FOXREACTOR],
+               [test X$ace_user_enable_fox_reactor = Xyes])
+AM_CONDITIONAL([BUILD_TAO_FOXRESOURCE],
+               [test X$ace_user_enable_fox_reactor = Xyes])
+])
--- ACE_wrappers.orig/bin/MakeProjectCreator/config/global.features
+++ ACE_wrappers/bin/MakeProjectCreator/config/global.features
@@ -90,6 +90,8 @@
 ace_tkreactor    = 1
 // Use FlReactor
 ace_flreactor    = 1
+// Use FoxReactor
+ace_foxreactor   = 1
 
 // Features for TAO support for various GUI libraries
 // Use QtResources for TAO
@@ -100,6 +102,8 @@
 tao_tkresource    = 1
 // Use FlResources for TAO
 tao_flresource    = 1
+// Use FoxResources for TAO
+tao_foxresource   = 1
 
 //Use the ZIP_Wrapper feature for when using the ZIP wrapper classes
 ZIP_Wrapper = 0
--- ACE_wrappers.orig/ace/ace.mwc
+++ ACE_wrappers/ace/ace.mwc
@@ -6,6 +6,7 @@
   ace.mpc
   ace_for_tao.mpc
   ace_flreactor.mpc
+  ace_foxreactor.mpc
   ace_qtreactor.mpc
   ace_tkreactor.mpc
   ace_xtreactor.mpc
--- ACE_wrappers.orig/TAO/configure.ac
+++ ACE_wrappers/TAO/configure.ac
@@ -183,6 +183,7 @@
 ACE_ENABLE_QT_REACTOR
 ACE_ENABLE_TK_REACTOR
 ACE_ENABLE_XT_REACTOR
+ACE_ENABLE_FOX_REACTOR
 ACE_PATH_ZZIP
 ACE_PATH_ZLIB
 
