1
2#   This file must be sourced inside (ba)sh using: .
3#
4#   @configure_input@
5#
6#   Shell initialization for the GNUstep environment.
7#
8#   Copyright (C) 1997-2008 Free Software Foundation, Inc.
9#
10#   Author:  Scott Christley <scottc@net-community.com>
11#   Author:  Adam Fedor <fedor@gnu.org>
12#   Author:  Richard Frith-Macdonald <rfm@gnu.org>
13#   Author:  Nicola Pero <nicola.pero@meta-innovation.com>
14#
15#   This file is part of the GNUstep Makefile Package.
16#
17#   This library is free software; you can redistribute it and/or
18#   modify it under the terms of the GNU General Public License
19#   as published by the Free Software Foundation; either version 3
20#   of the License, or (at your option) any later version.
21#
22#   You should have received a copy of the GNU General Public
23#   License along with this library; see the file COPYING.
24#   If not, write to the Free Software Foundation,
25#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26#
27
28# Warning - this shell script is delicate, because it is sourced by
29# using . rather than simply executed.  It is sourced because that is
30# the only way to change the shell variables in the calling
31# environment.
32#
33# Sourcing makes the shell script more delicate for the following reasons:
34#
35#  * temporary variables are automatically set in the calling
36#  environment!  WORKAROUND: we need to unset all them after using
37#  them to avoid polluting the calling environment;
38#
39#  * not only the exit value of the script, but the exit value of each
40#  command we execute, might be interpreted by the calling
41#  environment.  Typically, the calling environment might be using the
42#  shell errexit option ('set -e') in bash parlance, which causes the
43#  shell to exit if any command returns an error value.  If this were
44#  a normal script, this option would mean that the shell would exit
45#  if the return value of the whole script were an error value; but
46#  because we are sourced, it is as all the commands in this script
47#  were executed directly in the calling environment, so *all* values
48#  returned by *all* commands must be non-error.  [this all typically
49#  happens in rpm builds, where scripts are run with the errexit
50#  option so that errors in scripts abort the build, and now if a
51#  script sources GNUstep.sh, then we are exactly in this situation -
52#  if any command inside GNUstep.sh returns an error value (even if
53#  GNUstep.sh as a whole would be happy and return succes), the whole
54#  rpm build process aborts!]. WORKAROUND: we must make sure all
55#  commands return success - last resorts hacks like 'command || :'
56#  which always returns success whatever command returns.
57#
58
59# If we're running in zsh (auch!) make sure we're using -y
60# (SH_WORD_SPLIT) else our path manipulations won't work.
61if [ -n "$ZSH_VERSION" ]; then
62
63  # If -y is not already set, set it and remember that we
64  # need to set it back to what it was at the end.
65  if ( setopt | grep shwordsplit > /dev/null ); then :; else
66    setopt shwordsplit
67    GS_ZSH_NEED_TO_RESTORE_SET=yes
68  fi
69
70fi
71
72# When this is set to 'yes', strict gnustep-make v2 compatibility mode
73# is turned on.
74GNUSTEP_MAKE_STRICT_V2_MODE=@GNUSTEP_MAKE_STRICT_V2_MODE@
75
76#
77# Read our configuration files
78#
79
80# Determine the location of the system configuration file
81if [ -z "$GNUSTEP_CONFIG_FILE" ]; then
82  GNUSTEP_CONFIG_FILE=@GNUSTEP_CONFIG_FILE@
83else
84  # Remember that the variable was already set in the environment, and
85  # preserve it at the end of the script.  Otherwise we'll unset it to
86  # avoid polluting the environment with our own internal variables.
87  GNUSTEP_KEEP_CONFIG_FILE=yes
88fi
89
90# Determine the location of the user configuration file
91if [ -z "$GNUSTEP_USER_CONFIG_FILE" ]; then
92  GNUSTEP_USER_CONFIG_FILE=@GNUSTEP_USER_CONFIG_FILE@
93else
94  GNUSTEP_KEEP_USER_CONFIG_FILE=yes
95fi
96
97# Read the system configuration file
98if [ -f "$GNUSTEP_CONFIG_FILE" ]; then
99  . "$GNUSTEP_CONFIG_FILE"
100fi
101
102# FIXME: determining GNUSTEP_HOME
103GNUSTEP_HOME=~
104
105# Read the user configuration file ... unless it is disabled (ie, set
106# to an empty string)
107if [ -n "$GNUSTEP_USER_CONFIG_FILE" ]; then
108  case "$GNUSTEP_USER_CONFIG_FILE" in
109    /*) # An absolute path
110        if [ -f "$GNUSTEP_USER_CONFIG_FILE" ]; then
111          . "$GNUSTEP_USER_CONFIG_FILE"
112        fi;;
113     *) # Something else
114        if [ -f "$GNUSTEP_HOME/$GNUSTEP_USER_CONFIG_FILE" ]; then
115          . "$GNUSTEP_HOME/$GNUSTEP_USER_CONFIG_FILE"
116        fi;;
117  esac
118fi
119
120# Now, set any essential variable (that is not already set) to the
121# built-in values.
122
123if [ "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
124  # In strict v2 mode, clean these obsolete variables in case the
125  # config file contains them.  They shouldn't exist so unsetting
126  # them can't harm.
127  unset GNUSTEP_SYSTEM_ROOT
128  unset GNUSTEP_LOCAL_ROOT
129  unset GNUSTEP_NETWORK_ROOT
130else
131  # This is deprecated and will be removed
132  if [ -z "$GNUSTEP_SYSTEM_ROOT" ]; then
133    GNUSTEP_SYSTEM_ROOT=@GNUSTEP_SYSTEM_ROOT@
134  fi
135
136  # This is deprecated and will be removed
137  if [ -z "$GNUSTEP_LOCAL_ROOT" ]; then
138    GNUSTEP_LOCAL_ROOT=@GNUSTEP_LOCAL_ROOT@
139  fi
140
141  # This is deprecated and will be removed
142  if [ -z "$GNUSTEP_NETWORK_ROOT" ]; then
143    GNUSTEP_NETWORK_ROOT=@GNUSTEP_NETWORK_ROOT@
144  fi
145
146  export GNUSTEP_SYSTEM_ROOT GNUSTEP_LOCAL_ROOT GNUSTEP_NETWORK_ROOT
147fi
148
149# GNUSTEP_FLATTENED is obsolete, please use GNUSTEP_IS_FLATTENED
150# instead
151if [ "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
152  unset GNUSTEP_FLATTENED
153else
154  GNUSTEP_FLATTENED=@GNUSTEP_FLATTENED@
155  export GNUSTEP_FLATTENED
156fi
157GNUSTEP_IS_FLATTENED=@GNUSTEP_IS_FLATTENED@
158if [ -z "$LIBRARY_COMBO" ]; then
159  LIBRARY_COMBO=@ac_cv_library_combo@
160fi
161if [ ! "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
162  # Having these variables in the environment is deprecated and will
163  # be removed.  But for now, if we are not in strict gnustep-make v2
164  # mode, then we always export these variables for
165  # backwards-compatibility.
166  export GNUSTEP_IS_FLATTENED LIBRARY_COMBO
167
168  # Else they are only exported if GNUSTEP_SH_EXPORT_ALL_VARIABLES
169  # is defined - at the end of the script.
170fi
171
172
173GNUSTEP_HAS_PKGCONFIG=@GNUSTEP_HAS_PKGCONFIG@
174
175if [ -z "$GNUSTEP_MAKEFILES" ]; then
176  GNUSTEP_MAKEFILES=@GNUSTEP_MAKEFILES@
177fi
178export GNUSTEP_MAKEFILES
179
180
181if [ "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
182  # Make sure this is never set in gnustep-make v2 strict mode; it
183  # might have been set in the config file.
184  unset GNUSTEP_USER_DIR
185  unset GNUSTEP_USER_ROOT
186else
187  # GNUSTEP_USER_DIR is deprecated and will be removed
188  if [ -z "$GNUSTEP_USER_DIR" ]; then
189    GNUSTEP_USER_DIR=@GNUSTEP_USER_DIR@
190  fi
191
192  #
193  # Set GNUSTEP_USER_ROOT which is the variable used in practice.
194  # GNUSTEP_USER_ROOT is deprecated and will be removed
195  #
196  case "$GNUSTEP_USER_DIR" in
197    /*) # An absolute path
198        GNUSTEP_USER_ROOT="$GNUSTEP_USER_DIR";;
199     *) # Something else
200        GNUSTEP_USER_ROOT="$GNUSTEP_HOME/$GNUSTEP_USER_DIR";;
201  esac
202
203  # This variable was used to set up GNUSTEP_USER_ROOT which is the one
204  # that is actually exported; we can now drop it from the environment.
205  unset GNUSTEP_USER_DIR
206
207  # This is deprecated and will be removed
208  export GNUSTEP_USER_ROOT
209fi
210
211# If multi-platform support is disabled, just use the hardcoded cpu,
212# vendor and os determined when gnustep-make was configured.  The
213# reason using the hardcoded ones might be better is that config.guess
214# and similar scripts might even require compiling test files to
215# determine the platform - but then you can't source GNUstep.sh
216# without having gcc, binutils, libc6-dev installed.  Which can be a
217# problem for end-users who are not developers and have no development
218# tools installed.  To prevent this problem, unless we were configured
219# to determine the platform at run time, by default we use the
220# hardcoded values of GNUSTEP_HOST*.
221if [ -z "@GNUSTEP_MULTI_PLATFORM@" ]; then
222  GNUSTEP_HOST=@target@
223  GNUSTEP_HOST_CPU=@clean_target_cpu@
224  GNUSTEP_HOST_VENDOR=@clean_target_vendor@
225  GNUSTEP_HOST_OS=@clean_target_os@
226fi
227
228#
229# Determine the host information
230#
231if [ -z "$GNUSTEP_HOST" ]; then
232  # Not all shells (e.g. /bin/sh on FreeBSD < 4.0 or ash) have pushd/popd
233  tmpdir=`pwd`; cd /tmp
234  GNUSTEP_HOST=`$GNUSTEP_MAKEFILES/config.guess`
235  GNUSTEP_HOST=`$GNUSTEP_MAKEFILES/config.sub $GNUSTEP_HOST`
236  cd "$tmpdir"
237  unset tmpdir
238fi
239
240if [ -z "$GNUSTEP_HOST_CPU" ]; then
241  GNUSTEP_HOST_CPU=`$GNUSTEP_MAKEFILES/cpu.sh $GNUSTEP_HOST`
242  GNUSTEP_HOST_CPU=`$GNUSTEP_MAKEFILES/clean_cpu.sh $GNUSTEP_HOST_CPU`
243fi
244
245if [ -z "$GNUSTEP_HOST_VENDOR" ]; then
246  GNUSTEP_HOST_VENDOR=`$GNUSTEP_MAKEFILES/vendor.sh $GNUSTEP_HOST`
247  GNUSTEP_HOST_VENDOR=`$GNUSTEP_MAKEFILES/clean_vendor.sh $GNUSTEP_HOST_VENDOR`
248fi
249
250if [ -z "$GNUSTEP_HOST_OS" ]; then
251  GNUSTEP_HOST_OS=`$GNUSTEP_MAKEFILES/os.sh $GNUSTEP_HOST`
252  GNUSTEP_HOST_OS=`$GNUSTEP_MAKEFILES/clean_os.sh $GNUSTEP_HOST_OS`
253fi
254
255if [ ! "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
256  # These variables are deprecated for usage in shell scripts; you
257  # need to use gnustep-config to get them in a shell script.
258  export GNUSTEP_HOST GNUSTEP_HOST_CPU GNUSTEP_HOST_VENDOR GNUSTEP_HOST_OS
259
260  # Even in strict gnustep-make v2 mode, we export them at the end
261  # if explicitly requested to export all variables.
262fi
263
264# Now load in all the remaining paths
265. $GNUSTEP_MAKEFILES/filesystem.sh
266
267# No longer needed
268unset GNUSTEP_HOME
269
270# Determine if the paths look like Windows paths that need fixing
271fixup_paths=no
272# Here we want to use `...` but the only portable way to use it when
273# there are "..." inside the expression (ie, it's actually
274# `..."..."...`) seems to be to use it in variable assignments.  So we
275# use a temporary variable and assign the result of `...` to it
276path_check=`echo "$GNUSTEP_MAKEFILES" | sed 's|^[a-zA-Z]:/.*$||'`
277if [ -z "$path_check" ]; then
278  fixup_paths=yes
279fi
280unset path_check
281
282if [ "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
283  unset GNUSTEP_PATHLIST
284else
285  # GNUSTEP_PATHLIST is deprecated and will be removed.
286  #
287  # GNUSTEP_PATHLIST is like an abstract path-like shell variable, which
288  # can be used to search the gnustep directories.
289  #
290  if [ -z "$GNUSTEP_PATHLIST" ]; then
291
292   GNUSTEP_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_ROOT" "$GNUSTEP_LOCAL_ROOT" "$GNUSTEP_NETWORK_ROOT" "$GNUSTEP_SYSTEM_ROOT" $fixup_paths`
293   export GNUSTEP_PATHLIST
294  fi
295fi
296
297#
298# Add path to Tools to PATH
299#
300# NB: functionally, print_unique_pathlist.sh is mostly used to do the
301# fixup_paths thing, since duplicated paths will automatically be
302# checked below when we add them to the PATH.  On the other hand,
303# removing duplicates later can be expensive since we do a echo+grep
304# for each duplicate.  When there are many duplicates it's faster to
305# use print_unique_pathlist.sh first to remove them and skip the
306# echos+greps later.
307GNUSTEP_TOOLS_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_TOOLS" "$GNUSTEP_LOCAL_TOOLS" "$GNUSTEP_NETWORK_TOOLS" "$GNUSTEP_SYSTEM_TOOLS" $fixup_paths`
308
309# Now, we check the paths in GNUSTEP_*_ADMIN_TOOLS.  These paths
310# should only be used by Administrators -- normal users don't have
311# enough powers to use those tools to do useful things.  Our test for
312# being an 'Administrator' is that anyone who can write to an Admin
313# directory can be considered powerful enough to use those tools.
314
315# FIXME: Unfortunately, this doesn't work if the Admin directory
316# is mounted read-only, so a better test is required!
317
318# So we examine GNUSTEP_*_ADMIN_TOOLS; if we find any path in that
319# list that exists and that we can write to, we add it to our PATH.
320for dir in "$GNUSTEP_SYSTEM_ADMIN_TOOLS" "$GNUSTEP_NETWORK_ADMIN_TOOLS" "$GNUSTEP_LOCAL_ADMIN_TOOLS" "$GNUSTEP_USER_ADMIN_TOOLS"; do
321  if [ -d "$dir"  -a  -w "$dir" ]; then
322    # Only add the new dir if it's not already in GNUSTEP_TOOLS_PATHLIST
323    if (echo ":${GNUSTEP_TOOLS_PATHLIST}:" \
324      |grep -v ":${dir}:" >/dev/null); then
325      GNUSTEP_TOOLS_PATHLIST="$dir:$GNUSTEP_TOOLS_PATHLIST"
326    fi
327  fi
328done
329
330#
331# And now, we put the results into PATH
332#
333old_IFS="$IFS"
334IFS=:
335for dir in $GNUSTEP_TOOLS_PATHLIST; do
336
337  # Prepare the path_fragment
338  if [ "$GNUSTEP_IS_FLATTENED" = "no" ]; then
339    path_fragment="$dir:$dir/${GNUSTEP_HOST_CPU}-${GNUSTEP_HOST_OS}/${LIBRARY_COMBO}:$dir/${GNUSTEP_HOST_CPU}-${GNUSTEP_HOST_OS}"
340  else
341    path_fragment="$dir"
342  fi
343
344  # Add it to PATH, but only if not already there (eg, typically /usr/bin is already there)
345  if [ -z "$PATH" ]; then
346    PATH="$path_fragment"
347  else
348    if ( echo ":${PATH}:"\
349      |grep -v ":${path_fragment}:" >/dev/null ); then
350      PATH="${path_fragment}:${PATH}"
351    fi
352  fi
353
354done
355IFS="$old_IFS"
356unset old_IFS
357unset dir
358unset path_fragment
359unset GNUSTEP_TOOLS_PATHLIST
360export PATH
361
362# Determine the library paths
363GNUSTEP_LIBRARIES_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_LIBRARIES" "$GNUSTEP_LOCAL_LIBRARIES" "$GNUSTEP_NETWORK_LIBRARIES" "$GNUSTEP_SYSTEM_LIBRARIES" $fixup_paths`
364
365old_IFS="$IFS"
366IFS=:
367  for dir in $GNUSTEP_LIBRARIES_PATHLIST; do
368
369    # prepare the path_fragment for libraries and this dir
370    if [ "$GNUSTEP_IS_FLATTENED" = "yes" ]; then
371      path_fragment="$dir"
372    else
373      path_fragment="$dir/$GNUSTEP_HOST_CPU-$GNUSTEP_HOST_OS/$LIBRARY_COMBO:$dir/$GNUSTEP_HOST_CPU-$GNUSTEP_HOST_OS"
374    fi
375
376    # Append the path_fragment to lib_paths ... in a different way,
377    # depending on the machine we're on.
378    case "$GNUSTEP_HOST_OS" in
379
380      *nextstep4* | *darwin*)
381        if [ -z "$DYLD_LIBRARY_PATH" ]; then
382          DYLD_LIBRARY_PATH="$path_fragment"
383        else
384          if ( echo ":${DYLD_LIBRARY_PATH}:"\
385	    |grep -v ":${path_fragment}:" >/dev/null ); then
386	    DYLD_LIBRARY_PATH="$path_fragment:$DYLD_LIBRARY_PATH"
387          fi
388        fi
389        export DYLD_LIBRARY_PATH;;
390
391      *hpux*)
392        if [ -z "$SHLIB_PATH" ]; then
393          SHLIB_PATH="$path_fragment"
394        else
395          if ( echo ":${SHLIB_PATH}:"\
396	    |grep -v ":${path_fragment}:" >/dev/null ); then
397	    SHLIB_PATH="$path_fragment:$SHLIB_PATH"
398          fi
399        fi
400        export SHLIB_PATH;
401
402        if [ -z "$LD_LIBRARY_PATH" ]; then
403          LD_LIBRARY_PATH="$path_fragment"
404        else
405          if ( echo ":${LD_LIBRARY_PATH}:"\
406	    |grep -v ":${path_fragment}:" >/dev/null ); then
407	    LD_LIBRARY_PATH="$path_fragment:$LD_LIBRARY_PATH"
408          fi
409        fi
410        export LD_LIBRARY_PATH;;
411
412      *)
413        if [ -z "$LD_LIBRARY_PATH" ]; then
414          LD_LIBRARY_PATH="$path_fragment"
415        else
416          if ( echo ":${LD_LIBRARY_PATH}:"\
417	    |grep -v ":${path_fragment}:" >/dev/null ); then
418	    LD_LIBRARY_PATH="$path_fragment:$LD_LIBRARY_PATH"
419          fi
420        fi
421        export LD_LIBRARY_PATH;;
422    esac
423  done
424IFS="$old_IFS"
425unset old_IFS
426unset dir
427unset path_fragment
428
429unset GNUSTEP_LIBRARIES_PATHLIST
430
431
432# Determine the framework paths - but only on Darwin since it's the
433# only platform where this is of any use.
434case "$GNUSTEP_HOST_OS" in
435
436  *darwin*)
437    GNUSTEP_FRAMEWORKS_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_LIBRARY/Frameworks" "$GNUSTEP_LOCAL_LIBRARY/Frameworks" "$GNUSTEP_NETWORK_LIBRARY/Frameworks" "$GNUSTEP_SYSTEM_LIBRARY/Frameworks" $fixup_paths`
438
439    old_IFS="$IFS"
440    IFS=:
441    for dir in $GNUSTEP_FRAMEWORKS_PATHLIST; do
442
443      # prepare the path_fragment for frameworks
444      path_fragment="$dir"
445
446# The code below has been temporarily removed, because...
447# Frameworks in GNUstep-make are supported by creating a link like
448#
449#   Libraries/libMyFramework.dylib ->
450#      Frameworks/MyFramework.framework/Versions/Current/libMyFramework.dylib,
451#
452# to mitigate the fact that FSF GCC does not support a -framework flag.
453#
454# On Darwin, however, we partially emulate -framework by setting the
455# "install_name" to the framework name during linking. The dynamic
456# linker (dyld) is smart enough to find the framework under this name,
457# but only if DYLD_FRAMEWORK_PATH is set (unless we set the
458# "install_name" to an absolute path, which we don't). We'd really like
459# to fully support -framework, though.
460#
461# Use otool -L MyApplication.app/MyApplication, for instance, to see
462# how the shared libraries/frameworks are linked.
463#
464#    if [ "$LIBRARY_COMBO" = "apple-apple-apple" -o \
465#         "$LIBRARY_COMBO" = "apple" ]; then
466
467      if [ -z "$DYLD_FRAMEWORK_PATH" ]; then
468        DYLD_FRAMEWORK_PATH="$path_fragment"
469      else
470        if ( echo ":${DYLD_FRAMEWORK_PATH}:"\
471	  |grep -v ":${path_fragment}:" >/dev/null ); then
472          DYLD_FRAMEWORK_PATH="$path_fragment:$DYLD_FRAMEWORK_PATH"
473        fi
474      fi
475      export DYLD_FRAMEWORK_PATH
476    done
477
478    IFS="$old_IFS"
479    unset old_IFS
480    unset dir
481    unset path_fragment
482
483    unset GNUSTEP_FRAMEWORKS_PATHLIST
484    ;;
485
486  *)
487    ;;
488esac
489
490#
491# Setup Java CLASSPATH and Guile GUILE_LOAD_PATH
492#
493GNUSTEP_LIBRARY_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_LIBRARY" "$GNUSTEP_LOCAL_LIBRARY" "$GNUSTEP_NETWORK_LIBRARY" "$GNUSTEP_SYSTEM_LIBRARY" $fixup_paths`
494
495old_IFS="$IFS"
496IFS=:
497for dir in $GNUSTEP_LIBRARY_PATHLIST; do
498
499  path_fragment="$dir/Libraries/Java"
500  if [ -z "$CLASSPATH" ]; then
501    CLASSPATH="$path_fragment"
502  else
503    if ( echo ":${CLASSPATH}:"\
504      |grep -v ":${path_fragment}:" >/dev/null ); then
505      CLASSPATH="$path_fragment:$CLASSPATH"
506    fi
507  fi
508
509  path_fragment="$dir/Libraries/Guile"
510  if [ -z "$GUILE_LOAD_PATH" ]; then
511    GUILE_LOAD_PATH="$path_fragment"
512  else
513    if ( echo ":${GUILE_LOAD_PATH}:"\
514      |grep -v ":${path_fragment}:" >/dev/null ); then
515      GUILE_LOAD_PATH="$path_fragment:$GUILE_LOAD_PATH"
516    fi
517  fi
518
519done
520IFS="$old_IFS"
521unset old_IFS
522unset dir
523unset path_fragment
524unset GNUSTEP_LIBRARY_PATHLIST
525export CLASSPATH
526export GUILE_LOAD_PATH
527
528#
529# Make sure info files, that we install by default into
530# xxx/Library/Documentation/info, are found by the info browsing
531# programs.  To get this effect, we add those paths to INFOPATH.
532#
533GNUSTEP_INFO_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_DOC_INFO" "$GNUSTEP_LOCAL_DOC_INFO" "$GNUSTEP_NETWORK_DOC_INFO" "$GNUSTEP_SYSTEM_DOC_INFO" $fixup_paths`
534old_IFS="$IFS"
535IFS=:
536for dir in $GNUSTEP_INFO_PATHLIST; do
537
538  if [ -z "$INFOPATH" ]; then
539    # The ':' at the end means to use the built-in paths after searching
540    # the INFOPATH we provide.
541    INFOPATH="${dir}:"
542  else
543    if ( echo ":${INFOPATH}:"\
544      |grep -v ":${dir}:" >/dev/null ); then
545      INFOPATH="$INFOPATH:${dir}:"
546    fi
547  fi
548done
549IFS="$old_IFS"
550unset old_IFS
551unset dir
552unset GNUSTEP_INFO_PATHLIST
553export INFOPATH
554
555if [ "$GNUSTEP_HAS_PKGCONFIG" = "yes" ]; then
556# Determine the library paths
557GNUSTEP_PKGCONFIG_PATHLIST=`$GNUSTEP_MAKEFILES/print_unique_pathlist.sh "$GNUSTEP_USER_LIBRARIES" "$GNUSTEP_LOCAL_LIBRARIES" "$GNUSTEP_NETWORK_LIBRARIES" "$GNUSTEP_SYSTEM_LIBRARIES" $fixup_paths`
558
559old_IFS="$IFS"
560IFS=:
561GNUSTEP_PKGCONFIG_FRAGMENT=pkgconfig
562
563  for dir in $GNUSTEP_PKGCONFIG_PATHLIST; do
564
565    # prepare the path_fragment for libraries and this dir
566    if [ "$GNUSTEP_IS_FLATTENED" = "yes" ]; then
567      path_fragment="$dir/$GNUSTEP_PKGCONFIG_FRAGMENT"
568    else
569      path_fragment="$dir/$GNUSTEP_HOST_CPU-$GNUSTEP_HOST_OS/$LIBRARY_COMBO/$GNUSTEP_PKGCONFIG_FRAGMENT:$dir/$GNUSTEP_HOST_CPU-$GNUSTEP_HOST_OS/$GNUSTEP_PKGCONFIG_FRAGMENT"
570    fi
571
572    if [ -z "$PKG_CONFIG_PATH" ]; then
573      PKG_CONFIG_PATH="$path_fragment"
574    else
575      if ( echo ":${PKG_CONFIG_PATH}:"\
576    |grep -v ":${path_fragment}:" >/dev/null ); then
577    PKG_CONFIG_PATH="$path_fragment:$PKG_CONFIG_PATH"
578      fi
579    fi
580    export PKG_CONFIG_PATH
581
582  done
583IFS="$old_IFS"
584unset old_IFS
585unset dir
586unset path_fragment
587
588unset GNUSTEP_PKGCONFIG_FRAGMENT
589unset GNUSTEP_PKGCONFIG_PATHLIST
590unset GNUSTEP_HAS_PKGCONFIG
591fi # [ "$GNUSTEP_HAS_PKGCONFIG" = "yes" ]
592
593#
594# Clean up the environment by removing the filesystem variables.  Do
595# it unless we were explicitly requested not to clean it up!  Mostly
596# gnustep-config will request that the environment is not cleaned up,
597# so it can print out all of the GNUstep variables.
598#
599if [ -n "$GNUSTEP_SH_EXPORT_ALL_VARIABLES" ]; then
600  export GNUSTEP_MAKE_STRICT_V2_MODE
601
602  unset GNUSTEP_KEEP_CONFIG_FILE GNUSTEP_KEEP_USER_CONFIG_FILE
603
604  export GNUSTEP_CONFIG_FILE GNUSTEP_USER_CONFIG_FILE
605
606  export GNUSTEP_USER_DEFAULTS_DIR
607
608  # Always export these variables even if in strict gnustep-make v2
609  # mode, so that for example gnustep-config can determine them.
610  export GNUSTEP_IS_FLATTENED LIBRARY_COMBO
611  export GNUSTEP_HOST GNUSTEP_HOST_CPU GNUSTEP_HOST_VENDOR GNUSTEP_HOST_OS
612
613  export GNUSTEP_SYSTEM_APPS GNUSTEP_SYSTEM_ADMIN_APPS GNUSTEP_SYSTEM_WEB_APPS GNUSTEP_SYSTEM_TOOLS GNUSTEP_SYSTEM_ADMIN_TOOLS
614  export GNUSTEP_SYSTEM_LIBRARY GNUSTEP_SYSTEM_HEADERS GNUSTEP_SYSTEM_LIBRARIES
615  export GNUSTEP_SYSTEM_DOC GNUSTEP_SYSTEM_DOC_MAN GNUSTEP_SYSTEM_DOC_INFO
616
617  export GNUSTEP_NETWORK_APPS GNUSTEP_NETWORK_ADMIN_APPS GNUSTEP_NETWORK_WEB_APPS GNUSTEP_NETWORK_TOOLS GNUSTEP_NETWORK_ADMIN_TOOLS
618  export GNUSTEP_NETWORK_LIBRARY GNUSTEP_NETWORK_HEADERS GNUSTEP_NETWORK_LIBRARIES
619  export GNUSTEP_NETWORK_DOC GNUSTEP_NETWORK_DOC_MAN GNUSTEP_NETWORK_DOC_INFO
620
621  export GNUSTEP_LOCAL_APPS GNUSTEP_LOCAL_ADMIN_APPS GNUSTEP_LOCAL_WEB_APPS GNUSTEP_LOCAL_TOOLS GNUSTEP_LOCAL_ADMIN_TOOLS
622  export GNUSTEP_LOCAL_LIBRARY GNUSTEP_LOCAL_HEADERS GNUSTEP_LOCAL_LIBRARIES
623  export GNUSTEP_LOCAL_DOC GNUSTEP_LOCAL_DOC_MAN GNUSTEP_LOCAL_DOC_INFO
624
625  export GNUSTEP_USER_APPS GNUSTEP_USER_ADMIN_APPS GNUSTEP_USER_WEB_APPS GNUSTEP_USER_TOOLS GNUSTEP_USER_ADMIN_TOOLS
626  export GNUSTEP_USER_LIBRARY GNUSTEP_USER_HEADERS GNUSTEP_USER_LIBRARIES
627  export GNUSTEP_USER_DOC GNUSTEP_USER_DOC_MAN GNUSTEP_USER_DOC_INFO
628
629  export GNUSTEP_SYSTEM_USERS_DIR GNUSTEP_LOCAL_USERS_DIR GNUSTEP_NETWORK_USERS_DIR
630else
631  if [ "$GNUSTEP_MAKE_STRICT_V2_MODE" = "yes" ]; then
632    unset GNUSTEP_IS_FLATTENED
633    unset LIBRARY_COMBO
634    unset GNUSTEP_HOST
635    unset GNUSTEP_HOST_CPU
636    unset GNUSTEP_HOST_VENDOR
637    unset GNUSTEP_HOST_OS
638  fi
639
640  unset GNUSTEP_MAKE_STRICT_V2_MODE
641
642  # Unset these variables but only if we set them internally; keep
643  # them if they were already in the environment.
644  if [ -z "$GNUSTEP_KEEP_CONFIG_FILE" ]; then
645    unset GNUSTEP_CONFIG_FILE
646  fi
647  unset GNUSTEP_KEEP_CONFIG_FILE
648
649  if [ -z "$GNUSTEP_KEEP_USER_CONFIG_FILE" ]; then
650    unset GNUSTEP_USER_CONFIG_FILE
651  fi
652  unset GNUSTEP_KEEP_USER_CONFIG_FILE
653
654  # Always unset these variables
655  unset GNUSTEP_USER_DEFAULTS_DIR
656
657  unset GNUSTEP_SYSTEM_APPS
658  unset GNUSTEP_SYSTEM_ADMIN_APPS
659  unset GNUSTEP_SYSTEM_WEB_APPS
660  unset GNUSTEP_SYSTEM_TOOLS
661  unset GNUSTEP_SYSTEM_ADMIN_TOOLS
662  unset GNUSTEP_SYSTEM_LIBRARY
663  unset GNUSTEP_SYSTEM_HEADERS
664  unset GNUSTEP_SYSTEM_LIBRARIES
665  unset GNUSTEP_SYSTEM_DOC
666  unset GNUSTEP_SYSTEM_DOC_MAN
667  unset GNUSTEP_SYSTEM_DOC_INFO
668
669  unset GNUSTEP_NETWORK_APPS
670  unset GNUSTEP_NETWORK_ADMIN_APPS
671  unset GNUSTEP_NETWORK_WEB_APPS
672  unset GNUSTEP_NETWORK_TOOLS
673  unset GNUSTEP_NETWORK_ADMIN_TOOLS
674  unset GNUSTEP_NETWORK_LIBRARY
675  unset GNUSTEP_NETWORK_HEADERS
676  unset GNUSTEP_NETWORK_LIBRARIES
677  unset GNUSTEP_NETWORK_DOC
678  unset GNUSTEP_NETWORK_DOC_MAN
679  unset GNUSTEP_NETWORK_DOC_INFO
680
681  unset GNUSTEP_LOCAL_APPS
682  unset GNUSTEP_LOCAL_ADMIN_APPS
683  unset GNUSTEP_LOCAL_WEB_APPS
684  unset GNUSTEP_LOCAL_TOOLS
685  unset GNUSTEP_LOCAL_ADMIN_TOOLS
686  unset GNUSTEP_LOCAL_LIBRARY
687  unset GNUSTEP_LOCAL_HEADERS
688  unset GNUSTEP_LOCAL_LIBRARIES
689  unset GNUSTEP_LOCAL_DOC
690  unset GNUSTEP_LOCAL_DOC_MAN
691  unset GNUSTEP_LOCAL_DOC_INFO
692
693  unset GNUSTEP_USER_APPS
694  unset GNUSTEP_USER_ADMIN_APPS
695  unset GNUSTEP_USER_WEB_APPS
696  unset GNUSTEP_USER_TOOLS
697  unset GNUSTEP_USER_ADMIN_TOOLS
698  unset GNUSTEP_USER_LIBRARY
699  unset GNUSTEP_USER_HEADERS
700  unset GNUSTEP_USER_LIBRARIES
701  unset GNUSTEP_USER_DOC
702  unset GNUSTEP_USER_DOC_MAN
703  unset GNUSTEP_USER_DOC_INFO
704
705  unset GNUSTEP_SYSTEM_USERS_DIR
706  unset GNUSTEP_LOCAL_USERS_DIR
707  unset GNUSTEP_NETWORK_USERS_DIR
708fi
709
710if [ -n "$GS_ZSH_NEED_TO_RESTORE_SET" ]; then
711  unsetopt shwordsplit
712fi
713# EOF
714