4 # Note: When adding make options to this script, ensure that the source still
5 # compiles without those options! (and just with GNUstep.sh being
7 # We do not want to force people to run configure.
10 # ******************** variables ****************
12 CFG_ARGS="$0 $1 $2 $3 $4 $5 $6 $7 $8 $9"
17 ARG_GSMAKE="$GNUSTEP_MAKEFILES"
18 ARG_CFGMAKE="$PWD/config.make"
23 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
26 NGSTREAMS_DIR="./sope-core/NGStreams"
27 LINK_SYSLIBDIRS="-L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/lib"
29 # ******************** usage ********************
33 \`configure' configures a GNUstep-make based sourcetree for installation.
37 Note: You do not need to configure this source tree, as another option
38 just ensure that the GNUstep.sh of your GNUstep make installation
39 is properly sourced prior running make.
42 -h, --help display this help and exit
43 -q, --quiet, --silent do not print \`checking...' messages
44 -n, --no-create do not create output files
46 Installation directories:
47 --prefix=PREFIX install files in PREFIX [/usr/local]
48 --gsmake=PATH path to gnustep-make tree
49 --configmake=PATH path to the config file being created
50 --with-gnustep install in GNUstep tree
51 --enable-debug turn on debugging and compile time warnings
52 --enable-strip turn on stripping of debug symbols
59 # ******************** running ********************
61 function printParas() {
63 if test $ARG_BEQUIET = 1; then echo " will be quite."; fi
64 if test $ARG_NOCREATE = 1; then echo " won't create files"; fi
65 if test $DARG_IS_FHS = 1; then
66 echo " FHS: install in FHS root";
68 echo " FHS: install in GNUstep tree";
71 if test $ARG_WITH_DEBUG = 1; then
76 if test $ARG_WITH_STRIP = 1; then
82 echo " prefix: $ARG_PREFIX"
83 echo " gstep: $ARG_GSMAKE"
84 echo " config: $ARG_CFGMAKE"
85 echo " script: $DARG_GNUSTEP_SH"
89 function warnOnFHSPrefix() {
91 Warning: you are configuring for a non standard FHS style prefix.
94 Some code in SOPE only looks in /usr and /usr/local for resources and is
95 therefore incompatible with arbitary install pathes.
97 If you want to have the flexibility of installation in arbitary pathes just
98 configure GNUstep-make and source the GNUstep.sh script prior executing tools
99 to ensure a proper environment.
100 All SOPE based code is completely relocatable when being used in a GNUstep
106 function validateGNUstepArgs() {
108 if test "x$ARG_GSMAKE" = "x"; then
109 if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
110 ARG_GSMAKE="$HOME/OGoRoot/Library/Makefiles/"
111 elif test -f $HOME/GNUstep/Library/Makefiles/GNUstep.sh; then
112 ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/"
113 elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then
114 ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/"
116 echo "error: please specify a GNUstep make tree!"
119 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
120 elif test -d $ARG_GSMAKE; then
121 if test -f $ARG_GSMAKE/GNUstep.sh; then
122 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
123 elif test -f $ARG_GSMAKE/Library/Makefiles/GNUstep.sh; then
124 ARG_GSMAKE="$ARG_GSMAKE/Library/Makefiles"
125 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
127 echo "error: specified directory contains no GNUstep.sh: $ARG_GSMAKE"
131 echo "error: specified GNUstep make tree does not exist: $ARG_GSMAKE"
136 function validateArgs() {
137 # validate prefix (could be better?)
138 case "x$ARG_PREFIX" in
139 "x/usr/local"|"x/usr/local/")
145 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
150 if test $ARG_WITH_GNUSTEP = 1; then
152 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
153 if test $ARG_BEQUIET != 1; then
154 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
159 ARG_PREFIX="/usr/local/"
160 echo "Note: will install in default location: $ARG_PREFIX"
165 if test $ARG_WITH_GNUSTEP = 1; then
166 echo "error: specified --with-gnustep, but specified prefix is not"
167 echo " a GNUstep root: '$ARG_PREFIX'"
170 if test $ARG_BEQUIET != 1; then
178 if test $ARG_WITH_GNUSTEP = 1; then
179 if test $DARG_IS_FHS = 1; then
180 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
186 function printGNUstepSetup() {
187 echo "GNUstep environment:"
188 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
189 echo " local: ${GNUSTEP_LOCAL_ROOT}"
190 echo " user: ${GNUSTEP_USER_ROOT}"
191 echo " path: ${GNUSTEP_PATHLIST}"
192 echo " flat: ${GNUSTEP_FLATTENED}"
193 echo " arch: ${GNUSTEP_HOST}"
194 echo " combo: ${LIBRARY_COMBO}"
198 function cfgwrite() {
199 echo "$1" >> $ARG_CFGMAKE
202 function genConfigMake() {
203 # we ignore the following vars also patches by gstep-make:
209 if test $ARG_BEQUIET != 1; then
210 echo "creating: $ARG_CFGMAKE"
213 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
214 cfgwrite "# created by: '$CFG_ARGS'"
217 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
218 cfgwrite "# make debug=yes"
221 cfgwrite "# print on the cmdline that this file is being used"
223 cfgwrite " @echo Local GNUstep config.make is active"
226 # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
228 if test $DARG_IS_FHS = 1; then
229 cfgwrite "# configured for FHS install"
230 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
234 if test $ARG_WITH_DEBUG = 1; then
235 cfgwrite "# configured to produce debugging code";
236 cfgwrite "debug:=yes"
238 cfgwrite "# configured to produce non-debugging code";
243 if test $ARG_WITH_STRIP = 1; then
244 cfgwrite "# configured to produce stripped code";
245 cfgwrite "strip:=yes"
247 cfgwrite "# configured not to strip code";
252 cfgwrite "# enforce shared libraries";
253 cfgwrite "shared:=yes"
256 cfgwrite "# GNUstep environment variables:";
257 for i in `env | grep GNUSTEP_ | sort`; do
258 MAKE_ASSI="`echo $i | sed s/=/:=/`"
259 cfgwrite "${MAKE_ASSI}";
261 cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
264 cfgwrite "# avoid a gstep-make warning"
265 cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
268 function checkLinking() {
270 local tmpdir=".configure-test-$$"
274 cp ../maintenance/dummytool.m .
276 tmpmake="GNUmakefile"
277 echo >$tmpmake "include ../config.make"
278 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
279 echo >>$tmpmake "TOOL_NAME := linktest"
280 echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
281 echo >>$tmpmake "linktest_TOOL_LIBS += -l$1"
282 echo >>$tmpmake "SYSTEM_LIB_DIR += ${LINK_SYSLIBDIRS}"
283 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
285 make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
288 if test $LINK_RESULT = 0; then
289 echo "$2 library found: $1"
291 if test "x$2" = "xrequired"; then
292 echo "failed to link $2 library: $1"
296 echo "failed to link $2 library: $1"
304 function checkDependencies() {
305 checkLinking "xml2" required;
306 checkLinking "ldap" required;
307 checkLinking "ssl" required; # TODO: make optional
308 checkLinking "pq" required; # TODO: make optional
312 if test $ARG_BEQUIET != 1; then
316 if test $ARG_NOCREATE = 1; then
317 if test $ARG_BEQUIET != 1; then
318 echo "not creating the config file ...";
324 if test -x $NGSTREAMS_DIR/configure; then
325 if test $ARG_BEQUIET != 1; then
326 echo -n "configuring NGStreams library .."
329 ./configure >$old/config-NGStreams.log
331 echo ".. done (log in config-NGStreams.log)."
337 # ******************** options ********************
339 function extractFuncValue() {
340 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
343 function processOption() {
348 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
349 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
360 ARG_CFGMAKE="$VALUE";
379 *) echo "error: cannot process argument: $1"; exit 1; ;;
387 # load GNUstep environment
389 # first we load the GNUstep.sh environment
390 source $DARG_GNUSTEP_SH
391 if test $ARG_BEQUIET != 1; then
395 # ensure the parameters make sense