Hi,

maybe I've overlooked something in configure.in, but to me it seems that
it is impossible to compile vim7 without searching /usr/local/include
and /usr/local/lib.

Thing is, on solaris fex, if iconv.h is found in /usr/local/include,
/usr/local/lib/libiconv.so get linked too.
But the rpath for libiconv.so.3 does not get encoded into the binary,
and I really don't want to set LD_LIBRARY_PATH (hmm, maybe this should
be in system loader path).

Additionally, I also want to be able to compile completely independent
of /usr/local, with a gcc built --with-local-prefix=/another/prefix, and
with libiconv and others from that prefix.

So I have two new requirements for the /usr/local search:

1) Of course, I want to keep the default as is.
2) completely disable adding /usr/local/include and /usr/local/lib
3) set a different path to be used instead of /usr/local

Attached is a patch for src/configure.in to accept "--with-local-prefix"
flag, which solves above requirements:

1) default: do not pass any --with-local-prefix argument.
2) disable: use --without-local-prefix or even --with-local-prefix=no
3) change:  use --with-local-prefix=/another/prefix

Thanks,
  haubi
-- 
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:[EMAIL PROTECTED]  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
--- src/configure.in
+++ src/configure.in
@@ -186,8 +186,22 @@
 dnl Add /usr/local/lib to $LDFLAGS and /usr/local/include to CFLAGS.
 dnl Only when the directory exists and it wasn't there yet.
 dnl For gcc don't do this when it is already in the default search path.
+AC_MSG_CHECKING(for local prefix)
+local_prefix=/usr/local
 have_local_include=''
 have_local_lib=''
+AC_ARG_WITH(local-prefix, [  --with-local-prefix=/prefix   build against /prefix instead of /usr/local], [
+  local_prefix="$withval"
+  case "$withval" in
+  */*) ;;
+  no)
+    # avoid adding local prefix to LDFLAGS and CPPFLAGS
+    have_local_include=yes
+    have_local_lib=yes
+    ;;
+  *) AC_MSG_ERROR(must pass path argument to --with-local-prefix) ;;
+  esac
+], [
 if test "$GCC" = yes; then
   echo 'void f(){}' > conftest.c
   dnl -no-cpp-precomp is needed for OS X 10.2 (Ben Fowler)
@@ -195,18 +209,20 @@
   have_local_lib=`${CC-cc} -c -v conftest.c 2>&1 | grep '/usr/local/lib'`
   rm -f conftest.c conftest.o
 fi
-if test -z "$have_local_lib" -a -d /usr/local/lib; then
-  tt=`echo "$LDFLAGS" | sed -e 's+-L/usr/local/lib ++g' -e 's+-L/usr/local/lib$++g'`
+])
+if test -z "$have_local_lib" -a -d "${local_prefix}"/lib; then
+  tt=`echo "$LDFLAGS" | sed -e "s+-L${local_prefix}lib ++g" -e "s+-L${local_prefix}/lib$++g"`
   if test "$tt" = "$LDFLAGS"; then
-    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+    LDFLAGS="$LDFLAGS -L${local_prefix}/lib"
   fi
 fi
-if test -z "$have_local_include" -a -d /usr/local/include; then
-  tt=`echo "$CPPFLAGS" | sed -e 's+-I/usr/local/include ++g' -e 's+-I/usr/local/include$++g'`
+if test -z "$have_local_include" -a -d "${local_prefix}"/include; then
+  tt=`echo "$CPPFLAGS" | sed -e "s+-I${local_prefix}/include ++g" -e "s+-I${local_prefix}/include$++g"`
   if test "$tt" = "$CPPFLAGS"; then
-    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+    CPPFLAGS="$CPPFLAGS -I${local_prefix}/include"
   fi
 fi
+AC_MSG_RESULT($local_prefix)
 
 AC_MSG_CHECKING(--with-vim-name argument)
 AC_ARG_WITH(vim-name, [  --with-vim-name=NAME    what to call the Vim executable],

Reply via email to