samplecfg 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. #!/bin/bash
  2. #
  3. # $Id$
  4. #
  5. # Generate Sample Free Pascal configuration file
  6. #
  7. if [ $# != 1 ]; then
  8. echo 'Usage :'
  9. echo 'samplecfg fpcdir'
  10. echo 'fpcdir = Path where FPC is installed'
  11. exit 1
  12. fi
  13. # Detect if we have write permission in root.
  14. if [ -w /etc ] ; then
  15. echo Write permission in /etc.
  16. thefile=/etc/ppc386.cfg
  17. else
  18. echo No write premission in /etc.
  19. thefile=$HOME/.ppc386.cfg
  20. fi
  21. #
  22. if [ -f $thefile ] ; then
  23. mv $thefile $thefile.orig >/dev/null 2>&1
  24. if [ $? == 0 ]; then
  25. echo Saved old config to $thefile.orig
  26. else
  27. echo Could not save old config. Bailing out...
  28. exit
  29. fi
  30. fi
  31. # Find path to libgcc.a
  32. GCCSPEC=`(gcc -v 2>&1)| head -n 1| awk '{ print $4 } '`
  33. GCCDIR=`dirname $GCCSPEC`
  34. echo Found libgcc.a in $GCCDIR
  35. # Write the file
  36. echo Writing sample configuration file to $thefile
  37. cat <<EOFCFG > $thefile
  38. #
  39. # Example ppc386.cfg for Free Pascal Compiler Version 0.99.12
  40. #
  41. # ----------------------
  42. # Defines (preprocessor)
  43. # ----------------------
  44. #
  45. # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
  46. #
  47. # -d is the same as #DEFINE
  48. # -u is the same as #UNDEF
  49. #
  50. # When not m68k is defined at the commandline, define i386
  51. #IFNDEF m68k
  52. #DEFINE i386
  53. #ENDIF
  54. #
  55. # Some examples (for switches see below, and the -? helppages)
  56. #
  57. # Try compiling with the -dRELEASE or -dDEBUG on the commandline
  58. #
  59. # For a release compile with optimizes and strip debuginfo
  60. #IFDEF RELEASE
  61. -OG2p3
  62. -Xs
  63. #WRITE Compiling Release Version
  64. #ENDIF
  65. # For a debug version compile with debuginfo and all codegeneration checks on
  66. #IFDEF DEBUG
  67. -g
  68. -Crtoi
  69. #WRITE Compiling Debug Version
  70. #ENDIF
  71. # ----------------
  72. # Parsing switches
  73. # ----------------
  74. # All assembler blocks are intel styled by default
  75. #-Rintel
  76. # All assembler blocks are AT&T styled by default
  77. #-Ratt
  78. # Semantic checking
  79. # -S2 switch some Delphi 2 extension on
  80. # -Sc supports operators like C (*=,+=,/= and -=)
  81. # -Sg allows LABEL and GOTO
  82. # -Si support C++ stlyed INLINE
  83. # -Sm support macros like C (global)
  84. # -So tries to be TP/BP 7.0 compatible
  85. # -Ss constructor name must be init (destructor must be done)
  86. # -St allows static keyword in objects
  87. # Allow goto, inline, C-operators, C-vars
  88. -Sgic
  89. # ---------------
  90. # Code generation
  91. # ---------------
  92. # Uncomment the next line if you always want static/dynamic units by default
  93. # (can be overruled with -CD, -CS at the commandline)
  94. #-CS
  95. #-CD
  96. # Set the default heapsize to 8Mb
  97. #-Ch8000000
  98. # Set default codegeneration checks (iocheck, overflow, range, stack)
  99. #-Ci
  100. #-Co
  101. #-Cr
  102. #-Ct
  103. # Optimizer switches
  104. # -Og generate smaller code
  105. # -OG generate faster code (default)
  106. # -Or keep certain variables in registers (still BUGGY!!!)
  107. # -Ou enable uncertain optimizations (see docs)
  108. # -O1 level 1 optimizations (quick optimizations)
  109. # -O2 level 2 optimizations (-O1 + slower optimizations)
  110. # -O3 level 3 optimizations (same as -O2u)
  111. # -Op target processor
  112. # -Op1 set target processor to 386/486
  113. # -Op2 set target processor to Pentium/PentiumMMX (tm)
  114. # -Op3 set target processor to PPro/PII/c6x86/K6 (tm)
  115. # Optimize always for Size and PII
  116. #-OG2p3
  117. # -----------------------
  118. # Set Filenames and Paths
  119. # -----------------------
  120. # Slashes are also allowed under dos
  121. # path to the messagefile, not necessary anymore but can be used to override
  122. # the default language
  123. #-Fr$1/msg/errore.msg
  124. #-Fr$1/msg/errorn.msg
  125. # searchpath for includefiles
  126. #-Fi/pp/inc;/pp/rtl/inc
  127. # searchpath for units and other system dependent things
  128. -Fu$1/units/\$target
  129. -Fu$1/units/\$target/*
  130. -Fu$1/units/\$target/rtl
  131. #-Fu~/fpc/packages/*;~/fpc/rtl/linux
  132. # searchpath for libraries
  133. -Fl$GCCDIR
  134. #-Fl/pp/lib
  135. #-Fl/lib;/usr/lib
  136. # -------------
  137. # Linking
  138. # -------------
  139. # generate always debugging information for GDB (slows down the compiling
  140. # process)
  141. #-g
  142. # always pass an option to the linker
  143. #-k-s
  144. # Always strip debuginfo from the executable
  145. -Xs
  146. # -------------
  147. # Miscellaneous
  148. # -------------
  149. # Write always a nice FPC logo ;)
  150. -l
  151. # Verbosity
  152. # e : Show errors (default) d : Show debug info
  153. # w : Show warnings u : Show used files
  154. # n : Show notes t : Show tried files
  155. # h : Show hints m : Show defined macros
  156. # i : Show general info p : Show compiled procedures
  157. # l : Show linenumbers c : Show conditionals
  158. # a : Show everything 0 : Show nothing (except errors)
  159. # Display Info, Warnings, Notes and Hints
  160. -viwnh
  161. # If you don't want so much verbosity use
  162. #-vw
  163. #
  164. # That's all folks
  165. #
  166. EOFCFG