samplecfg 4.5 KB

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