@@ -8,7 +8,37 @@ AC_PROG_CXX
88AC_LANG ( C++ )
99
1010AC_CONFIG_MACRO_DIRS([ m4 m4/autoconf-archive] )
11- AX_CHECK_GL
11+
12+ dnl emscripten
13+ AC_ARG_ENABLE ( [ emscripten] ,
14+ AS_HELP_STRING ( [ --enable-emscripten] , [ Build for web with emscripten] ) ,
15+ [ ] , [ enable_emscripten=no] )
16+ AS_IF ( [ test "x$enable_emscripten" = "xyes"] , [
17+ dnl Set up emscripten
18+ m4_include ( [ m4/emscripten.m4] )
19+ AC_DEFINE ( [ EMSCRIPTEN] , [ 1] , [ Define EMSCRIPTEN] )
20+ enable_threading=no
21+ ] , [
22+ dnl Running in a normal OS (not emscripten)
23+ AX_CHECK_GL
24+
25+ # check OS
26+ AC_CANONICAL_HOST
27+ AC_MSG_CHECKING ( Freedom )
28+ case $host_os in
29+ darwin*)
30+ # OSX needs CoreFoundation
31+ AC_MSG_RESULT ( Apple hoarderware detected )
32+ LIBS="$LIBS -framework CoreFoundation"
33+ ;;
34+ linux*)
35+ # limux needs dl
36+ AC_MSG_RESULT ( GNU/LINUX detected )
37+ LIBS="$LIBS -ldl"
38+ ;;
39+ esac
40+ ] )
41+
1242
1343AC_CHECK_LIB ( c , dlopen , LIBDL="" , AC_CHECK_LIB ( dl , dlopen , LIBDL="-ldl" ) )
1444
@@ -25,6 +55,7 @@ AC_CONFIG_FILES([
2555 src/libprojectM/libprojectM.pc
2656 src/NativePresets/Makefile
2757 src/projectM-sdl/Makefile
58+ src/projectM-emscripten/Makefile
2859 src/projectM-qt/Makefile
2960 src/projectM-pulseaudio/Makefile
3061] )
@@ -37,14 +68,20 @@ AS_IF([test "x$enable_sdl" = "xyes"], [
3768 m4_include ( [ m4/sdl2.m4] )
3869 SDL_VERSION=2.0.5
3970 AS_IF ( [ test "$TRAVIS"] , [ SDL_VERSION=2.0.2] ) # travis has old SDL, we don't care
71+ AS_IF ( [ test "EMSCRIPTEN"] , [ SDL_VERSION=2.0.0] ) # emscripten has old SDL, we don't care
4072 AM_PATH_SDL2($SDL_VERSION, :, AC_MSG_ERROR ( [ *** SDL version $SDL_VERSION not found!] ) )
4173] )
4274
75+ dnl glm
76+ AS_IF ( [ test "x$enable_emscripten" != "xyes"] , [
77+ AC_CHECK_HEADER ( [ glm/glm.hpp] ,, AC_MSG_ERROR ( libglm is required. ) )
78+ ] )
79+
4380dnl Threading
4481AC_ARG_ENABLE ( [ threading] ,
4582AS_HELP_STRING ( [ --enable-threading] , [ multhreading] ) ,
4683[ ] , [ enable_threading=yes] )
47- AS_IF ( [ test "x$enable_threading" = "xyes"] , [
84+ AS_IF ( [ test "x$enable_threading" = "xyes" && ! test "$EMSCRIPTEN" ] , [
4885 m4_include ( [ m4/autoconf-archive/ax_pthread.m4] )
4986 AX_PTHREAD ( [
5087 AC_DEFINE ( [ USE_THREADS] , [ 1] , [ Define USE_THREADS] )
@@ -57,8 +94,6 @@ AS_IF([test "x$enable_threading" = "xyes"], [
5794 ] )
5895] )
5996
60- AC_CHECK_HEADER ( [ glm/glm.hpp] ,, AC_MSG_ERROR ( libglm is required. ) )
61-
6297AC_ARG_ENABLE ( [ gles] ,
6398 AS_HELP_STRING ( [ --enable-gles] , [ OpenGL ES support] ) ,
6499 [ ] , [ enable_gles=no] )
@@ -75,7 +110,7 @@ AC_CONFIG_FILES([src/libprojectM/config.inp.in])
75110AC_PREFIX_DEFAULT ( [ /usr/local] )
76111
77112AC_PROG_MKDIR_P
78-
113+
79114AX_CHECK_COMPILE_FLAG ( [ -stdlib=libc++] , [
80115 CXXFLAGS="$CXXFLAGS -stdlib=libc++"] )
81116
@@ -108,28 +143,14 @@ AS_IF([test "x$enable_qt" = "xyes"], [
108143
109144AM_CONDITIONAL([ ENABLE_SDL] , [ test "$enable_sdl" = yes] )
110145AM_CONDITIONAL([ ENABLE_QT] , [ test "$enable_qt" = yes] )
146+ AM_CONDITIONAL([ ENABLE_EMSCRIPTEN] , [ test "$enable_emscripten" = yes] )
111147
112148
113149my_CFLAGS="-Wall -Wchar-subscripts -Wformat-security -Wmissing-declarations -Wpointer-arith -Wshadow -Wsign-compare -Wtype-limits "
114- my_CFLAGS+='-DDATADIR_PATH=\""$(pkgdatadir)"\"'
150+ my_CFLAGS+='-DDATADIR_PATH=\""$(pkgdatadir)"\" '
151+ my_CFLAGS+='-I$(top_srcdir)/vendor '
115152AC_SUBST ( [ my_CFLAGS] )
116153
117- # check OS
118- AC_CANONICAL_HOST
119- AC_MSG_CHECKING ( Freedom )
120- case $host_os in
121- darwin*)
122- # OSX needs CoreFoundation
123- AC_MSG_RESULT ( Apple hoarderware detected )
124- LIBS="$LIBS -framework CoreFoundation"
125- ;;
126- linux*)
127- # limux needs dl
128- AC_MSG_RESULT ( GNU/LINUX detected )
129- LIBS="$LIBS -ldl"
130- ;;
131- esac
132-
133154
134155
135156AC_OUTPUT
@@ -157,4 +178,5 @@ Threading: ${enable_threading}
157178SDL: ${enable_sdl}
158179Qt & Pulseaudio: ${enable_qt}
159180OpenGLES: ${enable_gles}
181+ Emscripten: ${enable_emscripten}
160182] )
0 commit comments