samplecfg 6.4 KB

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