From 44bdf5ac73d8a3a0849a0ae400caf4edc07a53e2 Mon Sep 17 00:00:00 2001 From: Richard Kettlewell Date: Mon, 11 Jul 2011 20:02:26 +0100 Subject: [PATCH] Detect Fink automatically. 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 --- README.mac | 2 +- configure | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 8 ++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/README.mac b/README.mac index 5e018c1..c84a84f 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 5693f28..ef81cf8 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 29ced95..6959e28 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 -- 2.30.2