OK, I almost have SDL2 building. Using this configure command,
sh ../SDL2-os2/configure 'LDFLAGS=-Zomf -Zhigh-mem -Zmap -Zbin-files' LIBS=-lcx 'CPPFLAGS=-idirafter=k:/usr/include/os2tk45'
Configure outputs,
SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic hidapi sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math : mmx 3dnow sse
Audio drivers : OS/2
Video drivers : OS/2
Input drivers :
Enable virtual joystick APIs : YES
Using libsamplerate : NO
Using libudev : NO
Using dbus : NO
Using ime : NO
Using ibus : NO
Using fcitx : NO
So it looks like it is pulling hidapi for joystick use. Possibly the OS/2 joystick support needs disabling.
Unluckily the build dies here,
libtool: compile: gcc.exe -g -O3 -idirafter=k:/usr/include/os2tk45 -DUSING_GENERATED_CONFIG_H -Iinclude -IK:/work/SDL2-os2/include -idirafter K:/work/SDL2-os2/src/video/khronos -mmmx -m3dnow -msse -Wall -fno-strict-aliasing -DOS2EMX_PLAIN_CHAR -Wdeclaration-after-statement -Werror=declaration-after-statement -D_REENTRANT -I/@unixroot/usr/include/libusb-1.0 -MMD -MT build/SDL_os2dive.lo -c K:/work/SDL2-os2/src/video/os2/SDL_os2dive.c -DDLL_EXPORT -DPIC -o build/.lib/SDL_os2dive.o
K:/work/SDL2-os2/src/video/os2/SDL_os2dive.c:27:10: fatal error: mmioos2.h: No such file or directory
27 | #include <mmioos2.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [build/SDL_os2dive.lo] Error 1
The CPPFLAGS=-idirafter=k:/usr/include/os2tk45 should put the toolkit last in the include path, yet mmioos2.h isn't found.