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 SOPE_SRCDIR="$PWD" # TODO: rather use location of configure (using basename)
27 NGSTREAMS_DIR="${SOPE_SRCDIR}/sope-core/NGStreams"
28 GSTEPMAKE_SRCDIR="${SOPE_SRCDIR}/gnustep-make"
29 INTERNAL_MAKEDIR="${SOPE_SRCDIR}/.gsmake"
31 # TODO: add pg_config, mysql_config etc!
32 LINK_SYSLIBDIRS="-L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/lib"
34 # ******************** usage ********************
38 \`configure' configures a GNUstep-make based sourcetree for installation.
42 Note: You do not need to configure this source tree, as another option
43 just ensure that the GNUstep.sh of your GNUstep make installation
44 is properly sourced prior running make.
47 -h, --help display this help and exit
48 -q, --quiet, --silent do not print \`checking...' messages
49 -n, --no-create do not create output files
51 Installation directories:
52 --prefix=PREFIX install files in PREFIX [/usr/local]
53 --gsmake=PATH path to gnustep-make tree
54 --configmake=PATH path to the config file being created
55 --with-gnustep install in GNUstep tree
56 --enable-debug turn on debugging and compile time warnings
57 --enable-strip turn on stripping of debug symbols
64 # ******************** running ********************
66 function printParas() {
68 if test $ARG_BEQUIET = 1; then echo " will be quite."; fi
69 if test $ARG_NOCREATE = 1; then echo " won't create files"; fi
70 if test $DARG_IS_FHS = 1; then
71 echo " FHS: install in FHS root";
73 echo " FHS: install in GNUstep tree";
76 if test $ARG_WITH_DEBUG = 1; then
81 if test $ARG_WITH_STRIP = 1; then
87 echo " prefix: $ARG_PREFIX"
88 echo " gstep: $ARG_GSMAKE"
89 echo " config: $ARG_CFGMAKE"
90 echo " script: $DARG_GNUSTEP_SH"
94 function warnOnFHSPrefix() {
96 Warning: you are configuring for a non standard FHS style prefix.
99 Some code in SOPE only looks in /usr and /usr/local for resources and is
100 therefore incompatible with arbitary install pathes.
102 If you want to have the flexibility of installation in arbitary pathes just
103 configure GNUstep-make and source the GNUstep.sh script prior executing tools
104 to ensure a proper environment.
105 All SOPE based code is completely relocatable when being used in a GNUstep
111 function setupInternalGSMake() {
112 if test -f ${INTERNAL_MAKEDIR}/Library/Makefiles/GNUstep.sh; then
113 ARG_GSMAKE="${INTERNAL_MAKEDIR}/Library/Makefiles/"
117 if test "x$ARG_PREFIX" = "x"; then
118 ARG_PREFIX="/usr/local/"
120 elif test -d gnustep-make; then
121 SETUP_COMBO="gnu-fd-nil"
122 SETUP_LOGNAME="config-gstepmake.log"
123 if test -d /Developer/Applications/Xcode.app; then
124 # rather weird OSX test, right? ;->
125 SETUP_COMBO="apple-apple-nil"
129 echo -n "configuring builtin gnustep-make environment (${SETUP_LOGNAME}) .."
131 cd "$GSTEPMAKE_SRCDIR"
132 ./configure >${pregsmdir}/${SETUP_LOGNAME} \
133 --prefix="${INTERNAL_MAKEDIR}" \
134 --without-system-root \
135 --with-network-root="${INTERNAL_MAKEDIR}" \
136 --with-local-root="${INTERNAL_MAKEDIR}" \
137 --with-user-root="${INTERNAL_MAKEDIR}" \
138 --with-library-combo="${SETUP_COMBO}"
140 echo -n ".. install .."
141 make install >>${pregsmdir}/${SETUP_LOGNAME}
143 ARG_GSMAKE="${INTERNAL_MAKEDIR}/Library/Makefiles/"
147 if test "x$ARG_PREFIX" = "x"; then
148 ARG_PREFIX="/usr/local/"
152 if test -f $ARG_GSMAKE/GNUstep.sh; then
153 echo ".. done (log in ${SETUP_LOGNAME})."
155 echo "error: failed to setup embedded gnustep-make sources!"
156 cat ${pregsmdir}/${SETUP_LOGNAME}
160 echo "error: did not find embedded gnustep-make sources!"
165 function validateGNUstepArgs() {
167 if test "x$ARG_GSMAKE" = "x"; then
168 if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
169 ARG_GSMAKE="$HOME/OGoRoot/Library/Makefiles/"
170 elif test -f $HOME/GNUstep/Library/Makefiles/GNUstep.sh; then
171 ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/"
172 elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then
173 ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/"
177 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
178 elif test -d $ARG_GSMAKE; then
179 if test -f $ARG_GSMAKE/GNUstep.sh; then
180 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
181 elif test -f $ARG_GSMAKE/Library/Makefiles/GNUstep.sh; then
182 ARG_GSMAKE="$ARG_GSMAKE/Library/Makefiles"
183 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
185 echo "error: specified directory contains no GNUstep.sh: $ARG_GSMAKE"
189 echo "error: specified GNUstep make tree does not exist: $ARG_GSMAKE"
194 function setupAppleArgs() {
198 if test "x${xLIBRARY_COMBO}" != "xapple-apple-nil"; then
199 if test "x${LIBRARY_COMBO}" != "xapple-apple-apple"; then
200 echo "WARNING: detected unusual GNUstep setup: ${LIBRARY_COMBO}"
206 function validateArgs() {
207 # validate prefix (could be better?)
208 case "x$ARG_PREFIX" in
209 "x/usr/local"|"x/usr/local/")
215 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
220 if test $ARG_WITH_GNUSTEP = 1; then
222 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
223 if test $ARG_BEQUIET != 1; then
224 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
229 ARG_PREFIX="/usr/local/"
230 echo "Note: will install in default location: $ARG_PREFIX"
235 if test $ARG_WITH_GNUSTEP = 1; then
236 echo "error: specified --with-gnustep, but specified prefix is not"
237 echo " a GNUstep root: '$ARG_PREFIX'"
240 if test $ARG_BEQUIET != 1; then
248 if test $ARG_WITH_GNUSTEP = 1; then
249 if test $DARG_IS_FHS = 1; then
250 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
256 function printGNUstepSetup() {
257 echo "GNUstep environment:"
258 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
259 echo " local: ${GNUSTEP_LOCAL_ROOT}"
260 echo " user: ${GNUSTEP_USER_ROOT}"
261 echo " path: ${GNUSTEP_PATHLIST}"
262 echo " flat: ${GNUSTEP_FLATTENED}"
263 echo " arch: ${GNUSTEP_HOST}"
264 echo " combo: ${LIBRARY_COMBO}"
268 function cfgwrite() {
269 echo "$1" >> $ARG_CFGMAKE
272 function genConfigMake() {
273 # we ignore the following vars also patches by gstep-make:
279 if test $ARG_BEQUIET != 1; then
280 echo "creating: $ARG_CFGMAKE"
283 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
284 cfgwrite "# created by: '$CFG_ARGS'"
287 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
288 cfgwrite "# make debug=yes"
291 #cfgwrite "# print on the cmdline that this file is being used"
293 #cfgwrite " @echo Local GNUstep config.make is active"
296 # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
298 if test $DARG_IS_FHS = 1; then
299 cfgwrite "# configured for FHS install"
300 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
304 if test $ARG_WITH_DEBUG = 1; then
305 cfgwrite "# configured to produce debugging code";
306 cfgwrite "debug:=yes"
308 cfgwrite "# configured to produce non-debugging code";
313 if test $ARG_WITH_STRIP = 1; then
314 cfgwrite "# configured to produce stripped code";
315 cfgwrite "strip:=yes"
317 cfgwrite "# configured not to strip code";
322 cfgwrite "# enforce shared libraries";
323 cfgwrite "shared:=yes"
326 cfgwrite "# GNUstep environment variables:";
327 for i in `env | grep GNUSTEP_ | sort`; do
328 MAKE_ASSI="`echo $i | sed s/=/:=/`"
329 cfgwrite "${MAKE_ASSI}";
331 cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
334 cfgwrite "# avoid a gstep-make warning"
335 cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
338 function checkLinking() {
339 # library-name => $1, type => $2
341 local tmpdir=".configure-test-$$"
345 cp ../maintenance/dummytool.m .
347 tmpmake="GNUmakefile"
348 echo >$tmpmake "include ../config.make"
349 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
350 echo >>$tmpmake "TOOL_NAME := linktest"
351 echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
352 echo >>$tmpmake "linktest_TOOL_LIBS += -l$1"
353 echo >>$tmpmake "SYSTEM_LIB_DIR += ${LINK_SYSLIBDIRS}"
354 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
356 make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
359 if test $LINK_RESULT = 0; then
360 echo "$2 library found: $1"
361 cfgwrite "HAS_LIBRARY_$1=yes"
363 if test "x$2" = "xrequired"; then
364 echo "failed to link $2 library: $1"
368 echo "failed to link $2 library: $1"
369 cfgwrite "HAS_LIBRARY_$1=no"
377 function checkDependencies() {
379 cfgwrite "# library dependencies"
380 checkLinking "xml2" optional;
381 checkLinking "ldap" optional;
382 checkLinking "ssl" required; # TODO: make optional
383 checkLinking "pq" optional;
384 checkLinking "sqlite3" optional;
385 checkLinking "mysqlclient" optional;
389 if test $ARG_BEQUIET != 1; then
393 if test $ARG_NOCREATE = 1; then
394 if test $ARG_BEQUIET != 1; then
395 echo "not creating the config file ...";
401 if test -x $NGSTREAMS_DIR/configure; then
402 if test $ARG_BEQUIET != 1; then
403 echo -n "configuring NGStreams library .."
406 ./configure >$old/config-NGStreams.log
408 echo ".. done (log in config-NGStreams.log)."
414 # ******************** options ********************
416 function extractFuncValue() {
417 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
420 function processOption() {
425 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
426 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
437 ARG_CFGMAKE="$VALUE";
443 "x--without-gnustep")
460 *) echo "error: cannot process argument: $1"; exit 1; ;;
468 # load GNUstep environment
470 # first we load the GNUstep.sh environment
471 source $DARG_GNUSTEP_SH
472 if test $ARG_BEQUIET != 1; then
476 # setup some GNUstep dependend defaults
477 if test "x$GNUSTEP_HOST_VENDOR" = "xapple"; then
481 # ensure the parameters make sense