$NetBSD: patch-gnu_configure.in,v 1.1 2015/04/12 15:45:00 tnn Exp $

--- gnu/configure.in.orig	2005-06-21 18:27:20.000000000 +0000
+++ gnu/configure.in
@@ -12,13 +12,23 @@ dnl Installation script (let it be, temp
 AC_PROG_INSTALL([e:/os2apps/autoconf/install-sh])
 
 dnl Configuration parameters
-AC_CONFIG_HEADER([../c_defs.h:config.h.in])
+AC_CONFIG_HEADER([c_defs.h:config.h.in])
 
 dnl Checks for the canonical system name
 AC_CANONICAL_HOST
 
 dnl Checks for programs.
 AC_PROG_CC
+AC_DEFUN(AC_PROG_LD_GNU,
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+  ac_cv_prog_gnu_ld=yes
+else
+  ac_cv_prog_gnu_ld=no
+fi])
+])
+AC_PROG_LD_GNU
 
 dnl Checks for header files.
 AC_HEADER_STDC
@@ -35,7 +45,8 @@ AC_FUNC_MEMCMP
 AC_FUNC_SETVBUF_REVERSED
 AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([getcwd min max mkdir mkdtemp rmdir fcloseall strcasecmp setpriority strdup strerror strstr strupr strlwr strtol strtoul])
+AC_CHECK_FUNCS([getcwd lchown min max mkdir mkdtemp rmdir fcloseall strcasecmp setpriority strdup strerror strstr strupr strlwr strtol strtoul])
+AC_SEARCH_LIBS([dlsym], [dl])
 
 dnl Platform-specific tuning
 PROG_EXT=
@@ -45,22 +56,27 @@ REQUIRES_DEF=
 OS_ID="UNIX"
 OS_DEF="-D_UNIX"
 DLL_CFLAGS="-fPIC"
+LD_STRIP="-s "
 
 case $host_os in
 linux*)
 	AC_DEFINE(ELF_EXECUTABLES, 1, [Define if executables use ELF format])
         DYN_LIBS="-ldl"
-        LD_STRIP="gnu/stripgcc.lnk"
+        LD_STRIP="-s gnu/stripgcc.lnk"
 	;;
 k*bsd*)
 	AC_DEFINE(ELF_EXECUTABLES)
 	DYN_LIBS="-ldl"
-	LD_STRIP="gnu/stripgcc.lnk"
+	LD_STRIP="-s gnu/stripgcc.lnk"
 	;;
 *bsd*)
 	AC_DEFINE(ELF_EXECUTABLES)
         DLL_FLAGS="-shared -export-dynamic"
-        LD_STRIP="gnu/stripgcc.lnk"
+        LD_STRIP="-s gnu/stripgcc.lnk"
+	;;
+darwin*)
+	DLL_FLAGS="-bundle"
+	LD_STRIP=""
 	;;
 interix3*)
 	# not ELF
@@ -71,14 +87,16 @@ interix3*)
 	AC_DEFINE(ELF_EXECUTABLES)
         DLL_FLAGS="-shared -fPIC"
         DLL_CFLAGS="-shared -fPIC"
-        LD_STRIP="gnu/stripgcc.lnk"
+        LD_STRIP="-s gnu/stripgcc.lnk"
 	;;
 *solaris*)
 	AC_DEFINE(ELF_EXECUTABLES)
         CFLAGS="-DSUNOS -D_UNIX"
         DLL_FLAGS="-shared -fPIC"
         DLL_CFLAGS="-shared -fPIC"
-        LD_STRIP="gnu/stripgcc.lnk"
+	if test X"$ac_cv_prog_gnu_ld" = X"yes"; then
+        LD_STRIP="-s gnu/stripgcc.lnk"
+	fi
 	;;
 os2*)
 	PROG_EXT=".exe"
@@ -125,7 +143,7 @@ dnl Initial setup
 
 test -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
 AC_SUBST(CONFIG_SHELL)
-
+AC_OUTPUT(makefile.gnu:makefile.in)
 AC_MSG_CHECKING([if dynamic C library may be used])
 AC_ARG_ENABLE(libc,
 [  --disable-libc          Disable linking with dynamic C library],
