samplecfg 4.8 KB

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