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-config --variable=GNUSTEP_MAKEFILES 2>/dev/null`
18 ARG_CFGMAKE="$PWD/config.make"
23 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
26 # detect GNU make, needed at least on *BSD
27 make -v 2>/dev/null | grep GNU >/dev/null 2>/dev/null
34 NGSTREAMS_DIR="./sope-core/NGStreams"
35 LINK_SYSLIBDIRS="-L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/lib"
37 # ******************** usage ********************
41 \`configure' configures a GNUstep-make based sourcetree for installation.
45 Note: You do not need to configure this source tree, as another option
46 just ensure that the GNUstep.sh of your GNUstep make installation
47 is properly sourced prior running make.
50 -h, --help display this help and exit
51 -q, --quiet, --silent do not print \`checking...' messages
52 -n, --no-create do not create output files
54 Installation directories:
55 --prefix=PREFIX install files in PREFIX [/usr/local]
56 --gsmake=PATH path to gnustep-make tree
57 --configmake=PATH path to the config file being created
58 --without-gnustep do not install in GNUstep tree
59 --enable-debug turn on debugging and compile time warnings
60 --enable-strip turn on stripping of debug symbols
67 # ******************** running ********************
71 if test $ARG_BEQUIET = 1; then echo " will be quite."; fi
72 if test $ARG_NOCREATE = 1; then echo " won't create files"; fi
73 if test $DARG_IS_FHS = 1; then
74 echo " FHS: install in FHS root";
76 echo " FHS: install in GNUstep tree";
79 if test $ARG_WITH_DEBUG = 1; then
84 if test $ARG_WITH_STRIP = 1; then
90 echo " prefix: $ARG_PREFIX"
91 echo " gstep: $ARG_GSMAKE"
92 echo " config: $ARG_CFGMAKE"
93 echo " script: $DARG_GNUSTEP_SH"
99 Warning: you are configuring for a non standard FHS style prefix.
102 Some code in SOPE only looks in /usr and /usr/local for resources and is
103 therefore incompatible with arbitary install pathes.
105 If you want to have the flexibility of installation in arbitary pathes just
106 configure GNUstep-make and source the GNUstep.sh script prior executing tools
107 to ensure a proper environment.
108 All SOPE based code is completely relocatable when being used in a GNUstep
114 validateGNUstepArgs() {
116 if test "x$ARG_GSMAKE" = "x"; then
117 if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
118 ARG_GSMAKE="$HOME/OGoRoot/Library/Makefiles/"
119 elif test -f $HOME/GNUstep/Library/Makefiles/GNUstep.sh; then
120 ARG_GSMAKE="$HOME/GNUstep/Library/Makefiles/"
121 elif test -f /usr/GNUstep/System/Library/Makefiles/GNUstep.sh; then
122 ARG_GSMAKE="/usr/GNUstep/System/Library/Makefiles/"
124 echo "error: please specify a GNUstep make tree!"
127 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
128 elif test -d $ARG_GSMAKE; then
129 if test -f $ARG_GSMAKE/GNUstep.sh; then
130 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
131 elif test -f $ARG_GSMAKE/Library/Makefiles/GNUstep.sh; then
132 ARG_GSMAKE="$ARG_GSMAKE/Library/Makefiles"
133 DARG_GNUSTEP_SH="$ARG_GSMAKE/GNUstep.sh"
135 echo "error: specified directory contains no GNUstep.sh: $ARG_GSMAKE"
139 echo "error: specified GNUstep make tree does not exist: $ARG_GSMAKE"
148 if test "xLIBRARY_COMBO" != "apple-apple-nil"; then
149 if test "xLIBRARY_COMBO" != "apple-apple-apple"; then
150 echo "WARNING: detected unusual GNUstep setup: $LIBRARY_COMBO"
157 # validate prefix (could be better?)
158 case "x$ARG_PREFIX" in
159 "x/usr/local"|"x/usr/local/")
165 "x$GNUSTEP_USER_ROOT"|"x$GNUSTEP_LOCAL_ROOT"|"x$GNUSTEP_SYSTEM_ROOT")
170 if test $ARG_WITH_GNUSTEP = 1; then
172 ARG_PREFIX="$GNUSTEP_LOCAL_ROOT"
173 if test $ARG_BEQUIET != 1; then
174 echo "Note: will install in GNUSTEP_LOCAL_ROOT: $ARG_PREFIX"
179 ARG_PREFIX="/usr/local/"
180 echo "Note: will install in default location: $ARG_PREFIX"
185 if test $ARG_WITH_GNUSTEP = 1; then
186 echo "error: specified --with-gnustep, but specified prefix is not"
187 echo " a GNUstep root: '$ARG_PREFIX'"
190 if test $ARG_BEQUIET != 1; then
198 if test $ARG_WITH_GNUSTEP = 1; then
199 if test $DARG_IS_FHS = 1; then
200 echo "error: configured for FHS root _and_ GNUstep tree. Choose one!"
206 printGNUstepSetup() {
207 echo "GNUstep environment:"
208 echo " system: ${GNUSTEP_SYSTEM_ROOT}"
209 echo " local: ${GNUSTEP_LOCAL_ROOT}"
210 echo " user: ${GNUSTEP_USER_ROOT}"
211 echo " path: ${GNUSTEP_PATHLIST}"
212 echo " flat: ${GNUSTEP_FLATTENED}"
213 echo " arch: ${GNUSTEP_HOST}"
214 echo " combo: ${LIBRARY_COMBO}"
219 echo "$1" >> $ARG_CFGMAKE
223 # we ignore the following vars also patches by gstep-make:
229 if test $ARG_BEQUIET != 1; then
230 echo "creating: $ARG_CFGMAKE"
233 echo "# GNUstep environment configuration" > $ARG_CFGMAKE
234 cfgwrite "# created by: '$CFG_ARGS'"
237 cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
238 cfgwrite "# $MAKE debug=yes"
241 #cfgwrite "# print on the cmdline that this file is being used"
243 #cfgwrite " @echo Local GNUstep config.make is active"
246 cfgwrite "SOGO_MAJOR_VERSION=0"
247 cfgwrite "SOGO_MINOR_VERSION=9"
248 cfgwrite "SOPE_MAJOR_VERSION=4"
249 cfgwrite "SOPE_MINOR_VERSION=7"
251 if test $DARG_IS_FHS = 1; then
252 cfgwrite "# configured for FHS install"
253 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
257 if test $ARG_WITH_DEBUG = 1; then
258 cfgwrite "# configured to produce debugging code";
259 cfgwrite "debug:=yes"
261 cfgwrite "# configured to produce non-debugging code";
266 if [ "X${UNAME}" = "XLinux" ];then
268 if [ ${UNAME} = x86_64 -o ${UNAME} = sparc64 -o ${UNAME} = ppc64 ];then
269 cfgwrite "CGS_LIBDIR_NAME:=lib64"
271 cfgwrite "CGS_LIBDIR_NAME:=lib"
274 cfgwrite "CGS_LIBDIR_NAME:=lib"
277 cfgwrite "ifneq (\$(FHS_INSTALL_ROOT),)"
278 cfgwrite "CONFIGURE_FHS_INSTALL_LIBDIR:=\$(FHS_INSTALL_ROOT)/\$(CGS_LIBDIR_NAME)/"
279 # cfgwrite "CONFIGURE_SYSTEM_LIB_DIR += -L\$(CONFIGURE_FHS_INSTALL_LIBDIR)"
281 # cfgwrite "CONFIGURE_SYSTEM_LIB_DIR += -L/usr/\$(CGS_LIBDIR_NAME)/"
283 if test $DARG_IS_FHS = 1; then
284 cfgwrite "# configured for FHS install"
285 cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
287 cfgwrite "SOGO_SYSLIBDIR=\${DESTDIR}\${FHS_INSTALL_ROOT}/\${CGS_LIBDIR_NAME}"
288 cfgwrite "SOGO_LIBDIR=\${SOGO_SYSLIBDIR}/sogod-\${SOGO_MAJOR_VERSION}.\${SOGO_MINOR_VERSION}"
289 cfgwrite "SOPE_LIBDIR=\$(SOGO_SYSLIBDIR)/sope-\${SOPE_MAJOR_VERSION}.\${SOPE_MINOR_VERSION}"
290 cfgwrite "SOGO_SYSSHAREDIR=\${DESTDIR}\${FHS_INSTALL_ROOT}/share"
291 cfgwrite "SOGO_SHARED=\${SOGO_SYSSHAREDIR}/sogo-\${SOGO_MAJOR_VERSION}.\${SOGO_MINOR_VERSION}"
292 cfgwrite "SOPE_SHARED=\${SOGO_SYSSHAREDIR}/sope-\${SOPE_MAJOR_VERSION}.\${SOPE_MINOR_VERSION}"
293 cfgwrite "SOGO_TEMPLATESDIR=\${SOGO_SHARED}/templates"
294 cfgwrite "SOGO_WEBSERVERRESOURCESDIR=\${SOGO_SHARED}/www"
295 cfgwrite "SOGO_TOOLS=\${DESTDIR}\${FHS_INSTALL_ROOT}/bin"
296 cfgwrite "SOGO_ADMIN_TOOLS=\${DESTDIR}\${FHS_INSTALL_ROOT}/sbin"
297 cfgwrite "SOPE_SAXMAPPINGS=\${SOPE_SHARED}/saxmappings"
298 cfgwrite "SOPE_SAXDRIVERS=\${SOPE_LIBDIR}/saxdrivers"
299 cfgwrite "SOPE_WOXBUILDERS=\${SOPE_LIBDIR}/wox-builders"
300 cfgwrite "SOGO_TYPEMODELS=\${SOGO_SYSSHAREDIR}/ocs"
304 cfgwrite "# configured for GNUstep install"
306 cfgwrite "SOGO_SYSLIBDIR=\${DESTDIR}/\${GNUSTEP_LIBRARY}/Libraries"
307 cfgwrite "SOGO_LIBDIR=\${DESTDIR}/\${GNUSTEP_LIBRARY}/SOGo-\${SOGO_MAJOR_VERSION}.\${SOGO_MINOR_VERSION}"
308 cfgwrite "SOGO_TEMPLATESDIR=\${SOGO_LIBDIR}/Templates"
309 cfgwrite "SOGO_WEBSERVERRESOURCESDIR=\${SOGO_LIBDIR}/WebServerResources"
310 cfgwrite "SOGO_TOOLS=\${DESTDIR}/\${GNUSTEP_TOOLS}"
311 cfgwrite "SOGO_ADMIN_TOOLS=\${DESTDIR}/\${GNUSTEP_ADMIN_TOOLS}"
312 cfgwrite "SOPE_SAXMAPPINGS=\${DESTDIR}/\${GNUSTEP_LIBRARY}/SaxMappings"
313 cfgwrite "SOPE_SAXDRIVERS=\${DESTDIR}/\${GNUSTEP_LIBRARY}/SaxDrivers-\${SOPE_MAJOR_VERSION}.\${SOPE_MINOR_VERSION}"
314 cfgwrite "SOPE_WOXBUILDERS=\${DESTDIR}/\${GNUSTEP_LIBRARY}/WOxElemBuilders-\${SOPE_MAJOR_VERSION}.\${SOPE_MINOR_VERSION}"
315 cfgwrite "SOGO_TYPEMODELS=\${DESTDIR}/\${GNUSTEP_LIBRARY}/OCSTypeModels"
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"
343 local tmpdir=".configure-test-$$"
347 cp ../maintenance/dummytool.m .
349 tmpmake="GNUmakefile"
350 echo >$tmpmake "include ../config.make"
351 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
352 echo >>$tmpmake "TOOL_NAME := linktest"
353 echo >>$tmpmake "linktest_OBJC_FILES := dummytool.m"
354 echo >>$tmpmake "linktest_TOOL_LIBS += -l$1"
355 echo >>$tmpmake "SYSTEM_LIB_DIR += ${LINK_SYSLIBDIRS}"
356 echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/tool.make"
358 $MAKE -s messages=yes -f $tmpmake linktest >out.log 2>err.log
361 if test $LINK_RESULT = 0; then
362 echo "$2 library found: $1"
364 if test "x$2" = "xrequired"; then
365 echo "failed to link $2 library: $1"
369 echo "failed to link $2 library: $1"
377 checkDependencies() {
378 checkLinking "SaxObjC" required;
379 checkLinking "NGLdap" required;
383 if test $ARG_BEQUIET != 1; then
387 if test $ARG_NOCREATE = 1; then
388 if test $ARG_BEQUIET != 1; then
389 echo "not creating the config file ...";
395 if test -x $NGSTREAMS_DIR/configure; then
396 if test $ARG_BEQUIET != 1; then
397 echo -n "configuring NGStreams library .."
400 ./configure >$old/config-NGStreams.log
402 echo ".. done (log in config-NGStreams.log)."
408 # ******************** options ********************
411 VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
419 "x--quiet"|"x--silent"|"x-q") ARG_BEQUIET=1; ;;
420 "x--no-create"|"x-n") ARG_NOCREATE=1; ;;
431 ARG_CFGMAKE="$VALUE";
437 "x--without-gnustep")
454 *) echo "error: cannot process argument: $1"; exit 1; ;;
462 # load GNUstep environment
464 # first we load the GNUstep.sh environment
466 if test $ARG_BEQUIET != 1; then
470 # setup some GNUstep dependend defaults
471 if test "x$GNUSTEP_HOST_VENDOR" = "xapple"; then
475 # ensure the parameters make sense