Browse Source

Use new error message macro in configure, use luajit by default, switch to pkg-config for as much as possible

Bart van Strien 11 years ago
parent
commit
6eb0544bbc
2 changed files with 31 additions and 21 deletions
  1. 22 19
      platform/unix/configure.ac
  2. 9 2
      platform/unix/genmodules

+ 22 - 19
platform/unix/configure.ac

@@ -27,11 +27,14 @@ AC_DEFUN([ACLOVE_CXX_FLAG_TEST], # WARNING: NOT REENTRANT
 			  [AC_MSG_RESULT([no]); $3])
 			  [AC_MSG_RESULT([no]); $3])
 		  CXXFLAGS="$aclove_cxx_flag_test_save_cflags"])
 		  CXXFLAGS="$aclove_cxx_flag_test_save_cflags"])
 
 
+AC_DEFUN([LOVE_MSG_ERROR],
+		 [AC_MSG_ERROR([LÖVE needs "$1"[,] please install "$1" with development files and try again])])
+
 # C++11 support
 # C++11 support
 cxx11name="no"
 cxx11name="no"
 ACLOVE_CXX_FLAG_TEST([-std=c++0x], cxx11name="c++0x", [])
 ACLOVE_CXX_FLAG_TEST([-std=c++0x], cxx11name="c++0x", [])
 ACLOVE_CXX_FLAG_TEST([-std=c++11], cxx11name="c++11", [])
 ACLOVE_CXX_FLAG_TEST([-std=c++11], cxx11name="c++11", [])
-AS_VAR_IF([cxx11name], [no], AC_MSG_ERROR([Can't LÖVE without C++11]), CXXFLAGS="$CXXFLAGS -std=$cxx11name")
+AS_VAR_IF([cxx11name], [no], AC_MSG_ERROR([LÖVE needs a C++ compiler with C++11 support]), CXXFLAGS="$CXXFLAGS -std=$cxx11name")
 
 
 # Allow people on OSX to use autotools, they need their platform files
 # Allow people on OSX to use autotools, they need their platform files
 AC_ARG_ENABLE([osx],
 AC_ARG_ENABLE([osx],
@@ -43,25 +46,24 @@ AS_VAR_IF([enable_osx], [no], [], #else
 
 
 # --with-lua and --with-luaversion
 # --with-lua and --with-luaversion
 AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
 AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
-			[], [with_lua=lua])
+			[], [with_lua=luajit])
 AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
 AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
 			[], [with_luaversion=5.1])
 			[], [with_luaversion=5.1])
 
 
-# pkg-config
+# pkg-config libraries
+AM_PATH_SDL2([], [], [LOVE_MSG_ERROR([SDL 2])])
 PKG_CHECK_MODULES([lua], [${with_lua}${with_luaversion}], [lua_found=yes],
 PKG_CHECK_MODULES([lua], [${with_lua}${with_luaversion}], [lua_found=yes],
 				  [PKG_CHECK_MODULES([lua], [${with_lua}], [lua_found=yes], [lua_found=no])])
 				  [PKG_CHECK_MODULES([lua], [${with_lua}], [lua_found=yes], [lua_found=no])])
-PKG_CHECK_MODULES([freetype2], [freetype2], [], AC_MSG_ERROR([Can't LÖVE without FreeType2]))
-AM_PATH_SDL2([], [], AC_MSG_ERROR([Can't LÖVE without SDL 2]))
-
-# Libraries
-AC_SEARCH_LIBS([sqrt], [m], [], AC_MSG_ERROR([Can't LÖVE without C math library]))
-AC_SEARCH_LIBS([alSourcePlay], [openal], [], AC_MSG_ERROR([Can't LÖVE without OpenAL]))
-AC_SEARCH_LIBS([ilInit], [IL], [], AC_MSG_ERROR([Can't LÖVE without DevIL]))
-AC_SEARCH_LIBS([FT_Load_Glyph], [freetype], [], AC_MSG_ERROR([Can't LÖVE without FreeType]))
-AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], AC_MSG_ERROR([Can't LÖVE without PhysicsFS]))
-AC_SEARCH_LIBS([ModPlug_Load], [modplug], [], AC_MSG_ERROR([Can't LÖVE without ModPlug]))
-AC_SEARCH_LIBS([ov_open], [vorbisfile], [], AC_MSG_ERROR([Can't LÖVE without VorbisFile]))
-AC_SEARCH_LIBS([glLoadIdentity], [GL], [], AC_MSG_ERROR([Can't LÖVE without OpenGL]))
+PKG_CHECK_MODULES([freetype2], [freetype2], [], [LOVE_MSG_ERROR([FreeType2])])
+PKG_CHECK_MODULES([openal], [openal], [], [LOVE_MSG_ERROR([OpenAL])])
+PKG_CHECK_MODULES([devil], [IL], [], [LOVE_MSG_ERROR([DevIL])])
+PKG_CHECK_MODULES([libmodplug], [libmodplug], [], [LOVE_MSG_ERROR([libmodplug])])
+PKG_CHECK_MODULES([vorbisfile], [vorbisfile], [], [LOVE_MSG_ERROR([libvorbis and libvorbisfile])])
+
+# Other libraries
+AC_SEARCH_LIBS([sqrt], [m], [], [LOVE_MSG_ERROR([the C math library])])
+AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], [LOVE_MSG_ERROR([PhysicsFS])])
+AC_SEARCH_LIBS([glLoadIdentity], [GL], [], [LOVE_MSG_ERROR([OpenGL])])
 
 
 # Lua, treated seperately because of --with-lua
 # Lua, treated seperately because of --with-lua
 AS_VAR_IF([with_luaversion], [5.2], [luatest=lua_version], [luatest=lua_pcall]) # use lua_version for 5.2
 AS_VAR_IF([with_luaversion], [5.2], [luatest=lua_version], [luatest=lua_pcall]) # use lua_version for 5.2
@@ -75,7 +77,7 @@ AS_VAR_IF([lua_found], [yes],
 		  [
 		  [
 		   AC_MSG_WARN([Could not find pkg-config definition for ${with_lua}${with_luaversion} or ${with_lua}, falling back to manual detection])
 		   AC_MSG_WARN([Could not find pkg-config definition for ${with_lua}${with_luaversion} or ${with_lua}, falling back to manual detection])
 		   AC_SEARCH_LIBS([$luatest], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
 		   AC_SEARCH_LIBS([$luatest], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
-						  AC_MSG_ERROR([Can't LÖVE without $with_lua]))
+						  [LOVE_MSG_ERROR([$with_lua])])
 		   luaheaders_found=no
 		   luaheaders_found=no
 		   AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
 		   AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
 		   AC_CHECK_HEADER(["${with_lua}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}"], [])])
 		   AC_CHECK_HEADER(["${with_lua}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}"], [])])
@@ -84,12 +86,13 @@ AS_VAR_IF([luaheaders_found], [yes], [], #else
 		   AC_MSG_WARN([Could not locate lua headers for ${with_lua}${with_luaversion} or ${with_lua}, you probably need to specify them with CPPFLAGS])])
 		   AC_MSG_WARN([Could not locate lua headers for ${with_lua}${with_luaversion} or ${with_lua}, you probably need to specify them with CPPFLAGS])])
 
 
 # mpg123, treated seperately because it can be disabled (default on)
 # mpg123, treated seperately because it can be disabled (default on)
+# also not pkg-config because of the FILE_OFFSET_BITS.. bit
 AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
 AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
 AS_VAR_IF([enable_mpg123], [no],
 AS_VAR_IF([enable_mpg123], [no],
 	  AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]),
 	  AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]),
 	  # else
 	  # else
 	  AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [],
 	  AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [],
-					 AC_MSG_ERROR([Can't LÖVE without Mpg123]))
+					 [LOVE_MSG_ERROR([libmpg123])])
 	  AC_SEARCH_LIBS([mpg123_seek_64], [mpg123],
 	  AC_SEARCH_LIBS([mpg123_seek_64], [mpg123],
 					 AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]),
 					 AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]),
 					 AC_SUBST([FILE_OFFSET],[])))
 					 AC_SUBST([FILE_OFFSET],[])))
@@ -97,7 +100,7 @@ AS_VAR_IF([enable_mpg123], [no],
 # GME, treated seperately because it can be enabled (default off)
 # GME, treated seperately because it can be enabled (default off)
 AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
 AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
 AS_VAR_IF([enable_gme], [yes],
 AS_VAR_IF([enable_gme], [yes],
-	  AC_SEARCH_LIBS([gme_open_data], [gme], [], AC_MSG_ERROR([Can't LÖVE without gme]))
+	  AC_SEARCH_LIBS([gme_open_data], [gme], [], [LOVE_MSG_ERROR([gme])])
 	  AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme])
 	  AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme])
 	  AC_CHECK_HEADER([gme/gme.h], [includes="$includes -I/usr/include/gme"], []))
 	  AC_CHECK_HEADER([gme/gme.h], [includes="$includes -I/usr/include/gme"], []))
 
 
@@ -112,7 +115,7 @@ AC_ARG_ENABLE([exe],
 			  AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes])
 			  AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes])
 
 
 AS_VAR_IF([enable_exe], [no], [], #else
 AS_VAR_IF([enable_exe], [no], [], #else
-	  AC_DEFINE([LOVE_BUILD_EXE], [], [Don't build launcher]))
+	  AC_DEFINE([LOVE_BUILD_EXE], [], [Skip building launcher]))
 
 
 AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
 AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
 AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" == xno])
 AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" == xno])

+ 9 - 2
platform/unix/genmodules

@@ -109,7 +109,10 @@ inc_modules="$inc_current/modules"
 inc_libraries="$inc_current/libraries"
 inc_libraries="$inc_current/libraries"
 
 
 cat > src/Makefile.am << EOF
 cat > src/Makefile.am << EOF
-AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET) \$(SDL_CFLAGS) \$(freetype2_CFLAGS) \$(lua_CFLAGS)
+AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET)\
+	\$(SDL_CFLAGS) \$(lua_CFLAGS) \$(freetype2_CFLAGS)\
+	\$(openal_CFLAGS) \$(devil_CFLAGS) \$(libmodplug_CFLAGS)\
+	\$(vorbisfile_CFLAGS)
 AUTOMAKE_OPTIONS = subdir-objects
 AUTOMAKE_OPTIONS = subdir-objects
 SUBDIRS =
 SUBDIRS =
 
 
@@ -139,7 +142,11 @@ endif
 
 
 # libLÖVE
 # libLÖVE
 lib_LTLIBRARIES = liblove${love_suffix}.la
 lib_LTLIBRARIES = liblove${love_suffix}.la
-liblove${love_amsuffix}_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS) \$(SDL_LIBS) \$(freetype2_LIBS) \$(lua_LIBS)
+liblove${love_amsuffix}_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS)
+liblove${love_amsuffix}_la_LIBADD = \
+	\$(SDL_LIBS) \$(freetype2_LIBS) \$(lua_LIBS)\
+	\$(openal_LIBS) \$(devil_LIBS) \$(libmodplug_LIBS)\
+	\$(vorbisfile_LIBS)
 EOF
 EOF
 
 
 genmodules >> src/Makefile.am
 genmodules >> src/Makefile.am