What to do if you want to incorporate our MPE-code in Flight Gear in a new CVS-version (0.9 tested):

1. Changes to top-level "configure.ac"
--------------------------------------

1a.
Add the following code somewhere. It is currently added after the checks for Network OLK (around line 90).

### BEGIN BLOCK ###

# Specify that we want to build "ICE MPE-project" networking support
AC_ARG_WITH(network_mpe, [  --with-network-mpe      Include ICE MPE-project networking support])
if test "x$with_network_mpe" = "xno" ; then
	echo "Building without ICE MPE-project networking support"
else
	echo "Checking for libaries needed by ICE MPE-project modules"
	AC_CHECK_LIB(plibul,gettimeofday,,exit 1)
	AC_CHECK_LIB(Bitmanip,bfx,exit 1)
	AC_CHECK_LIB(lzo,lzo1x_1_compress,,exit 1)
	AC_CHECK_LIB(z,compress,,exit 1)
	AC_DEFINE([FG_NETWORK_MPE], 1, [Define to build with ICE MPE-project networking support])
	echo "Building with ICE MPE-project networking support"
fi
AM_CONDITIONAL(ENABLE_NETWORK_MPE, test "x$with_network_mpe" != "xno")

### END BLOCK ###

1b.
After this we have insert the Makefile for NetworkMPE in the list of configure directories. This is list usually found at the end of the file.
We add it somewhere is the list (for example right after NetworkOLK), the entry looks as following:

### BEGIN BLOCK ###

AC_CONFIG_FILES([ \
	Makefile
	...
	...
	src/Navaids/Makefile \
	src/Network/Makefile \
	src/NetworkOLK/Makefile \
	src/NetworkMPE/Makefile \     <--our line
	src/Objects/Makefile \
	...
	...
])

### END BLOCK ###

This was all for the toplevel "configure.ac" file.



2. Changes to "src/Makefile.am"
-------------------------------

2a.
Add the following code at the start of the file:

### BEGIN BLOCK ###

if ENABLE_NETWORK_MPE
NETWORK_MPE_DIR = NetworkMPE
else
NETWORK_MPE_DIR = 
endif

### END BLOCK ###

NOTE: Do NOT use tabs/space to indent the code, some versions of automake/autoconf will not like this.


2b.
Now, insert the marked line in the following list of subdirs:

### BEGIN BLOCK ###

SUBDIRS = \
	Include \
	...
	...
	Navaids \
	$(NETWORK_DIRS) \
	$(NETWORK_MPE_DIR) \     <-- our line
	...
	...
	Main

### END BLOCK ###



3. Changes to "src/Main/Makefile.am"
------------------------------------

3a.
Add the following code at the start of the file:

### BEGIN BLOCK ###

if ENABLE_NETWORK_MPE
NETWORK_MPE_LIB = $(top_builddir)/src/NetworkMPE/libNetworkMPE.a
else
NETWORK_MPE_LIB = 
endif

### END BLOCK ###

NOTE: Do NOT use tabs/space to indent the code, some versions of automake/autoconf will not like this.


3b.

Now, insert the marked line in the following list of "fgfs_LDADD":

### BEGIN BLOCK ###

fgfs_LDADD = \ 
	$(top_builddir)/src/Aircraft/libAircraft.a =
	...
	...
	$(NETWORK_LIBS) \
	$(NETWORK_MPE_LIB) \      <-- our line
	....

### END BLOCK ###



4. Changes to "src/Main/fg_init.cxx"
------------------------------------

4a.
Add the following code in the middle of the include, for example just before '#include "fg_init"':

### BEGIN BLOCK ###

#ifdef FG_NETWORK_MPE
#	include <NetworkMPE/mpeHandlerClient.h>
#endif

### END BLOCK ###

NOTE: Do NOT use tabs/space to indent the code, the PRE-processor DOES NOT ACCEPT THIS !

4b.
Add the following code somewhere in the code of the function "bool fgInitSubSystems(void)". I've added it after the ATC-manager around line 1125.

### BEGIN BLOCK ###

#ifdef FG_NETWORK_MPE
	/////////////////////////////////////////////////
	// Initialise the Multiplayer Engine Manager
	/////////////////////////////////////////////////
	if (fgGetBool("/sim/networking/mpe/enabled)) {
		SG_LOG(SG_GENERAL, SG_INFO, "  ICE Multi Player Engine Manager");
		globals->get_subsystem_mgr()->add(FGSubsystemMgr::GENERAL, "mpe", new mpeHandlerClient);
		fgSetBool("/sim/networking/mpe/enabled,true);
	}
#endif /* FG_NETWORK_MPE */

### END BLOCK ###



5. Copy NetworkMPE-directory to FlightGear sources
--------------------------------------------------

Copy the directory "NetworkMPE" to the directory "src/NetworkMPE" of the Flight Gear top-level directory.
(i.e.  "cp -R NetworkMPE /data/ace/src/FlightGear/src")



6. Run "autogen.sh" in Flight Gear toplevel directory
-----------------------------------------------------

Just do what the title says :) Everything you've done previously with the ".ac" and ".am" files get parsed in this step so it vital you do this and see no errors/warning.


7. Run "configure" with lots of parameters
------------------------------------------

7a.
Run "configure" in the toplevel of the Flight Gear sources with the following parameters: 

### BEGIN BLOCK ###

 ./configure --prefix=/data/ace/mpe-cvs --with-network-mpe

### END BLOCK ###

This will check if you have met all dependencies needed by Flight Gear AND my network module. Any errors, such as missing header files, should be mentioned here.
Headers/functions that might give problems are "bfx/bfi (both in libBitmanip.a), ulClock timeGeTime@0 (can be found in libwinmm.a on Cygwin)

7b.
A good suggestion when compiling on "rover.kbs.twi.tudelft.nl" (my host atm) is using the following shell commands
be for starting configure/make etc:

### BEGIN BLOCK ###

unset CPPFLAGS
unset LDFLAGS

export      CPPFLAGS="-I/data/ace/mpe-cvs/include -I/data/ace/mpe/include"
export       LDFLAGS="-L/data/ace/mpe-cvs/lib     -L/data/ace/mpe/lib"
export LD_LIBRARY_PATH="/data/ace/mpe-cvs/lib:/data/ace/mpe/lib"
export             PATH=/data/ace/mpe-cvs/bin:/data/ace/mpe/bin:$PATH

### END BLOCK ###


And with this doesn't work, try (re-)compiling plib, simgear for CVS.



8. Compiling Flight Gear
------------------------

After a successful run of "configure" (SEE STEP 7 !) just type: "make && make install" (without quotes)
This should do the trick. Also remember using step 7b if your compiling on "rover".

9. Starting Flight Gear with MPE
--------------------------------

Flight Gear must be started with the parameter "--prop:/sim/networking/mpe/enabled=1". After Flight Gear starts up you should see a whole new set of properties on "/sim/networking/mpe". This means that the engine is active. The debug-window should also give some info about the status of the engine.



10. Happy experimenting !
-------------------------

THE END


Written by Leon Otte (s0meb0dy_else@yahoo.com, fg_ace@yahoo.com, test12345@zeelandnet.nl)
