main uint/cterm / libmaus / configure
 1#!/bin/sh
 2
 3for arg do
 4	case "$arg" in
 5		--help)
 6			echo "Usage: ./configure [x11|wayland|mac]"
 7			exit 0
 8			;;
 9		*)
10			if [ -n "$backend" ]; then
11				echo "Usage: ./configure [x11|wayland|mac]"
12				exit 1
13			fi
14			backend="$arg"
15			;;
16	esac
17done
18
19cat > config.mk << EOF
20# Generated by configure script
21BACKEND = $backend
22EOF
23
24case "$backend" in
25	x11)
26		echo "CONF_CPPFLAGS = -DBACKEND_X11" >> config.mk
27		echo "CONF_LDFLAGS = -lX11 -lXext" >> config.mk
28		echo "CONF_SRC = source/maus_x11.c" >> config.mk
29		echo "CONF_OBJS = build/maus_x11.o" >> config.mk
30		echo "CONF_LIB_NAME = libmaus_x11.a" >> config.mk
31		;;
32	wayland)
33		echo "CONF_CPPFLAGS = -DBACKEND_WAY $(pkg-config --cflags wayland-client wayland-cursor xkbcommon)" >> config.mk
34		echo "CONF_LDFLAGS = $(pkg-config --libs wayland-client wayland-cursor xkbcommon)" >> config.mk
35		echo "CONF_SRC = source/maus_wayland.c build/xdg-shell-protocol.c build/pointer-constraints-unstable-v1-protocol.c build/relative-pointer-unstable-v1-protocol.c" >> config.mk
36		echo "CONF_OBJS = build/maus_wayland.o build/xdg-shell-protocol.o build/pointer-constraints-unstable-v1-protocol.o build/relative-pointer-unstable-v1-protocol.o" >> config.mk
37		echo "CONF_LIB_NAME = libmaus_wayland.a" >> config.mk
38		echo "PROTOS = $(pkg-config --variable=pkgdatadir wayland-protocols)" >> config.mk
39		;;
40	mac)
41		# TODO
42		;;
43	*)
44		echo "Unsupported backend '$backend'"
45		rm -f config.mk
46		exit 1
47		;;
48esac
49echo "Configuration done"
50