ecsv avatar ecsv committed a629997

Test for essential build dependencies before getting their cflags/libs

Comments (0)

Files changed (1)

projects/unix/Makefile

 endif
 
 # base CFLAGS, LIBS, and LDFLAGS
-CFLAGS += -Wall -ffast-math -msse -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/wrapper -DGCC $(shell pkg-config --cflags gl)
+CFLAGS += -Wall -ffast-math -msse -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/wrapper -DGCC
 CXXFLAGS += -fvisibility-inlines-hidden
-LDFLAGS += $(shell pkg-config --libs gl)
 
 # Since we are building a shared library, we must compile with -fPIC for x86_64 CPUs.
 # On 32-bit systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
   LDFLAGS += -lc
 endif
 
+# test for essential build dependencies
+ifeq ($(shell which pkg-config 2>/dev/null),)
+  $(error pkg-config not found)
+endif
+ifeq ($(shell pkg-config --modversion gl 2>/dev/null),)
+  $(error No OpenGL development libraries found!)
+endif
+CFLAGS += $(shell pkg-config --cflags gl)
+LDFLAGS += $(shell pkg-config --libs gl)
+
 # test for presence of SDL
 ifeq ($(shell which sdl-config 2>/dev/null),)
   $(error No SDL development libraries found!)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.