samplecfg 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. #!/bin/sh
  2. #
  3. # $Id: samplecfg,v 1.13 2005/02/19 18:50:20 florian Exp $
  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. if [ -z "$GCCSPEC" ] ; then
  43. GCCSPEC=`gcc -print-libgcc-file-name`
  44. fi
  45. GCCDIR=`dirname $GCCSPEC`
  46. echo $GCCDIR
  47. if [ -f $GCCDIR ]; then
  48. # include ports tree dir for FreeBSDers.
  49. case $HOSTOS in
  50. freebsd)
  51. GCCDIR=-Fl/usr/local/lib
  52. ;;
  53. openbsd)
  54. GCCDIR=-Fl/usr/local/lib
  55. ;;
  56. netbsd)
  57. GCCDIR=-Fl/usr/pkg/lib
  58. ;;
  59. esac
  60. else
  61. echo Found libgcc.a in $GCCDIR
  62. GCCDIR=-Fl$GCCDIR
  63. fi
  64. # set right path to FPC with $fpcversion
  65. FPCPATH=`dirname "$1"`/\$fpcversion
  66. # Write the file
  67. echo Writing sample configuration file to $thefile
  68. cat <<EOFCFG > $thefile
  69. #
  70. # Example fpc.cfg for Free Pascal Compiler
  71. #
  72. # ----------------------
  73. # Defines (preprocessor)
  74. # ----------------------
  75. #
  76. # nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
  77. #
  78. # -d is the same as #DEFINE
  79. # -u is the same as #UNDEF
  80. #
  81. #
  82. # Some examples (for switches see below, and the -? helppages)
  83. #
  84. # Try compiling with the -dRELEASE or -dDEBUG on the commandline
  85. #
  86. # For a release compile with optimizes and strip debuginfo
  87. #IFDEF RELEASE
  88. -OG2p3
  89. -Xs
  90. #WRITE Compiling Release Version
  91. #ENDIF
  92. # For a debug version compile with debuginfo and all codegeneration checks on
  93. #IFDEF DEBUG
  94. -g
  95. -Crtoi
  96. #WRITE Compiling Debug Version
  97. #ENDIF
  98. # set binutils prefix
  99. #IFDEF FPC_CROSSCOMPILING
  100. -XP$fpctarget-
  101. #ENDIF
  102. # ----------------
  103. # Parsing switches
  104. # ----------------
  105. # Pascal language mode
  106. # -Mfpc free pascal dialect (default)
  107. # -Mobjfpc switch some Delphi 2 extensions on
  108. # -Mdelphi tries to be Delphi compatible
  109. # -Mtp tries to be TP/BP 7.0 compatible
  110. # -Mgpc tries to be gpc compatible
  111. # -Mmacpas tries to be compatible to the macintosh pascal dialects
  112. #
  113. # Turn on Object Pascal extensions by default
  114. #-Mobjfpc
  115. # Assembler reader mode
  116. # -Rdefault use default assembler
  117. # -Ratt read AT&T style assembler
  118. # -Rintel read Intel style assembler
  119. #
  120. # All assembler blocks are AT&T styled by default
  121. #-Ratt
  122. # Semantic checking
  123. # -S2 same as -Mobjfpc
  124. # -Sc supports operators like C (*=,+=,/= and -=)
  125. # -Sa include assertion code.
  126. # -Sd same as -Mdelphi
  127. # -Se<x> compiler stops after the <x> errors (default is 1)
  128. # -Sg allow LABEL and GOTO
  129. # -Sh Use ansistrings
  130. # -Si support C++ styled INLINE
  131. # -SI<x> set interface style to <x>
  132. # -SIcomCOM compatible interface (default)
  133. # -SIcorbaCORBA compatible interface
  134. # -Sm support macros like C (global)
  135. # -So same as -Mtp
  136. # -Sp same as -Mgpc
  137. # -Ss constructor name must be init (destructor must be done)
  138. # -St allow static keyword in objects
  139. #
  140. # Allow goto, inline, C-operators, C-vars
  141. -Sgic
  142. # ---------------
  143. # Code generation
  144. # ---------------
  145. # Uncomment the next line if you always want static/dynamic units by default
  146. # (can be overruled with -CD, -CS at the commandline)
  147. #-CS
  148. #-CD
  149. # Set the default heapsize to 8Mb
  150. #-Ch8000000
  151. # Set default codegeneration checks (iocheck, overflow, range, stack)
  152. #-Ci
  153. #-Co
  154. #-Cr
  155. #-Ct
  156. # Optimizer switches for i386 compiler
  157. # -Og generate smaller code
  158. # -OG generate faster code (default)
  159. # -Or keep certain variables in registers (still BUGGY!!!)
  160. # -Ou enable uncertain optimizations (see docs)
  161. # -O1 level 1 optimizations (quick optimizations)
  162. # -O2 level 2 optimizations (-O1 + slower optimizations)
  163. # -O3 level 3 optimizations (same as -O2u)
  164. # -Op target processor
  165. # -Op1 set target processor to 386/486
  166. # -Op2 set target processor to Pentium/PentiumMMX (tm)
  167. # -Op3 set target processor to PPro/PII/c6x86/K6 (tm)
  168. # Optimize always for Size and PII
  169. #-OG2p3
  170. # -----------------------
  171. # Set Filenames and Paths
  172. # -----------------------
  173. # Slashes are also allowed under dos
  174. # path to the messagefile, not necessary anymore but can be used to override
  175. # the default language
  176. #-Fr$FPCPATH/msg/errore.msg
  177. #-Fr$FPCPATH/msg/errorn.msg
  178. # searchpath for includefiles
  179. #-Fi/pp/inc;/pp/rtl/inc
  180. # searchpath for units and other system dependent things
  181. -Fu$FPCPATH/units/\$fpctarget
  182. -Fu$FPCPATH/units/\$fpctarget/*
  183. -Fu$FPCPATH/units/\$fpctarget/rtl
  184. #-Fu~/fpc/packages/base/*/units/$fpctarget;~/fpc/fcl/units/$fpctarget;~/fpc/rtl/units/$fpctarget
  185. # searchpath for libraries
  186. $GCCDIR
  187. #-Fl/pp/lib
  188. #-Fl/lib;/usr/lib
  189. # -------------
  190. # Linking
  191. # -------------
  192. # generate always debugging information for GDB (slows down the compiling
  193. # process)
  194. # -gc generate checks for pointers
  195. # -gd use dbx
  196. # -gg use gsym
  197. # -gh use heap trace unit (for memory leak debugging)
  198. # -gl use line info unit to show more info for backtraces
  199. # -gv generates programs tracable with valgrind
  200. # -gw generate dwarf debugging info
  201. #
  202. # Enable debuginfo and use the line info unit by default
  203. #-gl
  204. # always pass an option to the linker
  205. #-k-s
  206. # Always strip debuginfo from the executable
  207. -Xs
  208. # -------------
  209. # Miscellaneous
  210. # -------------
  211. # Write always a nice FPC logo ;)
  212. -l
  213. # Verbosity
  214. # e : Show errors (default) d : Show debug info
  215. # w : Show warnings u : Show unit info
  216. # n : Show notes t : Show tried/used files
  217. # h : Show hints m : Show defined macros
  218. # i : Show general info p : Show compiled procedures
  219. # l : Show linenumbers c : Show conditionals
  220. # a : Show everything 0 : Show nothing (except errors)
  221. # b : Show all procedure r : Rhide/GCC compatibility mode
  222. # declarations if an error x : Executable info (Win32 only)
  223. # occurs
  224. #
  225. # Display Info, Warnings, Notes and Hints
  226. -viwn
  227. # If you don't want so much verbosity use
  228. #-vw
  229. #
  230. # That's all folks
  231. #
  232. EOFCFG