1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
|
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
dnl %CopyrightBegin%
dnl
dnl Copyright Ericsson AB 2008-2016. All Rights Reserved.
dnl
dnl Licensed under the Apache License, Version 2.0 (the "License");
dnl you may not use this file except in compliance with the License.
dnl You may obtain a copy of the License at
dnl
dnl http://www.apache.org/licenses/LICENSE-2.0
dnl
dnl Unless required by applicable law or agreed to in writing, software
dnl distributed under the License is distributed on an "AS IS" BASIS,
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl See the License for the specific language governing permissions and
dnl limitations under the License.
dnl
dnl %CopyrightEnd%
AC_INIT()
AC_CONFIG_AUX_DIRS($srcdir/autoconf)
AC_PREREQ(2.59)
## Delete previous failed configure results
if test -f ./CONF_INFO; then
rm ./CONF_INFO
fi
if test -z "$ERL_TOP" || test ! -d $ERL_TOP ; then
AC_MSG_ERROR([ERL_TOP is not set])
else
erl_top=${ERL_TOP}
AC_CONFIG_AUX_DIRS($erl_top/erts/autoconf)
WX_BUILDING_INSIDE_ERLSRC=true
fi
if test "X$host" != "Xfree_source" -a "X$host" != "Xwin32"; then
AC_CANONICAL_HOST
else
host_os=win32
fi
case $host_os in
mingw32)
if test "X$host" = "X"; then
host=win32
fi
;;
*)
;;
esac
TARGET=$host
AC_SUBST(TARGET)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_CPP
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#ifndef __cplusplus
#error "broken C++"
#endif]])],,
[CXX=;])
AC_LANG_POP([C++])
if test "X$CXX" = X ; then
echo "Can not find C++ compiler" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
AC_MSG_WARN([Can not find C++ compiler])
fi
WXERL_CAN_BUILD_DRIVER=false
AC_MSG_NOTICE(Building for [$host_os])
WXERL_CAN_BUILD_DRIVER=true
LM_WINDOWS_ENVIRONMENT
USER_CFLAGS=$CFLAGS
if test X"$MIXED_CYGWIN_VC" = X"yes" -o X"$MIXED_MSYS_VC" = X"yes"; then
CFLAGS="-Owx"
fi
AC_CHECK_SIZEOF(void *)
PTHR_CFLAGS="-D_THREAD_SAFE -D_REENTRANT"
OBJC_CC=$CC
OBJC_CFLAGS=""
CXXFLAGS=""
dnl NOTE: CPPFLAGS will be included in CFLAGS at the end
case $host_os in
darwin*)
AC_MSG_CHECKING([Checking wxWidgets for min version:])
WX_CC=`wx-config --cc`
MAC_MIN=`echo "$WX_CC" | sed 's/^[[^ ]]*\ *//'`
AC_MSG_RESULT([$MAC_MIN])
AC_MSG_CHECKING([if compiler accepts -ObjC])
CFLAGS="$CFLAGS -ObjC"
AC_TRY_COMPILE([],[;], accept_objc_flag=true, accept_objc_flag=false)
if test "X$accept_objc_flag" = "Xtrue"; then
AC_MSG_RESULT([yes])
C_ONLY_FLAGS="-ObjC"
else
dnl We are probably trying to build with a non-Apple gcc,
dnl which is good as long as we do not try to build Cocoa
dnl code. We need an Apple compiler for just that (Objective C)
AC_MSG_RESULT([no])
AC_MSG_CHECKING([for a Cocoa compliant Objective C compiler])
SEARCHFOR=""
SEARCHFORXX=""
save_IFS=$IFS
IFS=:
set $PATH
IFS=$save_IFS
while test X"$1" != X""; do
dnl Add all possible paths to a real apple gcc
SEARCHFOR="$1/gcc-apple-4.2 $SEARCHFOR"
SEARCHFORXX="$1/g++-apple-4.2 $SEARCHFORXX"
shift
done
dnl Add LLVM compilers, they will work in this case
SEARCHFOR="/usr/bin/clang /usr/bin/gcc $SEARCHFOR"
SEARCHFORXX="/usr/bin/clang /usr/bin/g++ $SEARCHFORXX"
APPLE_CC=""
APPLE_CXX=""
dnl SEARCHFOR is reversed, so we want to find the last existing
dnl executable in the list
IFS=" "
set $SEARCHFORXX
for x in $SEARCHFOR; do
if test -x $x; then
APPLE_CC=$x
fi
if test -x "$1"; then
APPLE_CXX="$1"
fi
shift
done
IFS=$save_IFS
if test X$APPLE_CC = X -o X$APPLE_CXX = X; then
AC_MSG_RESULT([no])
dnl Complete failure, we cannot build Cocoa code
echo "Can not find compiler to compile Cocoa applications" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
AC_MSG_WARN([Can not find compiler to compile Cocoa applications])
WXERL_CAN_BUILD_DRIVER=false
else
dnl We think we found an Apple compiler and will add
dnl Apple specific options
AC_MSG_RESULT([$APPLE_CC ($APPLE_CXX)])
dnl We should use this compiler for all of wx - hack...
CC=$APPLE_CC
CXX=$APPLE_CXX
dnl Both clang and gcc accept these flags...
#CXXFLAGS="-x c++ $CXXFLAGS"
OBJC_CC=$APPLE_CC
OBJC_CFLAGS="-ObjC"
fi
fi
CFLAGS="$USER_CFLAGS $MAC_MIN -Wno-deprecated-declarations"
CPPFLAGS="$CPPFLAGS -D_MACOSX $PTHR_CFLAGS"
;;
mingw32)
CFLAGS="$CFLAGS -DWIN32 -DWINVER=0x0600 -D_WINDOWS -D_UNICODE -DUNICODE"
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
AC_MSG_WARN([Reverting to 32-bit time_t])
CPPFLAGS="$CPPFLAGS -D_USE_32BIT_TIME_T"
;;
win32)
CFLAGS="$CFLAGS -DWIN32 -DWINVER=0x0600 -D_WINDOWS -D_UNICODE -DUNICODE"
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
;;
*)
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE $PTHR_CFLAGS"
;;
esac
AC_SUBST(OBJC_CC)
AC_SUBST(OBJC_CFLAGS)
case $host_os in
darwin*)
LDFLAGS="$MAC_MIN -bundle -flat_namespace -undefined warning -fPIC $LDFLAGS"
# Check sizof_void_p as future will hold 64bit MacOS wx
if test $ac_cv_sizeof_void_p = 4; then
LDFLAGS="-m32 $LDFLAGS"
fi
GL_LIBS="-framework OpenGL"
;;
win32)
LDFLAGS="-dll $LDFLAGS"
GL_LIBS="-lglu32 -lOpengl32"
;;
mingw32)
LDFLAGS="-shared -fPIC $LDFLAGS"
GL_LIBS="-lglu32 -lOpengl32"
;;
*)
LDFLAGS="-shared -fPIC $LDFLAGS"
GL_LIBS="-lGL -lGLU"
;;
esac
dnl ----------------------------------------------------------------------
dnl Include CPPFLAGS in CFLAGS
dnl ----------------------------------------------------------------------
case $host_os in
mingw32)
DEBUG_CFLAGS="-g -Wall -DDEBUG $CFLAGS"
CFLAGS="-g -Wall -O2 $CFLAGS -fomit-frame-pointer -fno-strict-aliasing"
;;
win32)
DEBUG_CFLAGS="-g -Wall $CFLAGS -DDEBUG"
CFLAGS="-g -Wall -O2 $CFLAGS"
;;
darwin*)
DEBUG_CFLAGS="-g -Wall -fPIC $CFLAGS -DDEBUG"
# omit-frame-pointer causes seg faults with 10.9 and clang
CFLAGS="-g -Wall -fPIC $CFLAGS -fno-strict-aliasing"
;;
*)
DEBUG_CFLAGS="-g -Wall -fPIC $CFLAGS -DDEBUG"
CFLAGS="-Wall -fPIC $CFLAGS -fomit-frame-pointer -fno-strict-aliasing"
;;
esac
dnl
dnl Use -O1 -fno-move-loop-invariants for wxe_funcs.cpp to reduce
dnl compilation time
dnl
if test "x$GCC" = xyes -a X"$host_os" != X"win32" ; then
CXXNOOPT="-O1"
LM_TRY_ENABLE_CFLAG([-fno-move-loop-invariants], [CXXNOOPT])
fi
dnl
dnl Opengl tests
dnl
if test X"$host_os" != X"win32" ; then
AC_CHECK_HEADERS([GL/gl.h], [],
[AC_CHECK_HEADERS([OpenGL/gl.h])])
if test X"$ac_cv_header_GL_gl_h" != Xyes &&
test X"$ac_cv_header_OpenGL_gl_h" != Xyes
then
saved_CPPFLAGS="$CPPFLAGS"
AC_MSG_NOTICE(Checking for OpenGL headers in /usr/X11R6)
CPPFLAGS="-isystem /usr/X11R6/include $CPPFLAGS"
$as_unset ac_cv_header_GL_gl_h
AC_CHECK_HEADERS([GL/gl.h])
if test X"$ac_cv_header_GL_gl_h" != Xyes ; then
AC_MSG_NOTICE(Checking for OpenGL headers in /usr/local)
CPPFLAGS="-isystem /usr/local/include $saved_CPPFLAGS"
$as_unset ac_cv_header_GL_gl_h
AC_CHECK_HEADERS([GL/gl.h])
if test X"$ac_cv_header_GL_gl_h" != Xyes ; then
AC_MSG_WARN([No OpenGL headers found, wx will NOT be usable])
echo "No OpenGL headers found, wx will NOT be usable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
CPPFLAGS="$saved_CPPFLAGS"
else
GL_LIBS="-L/usr/local/lib $GL_LIBS"
fi
else
GL_LIBS="-L/usr/X11R6/lib $GL_LIBS"
fi
fi
else
AC_CHECK_HEADERS([gl/gl.h],[],[],[#include <windows.h>])
fi
if test X"$host_os" != X"win32" ; then
AC_CHECK_HEADERS([GL/glu.h], [],
[AC_CHECK_HEADERS([OpenGL/glu.h])])
if test X"$ac_cv_header_GL_glu_h" != Xyes &&
test X"$ac_cv_header_OpenGL_glu_h" != Xyes
then
AC_MSG_WARN([No GLU headers found, wx will NOT be usable])
echo "No GLU headers (glu.h) found, wx will NOT be usable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
fi
else
AC_CHECK_HEADERS([gl/glu.h],[],[],[#include <windows.h>])
fi
AC_SUBST(GL_LIBS)
DEBUG_CXXFLAGS="$CXXFLAGS $DEBUG_CFLAGS $CPPFLAGS"
DEBUG_CFLAGS="$DEBUG_CFLAGS $CPPFLAGS $C_ONLY_FLAGS"
CXXNOOPTFLAGS="$CXXFLAGS $CFLAGS $CPPFLAGS $CXXNOOPT"
CXXFLAGS="$CXXFLAGS $CFLAGS $CPPFLAGS"
CFLAGS="$CFLAGS $CPPFLAGS $C_ONLY_FLAGS"
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_CXXFLAGS)
ERLC=erlc
ERL=erl
ERLANG_ROOT_DIR=$ERL_TOP
AC_SUBST(ERLC)
AC_SUBST(WX_BUILDING_INSIDE_ERLSRC)
AC_SUBST(ERLANG_ROOT_DIR)
dnl
dnl Check for wxwidgets
dnl
if test "$cross_compiling" = "yes"; then
echo "Cross compilation of the wx driver is not supported yet, wx will NOT be usable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
elif test X"$MIXED_CYGWIN_VC" = X"no" -a X"$MIXED_MSYS_VC" = X"no"; then
WX_VERSION=`wx-config --version`
case $WX_VERSION in
2.8.*)
m4_include(wxwin-2.8.m4)
;;
*)
m4_include(wxwin-2.9.m4)
;;
esac
AM_OPTIONS_WXCONFIG
reqwx=2.8.4
# Try to find debug libs first
# wxelibs=core,base,gl,aui,adv
AC_MSG_CHECKING(for debug build of wxWidgets)
AM_PATH_WXCONFIG($reqwx, wxWinWithGLDBG=1, wxWinWithGLDBG=0, [stc,xrc,html,adv,xml,core,base,gl,aui], [--unicode --debug=yes])
DEBUG_WX_CFLAGS=$WX_CFLAGS
DEBUG_WX_CXXFLAGS=$WX_CXXFLAGS
DEBUG_WX_LIBS=$WX_LIBS
DEBUG_WX_LIBS_STATIC=$WX_LIBS_STATIC
AC_SUBST(DEBUG_WX_CFLAGS)
AC_SUBST(DEBUG_WX_CXXFLAGS)
AC_SUBST(DEBUG_WX_LIBS)
AC_SUBST(DEBUG_WX_LIBS_STATIC)
AC_MSG_CHECKING(for standard build of wxWidgets)
AM_PATH_WXCONFIG($reqwx, wxWinWithGL=1, wxWinWithGL=0, [stc,xrc,html,adv,xml,core,base,gl,aui], [--unicode --debug=no])
if test "x$WX_LIBS_STATIC" = "x"; then
WX_HAVE_STATIC_LIBS=false
else
WX_HAVE_STATIC_LIBS=true
fi
wxWin=0
if test "$wxWinWithGLDBG" = 1; then
if test "$wxWinWithGL" = 1; then
wxWin=1
FORCED_DEBUG_BUILD=false
else
wxWin=1
FORCED_DEBUG_BUILD=debug
WX_CFLAGS=$DEBUG_WX_CFLAGS
WX_CXXFLAGS=$DEBUG_WX_CXXFLAGS
WX_LIBS=$DEBUG_WX_LIBS
WX_LIBS_STATIC=$DEBUG_WX_LIBS_STATIC
fi
elif test "$wxWinWithGL" = 1; then
wxWin=1
FORCED_DEBUG_BUILD=false
fi
AC_SUBST(FORCED_DEBUG_BUILD)
RC_FILE_TYPE=o
define(wx_warn_text,[
wxWidgets must be installed on your system.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' or 'wx-config --static --libs' command)
is in LD_LIBRARY_PATH or equivalent variable and
wxWidgets version is $reqwx or above.])
if test "$wxWin" != 1; then
echo "wxWidgets not found, wx will NOT be usable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
AC_MSG_WARN([wx_warn_text])
fi
else
AC_MSG_CHECKING(for wxWidgets in standard locations)
# Check whether --with-wxdir was given.
AC_MSG_NOTICE(OptionCheck: [$with_wxdir $with_wx_prefix])
if test "${with_wxdir+set}" = set; then :
withval=$with_wxdir; CWXWIN0=$withval
else
# Check whether --with-wx-prefix was given.
if test "${with_wx_prefix+set}" = set; then :
withval=$with_wx_prefix; CWXWIN0=$withval
else
echo Setting it empty
CWXWIN0=""
fi
fi
if test "x$MIXED_MSYS" = "xyes"; then
CWXWIN_CONFIG=`win2msys_path.sh $wx_config_name 2>/dev/null`
else
CWXWIN_CONFIG=`cygpath $wx_config_name 2>/dev/null`
fi
CWXWIN1=`dirname $CWXWIN_CONFIG 2>/dev/null`
CWXWIN2=`dirname $CWXWIN1 2>/dev/null`
if test -z "$PROGRAMFILES" ; then
PROGRAMFILES=c:/Program Files
fi
if test "x$MIXED_MSYS" = "xyes"; then
CWXWIN_PROG=`win2msys_path.sh "$PROGRAMFILES" 2>/dev/null`
else
CWXWIN_PROG=`cygpath -d "$PROGRAMFILES" | cygpath -f - 2>/dev/null`
fi
CWXWIN3="$CWXWIN_PROG/wxWidgets-3.*.* $CWXWIN_PROG/wxWidgets-2.*.*"
CWXWIN4="$CWXWIN_PROG/wxMSW-3.*.* $CWXWIN_PROG/wxMSW-2.*.*"
DOC_OPT=/opt/local/pgm
CWX_DOCUMENTED="$DOC_OPT/wxWidgets-2.*.* $DOC_OPT/wxMSW-2.*.*"
CWX_DOCUMENTED="$DOC_OPT/wxWidgets-3.*.* $DOC_OPT/wxMSW-3.*.* $CWX_DOCUMENTED"
case $ac_cv_sizeof_void_p in
8)
DOC_OPT64=/opt/local64/pgm
CWX_DOCUMENTED="$DOC_OPT64/wxWidgets-2.*.* $DOC_OPT64/wxMSW-2.*.* $CWX_DOCUMENTED"
CWX_DOCUMENTED="$DOC_OPT64/wxWidgets-3.*.* $DOC_OPT64/wxMSW-3.*.* $CWX_DOCUMENTED"
;;
*)
true
;;
esac
CWXPATH="$CWXWIN0 $CWXWIN1 $CWXWIN2 $CWX_DOCUMENTED $CWXWIN3 $CWXWIN4"
for dir in $CWXPATH; do
AC_MSG_NOTICE(Checking: [$dir])
if test -f $dir/include/wx/wx.h; then
WXINCLUDE_MSVC=$dir/include/msvc
WXINCLUDE_PLAIN=$dir/include
WXINCLUDE_CONTRIB=$dir/contrib/include
WX_CFLAGS="-EHsc -D_UNICODE -DUNICODE -I$WXINCLUDE_MSVC -I$WXINCLUDE_PLAIN -I$WXINCLUDE_CONTRIB -D__WXMSW__"
WX_CXXFLAGS="-TP $WX_CFLAGS"
WX_LIBDIR=$dir/lib/vc_lib
WX_LIBDIR64=$dir/lib/vc_x64_lib
WX_RESCOMP="rc.sh -I$WXINCLUDE_PLAIN -D __WIN32__"
RC_FILE_TYPE=res
for lib in $WX_LIBDIR $WX_LIBDIR64; do
maybe=`ls $lib/wxbase*.lib | egrep 'wxbase[[0-9]]*u\.lib'`
if test '!' -z "$maybe"; then
corelib_number=`echo $maybe | sed 's,.*\([[0-9]].\)u\.lib,\1,'`
WX_LIBDIR=$lib
break
fi
done
if test '!' -z "$corelib_number"; then
WXLIBNO=$corelib_number
WX_LIBS0="wxmsw${WXLIBNO}u_stc wxmsw${WXLIBNO}u_xrc wxmsw${WXLIBNO}u_html"
WX_LIBS1="wxmsw${WXLIBNO}u_adv wxbase${WXLIBNO}u_xml wxmsw${WXLIBNO}u_core"
WX_LIBS2="wxbase${WXLIBNO}u wxmsw${WXLIBNO}u_gl wxmsw${WXLIBNO}u_aui"
WX_LIBS3="wxregexu wxexpat wxtiff wxjpeg wxpng wxzlib"
WX_SYSLIBS="winspool winmm oleaut32 ole32 gdiplus"
WX_LIBS_STATIC="-L$WX_LIBDIR"
for lib in $WX_LIBS0 $WX_LIBS1 $WX_LIBS2 $WX_LIBS3 $WX_SYSLIBS; do
WX_LIBS_STATIC="$WX_LIBS_STATIC -l$lib"
done
AC_MSG_RESULT([$dir])
break
fi
fi
done
if test -z "$WX_LIBS_STATIC"; then
AC_MSG_RESULT([failed])
echo "No usable wxWidgets not found, wx will not be useable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
AC_MSG_WARN([Cannot find core lib version for wxWidgets])
fi
WX_HAVE_STATIC_LIBS=true
AC_SUBST(WX_CFLAGS)
AC_SUBST(WX_CXXFLAGS)
AC_SUBST(WX_LIBS_STATIC)
AC_SUBST(WX_RESCOMP)
fi
if test "$WXERL_CAN_BUILD_DRIVER" != "false"; then
AC_SUBST(WX_HAVE_STATIC_LIBS)
AC_SUBST(RC_FILE_TYPE)
AC_MSG_CHECKING(if wxwidgets have opengl support)
AC_LANG_PUSH(C++)
saved_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#ifdef WIN32
# include <windows.h>
#endif
#include "wx/wx.h"
]], [[
#if wxUSE_GLCANVAS
;
#else
#error barf
#endif
]])],
[HAVE_GL_SUPPORT=yes
AC_DEFINE(HAVE_GL_SUPPORT, [1], [Define if wxwidgets have gl support])],
HAVE_GL_SUPPORT=no)
CXXFLAGS=$saved_CXXFLAGS
AC_LANG_POP(C++)
AC_MSG_RESULT($HAVE_GL_SUPPORT)
AC_SUBST(HAVE_GL_SUPPORT)
if test X"$HAVE_GL_SUPPORT" != X"yes" ; then
echo "wxWidgets don't have gl support, wx will NOT be useable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
fi
dnl Check for GLintptr
dnl We define the types glext.h so we don't depend on glext.h is updated
dnl to the latest version, but some systems defined them in gl.h
dnl i.e Darwin and Solaris.
AC_CHECK_TYPES([GLintptr, GLintptrARB, GLchar,
GLcharARB, GLhalfARB, GLint64EXT],
[], [],
[#ifdef WIN32
# include <windows.h>
# include <gl/gl.h>
#elif defined(HAVE_GL_GL_H)
# include <GL/gl.h>
#elif defined(HAVE_OPENGL_GL_H)
# include <OpenGL/gl.h>
#endif
])
dnl
AC_MSG_CHECKING(GLU Callbacks uses Tiger Style)
AC_LANG_PUSH(C++)
saved_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS"
AC_TRY_COMPILE([
#ifdef WIN32
# include <windows.h>
# include <gl/glu.h>
#elif defined(HAVE_GL_GL_H)
# include <GL/glu.h>
#elif defined(HAVE_OPENGL_GL_H)
# include <OpenGL/glu.h>
#endif
#ifndef CALLBACK
# define CALLBACK
#endif
void CALLBACK foo() {};
],
[
GLUtesselator* tess;
gluTessCallback(tess,GLU_TESS_VERTEX,(GLvoid (*)(...)) foo);
],
[TESS_CB_TIGER_STYLE=yes
AC_DEFINE(TESS_CB_TIGER_STYLE, [1], [GLU Callbacks are Tiger style])],
TESS_CB_TIGER_STYLE=no)
AC_MSG_RESULT($TESS_CB_TIGER_STYLE)
AC_SUBST(TESS_CB_TIGER_STYLE)
dnl
dnl Check that we wx have stc (wxStyledTextControl) headers
dnl
AC_CHECK_HEADERS([wx/stc/stc.h],
[],
[WXERL_CAN_BUILD_DRIVER=false
echo "wxWidgets don't have wxStyledTextControl (stc.h), wx will NOT be useable" >> ./CONF_INFO
AC_MSG_WARN([Can not find wx/stc/stc.h $CXXFLAGS])
],
[#ifdef WIN32
# include <windows.h>
#endif
#include "wx/wx.h"])
dnl
dnl Check that we can link all the libraries
dnl
AC_MSG_CHECKING(if we can link wxwidgets programs)
saved_LIBS=$LIBS
if test X"$WX_HAVE_STATIC_LIBS" = X"true" ; then
LIBS=$WX_LIBS_STATIC
fi
AC_LINK_IFELSE([AC_LANG_SOURCE([
#ifdef WIN32
# include <windows.h>
# include <gl/gl.h>
#elif defined(HAVE_GL_GL_H)
# include <GL/gl.h>
#elif defined(HAVE_OPENGL_GL_H)
# include <OpenGL/gl.h>
#endif
#include "wx/wx.h"
#include "wx/stc/stc.h"
#include "wx/glcanvas.h"
])
class MyApp : public wxApp
{
virtual bool OnInit() {
// Test that we have a FromUTF8
// it isn't in too old wxWidgets versions
wxString test = wxString::FromUTF8((const char *)"foo");
wxStyledTextCtrl * foo = new wxStyledTextCtrl();
wxGLCanvas * bar = new wxGLCanvas((wxWindow *) NULL, -1,
wxDefaultPosition,wxDefaultSize,0);
return true;
};
};
IMPLEMENT_APP(MyApp)
],
[
CAN_LINK_WX=yes
],
[
CAN_LINK_WX=no
])
CXXFLAGS=$saved_CXXFLAGS
LIBS=$saved_LIBS
AC_LANG_POP(C++)
AC_MSG_RESULT($CAN_LINK_WX)
if test X"$CAN_LINK_WX" != X"yes" ; then
echo "Can not link the wx driver, wx will NOT be useable" >> ./CONF_INFO
WXERL_CAN_BUILD_DRIVER=false
AC_MSG_WARN([Can not link wx program are all developer packages installed?])
fi
fi dnl - if test "$WXERL_CAN_BUILD_DRIVER" != "false"
AC_SUBST(WXERL_CAN_BUILD_DRIVER)
if test "x$GCC" = xyes; then
# Treat certain GCC warnings as errors
LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS])
LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CXXFLAGS])
fi
dnl ----------------------------------------------------------------------
dnl Enable -fsanitize= flags.
dnl ----------------------------------------------------------------------
m4_define(DEFAULT_SANITIZERS, [address,undefined])
AC_ARG_ENABLE(
sanitizers,
AS_HELP_STRING(
[--enable-sanitizers@<:@=comma-separated list of sanitizers@:>@],
[Default=DEFAULT_SANITIZERS]),
[
case "$enableval" in
no) sanitizers= ;;
yes) sanitizers="-fsanitize=DEFAULT_SANITIZERS" ;;
*) sanitizers="-fsanitize=$enableval" ;;
esac
CFLAGS="$CFLAGS $sanitizers"
CXXFLAGS="$CXXFLAGS $sanitizers"
LDFLAGS="$LDFLAGS $sanitizers"
])
#############################################################################
dnl
case $host_os in
mingw32|win32)
RUN_ERL=werl
SO_EXT=.dll;;
*)
RUN_ERL=erl
SO_EXT=.so;;
esac
AC_SUBST(SO_EXT)
AC_SUBST(RUN_ERL)
AC_SUBST(CXXNOOPTFLAGS)
if test X"$WX_BUILDING_INSIDE_ERLSRC" != X"true" ; then
dnl Find driver directory name according to erlang
WXERL_SYS_TYPE=`erl -noshell -eval 'io:format("~s~n",[[erlang:system_info(system_architecture)]])' -s erlang halt`
else
WXERL_SYS_TYPE=$TARGET
fi
AC_SUBST(WXERL_SYS_TYPE)
mkdir -p $WXERL_SYS_TYPE
CONFIG_STATUS=$WXERL_SYS_TYPE/config.status
dnl
AC_CONFIG_FILES([
config.mk
c_src/Makefile
])
AC_OUTPUT
CORES=`ls core* 2>/dev/null`
if test X"$CORES" != X"" ; then
echo "Configure dumped core files" > ignore_core_files
fi
|