samplecfg 4.6 KB

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