relink-gcc.sh 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #! /bin/sh
  2. # Relink everything for Linux.
  3. #
  4. # This supposes that FOX has already been built and its library
  5. # is in $HOME/support/lib, or possibly for a case where the library has
  6. # been distributed in binary form (as well as in source) in the current
  7. # directory
  8. # Note that the exact set of libraries that need to be listed here
  9. # can vary between Linux distributions and releases. In particular
  10. # some NEED Xcursor and Xrender while others must not list those libraries
  11. # since they do not exist.
  12. # The trial and error script here feels terribly ugly. What it does is to
  13. # try linking with every combination of the libraries that I have seen
  14. # delicacies about! If this does not work you should probably change the
  15. # linker diagnostic redirection so it does not to to /dev/null and work out
  16. # just what is not being found.
  17. rm -f /tmp/linker.log
  18. for FOXLIB in "-L../fox/lib" "-L/usr/local/lib"; do
  19. for LDFLAGS in "-L/usr/X11R6/lib" "-L/usr/X11R6/lib64"; do
  20. echo "trying with $FOXLIB $LDFLAGS"
  21. for thread in "-lpthread" ""; do
  22. for dl in "-ldl" ""; do
  23. for curses in "-lncurses" "-lcurses" ""; do
  24. for render in "-lXrender" ""; do
  25. for cursor in "-lXcursor" ""; do
  26. LIBS="$cursor $render $curses -lXext -lX11 $thread $dl"
  27. if g++ -o fwindemo $FOXLIB $LDFLAGS fwindemo.o fwin.o \
  28. FXTerminal.o FXWorker.o FXDCNativePrinter.o FXPostscriptFont.o \
  29. termed.o -lFOX-1.6 $LIBS 2>>/tmp/linker.log &&
  30. g++ -o csl $FOXLIB $LDFLAGS arith01.o arith02.o \
  31. arith03.o arith04.o arith05.o arith06.o arith07.o arith08.o arith09.o \
  32. arith10.o arith11.o arith12.o char.o csl.o cslmpi.o eval1.o eval2.o \
  33. eval3.o eval4.o fasl.o fns1.o fns2.o fns3.o gc.o preserve.o print.o \
  34. cslread.o restart.o sysfwin.o fwin.o FXTerminal.o FXWorker.o \
  35. FXDCNativePrinter.o FXPostscriptFont.o termed.o bytes.o stubs.o \
  36. -lFOX-1.6 $LIBS 2>> /tmp/linker.log &&
  37. g++ -o r38 $FOXLIB $LDFLAGS arith01.o arith02.o \
  38. arith03.o arith04.o arith05.o arith06.o arith07.o arith08.o arith09.o \
  39. arith10.o arith11.o arith12.o char.o csl.o cslmpi.o eval1.o eval2.o \
  40. eval3.o eval4.o fasl.o fns1.o fns2.o fns3.o gc.o preserve.o print.o \
  41. cslread.o restart.o sysfwin.o fwin.o FXTerminal.o FXWorker.o \
  42. FXDCNativePrinter.o FXPostscriptFont.o termed.o bytes.o u01.o u02.o \
  43. u03.o u04.o u05.o u06.o u07.o u08.o u09.o u10.o u11.o u12.o \
  44. -lFOX-1.6 $LIBS 2>> /tmp/linker.log &&
  45. g++ -o slowr38 $FOXLIB $LDFLAGS arith01.o arith02.o \
  46. arith03.o arith04.o arith05.o arith06.o arith07.o arith08.o arith09.o \
  47. arith10.o arith11.o arith12.o char.o csl.o cslmpi.o eval1.o eval2.o \
  48. eval3.o eval4.o fasl.o fns1.o fns2.o fns3.o gc.o preserve.o print.o \
  49. cslread.o restart.o sysfwin.o fwin.o FXTerminal.o FXWorker.o \
  50. FXDCNativePrinter.o FXPostscriptFont.o termed.o bytes1.o stubs.o \
  51. -lFOX-1.6 $LIBS 2>> /tmp/linker.log &&
  52. gcc -o termdemo $FOXLIB $LDFLAGS termdemo.o termed.o \
  53. -lFOX-1.6 $LIBS 2>> /tmp/linker.log; then
  54. echo "Relinking complete"
  55. echo "used LDFLAGS=$FOXLIB $LDFLAGS"
  56. echo "used LIBS=$LIBS"
  57. exit 0
  58. fi
  59. done
  60. done
  61. done
  62. done
  63. done
  64. done
  65. done
  66. echo "Linking failed! You will need to find a set of libraries by hand"
  67. exit 1