+
+LD_SWITCH_SYSTEM=
+case "$opsys" in
+ freebsd)
+ ## Let `ld' find image libs and similar things in /usr/local/lib.
+ ## The system compiler, GCC, has apparently been modified to not
+ ## look there, contrary to what a stock GCC would do.
+ LD_SWITCH_SYSTEM=-L/usr/local/lib
+ ;;
+
+ gnu-linux)
+ ## cpp test was "ifdef __mips__", but presumably this is equivalent...
+ test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0"
+ ;;
+
+ netbsd)
+ LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+ ;;
+
+ openbsd)
+ ## Han Boetes <han@mijncomputer.nl> says this is necessary,
+ ## otherwise Emacs dumps core on elf systems.
+ LD_SWITCH_SYSTEM="-Z"
+ ;;
+esac
+AC_SUBST(LD_SWITCH_SYSTEM)
+
+ac_link="$ac_link $LD_SWITCH_SYSTEM"
+
+## This is fun. Some settings of LD_SWITCH_SYSTEM reference
+## LD_SWITCH_X_SITE_AUX, which has not been defined yet. When using
+## cpp, it was expanded to null. Thus LD_SWITCH_SYSTEM had different
+## values in configure and the Makefiles. How helpful.
+## FIXME why not use LD_SWITCH_SYSTEM_TEMACS (or somesuch) instead?
+case "$opsys" in
+ gnu-linux)
+ ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time.
+ LD_SWITCH_SYSTEM="$LD_SWITCH_SYSTEM \$(LD_SWITCH_X_SITE_AUX)" ;;
+
+ netbsd|openbsd)
+ ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R.
+ LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;;
+esac
+
+
+C_SWITCH_MACHINE=
+if test "$machine" = "alpha"; then
+ AC_CHECK_DECL([__ELF__])
+ if test "$ac_cv_have_decl___ELF__" = "yes"; then
+ ## With ELF, make sure that all common symbols get allocated to in the
+ ## data section. Otherwise, the dump of temacs may miss variables in
+ ## the shared library that have been initialized. For example, with
+ ## GNU libc, __malloc_initialized would normally be resolved to the
+ ## shared library's .bss section, which is fatal.
+ if test "x$GCC" = "xyes"; then
+ C_SWITCH_MACHINE="-fno-common"
+ else
+ AC_MSG_ERROR([What gives? Fix me if DEC Unix supports ELF now.])
+ fi
+ fi
+fi
+AC_SUBST(C_SWITCH_MACHINE)
+
+
+C_SWITCH_SYSTEM=
+## Some programs in src produce warnings saying certain subprograms
+## are too complex and need a MAXMEM value greater than 2000 for
+## additional optimization. --nils@exp-math.uni-essen.de
+test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
+ C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
+## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
+## It is redundant in glibc2, since we define _GNU_SOURCE.
+AC_SUBST(C_SWITCH_SYSTEM)
+
+
+LIBS_SYSTEM=
+case "$opsys" in
+ ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
+ aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
+
+ freebsd) LIBS_SYSTEM="-lutil" ;;
+
+ hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
+
+ sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
+
+ ## Motif needs -lgen.
+ unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
+esac
+AC_SUBST(LIBS_SYSTEM)
+