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