Impoved SDL configure checks

Sat, 16 Mar 2024 11:54:46 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 16 Mar 2024 11:54:46 +0100
changeset 642
5cb83127d285
parent 641
000d40511c92
child 643
586d376ab629

Impoved SDL configure checks

configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
--- a/configure	Sat Mar 16 11:09:43 2024 +0100
+++ b/configure	Sat Mar 16 11:54:46 2024 +0100
@@ -3813,24 +3813,21 @@
 SDL_CFLAGS=""
 SDL_LIBS=""
 SDL="No"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SDL2 library" >&5
-$as_echo_n "checking SDL2 library... " >&6; }
+{ $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; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl2 library v2.0.0 or newer" >&5
-$as_echo_n "checking sdl2 library v2.0.0 or newer... " >&6; }
+  { $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 sdl2
   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 sdl2)"
-  SDL_LIBS="$(pkg-config --libs sdl2)"
-  for ac_header in SDL2/SDL.h
+    SDL_CFLAGS="$(pkg-config --cflags sdl2)"
+    SDL_LIBS="$(pkg-config --libs sdl2)"
+    for ac_header in SDL2/SDL.h
 do :
   ac_fn_c_check_header_mongrel "$LINENO" "SDL2/SDL.h" "ac_cv_header_SDL2_SDL_h" "$ac_includes_default"
 if test "x$ac_cv_header_SDL2_SDL_h" = xyes; then :
@@ -3842,34 +3839,41 @@
 
 done
 
-  SDL="Yes"
+    SDL="Yes"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+  fi
 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 SDL2_ttf library" >&5
+# Check for SDL_ttf if base SDL2 is found.
+if test "$SDL" = "Yes"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking SDL2_ttf library" >&5
 $as_echo_n "checking SDL2_ttf library... " >&6; }
-pkg-config --exists SDL2_ttf
-if test "$?" = "0"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl2 library v2.0.0 or newer" >&5
-$as_echo_n "checking sdl2 library v2.0.0 or newer... " >&6; }
-  pkg-config --atleast-version=2.0.0 SDL2_ttf
+  pkg-config --exists SDL2_ttf
   if test "$?" = "0"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking sdl2 library v2.0.0 or newer" >&5
+$as_echo_n "checking sdl2 library v2.0.0 or newer... " >&6; }
+    pkg-config --atleast-version=2.0.0 SDL2_ttf
+    if test "$?" = "0"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
 $as_echo "found" >&6; }
+      # Override flags
+      SDL_CFLAGS="$(pkg-config --cflags SDL2_ttf)"
+      SDL_LIBS="$(pkg-config --libs SDL2_ttf)"
+    else
+      as_fn_error $? "not found" "$LINENO" 5
+      SDL="No"
+    fi
   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 SDL2_ttf)"
-  SDL_LIBS="$(pkg-config --libs SDL2_ttf)"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
 fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
--- a/configure.ac	Sat Mar 16 11:09:43 2024 +0100
+++ b/configure.ac	Sat Mar 16 11:54:46 2024 +0100
@@ -106,42 +106,45 @@
 SDL_CFLAGS=""
 SDL_LIBS=""
 SDL="No"
-AC_MSG_CHECKING(SDL2 library)
+AC_MSG_CHECKING(SDL library)
 pkg-config --exists sdl
 if test "$?" = "0"; then
   AC_MSG_RESULT(yes)
-  AC_MSG_CHECKING(sdl2 library v2.0.0 or newer)
+  AC_MSG_CHECKING(sdl library v2.0.0 or newer)
   pkg-config --atleast-version=2.0.0 sdl2
   if test "$?" = "0"; then
     AC_MSG_RESULT(found)
+    SDL_CFLAGS="$(pkg-config --cflags sdl2)"
+    SDL_LIBS="$(pkg-config --libs sdl2)"
+    AC_CHECK_HEADERS(SDL2/SDL.h)
+    SDL="Yes"
   else
-    AC_MSG_ERROR(not found)
+    AC_MSG_RESULT(not found)
   fi
-  SDL_CFLAGS="$(pkg-config --cflags sdl2)"
-  SDL_LIBS="$(pkg-config --libs sdl2)"
-  AC_CHECK_HEADERS(SDL2/SDL.h)
-  SDL="Yes"
 else
   AC_MSG_RESULT(no)
 fi
 
-# Check for SDL_ttf
-AC_MSG_CHECKING(SDL2_ttf library)
-pkg-config --exists SDL2_ttf
-if test "$?" = "0"; then
-  AC_MSG_RESULT(yes)
-  AC_MSG_CHECKING(sdl2 library v2.0.0 or newer)
-  pkg-config --atleast-version=2.0.0 SDL2_ttf
+# Check for SDL_ttf if base SDL2 is found.
+if test "$SDL" = "Yes"; then
+  AC_MSG_CHECKING(SDL2_ttf library)
+  pkg-config --exists SDL2_ttf
   if test "$?" = "0"; then
-    AC_MSG_RESULT(found)
+    AC_MSG_RESULT(yes)
+    AC_MSG_CHECKING(sdl2 library v2.0.0 or newer)
+    pkg-config --atleast-version=2.0.0 SDL2_ttf
+    if test "$?" = "0"; then
+      AC_MSG_RESULT(found)
+      # Override flags
+      SDL_CFLAGS="$(pkg-config --cflags SDL2_ttf)"
+      SDL_LIBS="$(pkg-config --libs SDL2_ttf)"
+    else
+      AC_MSG_ERROR(not found)
+      SDL="No"
+    fi
   else
-    AC_MSG_ERROR(not found)
+    AC_MSG_RESULT(no)
   fi
-  # Override flags
-  SDL_CFLAGS="$(pkg-config --cflags SDL2_ttf)"
-  SDL_LIBS="$(pkg-config --libs SDL2_ttf)"
-else
-  AC_MSG_RESULT(no)
 fi
 
 dnl Checks for header files.

mercurial