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