From 755afd9d1b8676fac09e61c822488945779fc3ca Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 28 Jul 2020 23:42:34 +0200 Subject: [PATCH 01/11] Fix typos in wxSTC interface --- src/stc/scintilla/include/Scintilla.iface | 2 +- src/stc/stc.cpp | 2 +- src/stc/stc.interface.h.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stc/scintilla/include/Scintilla.iface b/src/stc/scintilla/include/Scintilla.iface index 6b9a77f66e..035d80235f 100644 --- a/src/stc/scintilla/include/Scintilla.iface +++ b/src/stc/scintilla/include/Scintilla.iface @@ -331,7 +331,7 @@ set void MarkerSetBack=2042(int markerNumber, colour back) # Set the background colour used for a particular marker number when its folding block is selected. set void MarkerSetBackSelected=2292(int markerNumber, colour back) -# Enable/disable highlight for current folding bloc (smallest one that contains the caret) +# Enable/disable highlight for current folding block (smallest one that contains the caret) fun void MarkerEnableHighlight=2293(bool enabled,) # Add a marker to a line, returning an ID which can be used to find or delete the marker. diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp index 8e3820d162..8eabc40aa3 100644 --- a/src/stc/stc.cpp +++ b/src/stc/stc.cpp @@ -622,7 +622,7 @@ void wxStyledTextCtrl::MarkerSetBackgroundSelected(int markerNumber, const wxCol SendMsg(SCI_MARKERSETBACKSELECTED, markerNumber, wxColourAsLong(back)); } -// Enable/disable highlight for current folding bloc (smallest one that contains the caret) +// Enable/disable highlight for current folding block (smallest one that contains the caret) void wxStyledTextCtrl::MarkerEnableHighlight(bool enabled) { SendMsg(SCI_MARKERENABLEHIGHLIGHT, enabled, 0); diff --git a/src/stc/stc.interface.h.in b/src/stc/stc.interface.h.in index af05c72bde..3ce91d11e4 100644 --- a/src/stc/stc.interface.h.in +++ b/src/stc/stc.interface.h.in @@ -868,7 +868,7 @@ public: @section event_types Event Types The following is a brief description of when the control generates these - events and a list of which methods provide relevent information. Additional + events and a list of which methods provide relevant information. Additional details can be found in the Scintilla documentation (http://www.scintilla.org/ScintillaDoc.html#Notifications). From 4cab673556d5a695089f82243bad6623fa570425 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 28 Jul 2020 23:43:01 +0200 Subject: [PATCH 02/11] Make sure generated wxSTC files have LF EOL Use 'wb' with Python 2 to enforce LF newlines. This does not work with Python 3, use 'newline':'\n' there (which in turn does not work with 2). --- src/stc/gen_iface.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 6e976fded1..d55b2cb703 100755 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -1174,11 +1174,20 @@ def processIface(iface, h_tmplt, cpp_tmplt, ih_tmplt, h_dest, cpp_dest, docstr_d ih_text = ih_text % data # write out destination files - open(h_dest, 'w').write(h_text) - open(cpp_dest, 'w').write(cpp_text) + # Use 'wb' with Python 2 to enforce LF newlines. This does not work with + # Python 3, use 'newline':'\n' there (which in turn does not work with 2). + if sys.version_info[0] == 2: + acc = 'wb' + eol = {} + else: + acc = 'wt' + eol = {'newline':'\n'} + + open(h_dest, acc, **eol).write(h_text) + open(cpp_dest, acc, **eol).write(cpp_text) if docstr_dest: - open(docstr_dest, 'w').write(docstrings) - open(ih_dest, 'w').write(ih_text) + open(docstr_dest, acc, **eol).write(docstrings) + open(ih_dest, acc, **eol).write(ih_text) def joinWithNewLines(values): From f25a88a13dc51d9d857e10b4b264c0e817bb7a0f Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 1 Aug 2020 11:33:41 +0200 Subject: [PATCH 03/11] CMake: allow to use build-in libraries on Linux Requires updates of expat and tiff submodules. Most libraries have their own CMakeLists, add a comment with a suggestion to use this for implementing build-in support. --- build/cmake/lib/expat.cmake | 2 ++ build/cmake/lib/png.cmake | 2 ++ build/cmake/lib/regex.cmake | 3 --- build/cmake/lib/tiff.cmake | 9 ++------- build/cmake/lib/zlib.cmake | 2 ++ 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/build/cmake/lib/expat.cmake b/build/cmake/lib/expat.cmake index 1d2b79b1fa..7200dd5dab 100644 --- a/build/cmake/lib/expat.cmake +++ b/build/cmake/lib/expat.cmake @@ -8,6 +8,8 @@ ############################################################################# if(wxUSE_EXPAT STREQUAL "builtin") + # TODO: implement building expat via its CMake file, using + # add_subdirectory or ExternalProject_Add wx_add_builtin_library(wxexpat src/expat/expat/lib/xmlparse.c src/expat/expat/lib/xmlrole.c diff --git a/build/cmake/lib/png.cmake b/build/cmake/lib/png.cmake index c06a8cc5f0..13ddab58e0 100644 --- a/build/cmake/lib/png.cmake +++ b/build/cmake/lib/png.cmake @@ -8,6 +8,8 @@ ############################################################################# if(wxUSE_LIBPNG STREQUAL "builtin") + # TODO: implement building libpng via its CMake file, using + # add_subdirectory or ExternalProject_Add if(NOT MSVC) set(PNG_EXTRA_SOURCES src/png/mips/filter_msa_intrinsics.c diff --git a/build/cmake/lib/regex.cmake b/build/cmake/lib/regex.cmake index 0478f5d42e..b28fc2c7ce 100644 --- a/build/cmake/lib/regex.cmake +++ b/build/cmake/lib/regex.cmake @@ -8,7 +8,6 @@ ############################################################################# if(wxUSE_REGEX) - # TODO: Forcing builtin until sys is implemented set(wxUSE_REGEX builtin) wx_add_builtin_library(wxregex src/regex/regcomp.c @@ -20,5 +19,3 @@ if(wxUSE_REGEX) set(REGEX_LIBRARIES wxregex) set(REGEX_INCLUDE_DIRS ${wxSOURCE_DIR}/src/regex) endif() - -#TODO: find external lib and include dir diff --git a/build/cmake/lib/tiff.cmake b/build/cmake/lib/tiff.cmake index 289390db73..f77e5283de 100644 --- a/build/cmake/lib/tiff.cmake +++ b/build/cmake/lib/tiff.cmake @@ -8,13 +8,8 @@ ############################################################################# if(wxUSE_LIBTIFF STREQUAL "builtin") - # TODO: implement building libtiff via ExternalProject_Add() - if(UNIX AND NOT APPLE) - message(WARNING "Builtin libtiff on unix is currently not supported") - wx_option_force_value(wxUSE_LIBTIFF OFF) - return() - endif() - + # TODO: implement building libtiff via its CMake file, using + # add_subdirectory or ExternalProject_Add if(WIN32) set(TIFF_PLATFORM_SRC src/tiff/libtiff/tif_win32.c) elseif(UNIX) diff --git a/build/cmake/lib/zlib.cmake b/build/cmake/lib/zlib.cmake index 0666e010ec..1eede10235 100644 --- a/build/cmake/lib/zlib.cmake +++ b/build/cmake/lib/zlib.cmake @@ -8,6 +8,8 @@ ############################################################################# if(wxUSE_ZLIB STREQUAL "builtin") + # TODO: implement building zlib via its CMake file, using + # add_subdirectory or ExternalProject_Add wx_add_builtin_library(wxzlib src/zlib/adler32.c src/zlib/compress.c From cc12eafc3491ac96dd154b699c25eebd6a629d09 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 1 Aug 2020 11:36:48 +0200 Subject: [PATCH 04/11] CMake: fix name clash between folder and application The test_gui project copies some resource files into image and drawing folders, so don't use the same name for the sample applications. --- build/cmake/samples/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 0f02941a74..811db5ce7c 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -42,7 +42,7 @@ wx_add_sample(docview docview.cpp doc.cpp view.cpp docview.h doc.h view.h wx_add_sample(dragimag dragimag.cpp dragimag.h RES dragimag.rc DATA backgrnd.png shape01.png shape02.png shape03.png DEPENDS wxUSE_DRAGIMAGE) -wx_add_sample(drawing DATA pat4.bmp pat35.bmp pat36.bmp image.bmp mask.bmp) +wx_add_sample(drawing DATA pat4.bmp pat35.bmp pat36.bmp image.bmp mask.bmp NAME drawingsample) wx_add_sample(erase) wx_add_sample(event event.cpp gestures.cpp gestures.h chessboard.cpp chessboard.h) wx_add_sample(except DEPENDS wxUSE_EXCEPTIONS) @@ -71,7 +71,7 @@ wx_add_sample(image image.cpp canvas.cpp canvas.h cursor_png.c RES image.rc DATA horse.png horse.jpg horse.bmp horse.gif horse.pcx horse.pnm horse_ag.pnm horse_rg.pnm horse.tif horse.tga horse.xpm horse.cur horse.ico horse3.ani smile.xbm toucan.png cmyk.jpg cursor.png - DEPENDS wxUSE_IMAGE) + NAME imagesample DEPENDS wxUSE_IMAGE) foreach(lang ar bg cs de fr it ka pl ru sv ja ja_JP.EUC-JP) list(APPEND INTERNAT_DATA_FILES ${lang}/internat.po ${lang}/internat.mo) endforeach() From 3c368408fb04980daba6f68b7a064a0d90d7a706 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 1 Aug 2020 11:39:12 +0200 Subject: [PATCH 05/11] CMake: use dedicated function to check function availability --- build/cmake/setup.cmake | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 1272e3de49..37c6af78d2 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -587,14 +587,11 @@ foreach(func endforeach() # Check various functions -foreach(func - fsync - snprintf vsnprintf strnlen strtoull - setpriority - ) - string(TOUPPER ${func} func_upper) - check_function_exists(${func} HAVE_${func_upper}) -endforeach() +wx_check_funcs(fsync + snprintf vsnprintf strnlen strtoull + setpriority + gettimeofday + ) if(MSVC) check_symbol_exists(vsscanf stdio.h HAVE_VSSCANF) @@ -643,7 +640,6 @@ cmake_pop_check_state() if(HAVE_DLOPEN) check_symbol_exists(dladdr dlfcn.h HAVE_DLADDR) endif() -check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) if(APPLE) set(wxUSE_EPOLL_DISPATCHER OFF) From 81a5efb6ab6135dd0c2bfcdd0b1a8a99b25c56c8 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 1 Aug 2020 11:40:20 +0200 Subject: [PATCH 06/11] Fix implicit-int-float-conversion warning in bombs demo --- demos/bombs/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/bombs/game.cpp b/demos/bombs/game.cpp index 48bd783d79..fc373513e9 100644 --- a/demos/bombs/game.cpp +++ b/demos/bombs/game.cpp @@ -64,7 +64,7 @@ bool BombsGame::Init(int aWidth, int aHeight, bool easyCorner) { for(y=0; y Date: Sat, 1 Aug 2020 11:41:28 +0200 Subject: [PATCH 07/11] Fix unused-function warning in wxSockAddressImpl code --- src/common/sckaddr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/sckaddr.cpp b/src/common/sckaddr.cpp index 0388132fb8..d73977556e 100644 --- a/src/common/sckaddr.cpp +++ b/src/common/sckaddr.cpp @@ -180,7 +180,11 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress); namespace { -#if defined(HAVE_GETHOSTBYNAME) +#if defined(HAVE_GETHOSTBYNAME) && \ + !defined(HAVE_FUNC_GETHOSTBYNAME_R_6) && \ + !defined(HAVE_FUNC_GETHOSTBYNAME_R_5) && \ + !defined(HAVE_FUNC_GETHOSTBYNAME_R_3) + hostent *deepCopyHostent(hostent *h, const hostent *he, char *buffer, From c2a7e6c94691f1dc981e10f4b26721e6d6efeb31 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 1 Aug 2020 11:41:54 +0200 Subject: [PATCH 08/11] Fix unused-variable warning in wxListCtrl code --- src/msw/listctrl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index ee2ffba2f3..a29c51d477 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -3281,7 +3281,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) // Find the coordinate of the right most visible point: this is not the // same as GetClientSize().x because the window might not be fully visible, // it could be clipped by its parent. - const wxSize size = GetSize(); const int availableWidth = GetParent()->GetClientSize().x - GetPosition().x; int visibleWidth = wxMin(GetClientSize().x, availableWidth - GetWindowBorderSize().x); From 6327ab4e5eb9f3d54010b45fe485d3a2179e95bd Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 1 Aug 2020 11:43:22 +0200 Subject: [PATCH 09/11] CMake: link with javascriptcoregtk-4.0 when building static library --- build/cmake/modules/FindWEBKIT2.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build/cmake/modules/FindWEBKIT2.cmake b/build/cmake/modules/FindWEBKIT2.cmake index 33a8e4a863..92a0874c60 100644 --- a/build/cmake/modules/FindWEBKIT2.cmake +++ b/build/cmake/modules/FindWEBKIT2.cmake @@ -9,6 +9,7 @@ SET( WEBKIT2_VERSION 4.0) set(WEBKIT2_INCLUDE_DIR WEBKIT2_INCLUDE_DIR-NOTFOUND) set(WEBKIT2_LIBRARY WEBKIT2_LIBRARY-NOTFOUND) +set(WEBKIT2_JS_LIBRARY WEBKIT2_JS_LIBRARY-NOTFOUND) set(WEBKIT2_LIBRARIES WEBKIT2_LIBRARIES-NOTFOUND) FIND_PATH(WEBKIT2_INCLUDE_DIR webkit2/webkit2.h @@ -20,6 +21,11 @@ FIND_LIBRARY(WEBKIT2_LIBRARY NAMES ${WEBKIT2_NAMES} ) +SET(WEBKIT2_JS_NAMES "javascriptcoregtk-${WEBKIT2_VERSION}") +FIND_LIBRARY(WEBKIT2_JS_LIBRARY + NAMES ${WEBKIT2_JS_NAMES} +) + # Handle the QUIETLY and REQUIRED arguments and set WEBKIT2_FOUND to # TRUE if all listed variables are TRUE. INCLUDE(FindPackageHandleStandardArgs) @@ -29,7 +35,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( ) IF(WEBKIT2_FOUND) - SET( WEBKIT2_LIBRARIES ${WEBKIT2_LIBRARY} ) + SET( WEBKIT2_LIBRARIES ${WEBKIT2_LIBRARY} ${WEBKIT2_JS_LIBRARY} ) ELSE(WEBKIT2_FOUND) SET( WEBKIT2_LIBRARIES ) ENDIF(WEBKIT2_FOUND) From 3328480f7806f50ba2484c1e096794848b6078f1 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 2 Aug 2020 13:57:51 +0200 Subject: [PATCH 10/11] CMake: use set_target_properties() instead of set_property(TARGET ) --- build/cmake/functions.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index c33dd3946c..06729d147c 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -340,7 +340,7 @@ macro(wx_add_library name) add_library(${name} ${wxBUILD_LIB_TYPE} ${src_files}) add_library(wx::${name_short} ALIAS ${name}) wx_set_target_properties(${name} ${wxADD_LIBRARY_IS_BASE}) - set_property(TARGET ${name} PROPERTY PROJECT_LABEL ${name_short}) + set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) # Setup install wx_install(TARGETS ${name} @@ -517,7 +517,7 @@ function(wx_add_builtin_library name) add_library(${name} STATIC ${src_list}) add_library(wx::${name_short} ALIAS ${name}) wx_set_builtin_target_properties(${name}) - set_property(TARGET ${name} PROPERTY PROJECT_LABEL ${name_short}) + set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) if(wxBUILD_SHARED) set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) endif() From 4ee04daa7ceb758ba8c67fb9e01528605e4fc2da Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 5 Aug 2020 20:04:05 +0200 Subject: [PATCH 11/11] Enable position independent code by default Add a build option (--disable-pic, wxBUILD_PIC=OFF) to disable it. Note that it is always enabled for shared libraries and static third party libraries. --- build/cmake/functions.cmake | 11 +++++--- build/cmake/options.cmake | 2 ++ configure | 51 ++++++++++++++++++++++++++++++++++--- configure.in | 19 +++++++++++--- 4 files changed, 73 insertions(+), 10 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 06729d147c..2c56b25f82 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -83,6 +83,10 @@ function(wx_set_common_target_properties target_name) RUNTIME_OUTPUT_DIRECTORY "${wxOUTPUT_DIR}${wxPLATFORM_LIB_DIR}" ) + if(wxBUILD_PIC) + set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + endif() + if(MSVC) if(wxCOMMON_TARGET_PROPS_DEFAULT_WARNINGS) set(MSVC_WARNING_LEVEL "/W3") @@ -498,6 +502,10 @@ function(wx_set_builtin_target_properties target_name) set_target_properties(${target_name} PROPERTIES FOLDER "Third Party Libraries") + if(wxBUILD_SHARED OR wxBUILD_PIC) + set_target_properties(${target_name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + endif() + wx_set_common_target_properties(${target_name} DEFAULT_WARNINGS) if(NOT wxBUILD_SHARED) wx_install(TARGETS ${name} ARCHIVE DESTINATION "lib${wxPLATFORM_LIB_DIR}") @@ -518,9 +526,6 @@ function(wx_add_builtin_library name) add_library(wx::${name_short} ALIAS ${name}) wx_set_builtin_target_properties(${name}) set_target_properties(${name} PROPERTIES PROJECT_LABEL ${name_short}) - if(wxBUILD_SHARED) - set_target_properties(${name} PROPERTIES POSITION_INDEPENDENT_CODE TRUE) - endif() endfunction() # List of third party libraries added via wx_add_thirdparty_library() diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 913f35542d..deca75f467 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -64,6 +64,8 @@ else() endif() wx_option(wxBUILD_STRIPPED_RELEASE "remove debug symbols in release build" ${wxBUILD_STRIPPED_RELEASE_DEFAULT}) mark_as_advanced(wxBUILD_STRIPPED_RELEASE) +wx_option(wxBUILD_PIC "Enable position independent code (PIC)." ON) +mark_as_advanced(wxBUILD_PIC) wx_option(wxUSE_NO_RTTI "disable RTTI support" OFF) # STL options diff --git a/configure b/configure index 3352c06eee..0a6727e2ca 100755 --- a/configure +++ b/configure @@ -634,6 +634,7 @@ WX_VERSION_TAG DMALLOC_LIBS OPENGL_LIBS LDFLAGS_GL +SAMPLES_CXXFLAGS SAMPLES_SUBDIRS DISTDIR GUIDIST @@ -889,7 +890,6 @@ RANLIB USE_DPI_AWARE_MANIFEST HOST_SUFFIX HEADER_PAD_OPTION -SAMPLES_CXXFLAGS SAMPLES_RPATH_FLAG DYLIB_RPATH_POSTLINK DYLIB_RPATH_INSTALL @@ -1123,6 +1123,7 @@ enable_utf8only enable_extended_rtti enable_optimise enable_profile +enable_pic enable_no_rtti enable_no_exceptions enable_permissive @@ -2079,6 +2080,7 @@ Optional Features: --enable-extended_rtti use extended RTTI (XTI) --disable-optimise compile without optimisations --enable-profile create code with profiling information + --disable-pic don't use position independent code when building static libraries (shared libraries always use PIC) --enable-no_rtti create code without RTTI information --enable-no_exceptions create code without C++ exceptions handling --enable-permissive compile code disregarding strict ANSI @@ -5939,6 +5941,35 @@ fi eval "$wx_cv_use_profile" + enablestring=disable + defaultval= + if test -z "$defaultval"; then + if test x"$enablestring" = xdisable; then + defaultval=yes + else + defaultval=no + fi + fi + + # Check whether --enable-pic was given. +if test "${enable_pic+set}" = set; then : + enableval=$enable_pic; + if test "$enableval" = yes; then + wx_cv_use_pic='wxUSE_PIC=yes' + else + wx_cv_use_pic='wxUSE_PIC=no' + fi + +else + + wx_cv_use_pic='wxUSE_PIC=${'DEFAULT_wxUSE_PIC":-$defaultval}" + +fi + + + eval "$wx_cv_use_pic" + + enablestring= defaultval= if test -z "$defaultval"; then @@ -26276,8 +26307,7 @@ $as_echo "yes" >&6; } TOOLKIT_INCLUDE="${TOOLKIT_INCLUDE} ${QT5_CFLAGS}" GUI_TK_LIBRARY="${GUI_TK_LIBRARY} ${QT5_LIBS}" if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then - SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" - WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS" + wxUSE_PIC=yes fi fi @@ -33152,6 +33182,11 @@ $as_echo "$as_me: WARNING: plugins require wxDynamicLibrary, disabling" >&2;} fi fi +if test "$wxUSE_PIC" = "no" -a "$wxUSE_SHARED" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: position independent code (PIC) can not be disabled for shared libraries" >&5 +$as_echo "$as_me: WARNING: position independent code (PIC) can not be disabled for shared libraries" >&2;} +fi + if test "$wxUSE_FSWATCHER" = "yes"; then if test "$USE_WIN32" != 1; then @@ -38157,7 +38192,6 @@ TOOLKIT_LOWERCASE=`echo $TOOLKIT | tr '[A-Z]' '[a-z]'` - case "$TOOLKIT" in GTK) TOOLKIT_DESC="GTK+" @@ -40592,6 +40626,14 @@ then #OBJCXXFLAGS="-DWX_PRECOMP $CXXFLAGS" fi +if test "$wxUSE_PIC" = "yes" ; then + if test "$wxUSE_SHARED" = "no" ; then + CFLAGS="$CFLAGS $PIC_FLAG" + CXXFLAGS="$CXXFLAGS $PIC_FLAG" + fi + SAMPLES_CXXFLAGS="$SAMPLES_CXXFLAGS $PIC_FLAG" +fi + if test "$DEPS_TRACKING" = 1 -a "$wxUSE_MAC" = 1 ; then if test "x$wxUSE_UNIVERSAL_BINARY" != "xno" ; then @@ -40690,6 +40732,7 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 diff --git a/configure.in b/configure.in index 27fe34a7cd..37622d6d51 100644 --- a/configure.in +++ b/configure.in @@ -678,6 +678,7 @@ WX_ARG_ENABLE(extended_rtti, [ --enable-extended_rtti use extended RTTI (XTI)] WX_ARG_DISABLE(optimise, [ --disable-optimise compile without optimisations], wxUSE_OPTIMISE) WX_ARG_ENABLE(profile, [ --enable-profile create code with profiling information], wxUSE_PROFILE) +WX_ARG_DISABLE(pic, [ --disable-pic don't use position independent code when building static libraries (shared libraries always use PIC)], wxUSE_PIC) WX_ARG_ENABLE(no_rtti, [ --enable-no_rtti create code without RTTI information], wxUSE_NO_RTTI) WX_ARG_ENABLE(no_exceptions, [ --enable-no_exceptions create code without C++ exceptions handling], wxUSE_NO_EXCEPTIONS) WX_ARG_ENABLE(permissive, [ --enable-permissive compile code disregarding strict ANSI], wxUSE_PERMISSIVE) @@ -3610,8 +3611,7 @@ libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config GUI_TK_LIBRARY="${GUI_TK_LIBRARY} ${QT5_LIBS}" if `pkg-config --variable qt_config Qt5Core | grep "reduce_relocations" >/dev/null`; then dnl build with position independent code if Qt needs it - SAMPLES_CXXFLAGS="-fPIC $SAMPLES_CXXFLAGS" - WXCONFIG_CXXFLAGS="-fPIC $WXCONFIG_CXXFLAGS" + wxUSE_PIC=yes fi ], [ @@ -5586,6 +5586,10 @@ if test "$wxUSE_PLUGINS" = "yes" ; then fi fi +if test "$wxUSE_PIC" = "no" -a "$wxUSE_SHARED" = "yes"; then + AC_MSG_WARN([position independent code (PIC) can not be disabled for shared libraries]) +fi + dnl --------------------------------------------------------------------------- dnl File system watcher checks dnl --------------------------------------------------------------------------- @@ -8269,7 +8273,6 @@ AC_SUBST(TOOLKIT_VERSION) AC_SUBST(DYLIB_RPATH_INSTALL) AC_SUBST(DYLIB_RPATH_POSTLINK) AC_SUBST(SAMPLES_RPATH_FLAG) -AC_SUBST(SAMPLES_CXXFLAGS) AC_SUBST(HEADER_PAD_OPTION) AC_SUBST(HOST_SUFFIX) AC_SUBST(USE_DPI_AWARE_MANIFEST) @@ -8359,6 +8362,15 @@ then #OBJCXXFLAGS="-DWX_PRECOMP $CXXFLAGS" fi +dnl cc/cxx option for position independent code +if test "$wxUSE_PIC" = "yes" ; then + if test "$wxUSE_SHARED" = "no" ; then + CFLAGS="$CFLAGS $PIC_FLAG" + CXXFLAGS="$CXXFLAGS $PIC_FLAG" + fi + SAMPLES_CXXFLAGS="$SAMPLES_CXXFLAGS $PIC_FLAG" +fi + dnl HACK ALERT!! dnl For now, we need to alter bk-deps not to generate deps dnl when we've configured a Universal binary build. @@ -8501,6 +8513,7 @@ AC_SUBST(DISTDIR) dnl additional subdirectories where we will build AC_SUBST(SAMPLES_SUBDIRS) +AC_SUBST(SAMPLES_CXXFLAGS) dnl additional libraries and linker settings AC_SUBST(LDFLAGS_GL)