Fixed bug 3078 - cmake: fix sdl2.m4 install location on cross hosts
authorSam Lantinga <slouken@libsdl.org>
Sat, 01 Oct 2016 15:11:18 -0700
changeset 104472e197b249d68
parent 10446 d5cb09daa54b
child 10448 282f839d2222
Fixed bug 3078 - cmake: fix sdl2.m4 install location on cross hosts

Timo Gurr

On cross hosts running autotools for SDL2_gfx-1.0.1 fails to find sdl2.m4:

eautoreconf: running in /var/tmp/paludis/build/media-libs-SDL2_gfx-1.0.1/work/SDL2_gfx-1.0.1 ...
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
libtoolize --copy --force --automake
aclocal
aclocal-1.13: warning: autoconf input should be named 'configure.ac', not 'configure.in'
configure.in:128: warning: macro 'AM_PATH_SDL2' not found in library
autoconf
configure.in:128: error: possibly undefined macro: AM_PATH_SDL2
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
* Failed Running autoconf !

SDL2 installs it to /usr/x86_64-pc-linux-gnu/share/aclocal on cross hosts, attached patch makes use of CMAKE_INSTALL_FULL_DATAROOTDIR to support correctly installing to the arch independent location /usr/share/aclocal.
CMakeLists.txt
     1.1 --- a/CMakeLists.txt	Sat Oct 01 15:04:13 2016 -0700
     1.2 +++ b/CMakeLists.txt	Sat Oct 01 15:11:18 2016 -0700
     1.3 @@ -2,7 +2,7 @@
     1.4    message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
     1.5  endif()
     1.6  
     1.7 -cmake_minimum_required(VERSION 2.8)
     1.8 +cmake_minimum_required(VERSION 2.8.5)
     1.9  project(SDL2 C)
    1.10  
    1.11  # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property
    1.12 @@ -26,6 +26,7 @@
    1.13  include(CheckStructHasMember)
    1.14  include(CMakeDependentOption)
    1.15  include(FindPkgConfig)
    1.16 +include(GNUInstallDirs)
    1.17  set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake")
    1.18  include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
    1.19  include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
    1.20 @@ -1608,7 +1609,7 @@
    1.21    endif()
    1.22    install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
    1.23    # TODO: what about the .spec file? Is it only needed for RPM creation?
    1.24 -  install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
    1.25 +  install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/aclocal")
    1.26  endif()
    1.27  
    1.28  ##### Uninstall target #####