2
0

samplecfg 6.5 KB

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