ruby-glfw 0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. data/README +1 -0
  2. data/README.API +73 -0
  3. data/Rakefile +120 -0
  4. data/examples/boing.rb +519 -0
  5. data/examples/gears.rb +327 -0
  6. data/examples/keytest.rb +117 -0
  7. data/examples/listmodes.rb +20 -0
  8. data/examples/mipmaps.rb +104 -0
  9. data/examples/mipmaps.tga +0 -0
  10. data/examples/particles.rb +837 -0
  11. data/examples/pong3d.rb +741 -0
  12. data/examples/pong3d_field.tga +0 -0
  13. data/examples/pong3d_instr.tga +0 -0
  14. data/examples/pong3d_menu.tga +0 -0
  15. data/examples/pong3d_title.tga +0 -0
  16. data/examples/pong3d_winner1.tga +0 -0
  17. data/examples/pong3d_winner2.tga +0 -0
  18. data/examples/splitview.rb +432 -0
  19. data/examples/triangle.rb +89 -0
  20. data/examples/wave.rb +294 -0
  21. data/ext/glfw/glfw.c +1094 -0
  22. data/ext/glfw/mkrf_conf.rb +70 -0
  23. data/glfw-src/Makefile +220 -0
  24. data/glfw-src/compile.ami +61 -0
  25. data/glfw-src/compile.bat +217 -0
  26. data/glfw-src/compile.sh +607 -0
  27. data/glfw-src/docs/Makefile +57 -0
  28. data/glfw-src/docs/Reference.pdf +0 -0
  29. data/glfw-src/docs/UsersGuide.pdf +0 -0
  30. data/glfw-src/docs/cleanup.bat +22 -0
  31. data/glfw-src/docs/glfwdoc.sty +80 -0
  32. data/glfw-src/docs/glfwrm.tex +3034 -0
  33. data/glfw-src/docs/glfwug.tex +2024 -0
  34. data/glfw-src/docs/readme.txt +80 -0
  35. data/glfw-src/examples/Makefile.amigaos.gcc +70 -0
  36. data/glfw-src/examples/Makefile.amigaos.vbcc +70 -0
  37. data/glfw-src/examples/Makefile.dos.djgpp +71 -0
  38. data/glfw-src/examples/Makefile.macosx.gcc +96 -0
  39. data/glfw-src/examples/Makefile.win32.bcc +75 -0
  40. data/glfw-src/examples/Makefile.win32.cross-mgw +79 -0
  41. data/glfw-src/examples/Makefile.win32.cygwin +79 -0
  42. data/glfw-src/examples/Makefile.win32.lcc +74 -0
  43. data/glfw-src/examples/Makefile.win32.mgw +75 -0
  44. data/glfw-src/examples/Makefile.win32.msvc +74 -0
  45. data/glfw-src/examples/Makefile.win32.ow +74 -0
  46. data/glfw-src/examples/Makefile.win32.pellesc +74 -0
  47. data/glfw-src/examples/Makefile.x11.in +54 -0
  48. data/glfw-src/examples/boing.c +606 -0
  49. data/glfw-src/examples/bundle.sh +46 -0
  50. data/glfw-src/examples/gears.c +382 -0
  51. data/glfw-src/examples/keytest.c +264 -0
  52. data/glfw-src/examples/listmodes.c +48 -0
  53. data/glfw-src/examples/mipmaps.c +126 -0
  54. data/glfw-src/examples/mipmaps.tga +0 -0
  55. data/glfw-src/examples/mtbench.c +301 -0
  56. data/glfw-src/examples/mthello.c +48 -0
  57. data/glfw-src/examples/particles.c +1148 -0
  58. data/glfw-src/examples/pong3d.c +839 -0
  59. data/glfw-src/examples/pong3d_field.tga +0 -0
  60. data/glfw-src/examples/pong3d_instr.tga +0 -0
  61. data/glfw-src/examples/pong3d_menu.tga +0 -0
  62. data/glfw-src/examples/pong3d_title.tga +0 -0
  63. data/glfw-src/examples/pong3d_winner1.tga +0 -0
  64. data/glfw-src/examples/pong3d_winner2.tga +0 -0
  65. data/glfw-src/examples/splitview.c +506 -0
  66. data/glfw-src/examples/triangle.c +108 -0
  67. data/glfw-src/examples/wave.c +397 -0
  68. data/glfw-src/images/opengl.gif +0 -0
  69. data/glfw-src/images/osicert.gif +0 -0
  70. data/glfw-src/include/GL/glfw.h +486 -0
  71. data/glfw-src/lib/amigaos/Makefile.amigaos.gcc +128 -0
  72. data/glfw-src/lib/amigaos/Makefile.amigaos.vbcc +128 -0
  73. data/glfw-src/lib/amigaos/SDI_compiler.h +94 -0
  74. data/glfw-src/lib/amigaos/amigaos_enable.c +51 -0
  75. data/glfw-src/lib/amigaos/amigaos_fullscreen.c +319 -0
  76. data/glfw-src/lib/amigaos/amigaos_glext.c +61 -0
  77. data/glfw-src/lib/amigaos/amigaos_init.c +284 -0
  78. data/glfw-src/lib/amigaos/amigaos_joystick.c +359 -0
  79. data/glfw-src/lib/amigaos/amigaos_thread.c +494 -0
  80. data/glfw-src/lib/amigaos/amigaos_time.c +206 -0
  81. data/glfw-src/lib/amigaos/amigaos_window.c +830 -0
  82. data/glfw-src/lib/amigaos/platform.h +337 -0
  83. data/glfw-src/lib/dos/Makefile.dos.djgpp +146 -0
  84. data/glfw-src/lib/dos/dos_enable.c +51 -0
  85. data/glfw-src/lib/dos/dos_events.c +173 -0
  86. data/glfw-src/lib/dos/dos_fullscreen.c +101 -0
  87. data/glfw-src/lib/dos/dos_glext.c +59 -0
  88. data/glfw-src/lib/dos/dos_init.c +105 -0
  89. data/glfw-src/lib/dos/dos_irq.s +246 -0
  90. data/glfw-src/lib/dos/dos_joystick.c +94 -0
  91. data/glfw-src/lib/dos/dos_keyboard.c +694 -0
  92. data/glfw-src/lib/dos/dos_mouse.c +337 -0
  93. data/glfw-src/lib/dos/dos_thread.c +267 -0
  94. data/glfw-src/lib/dos/dos_time.c +309 -0
  95. data/glfw-src/lib/dos/dos_window.c +563 -0
  96. data/glfw-src/lib/dos/platform.h +341 -0
  97. data/glfw-src/lib/enable.c +295 -0
  98. data/glfw-src/lib/fullscreen.c +95 -0
  99. data/glfw-src/lib/glext.c +201 -0
  100. data/glfw-src/lib/image.c +629 -0
  101. data/glfw-src/lib/init.c +108 -0
  102. data/glfw-src/lib/input.c +280 -0
  103. data/glfw-src/lib/internal.h +210 -0
  104. data/glfw-src/lib/joystick.c +101 -0
  105. data/glfw-src/lib/macosx/Makefile.macosx.gcc +172 -0
  106. data/glfw-src/lib/macosx/Makefile.macosx.gcc.universal +166 -0
  107. data/glfw-src/lib/macosx/libglfw.pc.in +11 -0
  108. data/glfw-src/lib/macosx/macosx_enable.c +42 -0
  109. data/glfw-src/lib/macosx/macosx_fullscreen.c +126 -0
  110. data/glfw-src/lib/macosx/macosx_glext.c +52 -0
  111. data/glfw-src/lib/macosx/macosx_init.c +194 -0
  112. data/glfw-src/lib/macosx/macosx_joystick.c +50 -0
  113. data/glfw-src/lib/macosx/macosx_thread.c +414 -0
  114. data/glfw-src/lib/macosx/macosx_time.c +112 -0
  115. data/glfw-src/lib/macosx/macosx_window.c +1279 -0
  116. data/glfw-src/lib/macosx/platform.h +349 -0
  117. data/glfw-src/lib/stream.c +194 -0
  118. data/glfw-src/lib/tga.c +405 -0
  119. data/glfw-src/lib/thread.c +340 -0
  120. data/glfw-src/lib/time.c +83 -0
  121. data/glfw-src/lib/win32/Makefile.win32.bcc +265 -0
  122. data/glfw-src/lib/win32/Makefile.win32.cross-mgw +274 -0
  123. data/glfw-src/lib/win32/Makefile.win32.cygwin +279 -0
  124. data/glfw-src/lib/win32/Makefile.win32.lcc +246 -0
  125. data/glfw-src/lib/win32/Makefile.win32.mgw +243 -0
  126. data/glfw-src/lib/win32/Makefile.win32.msvc +242 -0
  127. data/glfw-src/lib/win32/Makefile.win32.ow +242 -0
  128. data/glfw-src/lib/win32/Makefile.win32.pellesc +242 -0
  129. data/glfw-src/lib/win32/glfwdll.def +67 -0
  130. data/glfw-src/lib/win32/glfwdll_mgw1.def +67 -0
  131. data/glfw-src/lib/win32/glfwdll_mgw2.def +67 -0
  132. data/glfw-src/lib/win32/glfwdll_pellesc.def +65 -0
  133. data/glfw-src/lib/win32/libglfw.pc.in +11 -0
  134. data/glfw-src/lib/win32/platform.h +474 -0
  135. data/glfw-src/lib/win32/win32_dllmain.c +60 -0
  136. data/glfw-src/lib/win32/win32_enable.c +155 -0
  137. data/glfw-src/lib/win32/win32_fullscreen.c +317 -0
  138. data/glfw-src/lib/win32/win32_glext.c +85 -0
  139. data/glfw-src/lib/win32/win32_init.c +356 -0
  140. data/glfw-src/lib/win32/win32_joystick.c +234 -0
  141. data/glfw-src/lib/win32/win32_thread.c +511 -0
  142. data/glfw-src/lib/win32/win32_time.c +146 -0
  143. data/glfw-src/lib/win32/win32_window.c +1714 -0
  144. data/glfw-src/lib/window.c +727 -0
  145. data/glfw-src/lib/x11/Makefile.x11.in +243 -0
  146. data/glfw-src/lib/x11/platform.h +415 -0
  147. data/glfw-src/lib/x11/x11_enable.c +51 -0
  148. data/glfw-src/lib/x11/x11_fullscreen.c +524 -0
  149. data/glfw-src/lib/x11/x11_glext.c +69 -0
  150. data/glfw-src/lib/x11/x11_init.c +275 -0
  151. data/glfw-src/lib/x11/x11_joystick.c +371 -0
  152. data/glfw-src/lib/x11/x11_keysym2unicode.c +902 -0
  153. data/glfw-src/lib/x11/x11_thread.c +507 -0
  154. data/glfw-src/lib/x11/x11_time.c +154 -0
  155. data/glfw-src/lib/x11/x11_window.c +1746 -0
  156. data/glfw-src/license.txt +21 -0
  157. data/glfw-src/readme.html +927 -0
  158. data/glfw-src/support/d/examples/Makefile +59 -0
  159. data/glfw-src/support/d/examples/boing.d +610 -0
  160. data/glfw-src/support/d/examples/gears.d +379 -0
  161. data/glfw-src/support/d/examples/keytest.d +272 -0
  162. data/glfw-src/support/d/examples/listmodes.d +48 -0
  163. data/glfw-src/support/d/examples/mipmaps.d +126 -0
  164. data/glfw-src/support/d/examples/mtbench.d +304 -0
  165. data/glfw-src/support/d/examples/mthello.d +54 -0
  166. data/glfw-src/support/d/examples/particles.d +1150 -0
  167. data/glfw-src/support/d/examples/pong3d.d +840 -0
  168. data/glfw-src/support/d/examples/splitview.d +486 -0
  169. data/glfw-src/support/d/examples/triangle.d +108 -0
  170. data/glfw-src/support/d/examples/wave.d +400 -0
  171. data/glfw-src/support/d/imports/gl.d +4539 -0
  172. data/glfw-src/support/d/imports/glfw.d +349 -0
  173. data/glfw-src/support/d/imports/glu.d +328 -0
  174. data/glfw-src/support/d/lib/glfwdll.def +64 -0
  175. data/glfw-src/support/d/lib/glu32.def +56 -0
  176. data/glfw-src/support/d/lib/makefile +12 -0
  177. data/glfw-src/support/d/lib/opengl32.def +372 -0
  178. data/glfw-src/support/d/readme.html +83 -0
  179. data/glfw-src/support/delphi/examples/Triangle.dpr +105 -0
  180. data/glfw-src/support/delphi/lib/glfw.pas +437 -0
  181. data/glfw-src/support/delphi/readme.html +97 -0
  182. data/glfw-src/support/lua/examples/gears.lua +383 -0
  183. data/glfw-src/support/lua/examples/test1.lua +68 -0
  184. data/glfw-src/support/lua/readme.html +128 -0
  185. data/glfw-src/support/lua/src/luaglfw.c +1179 -0
  186. data/glfw-src/support/lua/src/luaglfw.h +48 -0
  187. data/glfw-src/support/lua/src/runlua.c +82 -0
  188. data/glfw-src/support/masm/examples/fpc.mac +47 -0
  189. data/glfw-src/support/masm/examples/makeit.bat +66 -0
  190. data/glfw-src/support/masm/examples/triangle.asm +232 -0
  191. data/glfw-src/support/masm/include/glfw.inc +326 -0
  192. data/glfw-src/support/masm/include/glu32.inc +55 -0
  193. data/glfw-src/support/masm/include/opengl32.inc +372 -0
  194. data/glfw-src/support/masm/lib/glfwdll.lib +0 -0
  195. data/glfw-src/support/masm/readme.html +170 -0
  196. data/glfw-src/support/msvc80/GLFW.sln +26 -0
  197. data/glfw-src/support/msvc80/GLFW.vcproj +257 -0
  198. data/glfw-src/support/msvc80/GLFWDLL.vcproj +287 -0
  199. data/glfw-src/support/visualbasic/bindings/glfw.bas +320 -0
  200. data/glfw-src/support/visualbasic/bindings/glu32.bas +284 -0
  201. data/glfw-src/support/visualbasic/bindings/opengl32.bas +999 -0
  202. data/glfw-src/support/visualbasic/examples/Triangle.bas +101 -0
  203. data/glfw-src/support/visualbasic/readme.html +164 -0
  204. data/website/index.html +84 -0
  205. data/website/style.css +110 -0
  206. metadata +301 -0
@@ -0,0 +1,607 @@
1
+ #!/bin/sh
2
+
3
+ ##########################################################################
4
+ # compile.sh - Unix/X11 configuration script
5
+ # $Date: 2007/07/01 09:46:46 $
6
+ # $Revision: 1.15 $
7
+ #
8
+ # This is a minimalist configuration script for GLFW, which is used to
9
+ # determine the availability of certain features.
10
+ #
11
+ # This script is not very nice at all (especially the Makefile generation
12
+ # is very ugly and hardcoded). Hopefully it will be cleaned up in the
13
+ # future, but for now it does a pretty good job.
14
+ ##########################################################################
15
+
16
+ ##########################################################################
17
+ # Check arguments
18
+ ##########################################################################
19
+ silent=no
20
+ for arg in "$@"; do
21
+ {
22
+ case "$arg" in
23
+ # Silent?
24
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
25
+ | -silent | --silent | --silen | --sile | --sil)
26
+ silent=yes ;;
27
+ esac;
28
+ }
29
+ done;
30
+
31
+
32
+ ##########################################################################
33
+ # Misc.
34
+ ##########################################################################
35
+
36
+ config_script=$0
37
+
38
+ # File descriptor usage:
39
+ # 0 standard input
40
+ # 1 file creation
41
+ # 2 errors and warnings
42
+ # 3 some systems may open it to /dev/tty
43
+ # 4 used on the Kubota Titan
44
+ # 5 compiler messages saved in config.log
45
+ # 6 checking for... messages and results
46
+ exec 5>./config.log
47
+ if [ "x$silent" = xyes ]; then
48
+ exec 6>/dev/null
49
+ else
50
+ exec 6>&1
51
+ fi
52
+
53
+ echo "\
54
+ This file contains any messages produced by compilers while
55
+ running $config_script, to aid debugging if $config_script makes a mistake.
56
+ " 1>&5
57
+
58
+
59
+ ##########################################################################
60
+ # Default compiler settings
61
+ ##########################################################################
62
+ if [ "x$CC" = x ]; then
63
+ CC=cc
64
+ fi
65
+
66
+ CFLAGS=
67
+ LFLAGS=
68
+ LDFLAGS=
69
+ INCS=
70
+ LIBS="-lGL -lX11"
71
+
72
+
73
+ ##########################################################################
74
+ # Compilation commands
75
+ ##########################################################################
76
+ compile='$CC -c $CFLAGS conftest.c 1>&5'
77
+ link='$CC -o conftest $CFLAGS $LFLAGS conftest.c $LIBS 1>&5'
78
+
79
+
80
+ ##########################################################################
81
+ # Check on what system we are running
82
+ ##########################################################################
83
+ echo "Checking what kind of system this is... " 1>&6
84
+
85
+ case "x`uname 2> /dev/null`" in
86
+ xLinux)
87
+ CFLAGS="$CFLAGS -Dlinux"
88
+ LDFLAGS="-shared"
89
+ echo " Linux" 1>&6
90
+ ;;
91
+ xDarwin)
92
+ CFLAGS="$CFLAGS"
93
+ LDFLAGS="-flat_namespace -undefined suppress"
94
+ echo " Mac OS X" 1>&6
95
+ ;;
96
+ *)
97
+ LDFLAGS="-shared -soname libglfw.so"
98
+ echo " Generic Unix" 1>&6
99
+ ;;
100
+ esac
101
+
102
+ echo " " 1>&6
103
+
104
+
105
+ ##########################################################################
106
+ # Check for X11 libs/include directories
107
+ ##########################################################################
108
+ echo "Checking for X11 libraries location... " 1>&6
109
+
110
+ # X11R6 in /usr/X11/lib ?
111
+ if [ -r "/usr/X11/lib" ]; then
112
+ LFLAGS="$LFLAGS -L/usr/X11/lib"
113
+ INCS="-I/usr/X11/include"
114
+ echo " X11 libraries location: /usr/X11/lib" 1>&6
115
+ # X11R/ in /usr/X11R7/lib ?
116
+ elif [ -r "/usr/X11R7/lib" ]; then
117
+ LFLAGS="$LFLAGS -L/usr/X11R7/lib"
118
+ INCS="-I/usr/X11R7/include"
119
+ echo " X11 libraries location: /usr/X11R7/lib" 1>&6
120
+ # X11R6 in /usr/X11R6/lib ?
121
+ elif [ -r "/usr/X11R6/lib" ]; then
122
+ LFLAGS="$LFLAGS -L/usr/X11R6/lib"
123
+ INCS="-I/usr/X11R6/include"
124
+ echo " X11 libraries location: /usr/X11R6/lib" 1>&6
125
+ # X11R5 in /usr/X11R5/lib ?
126
+ elif [ -r "/usr/X11R5/lib" ]; then
127
+ LFLAGS="$LFLAGS -L/usr/X11R5/lib"
128
+ INCS="-I/usr/X11R5/include"
129
+ echo " X11 libraries location: /usr/X11R5/lib" 1>&6
130
+ # X11R6 in /opt/X11R6/lib (e.g. QNX)?
131
+ elif [ -r "/opt/X11R6/lib" ]; then
132
+ LFLAGS="$LFLAGS -L/opt/X11R6/lib"
133
+ INCS="-I/opt/X11R6/include"
134
+ echo " X11 libraries location: /opt/X11R6/lib" 1>&6
135
+ # X11R6 in /usr/X/lib ?
136
+ elif [ -r "/usr/X/lib" ]; then
137
+ LFLAGS="$LFLAGS -L/usr/X/lib"
138
+ INCS="-I/usr/X/include"
139
+ echo " X11 libraries location: /usr/X/lib" 1>&6
140
+ else
141
+ # TODO: Detect and report X11R7 in /usr/lib
142
+ echo " X11 libraries location: Unknown (assuming linker will find them)" 1>&6
143
+ fi
144
+ echo " " 1>&6
145
+ CFLAGS="$CFLAGS $INCS"
146
+
147
+
148
+ ##########################################################################
149
+ # Check if we are using GNU C
150
+ ##########################################################################
151
+ echo "Checking whether we are using GNU C... " 1>&6
152
+ echo "$config_script: checking whether we are using GNU C" >&5
153
+
154
+ cat > conftest.c <<EOF
155
+ #ifdef __GNUC__
156
+ yes;
157
+ #endif
158
+ EOF
159
+
160
+ if { ac_try='$CC -E conftest.c'; { (eval echo $config_script: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
161
+ use_gcc=yes
162
+ else
163
+ use_gcc=no
164
+ fi
165
+ rm -f conftest*
166
+
167
+ echo " Using GNU C: ""$use_gcc" 1>&6
168
+ if [ "x$use_gcc" = xyes ]; then
169
+ CC=gcc
170
+ fi
171
+ echo " " 1>&6
172
+
173
+
174
+ ##########################################################################
175
+ # Check for X11 RandR availability
176
+ ##########################################################################
177
+ echo "Checking for X11 RandR support... " 1>&6
178
+ echo "$config_script: Checking for X11 RandR support" >&5
179
+ has_xrandr=no
180
+
181
+ cat > conftest.c <<EOF
182
+ #include <X11/Xlib.h>
183
+ #include <X11/extensions/Xrandr.h>
184
+
185
+ int main() {; return 0;}
186
+ EOF
187
+
188
+ if { (eval echo $config_script: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
189
+ rm -rf conftest*
190
+ has_xrandr=yes
191
+ else
192
+ echo "$config_script: failed program was:" >&5
193
+ cat conftest.c >&5
194
+ fi
195
+ rm -f conftest*
196
+
197
+ echo " X11 RandR extension: ""$has_xrandr" 1>&6
198
+ if [ "x$has_xrandr" = xyes ]; then
199
+ CFLAGS="$CFLAGS -D_GLFW_HAS_XRANDR"
200
+ LIBS="$LIBS -lXrandr"
201
+ fi
202
+ echo " " 1>&6
203
+
204
+
205
+ ##########################################################################
206
+ # Check for X11 VidMode availability
207
+ ##########################################################################
208
+ if [ "x$has_xrandr" != xyes ]; then
209
+
210
+ echo "Checking for X11 VidMode support... " 1>&6
211
+ echo "$config_script: Checking for X11 VidMode support" >&5
212
+ has_xf86vm=no
213
+
214
+ cat > conftest.c <<EOF
215
+ #include <X11/Xlib.h>
216
+ #include <X11/extensions/xf86vmode.h>
217
+
218
+ #if defined(__APPLE_CC__)
219
+ #error Not supported under Mac OS X
220
+ #endif
221
+
222
+ int main() {; return 0;}
223
+ EOF
224
+
225
+ if { (eval echo $config_script: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
226
+ rm -rf conftest*
227
+ has_xf86vm=yes
228
+ else
229
+ echo "$config_script: failed program was:" >&5
230
+ cat conftest.c >&5
231
+ fi
232
+ rm -f conftest*
233
+
234
+ echo " X11 VidMode extension: ""$has_xf86vm" 1>&6
235
+ if [ "x$has_xf86vm" = xyes ]; then
236
+ CFLAGS="$CFLAGS -D_GLFW_HAS_XF86VIDMODE"
237
+ LIBS="$LIBS -lXxf86vm -lXext"
238
+ fi
239
+ echo " " 1>&6
240
+
241
+ fi
242
+
243
+
244
+ ##########################################################################
245
+ # Check for pthread support
246
+ ##########################################################################
247
+ echo "Checking for pthread support... " 1>&6
248
+ echo "$config_script: Checking for pthread support" >&5
249
+ has_pthread=no
250
+
251
+ cat > conftest.c <<EOF
252
+ #include <pthread.h>
253
+ int main() {pthread_t posixID; posixID=pthread_self(); return 0;}
254
+ EOF
255
+
256
+ # Try -pthread (most systems)
257
+ CFLAGS_THREAD="-pthread"
258
+ CFLAGS_OLD="$CFLAGS"
259
+ CFLAGS="$CFLAGS $CFLAGS_THREAD"
260
+ LIBS_OLD="$LIBS"
261
+ LIBS="$LIBS -pthread"
262
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
263
+ rm -rf conftest*
264
+ has_pthread=yes
265
+ else
266
+ echo "$config_script: failed program was:" >&5
267
+ cat conftest.c >&5
268
+ fi
269
+
270
+ # Try -lpthread
271
+ if [ "x$has_pthread" = xno ]; then
272
+ CFLAGS_THREAD="-D_REENTRANT"
273
+ CFLAGS="$CFLAGS_OLD $CFLAGS_THREAD"
274
+ LIBS="$LIBS_OLD -lpthread"
275
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
276
+ rm -rf conftest*
277
+ has_pthread=yes
278
+ else
279
+ echo "$config_script: failed program was:" >&5
280
+ cat conftest.c >&5
281
+ fi
282
+ fi
283
+
284
+ # Try -lsocket (e.g. QNX)
285
+ if [ "x$has_pthread" = xno ]; then
286
+ CFLAGS="$CFLAGS_OLD"
287
+ LIBS="$LIBS_OLD -lsocket"
288
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
289
+ rm -rf conftest*
290
+ has_pthread=yes
291
+ else
292
+ echo "$config_script: failed program was:" >&5
293
+ cat conftest.c >&5
294
+ fi
295
+ fi
296
+
297
+ echo " pthread support: ""$has_pthread" 1>&6
298
+ if [ "x$has_pthread" = xyes ]; then
299
+ CFLAGS="$CFLAGS -D_GLFW_HAS_PTHREAD"
300
+ else
301
+ LIBS="$LIBS_OLD"
302
+ fi
303
+ echo " " 1>&6
304
+
305
+
306
+ ##########################################################################
307
+ # Check for sched_yield support
308
+ ##########################################################################
309
+ if [ "x$has_pthread" = xyes ]; then
310
+
311
+ echo "Checking for sched_yield support... " 1>&6
312
+ echo "$config_script: Checking for sched_yield support" >&5
313
+ has_sched_yield=no
314
+
315
+ LIBS_OLD="$LIBS"
316
+
317
+ cat > conftest.c <<EOF
318
+ #include <pthread.h>
319
+ int main() {sched_yield(); return 0;}
320
+ EOF
321
+
322
+ if { (eval echo $config_script: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
323
+ has_sched_yield=yes
324
+ else
325
+ echo "$config_script: failed program was:" >&5
326
+ cat conftest.c >&5
327
+ fi
328
+
329
+ if [ "x$has_sched_yield" = xno ]; then
330
+ LIBS="$LIBS_OLD -lrt"
331
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
332
+ has_sched_yield=yes
333
+ else
334
+ echo "$config_script: failed program was:" >&5
335
+ cat conftest.c >&5
336
+ LIBS="$LIBS_OLD"
337
+ fi
338
+ fi
339
+
340
+ rm -f conftest*
341
+
342
+ echo " sched_yield: ""$has_sched_yield" 1>&6
343
+ if [ "x$has_sched_yield" = xyes ]; then
344
+ CFLAGS="$CFLAGS -D_GLFW_HAS_SCHED_YIELD"
345
+ fi
346
+ echo " " 1>&6
347
+
348
+ fi
349
+
350
+
351
+ ##########################################################################
352
+ # Check for glXGetProcAddressXXX availability
353
+ ##########################################################################
354
+ echo "Checking for glXGetProcAddress support... " 1>&6
355
+ echo "$config_script: Checking for glXGetProcAddress support" >&5
356
+ has_glXGetProcAddress=no
357
+ has_glXGetProcAddressARB=no
358
+ has_glXGetProcAddressEXT=no
359
+
360
+ # glXGetProcAddress check
361
+ cat > conftest.c <<EOF
362
+ #include <X11/Xlib.h>
363
+ #include <GL/glx.h>
364
+ #include <GL/gl.h>
365
+ int main() {void *ptr=(void*)glXGetProcAddress("glFun"); return 0;}
366
+ EOF
367
+
368
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
369
+ rm -rf conftest*
370
+ has_glXGetProcAddress=yes
371
+ else
372
+ echo "$config_script: failed program was:" >&5
373
+ cat conftest.c >&5
374
+ fi
375
+ rm -f conftest*
376
+
377
+ # glXGetProcAddressARB check
378
+ cat > conftest.c <<EOF
379
+ #include <X11/Xlib.h>
380
+ #include <GL/glx.h>
381
+ #include <GL/gl.h>
382
+ int main() {void *ptr=(void*)glXGetProcAddressARB("glFun"); return 0;}
383
+ EOF
384
+
385
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
386
+ rm -rf conftest*
387
+ has_glXGetProcAddressARB=yes
388
+ else
389
+ echo "$config_script: failed program was:" >&5
390
+ cat conftest.c >&5
391
+ fi
392
+ rm -f conftest*
393
+
394
+ # glXGetProcAddressEXT check
395
+ cat > conftest.c <<EOF
396
+ #include <X11/Xlib.h>
397
+ #include <GL/glx.h>
398
+ #include <GL/gl.h>
399
+ int main() {void *ptr=(void*)glXGetProcAddressEXT("glFun"); return 0;}
400
+ EOF
401
+
402
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
403
+ rm -rf conftest*
404
+ has_glXGetProcAddressEXT=yes
405
+ else
406
+ echo "$config_script: failed program was:" >&5
407
+ cat conftest.c >&5
408
+ fi
409
+ rm -f conftest*
410
+
411
+ echo " glXGetProcAddress extension: ""$has_glXGetProcAddress" 1>&6
412
+ echo " glXGetProcAddressARB extension: ""$has_glXGetProcAddressARB" 1>&6
413
+ echo " glXGetProcAddressEXT extension: ""$has_glXGetProcAddressEXT" 1>&6
414
+ if [ "x$has_glXGetProcAddress" = xyes ]; then
415
+ CFLAGS="$CFLAGS -D_GLFW_HAS_GLXGETPROCADDRESS"
416
+ fi
417
+ if [ "x$has_glXGetProcAddressARB" = xyes ]; then
418
+ CFLAGS="$CFLAGS -D_GLFW_HAS_GLXGETPROCADDRESSARB"
419
+ fi
420
+ if [ "x$has_glXGetProcAddressEXT" = xyes ]; then
421
+ CFLAGS="$CFLAGS -D_GLFW_HAS_GLXGETPROCADDRESSEXT"
422
+ fi
423
+ echo " " 1>&6
424
+
425
+
426
+ ##########################################################################
427
+ # Check for dlopen support
428
+ ##########################################################################
429
+ echo "Checking for dlopen support... " 1>&6
430
+ echo "$config_script: Checking for dlopen support" >&5
431
+ has_dlopen=no
432
+
433
+ cat > conftest.c <<EOF
434
+ #include <dlfcn.h>
435
+ int main() {void *l=dlopen("libGL.so",RTLD_LAZY|RTLD_GLOBAL); return 0;}
436
+ EOF
437
+
438
+ # First try without -ldl
439
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
440
+ rm -rf conftest*
441
+ has_dlopen=yes
442
+ else
443
+ echo "$config_script: failed program was:" >&5
444
+ cat conftest.c >&5
445
+ fi
446
+
447
+ # Now try with -ldl if the previous attempt failed
448
+ if [ "x$has_dlopen" = xno ]; then
449
+ LIBS_OLD="$LIBS"
450
+ LIBS="$LIBS -ldl"
451
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
452
+ rm -rf conftest*
453
+ has_dlopen=yes
454
+ else
455
+ echo "$config_script: failed program was:" >&5
456
+ cat conftest.c >&5
457
+ fi
458
+ if [ "x$has_dlopen" = xno ]; then
459
+ LIBS="$LIBS_OLD"
460
+ fi
461
+ fi
462
+ rm -f conftest*
463
+
464
+ echo " dlopen support: ""$has_dlopen" 1>&6
465
+ if [ "x$has_dlopen" = xyes ]; then
466
+ CFLAGS="$CFLAGS -D_GLFW_HAS_DLOPEN"
467
+ fi
468
+ echo " " 1>&6
469
+
470
+
471
+ ##########################################################################
472
+ # Check for sysconf support
473
+ ##########################################################################
474
+ echo "Checking for sysconf support... " 1>&6
475
+ echo "$config_script: Checking for sysconf support" >&5
476
+ has_sysconf=no
477
+
478
+ cat > conftest.c <<EOF
479
+ #include <unistd.h>
480
+ #ifndef _SC_NPROCESSORS_ONLN
481
+ #ifndef _SC_NPROC_ONLN
482
+ #error Neither _SC_NPROCESSORS_ONLN nor _SC_NPROC_ONLN available
483
+ #endif
484
+ #endif
485
+ int main() {long x=sysconf(_SC_ARG_MAX); return 0; }
486
+ EOF
487
+
488
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
489
+ rm -rf conftest*
490
+ has_sysconf=yes
491
+ else
492
+ echo "$config_script: failed program was:" >&5
493
+ cat conftest.c >&5
494
+ fi
495
+ rm -f conftest*
496
+
497
+ echo " sysconf support: ""$has_sysconf" 1>&6
498
+ if [ "x$has_sysconf" = xyes ]; then
499
+ CFLAGS="$CFLAGS -D_GLFW_HAS_SYSCONF"
500
+ fi
501
+ echo " " 1>&6
502
+
503
+
504
+ ##########################################################################
505
+ # Check for sysctl support
506
+ ##########################################################################
507
+ echo "Checking for sysctl support... " 1>&6
508
+ echo "$config_script: Checking for sysctl support" >&5
509
+ has_sysctl=no
510
+
511
+ cat > conftest.c <<EOF
512
+ #include <sys/types.h>
513
+ #include <sys/sysctl.h>
514
+ #ifdef CTL_HW
515
+ #ifdef HW_NCPU
516
+ yes;
517
+ #endif
518
+ #endif
519
+ EOF
520
+
521
+ if { ac_try='$CC -E conftest.c'; { (eval echo $config_script: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
522
+ has_sysctl=yes
523
+ fi
524
+ rm -f conftest*
525
+
526
+ echo " sysctl support: ""$has_sysctl" 1>&6
527
+ if [ "x$has_sysctl" = xyes ]; then
528
+ CFLAGS="$CFLAGS -D_GLFW_HAS_SYSCTL"
529
+ fi
530
+ echo " " 1>&6
531
+
532
+
533
+ ##########################################################################
534
+ # Post fixups
535
+ ##########################################################################
536
+ if [ "x$use_gcc" = xyes ]; then
537
+ CFLAGS_SPEED="-c -I. -I.. $CFLAGS -O3 -ffast-math -Wall"
538
+ CFLAGS="-c -I. -I.. $CFLAGS -Os -Wall"
539
+ CFLAGS_LINK="$INCS -O3 -ffast-math -Wall"
540
+ else
541
+ CFLAGS_SPEED="-c -I. -I.. $CFLAGS -O"
542
+ CFLAGS="-c -I. -I.. $CFLAGS -O"
543
+ CFLAGS_LINK="$INCS -O"
544
+ fi
545
+ CFLAGS_LINK="-I../include $CFLAGS_LINK"
546
+ LFLAGS_LINK="../lib/x11/libglfw.a $LFLAGS -lGLU $LIBS -lm"
547
+
548
+
549
+ ##########################################################################
550
+ # Create Makefiles
551
+ ##########################################################################
552
+
553
+ # ./lib/x11/Makefile.x11
554
+ MKNAME='./lib/x11/Makefile.x11'
555
+ echo "Creating ""$MKNAME""..." 1>&6
556
+ echo " " 1>&6
557
+ echo "$config_script: Creating ""$MKNAME""..." >&5
558
+ echo "##########################################################################" >$MKNAME
559
+ echo "# Automatically generated Makefile for GLFW" >>$MKNAME
560
+ echo "##########################################################################" >>$MKNAME
561
+ echo "CC = $CC" >>$MKNAME
562
+ echo "CFLAGS = $CFLAGS" >>$MKNAME
563
+ echo "CFLAGS_SPEED = $CFLAGS_SPEED" >>$MKNAME
564
+ echo "LDFLAGS = $LDFLAGS" >>$MKNAME
565
+ echo "LFLAGS = $LFLAGS" >>$MKNAME
566
+ echo "LIBS = $LIBS" >>$MKNAME
567
+ echo " " >>$MKNAME
568
+ cat './lib/x11/Makefile.x11.in' >>$MKNAME
569
+
570
+ # ./examples/Makefile.x11
571
+ MKNAME='./examples/Makefile.x11'
572
+ echo "Creating ""$MKNAME""..." 1>&6
573
+ echo " " 1>&6
574
+ echo "$config_script: Creating ""$MKNAME""..." >&5
575
+ echo "##########################################################################" >$MKNAME
576
+ echo "# Automatically generated Makefile for GLFW" >>$MKNAME
577
+ echo "##########################################################################" >>$MKNAME
578
+ echo "CC = $CC" >>$MKNAME
579
+ echo "CFLAGS = $CFLAGS_LINK" >>$MKNAME
580
+ echo "LFLAGS = $LFLAGS_LINK" >>$MKNAME
581
+ echo " " >>$MKNAME
582
+ cat './examples/Makefile.x11.in' >>$MKNAME
583
+
584
+
585
+ ##########################################################################
586
+ # Create pkg-config template file
587
+ ##########################################################################
588
+
589
+ # ./lib/x11/libglfw.pc.in
590
+ MKNAME="./lib/x11/libglfw.pc.in"
591
+ echo "Creating ""$MKNAME""..." 1>&6
592
+ echo " " 1>&6
593
+ echo "$config_script: Creating ""$MKNAME""..." >&5
594
+ cat > "$MKNAME" <<EOF
595
+ prefix=@PREFIX@
596
+ exec_prefix=@PREFIX@
597
+ libdir=@PREFIX@/lib
598
+ includedir=@PREFIX@/include
599
+
600
+ Name: GLFW
601
+ Description: A portable framework for OpenGL development
602
+ Version: 2.6.0
603
+ URL: http://glfw.sourceforge.net/
604
+ Libs: -L\${libdir} -lglfw $LFLAGS $LIBS -lm
605
+ Cflags: -I\${includedir} $CFLAGS_THREAD
606
+ EOF
607
+