Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.

Sat, 07 Nov 2015 22:34:28 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 07 Nov 2015 22:34:28 +0100
changeset 410
e3f8a51b566a
parent 409
cdf68044adaf
child 411
ae85e91dcc58

Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.

brewco/brewco.h file | annotate | diff | comparison | revisions
brewpanel/brewpanel.c file | annotate | diff | comparison | revisions
brewpanel/brewpanel.h file | annotate | diff | comparison | revisions
brewpanel/dlgBrew.c file | annotate | diff | comparison | revisions
brewpanel/dlgBrew.h file | annotate | diff | comparison | revisions
brewpanel/sdlgui.c file | annotate | diff | comparison | revisions
brewpanel/sdlgui.h file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
--- a/brewco/brewco.h	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewco/brewco.h	Sat Nov 07 22:34:28 2015 +0100
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <getopt.h>
+#include <limits.h>
 
 #ifndef HAVE_WIRINGPI_H
 #include <pthread.h>
--- a/brewpanel/brewpanel.c	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewpanel/brewpanel.c	Sat Nov 07 22:34:28 2015 +0100
@@ -24,6 +24,7 @@
 #include "sdlgui.h"
 #include "dlgBrew.h"
 
+#ifdef HAVE_SDL_SDL_H
 
 int			DebugPanel = FALSE;		/* Logfile debugging		*/
 int			debug = FALSE;			/* Console debugging		*/
@@ -161,4 +162,13 @@
     return 0;
 }
 
+#else
 
+int main(int argc, char *argv[])
+{
+    fprintf(stderr, "brewpanel not compiled because SDL is missing.\n");
+    return 1;
+}
+
+#endif
+
--- a/brewpanel/brewpanel.h	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewpanel/brewpanel.h	Sat Nov 07 22:34:28 2015 +0100
@@ -23,8 +23,9 @@
 #include <signal.h>
 #include <getopt.h>
 
+#ifdef HAVE_SDL_SDL_H
 #include <SDL.h>
 #include <SDL_ttf.h>
-
+#endif
 
 #endif
--- a/brewpanel/dlgBrew.c	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewpanel/dlgBrew.c	Sat Nov 07 22:34:28 2015 +0100
@@ -27,6 +27,8 @@
 #include "dlgBrew.h"
 #include "sdlgui.h"
 
+#ifdef HAVE_SDL_SDL_H
+
 extern SDL_Surface	*PAN_surface;
 extern int		my_shutdown;
 
@@ -102,3 +104,4 @@
     return TRUE;
 }
 
+#endif
--- a/brewpanel/dlgBrew.h	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewpanel/dlgBrew.h	Sat Nov 07 22:34:28 2015 +0100
@@ -1,7 +1,9 @@
 #ifndef	_DLGBREW_H
 #define	_DLGBREW_H
 
+#ifdef HAVE_SDL_SDL_H
 
 int Dialog_BrewDlg(void);
 
 #endif
+#endif
--- a/brewpanel/sdlgui.c	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewpanel/sdlgui.c	Sat Nov 07 22:34:28 2015 +0100
@@ -25,6 +25,9 @@
 
 #include "brewpanel.h"
 #include "sdlgui.h"
+
+#ifdef HAVE_SDL_SDL_H
+
 #include "lcdfont10x16.h"
 
 
@@ -695,4 +698,5 @@
 
 }
 
+#endif
 
--- a/brewpanel/sdlgui.h	Sat Nov 07 22:04:17 2015 +0100
+++ b/brewpanel/sdlgui.h	Sat Nov 07 22:34:28 2015 +0100
@@ -1,7 +1,7 @@
 #ifndef _SDLGUI_H
 #define _SDLGUI_H
 
-//#include <SDL.h>
+#ifdef HAVE_SDL_SDL_H
 
 enum
 {
@@ -54,3 +54,5 @@
 void SDLGui_LCDwrite(SGOBJ *dlg, int x, int y, Uint8 c, int lcdindex);
 
 #endif
+
+#endif
--- a/configure	Sat Nov 07 22:04:17 2015 +0100
+++ b/configure	Sat Nov 07 22:34:28 2015 +0100
@@ -3676,27 +3676,26 @@
 fi
 
 # Check for SDL
+SDL_CFLAGS=""
+SDL_LIBS=""
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking SDL library" >&5
 $as_echo_n "checking SDL library... " >&6; }
 pkg-config --exists sdl
 if test "$?" = "0"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-else
-  as_fn_error $? "no" "$LINENO" 5
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl library v1.2.0 or newer" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl library v1.2.0 or newer" >&5
 $as_echo_n "checking sdl library v1.2.0 or newer... " >&6; }
-pkg-config --atleast-version=1.2.0 sdl
-if test "$?" = "0"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+  pkg-config --atleast-version=1.2.0 sdl
+  if test "$?" = "0"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
-else
-  as_fn_error $? "not found" "$LINENO" 5
-fi
-SDL_CFLAGS="$(pkg-config --cflags sdl)"
-SDL_LIBS="$(pkg-config --libs sdl)"
-for ac_header in SDL/SDL.h
+  else
+    as_fn_error $? "not found" "$LINENO" 5
+  fi
+  SDL_CFLAGS="$(pkg-config --cflags sdl)"
+  SDL_LIBS="$(pkg-config --libs sdl)"
+  for ac_header in SDL/SDL.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "SDL/SDL.h" "ac_cv_header_SDL_SDL_h" "$ac_includes_default"
 if test "x$ac_cv_header_SDL_SDL_h" = xyes; then :
@@ -3708,6 +3707,10 @@
 
 done
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 # Check for SDL_ttf
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking SDL_ttf library" >&5
@@ -3716,22 +3719,22 @@
 if test "$?" = "0"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-else
-  as_fn_error $? "no" "$LINENO" 5
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl library v2.0.0 or newer" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl library v2.0.0 or newer" >&5
 $as_echo_n "checking sdl library v2.0.0 or newer... " >&6; }
-pkg-config --atleast-version=2.0.0 SDL_ttf
-if test "$?" = "0"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+  pkg-config --atleast-version=2.0.0 SDL_ttf
+  if test "$?" = "0"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
+  else
+    as_fn_error $? "not found" "$LINENO" 5
+  fi
+  # Override flags
+  SDL_CFLAGS="$(pkg-config --cflags SDL_ttf)"
+  SDL_LIBS="$(pkg-config --libs SDL_ttf)"
 else
-  as_fn_error $? "not found" "$LINENO" 5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-# Override flags
-SDL_CFLAGS="$(pkg-config --cflags SDL_ttf)"
-SDL_LIBS="$(pkg-config --libs SDL_ttf)"
-
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
--- a/configure.ac	Sat Nov 07 22:04:17 2015 +0100
+++ b/configure.ac	Sat Nov 07 22:34:28 2015 +0100
@@ -82,43 +82,44 @@
 fi
 
 # Check for SDL
+SDL_CFLAGS=""
+SDL_LIBS=""
 AC_MSG_CHECKING(SDL library)
 pkg-config --exists sdl
 if test "$?" = "0"; then
   AC_MSG_RESULT(yes)
+  AC_MSG_CHECKING(sdl library v1.2.0 or newer)
+  pkg-config --atleast-version=1.2.0 sdl
+  if test "$?" = "0"; then
+    AC_MSG_RESULT(found)
+  else
+    AC_MSG_ERROR(not found)
+  fi
+  SDL_CFLAGS="$(pkg-config --cflags sdl)"
+  SDL_LIBS="$(pkg-config --libs sdl)"
+  AC_CHECK_HEADERS(SDL/SDL.h)
 else
-  AC_MSG_ERROR(no)
+  AC_MSG_RESULT(no)
 fi
-AC_MSG_CHECKING(sdl library v1.2.0 or newer)
-pkg-config --atleast-version=1.2.0 sdl
-if test "$?" = "0"; then
-  AC_MSG_RESULT(found)
-else
-  AC_MSG_ERROR(not found)
-fi
-SDL_CFLAGS="$(pkg-config --cflags sdl)"
-SDL_LIBS="$(pkg-config --libs sdl)"
-AC_CHECK_HEADERS(SDL/SDL.h)
 
 # Check for SDL_ttf
 AC_MSG_CHECKING(SDL_ttf library)
 pkg-config --exists SDL_ttf
 if test "$?" = "0"; then
   AC_MSG_RESULT(yes)
+  AC_MSG_CHECKING(sdl library v2.0.0 or newer)
+  pkg-config --atleast-version=2.0.0 SDL_ttf
+  if test "$?" = "0"; then
+    AC_MSG_RESULT(found)
+  else
+    AC_MSG_ERROR(not found)
+  fi
+  # Override flags
+  SDL_CFLAGS="$(pkg-config --cflags SDL_ttf)"
+  SDL_LIBS="$(pkg-config --libs SDL_ttf)"
 else
-  AC_MSG_ERROR(no)
+  AC_MSG_RESULT(no)
 fi
-AC_MSG_CHECKING(sdl library v2.0.0 or newer)
-pkg-config --atleast-version=2.0.0 SDL_ttf
-if test "$?" = "0"; then
-  AC_MSG_RESULT(found)
-else
-  AC_MSG_ERROR(not found)
-fi
-# Override flags
-SDL_CFLAGS="$(pkg-config --cflags SDL_ttf)"
-SDL_LIBS="$(pkg-config --libs SDL_ttf)"
-
 
 dnl Checks for header files.
 AC_HEADER_STDC

mercurial