check_commands make gcc # Options in the array below will be disabled unless they are # explicitly enabled. availables=( \ video video-opengl loadso render audio joystick haptic power \ filesystem threads timers file cpuinfo) # Notes about the activation of loadso # # When loadso is not activated, when compiling # using "sdl2-config" --libs to link we get the error: # libSDL2.a(SDL_dynapi.o): undefined reference to symbol 'dlopen@@GLIBC_2.1' # The problem is the option -ldl is required but not included by sdl2-config. # # In addition, when using an OPENGL window, if the loadso is not available # the following error is given at runtime: # # Could not create window: Failed loading libGL.so.1: SDL_LoadObject() not implemented # # We activate therefore the loadso module when opengl is enabled. # # The module timers is very important and should be enabled whenever the # events subsystem is used. # If timers is disabled and SDL_PollEvent is used the application will use # 100% of the CPU. In addition the SDL_Delay function will do nothing. # It could be disabled if events are also disabled but this configuration # is not currently supported. # By default we build video, timers and events modules enables=(video events timers) needs_loadso=no disables=(atomic dbus ibus ime fcitx input-tslib render-metal) audio_disables=(jack arts nas sndio fusionsound diskaudio dummyaudio libsamplerate) video_disables=(video-{mir,vulkan,directfb,dummy,opengles,opengles1,opengles2,vivante}) if [[ "$OSTYPE" == "linux"* ]]; then os_audio_enables=(pulseaudio) os_audio_disables=(oss esd "${audio_disables[@]}") enables+=(video-x11 video-x11-{xcursor,xrandr}) disables+=( "${video_disables[@]}" video-wayland \ video-x11-{xdbe,xinerama,scrnsaver,xshape,vm}) elif [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "mingw"* ]]; then os_audio_enables=() os_audio_disables=("${audio_disables[@]}") # On windows the default video driver is directx but windib will # be used if directx is disabled. Windib is based on GDI32 and doesn't # need to be explicitly enabled with configure. disables+=(directx render-d3d "${video_disables[@]}") elif [[ "$OSTYPE" == "darwin"* ]]; then enables+=(cocoa) disables+=("${video_disables[@]}") fi options=() while [ ! -z ${1+x} ]; do case $1 in -audio) enables+=(audio "${os_audio_enables[@]}") disables+=("${os_audio_disables[@]}") ;; -opengl) enables+=(video-opengl) needs_loadso=yes ;; -threads) enables+=(threads) ;; -joystick) enables+=(joystick) ;; -loadso) needs_loadso=yes ;; -filesystem) enables+=(filesystem) ;; -file) enables+=(file) ;; -threads) enables+=(threads) ;; -cpuinfo) enables+=(cpuinfo) ;; -render) enables+=(render) ;; *) options+=("$1") ;; esac shift done if [[ $needs_loadso == yes ]]; then enables+=(loadso) fi all_enables="${enables[*]}" for opt in "${availables[@]}"; do if [[ " $all_enables " != *" $opt "* ]]; then disables+=("$opt") fi done for name in "${enables[@]}"; do options+=("--enable-$name") done for name in "${disables[@]}"; do options+=("--disable-$name") done SDL_ARCHIVE_NAME="SDL2-$version" enter_archive "http://libsdl.org/release/${SDL_ARCHIVE_NAME}.tar.gz" build_and_install configure "${options[@]}"