[PATCH 1/3] Detect Fink automatically.

Richard Kettlewell rjk at terraraq.org.uk
Sat Jul 23 10:32:18 BST 2011


The logic is that if Fink is in the path then we should use it.  So
(unlike certain build systems I could mention) if you want to use a
local install of GMP, it should be sufficient to run ./configure
without /sw/bin in the path.

Signed-off-by: Richard Kettlewell <rjk at terraraq.org.uk>
---
 README.mac   |    2 +-
 configure    |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 configure.in |    8 ++++++++
 3 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/README.mac b/README.mac
index d6d60a8..d8b70ab 100644
--- a/README.mac
+++ b/README.mac
@@ -6,7 +6,7 @@ How to install secnet on a Fink-equipped OS X system:
     make
     sudo make install
   - Build secnet:
-    ./configure CPPFLAGS=-I/sw/include LDFLAGS=-L/sw/lib
+    ./configure
     make
     sudo make install
   - Install tuntap for OSX from http://tuntaposx.sourceforge.net/
diff --git a/configure b/configure
index 0bb23b6..d824749 100755
--- a/configure
+++ b/configure
@@ -613,6 +613,7 @@ LDFLAGS
 CFLAGS
 CC
 SET_MAKE
+FINK
 target_alias
 host_alias
 build_alias
@@ -2263,6 +2264,53 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+# If fink is on the path then it is assumed we should use it.
+# Extract the first word of "fink", so it can be a program name with args.
+set dummy fink; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_FINK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FINK in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FINK="$FINK" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FINK="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+FINK=$ac_cv_path_FINK
+if test -n "$FINK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FINK" >&5
+$as_echo "$FINK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test "x$FINK" != x; then
+  finkdir=`echo $FINK|sed 's,/[^/]*/[^/]*$,,'`
+  CPPFLAGS="-I$finkdir/include ${CPPFLAGS}"
+  LDFLAGS="-L$finkdir/lib ${LDFLAGS}"
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
diff --git a/configure.in b/configure.in
index a548dac..4b82f9a 100644
--- a/configure.in
+++ b/configure.in
@@ -11,6 +11,14 @@ AC_REVISION($Id: configure.in,v 1.4 2002/09/09 22:05:02 steve Exp $)
 
 AC_LANG_C
 
+# If fink is on the path then it is assumed we should use it.
+AC_PATH_PROG([FINK],[fink])
+if test "x$FINK" != x; then
+  finkdir=`echo $FINK|sed 's,/[[^/]]*/[[^/]]*$,,'`
+  CPPFLAGS="-I$finkdir/include ${CPPFLAGS}"
+  LDFLAGS="-L$finkdir/lib ${LDFLAGS}"
+fi
+
 AC_PROG_MAKE_SET
 AC_PROG_CC
 AC_PROG_INSTALL
-- 
1.6.4.2




More information about the sgo-software-discuss mailing list