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 setupAppleArgs() {
140 if test "xLIBRARY_COMBO" != "apple-apple-nil"; then
141 if test "xLIBRARY_COMBO" != "apple-apple-apple"; then
142 echo "WARNING: detected unusual GNUstep setup: $LIBRARY_COMBO"
148 function validateArgs() {
149 # validate prefix (could be better?)
150 case "x$ARG_PREFIX" in
151 "x/usr/local"|"x/usr/local/")
157 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
162 if test $ARG_WITH_GNUSTEP = 1; then
164 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
165 if test $ARG_BEQUIET != 1; then
166 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
171 ARG_PREFIX="/usr/local/"
172 echo "Note: will install in default location: $ARG_PREFIX"
177 if test $ARG_WITH_GNUSTEP = 1; then
178 echo "error: specified --with-gnustep, but specified prefix is not"
179 echo " a GNUstep root: '$ARG_PREFIX'"
182 if test $ARG_BEQUIET != 1; then
190 if test $ARG_WITH_GNUSTEP = 1; then
191 if test $DARG_IS_FHS = 1; then
192 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
198 function printGNUstepSetup() {
199 echo "GNUstep environment:"
200 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
201 echo " local: ${GNUSTEP_LOCAL_ROOT}"
202 echo " user: ${GNUSTEP_USER_ROOT}"
203 echo " path: ${GNUSTEP_PATHLIST}"
204 echo " flat: ${GNUSTEP_FLATTENED}"
205 echo " arch: ${GNUSTEP_HOST}"
206 echo " combo: ${LIBRARY_COMBO}"
210 function cfgwrite() {
211 echo "$1" >> $ARG_CFGMAKE
214 function genConfigMake() {
215 # we ignore the following vars also patches by gstep-make:
221 if test $ARG_BEQUIET != 1; then
222 echo "creating: $ARG_CFGMAKE"
225 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
226 cfgwrite "# created by: '$CFG_ARGS'"
229 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
230 cfgwrite "# make debug=yes"
233 #cfgwrite "# print on the cmdline that this file is being used"
235 #cfgwrite " @echo Local GNUstep config.make is active"
238 # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
240 if test $DARG_IS_FHS = 1; then
241 cfgwrite "# configured for FHS install"
242 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
246 if test $ARG_WITH_DEBUG = 1; then
247 cfgwrite "# configured to produce debugging code";
248 cfgwrite "debug:=yes"
250 cfgwrite "# configured to produce non-debugging code";
255 if test $ARG_WITH_STRIP = 1; then
256 cfgwrite "# configured to produce stripped code";
257 cfgwrite "strip:=yes"
259 cfgwrite "# configured not to strip code";
264 cfgwrite "# enforce shared libraries";
265 cfgwrite "shared:=yes"
268 cfgwrite "# GNUstep environment variables:";
269 for i in `env | grep GNUSTEP_ | sort`; do
270 MAKE_ASSI="`echo $i | sed s/=/:=/`"
271 cfgwrite "${MAKE_ASSI}";
273 cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
276 cfgwrite "# avoid a gstep-make warning"
277 cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
280 function checkLinking() {
282 local tmpdir=".configure-test-$$"
286 cp ../maintenance/dummytool.m .
288 tmpmake="GNUmakefile"
289 echo >$tmpmake "include ../config.make"
290 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
291 echo >>$tmpmake "TOOL_NAME := linktest"
292 echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
293 echo >>$tmpmake "linktest_TOOL_LIBS += -l$1"
294 echo >>$tmpmake "SYSTEM_LIB_DIR += ${LINK_SYSLIBDIRS}"
295 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
297 make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
300 if test $LINK_RESULT = 0; then
301 echo "$2 library found: $1"
303 if test "x$2" = "xrequired"; then
304 echo "failed to link $2 library: $1"
308 echo "failed to link $2 library: $1"
316 function checkDependencies() {
317 checkLinking "xml2" required;
318 checkLinking "ldap" required;
319 checkLinking "ssl" required; # TODO: make optional
320 checkLinking "pq" required; # TODO: make optional
324 if test $ARG_BEQUIET != 1; then
328 if test $ARG_NOCREATE = 1; then
329 if test $ARG_BEQUIET != 1; then
330 echo "not creating the config file ...";
336 if test -x $NGSTREAMS_DIR/configure; then
337 if test $ARG_BEQUIET != 1; then
338 echo -n "configuring NGStreams library .."
341 ./configure >$old/config-NGStreams.log
343 echo ".. done (log in config-NGStreams.log)."
349 # ******************** options ********************
351 function extractFuncValue() {
352 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
355 function processOption() {
360 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
361 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
372 ARG_CFGMAKE="$VALUE";
391 *) echo "error: cannot process argument: $1"; exit 1; ;;
399 # load GNUstep environment
401 # first we load the GNUstep.sh environment
402 source $DARG_GNUSTEP_SH
403 if test $ARG_BEQUIET != 1; then
407 # setup some GNUstep dependend defaults
408 if test "x$GNUSTEP_HOST_VENDOR" = "xapple"; then
412 # ensure the parameters make sense