configure 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/sh
  2. LIBS="x11"
  3. USE_XINERAMA="xinerama"
  4. USE_XRANDR="xrandr"
  5. USE_IMLIB2="imlib2"
  6. USE_XFT="xft freetype2"
  7. OS=`uname -s`
  8. PREFIX=/usr/local
  9. MANPREFIX="$PREFIX/man"
  10. XDG_CONFIG_DIR="$PREFIX/etc/xdg"
  11. while true; do
  12. case "$1" in
  13. --without-xinerama)
  14. USE_XINERAMA=""; shift;;
  15. --without-imlib2)
  16. USE_IMLIB2=""; shift;;
  17. --prefix)
  18. [ -z "$2" ] && echo "Missing argument" && exit 1
  19. PREFIX=$2; shift 2;;
  20. --xdg-config-dir)
  21. [ -z "$2" ] && echo "Missing argument" && exit 1
  22. XDG_CONFIG_DIR=$2; shift 2;;
  23. --help|-h)
  24. echo "Usage: ./configure [options]
  25. --without-xinerama : compile without xinerama support
  26. --without-imlib2 : compile without imlib2 support
  27. --prefix DIRECTORY : install binary with specified prefix (default $PREFIX)
  28. --xdg-config-dir DIRECTORY : install configuration to specified directory (default $XDG_CONFIG_DIR)"
  29. exit 0;;
  30. *) break;;
  31. esac
  32. done
  33. LIBS="$LIBS $USE_XINERAMA $USE_IMLIB2"
  34. which pkg-config > /dev/null 2>&1
  35. if [ $? -eq 0 ];
  36. then
  37. CFLAGS=`pkg-config --cflags-only-I $LIBS`
  38. LDFLAGS=`pkg-config --libs $LIBS`
  39. else
  40. # Try to use some known paths
  41. case $OS in
  42. FreeBSD)
  43. CFLAGS="-I/usr/local/include"
  44. LDFLAGS="-L/usr/local/lib";;
  45. OpenBSD)
  46. CFLAGS="-I/usr/X11R6/include -I/usr/local/include"
  47. LDFLAGS="-L/usr/X11R6/lib -L/usr/local/lib";;
  48. NetBSD)
  49. CFLAGS="-I/usr/X11R7/include -I/usr/local/include"
  50. LDFLAGS="-L/usr/X11R7/lib -L/usr/local/lib";;
  51. Linux)
  52. CFLAGS=""
  53. LDFLAGS=""
  54. ;;
  55. *)
  56. echo "No default CFLAGS and LDFLAGS found for your OS, feel free to contribute or install pkg-config :)"
  57. exit 1;;
  58. esac
  59. LDFLAGS="$LDFLAGS -lX11"
  60. [ -n "$USE_XINERAMA" ] && LDFLAGS="$LDFLAGS -lXinerama"
  61. [ -n "$USE_IMLIB2" ] && LDFLAGS="$LDFLAGS -lImlib2"
  62. fi
  63. [ -n "$USE_XINERAMA" ] && CFLAGS="$CFLAGS -DHAVE_XINERAMA"
  64. [ -n "$USE_IMLIB2" ] && CFLAGS="$CFLAGS -DHAVE_IMLIB2"
  65. cat > Makefile << EOF
  66. PREFIX=$PREFIX
  67. XDG_CONFIG_DIR=$XDG_CONFIG_DIR
  68. MANPREFIX=$MANPREFIX
  69. CFLAGS+=$CFLAGS
  70. LDFLAGS+=$LDFLAGS
  71. EOF
  72. cat Makefile.in >> Makefile
  73. echo "Compilation resume:
  74. OS=$OS
  75. CFLAGS=$CFLAGS
  76. LDFLAGS=$LDFLAGS
  77. PREFIX=$PREFIX
  78. MANPREFIX=$MANPREFIX
  79. XDG_CONFIG_DIR=$XDG_CONFIG_DIR
  80. You can run 'make' now :-)
  81. "