Index: orxonox/trunk/configure.ac
===================================================================
--- orxonox/trunk/configure.ac	(revision 3423)
+++ orxonox/trunk/configure.ac	(revision 3424)
@@ -1,14 +1,33 @@
-#                                               -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
+########################################################################## 
+#   orxonox - the future of 3D-vertical-scrollers			 #
+#									 #
+#   Copyright (C) 2004 orx						 #
+#									 #
+#   This program is free software; you can redistribute it and/or modify #
+#   it under the terms of the GNU General Public License as published by #
+#   the Free Software Foundation; either version 2, or (at your option)  #
+#   any later version.							 #
+#									 #
+#   ### File Specific:							 #
+#   main-programmer: Benjamin Grauer					 #
+#   co-programmer: ...							 #
+#									 #
+#   This is the main configuration File of autoconf.			 #
+#   Please edit this file only, if you exactly know what you are doing.  #
+#   It is quite fragile, and compiling orxonox on different Platforms    #
+#   is only guarantied, if build with the right config.                  #
+##########################################################################
+
+#########################
+## AUTOCONF INIT PHASE ##
+#########################
 AC_PREREQ(2.56)
 AC_INIT(orxonox, 0.2.1-pre-alpha, [orxonox-dev at mail.datacore.ch])
 
-# Detect the canonical host and target build environment.
+## Detect the canonical host and target build environment.
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
-
 AM_INIT_AUTOMAKE
 
@@ -16,11 +35,17 @@
 AC_CONFIG_HEADER([config.h])
 
-
-# Checks for programs.
+#########################
+## Checks for programs ##
+#########################
 AC_PROG_CXX
 AC_HEADER_STDC
 
-### CHECKING  OPTIONAT ARGUMENTS
-## DEBUG-statement
+##################################
+## CHECKING  OPTIONAL ARGUMENTS ##
+##################################
+
+#-----------------#
+# DEBUG-statement #
+#-----------------#
 DEBUG=no
 AC_MSG_CHECKING([if DEBUG-mode should be enabled])
@@ -29,14 +54,14 @@
 	 DEBUG=$enableval)
 
-if test "$DEBUG" = "no"; then 
+if test x$DEBUG = xno; then 
 	echo "no"
-	echo " -> Setting debuglevel to 1. Like this you can still see errors."
-	DEBUG=1
-elif test "$DEBUG" = yes; then
+	echo " -> Setting debuglevel to 3. (orxonox is still in Development. It really is needed."
+	DEBUG=3
+elif test x$DEBUG = xyes; then
 	echo "yes"
-	echo " -> Setting debuglevel to 3. HARD DEBUG MODE!!."
-	DEBUG=3
+	echo " -> Setting debuglevel to 4. HARD DEBUG MODE!!."
+	DEBUG=4
 else       
-	echo "yes set to $DEBUG"
+	echo "yes: setting debuglevel to to $DEBUG"
 fi
 	AC_DEFINE_UNQUOTED(DEBUG, $DEBUG, [in which debug mode we are])
@@ -44,53 +69,63 @@
 AC_SUBST(DEBUG)
 
-## GTK-disabled
+#--------------#
+# GTK-disabled #
+#--------------#
 AC_MSG_CHECKING([if gtk should be enabled])
 AC_ARG_WITH([gtk], 
 	AC_HELP_STRING(	[--without-gtk], 
 	[Prevents GTK from being loaded]), [def_gtk=no], [def_gtk=yes]) 
-if test "$def_gtk" = yes; then 
+if test x$def_gtk = xyes; then 
   echo "yes"
 fi 
-if test "$def_gtk" = no; then 
+if test x$def_gtk = xno; then 
   echo "no"
 fi
 
-## gThread-disabled
+#------------------#
+# gThread-disabled #
+#------------------#
 AC_MSG_CHECKING([if gThread should be enabled])
 AC_ARG_WITH([gthread], 
-	AC_HELP_STRING(	[--without-gthread], 
+	AC_HELP_STRING(	[--without-gthread],
 	[Prevents gThread from being loaded]), [def_gthread=no], [def_gthread=yes]) 
-if test "$def_gthread" = yes; then 
+if test x$def_gthread = xyes; then 
   echo "yes"
 fi 
-if test "$def_gthread" = no; then 
+if test x$def_gthread = xno; then 
   echo "no"
 fi
 
-## pthread-disabled
+#------------------#
+# pthread-disabled #
+#------------------#
 AC_MSG_CHECKING([if pthread should be enabled])
 AC_ARG_WITH([pthread], 
 	AC_HELP_STRING(	[--without-pthread], 
 	[Prevents pthread from being loaded]), [def_pthread=no], [def_pthread=yes]) 
-if test "$def_pthread" = yes; then 
+if test x$def_pthread = xyes; then 
   echo "yes"
 fi 
-if test "$def_pthread" = no; then 
+if test x$def_pthread = xno; then 
   echo "no"
 fi
 
-## libCurl disabled?
+#------------------#
+# libCurl-disabled #
+#------------------#
 AC_MSG_CHECKING([if libcURL should be enabled])
 AC_ARG_WITH([curl], 
 	AC_HELP_STRING(	[--without-curl], 
 	[Prevents libcURL from being loaded]), [def_curl=no], [def_curl=yes]) 
-if test "$def_curl" = yes; then 
+if test x$def_curl = xyes; then 
   echo "yes"
 fi 
-if test "$def_curl" = no; then 
+if test x$def_curl = xno; then 
   echo "no"
 fi
 
-### SDL_image-disable
+#-------------------#
+# SDL_image-disable #
+#-------------------#
 def_sdl_image=yes
 AC_MSG_CHECKING([if SDL_image should be enabled])
@@ -98,37 +133,49 @@
 	AC_HELP_STRING(	[--without-sdl-image], 
 	[Prevents SDL_image from being loaded]), [def_sdl_image=no]) 
-if test "$def_sdl_image" = yes; then 
+if test x$def_sdl_image = xyes; then 
   echo "yes"
 fi 
-if test "$def_sdl_image" = no; then 
+if test x$def_sdl_image = xno; then 
   echo "no"
 fi
-
-
-### SubProject-enable
-def_sdl_image=yes
+#-------------------#
+# SubProject-enable #
+#-------------------#
+def_sub_projects=no
 AC_MSG_CHECKING([if the SubProjects should be built])
 AC_ARG_ENABLE([sub-projects], 
 	AC_HELP_STRING(	[--enable-sub-projects], 
-	[also builds the subProjects by default]), [def_sub_projects=yes]) 
-if test "$def_sub_projects" = yes; then 
+	[also builds the subProjects while make from srcdir]), [def_sub_projects=yes]) 
+if test x$def_sub_projects = xyes; then
   echo "yes"
 fi 
-if test "$def_sub_projects" = no; then 
+if test x$def_sub_projects = xno; then
   echo "no"
 fi
 AM_CONDITIONAL(SUB_PROJECTS, test x$def_sub_projects = xyes)
 
-## PROGRAMM CHECKING
-# checking for Doxygen
+#######################
+## PROGRAMM CHECKING ##
+## 3. party Programs ##
+#######################
+
+#----------------------#
+# checking for Doxygen #
+#----------------------#
 AC_PATH_PROG(DOXYGEN, doxygen)
 AM_CONDITIONAL(DOXYGEN, test $DOXYGEN)
 
-### CHECKING FOR SYSTEM ###
+#########################
+## CHECKING FOR SYSTEM ##
+#########################
+## here the system is checked, and openGL is included
+## also checking for SDL on differen Systems
 
 AC_MSG_CHECKING([for System])
 ## checking for openGL-environment and other sys-specific parameters
 case "$target" in
-### WINDOWS ###
+#---------#
+# WINDOWS #
+#---------#
   *-*-mingw32*)
 echo "mingw-WINDOWS detected"
@@ -146,5 +193,5 @@
 #   checking for Windows openGl library
     AC_CHECK_LIB([opengl32], [main], FOUND_opengl32=yes, "gl/gl.h")
-    if test "$FOUND_opengl32" = "yes" ; then
+    if test x$FOUND_opengl32 = xyes ; then
 	LIBS="$LIBS -lopengl32"
     else
@@ -157,10 +204,10 @@
 
 # cheking for GLU-header
-    AC_CHECK_HEADERS(GL/glu.h ,,
+    AC_CHECK_HEADERS([GL/glu.h] ,,
       [AC_MSG_ERROR([cannot find opengl headers]) ])
 
 # checking for libGLU
     AC_CHECK_LIB([glu32], [main], FOUND_glu32=yes)
-    if test "$FOUND_glu32" = "yes" ; then
+    if test x$FOUND_glu32 = xyes ; then
 	LIBS="$LIBS -lGLU32"
     else
@@ -174,14 +221,14 @@
 # checking for mingw32
     AC_CHECK_LIB([mingw32], [main], FOUND_mingw32=yes)
-    if test $FOUND_mingw32 = "yes"; then 
+    if test x$FOUND_mingw32 = xyes; then 
 	LIBS="$LIBS -lmingw32"
     fi
 # checking for SDL-headers
-    AC_CHECK_HEADERS(SDL/SDL.h ,,
+    AC_CHECK_HEADERS([SDL/SDL.h] ,,
       [AC_MSG_ERROR([cannot find SDL headers]) ])
 
 #checking for libSDL
     AC_CHECK_LIB([sdlmain], [main], FOUND_sdlmain=yes)
-    if test "$FOUND_sdlmain" = "yes" ; then
+    if test x$FOUND_sdlmain = xyes ; then
        LIBS="$LIBS -lsdlmain"
     else
@@ -193,5 +240,5 @@
     fi
     AC_CHECK_LIB([sdl], [main], FOUND_sdl=yes)
-    if test "$FOUND_sdl" = "yes" ; then
+    if test x$FOUND_sdl = xyes ; then
        LIBS="$LIBS -lsdl"
     else
@@ -204,6 +251,7 @@
 
     ;;
-
-### LINUX ###
+#-------#
+# LINUX #
+#-------#
  *-*-linux*)
 echo "Linux detected"
@@ -214,10 +262,10 @@
 LDFLAGS="-L/usr/lib/opengl/xorg-x11/lib -L/usr/Mesa-6.0.1/lib -L/usr/X11R6/lib $LDFLAGS"
 # checking gl header
-   AC_CHECK_HEADERS(GL/gl.h ,,
+   AC_CHECK_HEADERS([GL/gl.h] ,,
       [AC_MSG_ERROR([cannot find opengl headers]) ])
 
 #  checking for Unix GL
    AC_CHECK_LIB([GL], [glLoadIdentity], FOUND_GL=yes)
-   if test "$FOUND_GL" = "yes" ; then
+   if test x$FOUND_GL = xyes ; then
      LIBS="$LIBS -lGL"
    else
@@ -230,9 +278,9 @@
 
 # cheking for GLU-header
-    AC_CHECK_HEADERS(GL/glu.h ,,
+    AC_CHECK_HEADERS([GL/glu.h] ,,
       [AC_MSG_ERROR([cannot find opengl headers]) ])
 
     AC_CHECK_LIB([GLU], [gluProject], FOUND_GLU=yes)
-    if test "$FOUND_GLU" = "yes" ; then
+    if test x$FOUND_GLU = xyes ; then
       LIBS="$LIBS -lGLU"
     else
@@ -245,10 +293,10 @@
 
 # checking for SDL-headers
-    AC_CHECK_HEADERS(SDL/SDL.h ,,
+    AC_CHECK_HEADERS([SDL/SDL.h] ,,
       [AC_MSG_ERROR([cannot find SDL headers]) ])
 
 # checking for SDL-lib
     AC_CHECK_LIB([SDL], [main], FOUND_SDL=yes)
-     if test "$FOUND_SDL" = "yes" ; then
+     if test x$FOUND_SDL = xyes ; then
        LIBS="$LIBS -lSDL"
      else
@@ -270,8 +318,9 @@
 #    LIBS="$LIBS $SDL_LIBS"
     ;;
-
-### OS X ###
+#-----------#
+# MAC -OS X #
+#-----------#
  *darwin*)
-echo "OS X detected"
+ echo "OS X detected"
 
  osX="yes"
@@ -279,11 +328,17 @@
  CPPFLAGS="-I/sw/include $CPPFLAGS"
 # checking gl header
-   AC_CHECK_HEADERS(OpenGL/gl.h ,,
+   AC_CHECK_HEADERS([OpenGL/gl.h] ,,
       [AC_MSG_ERROR([cannot find opengl headers]) ])
 # cheking for GLU-header
-    AC_CHECK_HEADERS(OpenGL/glu.h ,,
+    AC_CHECK_HEADERS([OpenGL/glu.h] ,,
       [AC_MSG_ERROR([cannot find opengl headers]) ])
 
    LIBS="$LIBS -framework OpenGL"
+
+       SDL_CFLAGS=`sdl-config --cflags`
+       SDL_LIBS=`sdl-config --libs`
+       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
+       LIBS="$LIBS $SDL_LIBS"
+
 
 # checking for SDL-headers
@@ -298,8 +353,4 @@
 #      )
 
-       SDL_CFLAGS=`sdl-config --cflags`
-       SDL_LIBS=`sdl-config --libs`
-       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
-       LIBS="$LIBS $SDL_LIBS"
 
     ;;
@@ -311,14 +362,20 @@
 AC_SUBST(MSBITFIELDS)
 
-## check for SDL_Image
-if test "$def_sdl_image" = "yes"; then
+###################################
+## CHECKING FOR HEADERS AND LIBS ##
+###################################
+
+#-----------#
+# SDL_Image #
+#-----------#
+if test x$def_sdl_image = xyes; then
 # checking for SDL_image-headers
-  AC_CHECK_HEADERS(SDL/SDL_image.h ,,
+  AC_CHECK_HEADERS([SDL/SDL_image.h] ,,
       [echo "sdl_image not found. falling back to other options"; def_sdl_image=no ])
 fi
-if test "$def_sdl_image" = "yes"; then
+if test x$def_sdl_image = xyes; then
 # checking for SDL_image-lib
-  AC_CHECK_LIB([SDL_image], [main], FOUND_SDL_image=yes)
-     if test "$FOUND_SDL_image" = "yes" ; then
+  AC_CHECK_LIB([SDL_image], [main], [FOUND_SDL_image=yes])
+     if test x$FOUND_SDL_image = xyes ; then
        LIBS="$LIBS -lSDL_image"
      else
@@ -331,14 +388,16 @@
 fi
 
-
-if test "$def_sdl_image" = "no"; then
- ## checking for libjpeg
- AC_CHECK_HEADERS(jpeglib.h ,jpegHeader="yes",
-        jpegHeader="no")
- if test $jpegHeader = "no"; then
+## case no SDL-image:
+if test x$def_sdl_image = xno; then
+#---------#
+# libjpeg #
+#---------#
+ AC_CHECK_HEADERS([jpeglib.h], [jpegHeader="yes"],
+        [jpegHeader="no"])
+ if test xjpegHeader = xno; then
 	echo " not including jpeg."
  else
-  AC_CHECK_LIB([jpeg], [main], FOUND_jpeg=yes)
-    if test "$FOUND_jpeg" = "yes" ; then
+  AC_CHECK_LIB([jpeg], [main], [FOUND_jpeg=yes])
+    if test x$FOUND_jpeg = xyes ; then
       LIBS="$LIBS -ljpeg"
     else
@@ -351,12 +410,14 @@
  fi
 
- ## checking for libpng
- AC_CHECK_HEADERS(png.h ,pngHeader="yes",
-        pngHeader="no")
- if test $pngHeader = "no"; then
+#--------#
+# libpng #
+#--------#
+ AC_CHECK_HEADERS([png.h], [pngHeader="yes"],
+        [pngHeader="no"])
+ if test x$pngHeader = xno; then
 	echo " not including png."
  else
   AC_CHECK_LIB([png], [main], FOUND_png=yes)
-    if test "$FOUND_png" = "yes" ; then
+    if test x$FOUND_png = xyes ; then
       LIBS="$LIBS -lpng"
     else
@@ -370,6 +431,8 @@
 fi
 
-## checking for GTK
-if test "$def_gtk" = yes; then 
+#-----#
+# GTK #
+#-----#
+if test x$def_gtk = xyes; then 
 
 	#PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.0.3 gthread-2.0 >= 2.0.3, have_gtk2=yes, have_gtk2=no)
@@ -390,6 +453,8 @@
 AM_CONDITIONAL(HAVE_GTK2, test x$have_gtk2 = xyes)
 
-## checking for gThread
-if test "$def_gthread" = yes; then 
+#---------#
+# gThread #
+#---------#
+if test x$def_gthread = xyes; then 
 
 	AC_MSG_CHECKING([for gthread])
@@ -409,8 +474,10 @@
 AM_CONDITIONAL(HAVE_GTHREAD, test x$have_gthread = xyes)
 
-## checking for libcURL
-if test "$def_curl" = yes; then 
-
- AC_CHECK_HEADERS([curl/curl.h], curlHeader="yes", curlHeader="no")
+#---------#
+# libcURL #
+#---------#
+if test x$def_curl = xyes; then 
+
+ AC_CHECK_HEADERS([curl/curl.h], [curlHeader="yes"], [curlHeader="no"])
  AC_CHECK_LIB([curl], [main], [FOUND_curl=yes])
  if test x$curlHeader = xyes & test x$FOUND_curl = xyes ; then
@@ -419,5 +486,5 @@
   CURLCFLAGS=`curl-config --cflags`
   AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [if we have CURL])
- else 
+ else
   have_curl=no
  fi
@@ -428,15 +495,18 @@
 AM_CONDITIONAL(HAVE_CURL, test x$have_curl = xyes)
 
-
-##checking for pthread
+#---------#
+# pthread #
+#---------#
 if test x$def_pthread = xyes ; then
  if test x$have_gthread = xyes ; then
-  AC_CHECK_HEADERS([pthread.h], pthreadHeader="yes", pthreadHeader="no")
-  AC_CHECK_LIB([pthread], [main], FOUND_pthread=yes)
-   if test "$FOUND_pthread" = "yes" ; then
+  AC_CHECK_HEADERS([pthread.h], [pthreadHeader="yes"], [pthreadHeader="no"])
+  AC_CHECK_LIB([pthread], [main], [FOUND_pthread=yes])
+   if test x$FOUND_pthread = xyes ; then
       LIBS="$LIBS -lpthread"
    fi
  fi
 fi
+
+
 # FIXME: Replace `main' with a function in `-lm':
  AC_CHECK_LIB([m], [main])
@@ -454,4 +524,7 @@
 AC_CHECK_FUNCS([bzero sqrt])
 
+######################
+## OUTPUT CONFIGURE ##
+######################
 AC_CONFIG_FILES([Makefile
                  src/Makefile
