samplecfg 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. # Pascal language mode
  97. # -Mfpc free pascal dialect (default)
  98. # -Mobjfpc switch some Delphi 2 extensions on
  99. # -Mdelphi tries to be Delphi compatible
  100. # -Mtp tries to be TP/BP 7.0 compatible
  101. # -Mgpc tries to be gpc compatible
  102. # -Mmacpas tries to be compatible to the macintosh pascal dialects
  103. #
  104. # Turn on Object Pascal extensions by default
  105. #-Mobjfpc
  106. # Assembler reader mode
  107. # -Rdefault use default assembler
  108. # -Ratt read AT&T style assembler
  109. # -Rintel read Intel style assembler
  110. #
  111. # All assembler blocks are AT&T styled by default
  112. #-Ratt
  113. # Semantic checking
  114. # -S2 same as -Mobjfpc
  115. # -Sc supports operators like C (*=,+=,/= and -=)
  116. # -Sa include assertion code.
  117. # -Sd same as -Mdelphi
  118. # -Se<x> compiler stops after the <x> errors (default is 1)
  119. # -Sg allow LABEL and GOTO
  120. # -Sh Use ansistrings
  121. # -Si support C++ styled INLINE
  122. # -SI<x> set interface style to <x>
  123. # -SIcomCOM compatible interface (default)
  124. # -SIcorbaCORBA compatible interface
  125. # -Sm support macros like C (global)
  126. # -So same as -Mtp
  127. # -Sp same as -Mgpc
  128. # -Ss constructor name must be init (destructor must be done)
  129. # -St allow static keyword in objects
  130. #
  131. # Allow goto, inline, C-operators, C-vars
  132. -Sgic
  133. # ---------------
  134. # Code generation
  135. # ---------------
  136. # Uncomment the next line if you always want static/dynamic units by default
  137. # (can be overruled with -CD, -CS at the commandline)
  138. #-CS
  139. #-CD
  140. # Set the default heapsize to 8Mb
  141. #-Ch8000000
  142. # Set default codegeneration checks (iocheck, overflow, range, stack)
  143. #-Ci
  144. #-Co
  145. #-Cr
  146. #-Ct
  147. # Optimizer switches for i386 compiler
  148. # -Og generate smaller code
  149. # -OG generate faster code (default)
  150. # -Or keep certain variables in registers (still BUGGY!!!)
  151. # -Ou enable uncertain optimizations (see docs)
  152. # -O1 level 1 optimizations (quick optimizations)
  153. # -O2 level 2 optimizations (-O1 + slower optimizations)
  154. # -O3 level 3 optimizations (same as -O2u)
  155. # -Op target processor
  156. # -Op1 set target processor to 386/486
  157. # -Op2 set target processor to Pentium/PentiumMMX (tm)
  158. # -Op3 set target processor to PPro/PII/c6x86/K6 (tm)
  159. # Optimize always for Size and PII
  160. #-OG2p3
  161. # -----------------------
  162. # Set Filenames and Paths
  163. # -----------------------
  164. # Slashes are also allowed under dos
  165. # path to the messagefile, not necessary anymore but can be used to override
  166. # the default language
  167. #-Fr$1/msg/errore.msg
  168. #-Fr$1/msg/errorn.msg
  169. # searchpath for includefiles
  170. #-Fi/pp/inc;/pp/rtl/inc
  171. # searchpath for units and other system dependent things
  172. -Fu$1/units/\$fpctarget
  173. -Fu$1/units/\$fpctarget/*
  174. -Fu$1/units/\$fpctarget/rtl
  175. #-Fu~/fpc/packages/base/*/units/$fpctarget;~/fpc/fcll/units/$fpctarget;~/fpc/rtl/units/$fpctarget
  176. # searchpath for libraries
  177. $GCCDIR
  178. #-Fl/pp/lib
  179. #-Fl/lib;/usr/lib
  180. # -------------
  181. # Linking
  182. # -------------
  183. # generate always debugging information for GDB (slows down the compiling
  184. # process)
  185. # -gc generate checks for pointers
  186. # -gd use dbx
  187. # -gg use gsym
  188. # -gh use heap trace unit (for memory leak debugging)
  189. # -gl use line info unit to show more info for backtraces
  190. # -gv generates programs tracable with valgrind
  191. # -gw generate dwarf debugging info
  192. #
  193. # Enable debuginfo and use the line info unit by default
  194. #-gl
  195. # always pass an option to the linker
  196. #-k-s
  197. # Always strip debuginfo from the executable
  198. -Xs
  199. # -------------
  200. # Miscellaneous
  201. # -------------
  202. # Write always a nice FPC logo ;)
  203. -l
  204. # Verbosity
  205. # e : Show errors (default) d : Show debug info
  206. # w : Show warnings u : Show unit info
  207. # n : Show notes t : Show tried/used files
  208. # h : Show hints m : Show defined macros
  209. # i : Show general info p : Show compiled procedures
  210. # l : Show linenumbers c : Show conditionals
  211. # a : Show everything 0 : Show nothing (except errors)
  212. # b : Show all procedure r : Rhide/GCC compatibility mode
  213. # declarations if an error x : Executable info (Win32 only)
  214. # occurs
  215. #
  216. # Display Info, Warnings, Notes and Hints
  217. -viwn
  218. # If you don't want so much verbosity use
  219. #-vw
  220. #
  221. # That's all folks
  222. #
  223. EOFCFG