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