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"
32 # TODO: add pg_config, mysql_config etc!
33 LINK_SYSLIBDIRS="-L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/lib"
35 # ******************** usage ********************
39 \`configure' configures a GNUstep-make based sourcetree for installation.
43 Note: You do not need to configure this source tree, as another option
44 just ensure that the GNUstep.sh of your GNUstep make installation
45 is properly sourced prior running make.
48 -h, --help display this help and exit
49 -q, --quiet, --silent do not print \`checking...' messages
50 -n, --no-create do not create output files
52 Installation directories:
53 --prefix=PREFIX install files in PREFIX [/usr/local]
54 --gsmake=PATH path to gnustep-make tree
55 --configmake=PATH path to the config file being created
56 --with-gnustep install in GNUstep tree
57 --enable-debug turn on debugging and compile time warnings
58 --enable-strip turn on stripping of debug symbols
65 # ******************** running ********************
67 function printParas() {
69 if test $ARG_BEQUIET = 1; then echo " will be quite."; fi
70 if test $ARG_NOCREATE = 1; then echo " won't create files"; fi
71 if test $DARG_IS_FHS = 1; then
72 echo " FHS: install in FHS root";
74 echo " FHS: install in GNUstep tree";
77 if test $ARG_WITH_DEBUG = 1; then
82 if test $ARG_WITH_STRIP = 1; then
88 echo " prefix: $ARG_PREFIX"
89 echo " gstep: $ARG_GSMAKE"
90 echo " config: $ARG_CFGMAKE"
91 echo " script: $DARG_GNUSTEP_SH"
95 function warnOnFHSPrefix() {
97 Warning: you are configuring for a non standard FHS style prefix.
100 Some code in SOPE only looks in /usr and /usr/local for resources and is
101 therefore incompatible with arbitary install pathes.
103 If you want to have the flexibility of installation in arbitary pathes just
104 configure GNUstep-make and source the GNUstep.sh script prior executing tools
105 to ensure a proper environment.
106 All SOPE based code is completely relocatable when being used in a GNUstep
112 function setupInternalGSMake() {
113 if test -f ${INTERNAL_MAKEDIR}/Library/Makefiles/GNUstep.sh; then
114 ARG_GSMAKE="${INTERNAL_MAKEDIR}/Library/Makefiles/"
118 USES_INTERNAL_MAKE=yes
119 if test "x$ARG_PREFIX" = "x"; then
120 ARG_PREFIX="/usr/local/"
122 elif test -d gnustep-make; then
123 SETUP_COMBO="gnu-fd-nil"
124 SETUP_LOGNAME="config-gstepmake.log"
125 if test -d /Developer/Applications/Xcode.app; then
126 # rather weird OSX test, right? ;->
127 SETUP_COMBO="apple-apple-nil"
131 echo -n "configuring builtin gnustep-make environment (${SETUP_LOGNAME}) .."
133 cd "$GSTEPMAKE_SRCDIR"
134 ./configure >${pregsmdir}/${SETUP_LOGNAME} \
135 --prefix="${INTERNAL_MAKEDIR}" \
136 --without-system-root \
137 --with-network-root="${INTERNAL_MAKEDIR}" \
138 --with-local-root="${INTERNAL_MAKEDIR}" \
139 --with-user-root="${INTERNAL_MAKEDIR}" \
140 --with-library-combo="${SETUP_COMBO}"
142 echo -n ".. install .."
143 make install >>${pregsmdir}/${SETUP_LOGNAME}
145 ARG_GSMAKE="${INTERNAL_MAKEDIR}/Library/Makefiles/"
149 USES_INTERNAL_MAKE=yes
150 if test "x$ARG_PREFIX" = "x"; then
151 ARG_PREFIX="/usr/local/"
155 if test -f $ARG_GSMAKE/GNUstep.sh; then
156 echo ".. done (log in ${SETUP_LOGNAME})."
158 echo "error: failed to setup embedded gnustep-make sources!"
159 cat ${pregsmdir}/${SETUP_LOGNAME}
163 echo "error: did not find embedded gnustep-make sources!"
168 function validateGNUstepArgs() {
170 if test "x$ARG_GSMAKE" = "x"; then
171 if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
172 ARG_GSMAKE="$HOME/OGoRoot/Library/Makefiles/"
173 elif test -f $HOME/GNUstep/Library/Makefiles/GNUstep.sh; then
174 ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/"
175 elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then
176 ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/"
180 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
181 elif test -d $ARG_GSMAKE; then
182 if test -f $ARG_GSMAKE/GNUstep.sh; then
183 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
184 elif test -f $ARG_GSMAKE/Library/Makefiles/GNUstep.sh; then
185 ARG_GSMAKE="$ARG_GSMAKE/Library/Makefiles"
186 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
188 echo "error: specified directory contains no GNUstep.sh: $ARG_GSMAKE"
192 echo "error: specified GNUstep make tree does not exist: $ARG_GSMAKE"
197 function setupAppleArgs() {
199 if test "x${USES_INTERNAL_MAKE}" = "no"; then
203 if test "x${xLIBRARY_COMBO}" != "xapple-apple-nil"; then
204 if test "x${LIBRARY_COMBO}" != "xapple-apple-apple"; then
205 echo "WARNING: detected MacOSX GNUstep setup: ${LIBRARY_COMBO}"
211 function validateArgs() {
212 # validate prefix (could be better?)
213 case "x$ARG_PREFIX" in
214 "x/usr/local"|"x/usr/local/")
220 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
225 if test $ARG_WITH_GNUSTEP = 1; then
227 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
228 if test $ARG_BEQUIET != 1; then
229 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
234 ARG_PREFIX="/usr/local/"
235 echo "Note: will install in default location: $ARG_PREFIX"
240 if test $ARG_WITH_GNUSTEP = 1; then
241 echo "error: specified --with-gnustep, but specified prefix is not"
242 echo " a GNUstep root: '$ARG_PREFIX'"
245 if test $ARG_BEQUIET != 1; then
253 if test $ARG_WITH_GNUSTEP = 1; then
254 if test $DARG_IS_FHS = 1; then
255 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
261 function printGNUstepSetup() {
262 echo "GNUstep environment:"
263 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
264 echo " local: ${GNUSTEP_LOCAL_ROOT}"
265 echo " user: ${GNUSTEP_USER_ROOT}"
266 echo " path: ${GNUSTEP_PATHLIST}"
267 echo " flat: ${GNUSTEP_FLATTENED}"
268 echo " arch: ${GNUSTEP_HOST}"
269 echo " combo: ${LIBRARY_COMBO}"
273 function cfgwrite() {
274 echo "$1" >> $ARG_CFGMAKE
277 function genConfigMake() {
278 # we ignore the following vars also patches by gstep-make:
284 if test $ARG_BEQUIET != 1; then
285 echo "creating: $ARG_CFGMAKE"
288 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
289 cfgwrite "# created by: '$CFG_ARGS'"
292 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
293 cfgwrite "# make debug=yes"
296 #cfgwrite "# print on the cmdline that this file is being used"
298 #cfgwrite " @echo Local GNUstep config.make is active"
301 # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
303 if test $DARG_IS_FHS = 1; then
304 cfgwrite "# configured for FHS install"
305 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
309 if test $ARG_WITH_DEBUG = 1; then
310 cfgwrite "# configured to produce debugging code";
311 cfgwrite "debug:=yes"
313 cfgwrite "# configured to produce non-debugging code";
318 if test $ARG_WITH_STRIP = 1; then
319 cfgwrite "# configured to produce stripped code";
320 cfgwrite "strip:=yes"
322 cfgwrite "# configured not to strip code";
327 cfgwrite "# enforce shared libraries";
328 cfgwrite "shared:=yes"
331 cfgwrite "# GNUstep environment variables:";
332 for i in `env | grep GNUSTEP_ | sort`; do
333 MAKE_ASSI="`echo $i | sed s/=/:=/`"
334 cfgwrite "${MAKE_ASSI}";
336 cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
339 cfgwrite "# avoid a gstep-make warning"
340 cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
343 function checkLinking() {
344 # library-name => $1, type => $2
346 local tmpdir=".configure-test-$$"
350 cp ../maintenance/dummytool.m .
352 tmpmake="GNUmakefile"
353 echo >$tmpmake "include ../config.make"
354 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
355 echo >>$tmpmake "TOOL_NAME := linktest"
356 echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
357 echo >>$tmpmake "linktest_TOOL_LIBS += -l$1"
358 echo >>$tmpmake "SYSTEM_LIB_DIR += ${LINK_SYSLIBDIRS}"
359 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
361 make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
364 if test $LINK_RESULT = 0; then
365 echo "$2 library found: $1"
366 cfgwrite "HAS_LIBRARY_$1=yes"
368 if test "x$2" = "xrequired"; then
369 echo "failed to link $2 library: $1"
373 echo "failed to link $2 library: $1"
374 cfgwrite "HAS_LIBRARY_$1=no"
382 function checkDependencies() {
384 cfgwrite "# library dependencies"
385 checkLinking "xml2" optional;
386 checkLinking "ldap" optional;
387 checkLinking "ssl" required; # TODO: make optional
388 checkLinking "pq" optional;
389 checkLinking "sqlite3" optional;
390 checkLinking "mysqlclient" optional;
394 if test $ARG_BEQUIET != 1; then
398 if test $ARG_NOCREATE = 1; then
399 if test $ARG_BEQUIET != 1; then
400 echo "not creating the config file ...";
406 if test -x $NGSTREAMS_DIR/configure; then
407 if test $ARG_BEQUIET != 1; then
408 echo -n "configuring NGStreams library .."
411 ./configure >$old/config-NGStreams.log
413 echo ".. done (log in config-NGStreams.log)."
419 # ******************** options ********************
421 function extractFuncValue() {
422 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
425 function processOption() {
430 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
431 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
442 ARG_CFGMAKE="$VALUE";
448 "x--without-gnustep")
465 *) echo "error: cannot process argument: $1"; exit 1; ;;
473 # load GNUstep environment
475 # first we load the GNUstep.sh environment
476 source $DARG_GNUSTEP_SH
477 if test $ARG_BEQUIET != 1; then
481 # setup some GNUstep dependend defaults
482 if test "x$GNUSTEP_HOST_VENDOR" = "xapple"; then
486 # ensure the parameters make sense