Skip to content

Commit

Permalink
remove use of locate(1) from configure scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnewton committed Oct 3, 2022
1 parent 0aea9e5 commit edc6edb
Show file tree
Hide file tree
Showing 29 changed files with 103 additions and 5,986 deletions.
1,564 changes: 27 additions & 1,537 deletions configure

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,6 @@ AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)

AC_PATH_PROG(LOCATE,locate)
AC_PATH_PROG(DIRNAME,dirname)
AC_PATH_PROG(GREP,grep)

Expand Down
79 changes: 2 additions & 77 deletions m4/ax_smart_try.m4
Original file line number Diff line number Diff line change
@@ -1,69 +1,3 @@
dnl #
dnl # Locate the directory in which a particular file is found.
dnl #
dnl # Usage: FR_LOCATE_DIR(MYSQLLIB_DIR, libmysqlclient.a)
dnl #
dnl # Defines the variable MYSQLLIB_DIR to be the directory(s) in
dnl # which the file libmysqlclient.a is to be found.
dnl #
dnl #
AC_DEFUN([FR_LOCATE_DIR],
[
dnl # If we have the program 'locate', then the problem of finding a
dnl # particular file becomes MUCH easier.
dnl #
dnl #
dnl # No 'locate' defined, do NOT do anything.
dnl #
if test "x$LOCATE" != "x"; then
dnl #
dnl # Root through a series of directories, looking for the given file.
dnl #
DIRS=
file=$2
for x in `${LOCATE} $file 2>/dev/null`; do
dnl #
dnl # When asked for 'foo', locate will also find 'foo_bar', which we
dnl # don't want. We want that EXACT filename.
dnl #
dnl # We ALSO want to be able to look for files like 'mysql/mysql.h',
dnl # and properly match them, too. So we try to strip off the last
dnl # part of the filename, using the name of the file we're looking
dnl # for. If we CANNOT strip it off, then the name will be unchanged.
dnl #
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
dnl #
dnl # Exclude a number of directories.
dnl #
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
dnl #
dnl # OK, we have an exact match. Let's be sure that we only find ONE
dnl # matching directory.
dnl #
already=`echo \$$1 ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
dnl #
dnl # And remember the directory in which we found the file.
dnl #
eval "$1=\"\$$1 $DIRS\""
])

dnl #
dnl # Auto-populate smart_try_dir for includes
dnl #
Expand Down Expand Up @@ -120,7 +54,7 @@ old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir=
smart_lib_dir="/usr/local/lib /opt/lib"
dnl #
dnl # Try first any user-specified directory, otherwise we may pick up
Expand Down Expand Up @@ -163,10 +97,7 @@ dnl #
dnl # Try to guess possible locations.
dnl #
if test "x$smart_lib" = "x"; then
FR_LOCATE_DIR(smart_lib_dir,[lib$1${libltdl_cv_shlibext}])
FR_LOCATE_DIR(smart_lib_dir,[lib$1.a])
for try in $smart_lib_dir /usr/local/lib /opt/lib; do
for try in $smart_lib_dir; do
AC_MSG_CHECKING([for $2 in -l$1 in $try])
LIBS="-l$1 $old_LIBS"
CPPFLAGS="-L$try -Wl,-rpath,$try $old_CPPFLAGS"
Expand Down Expand Up @@ -310,12 +241,6 @@ dnl #
dnl # Try to guess possible locations.
dnl #
if test "x$smart_include" = "x"; then
for prefix in $smart_prefix; do
FR_LOCATE_DIR(_smart_include_dir,"${_prefix}/${1}")
done
FR_LOCATE_DIR(_smart_include_dir, $1)
for try in $_smart_include_dir; do
AC_MSG_CHECKING([for $1 in $try])
CPPFLAGS="-isystem $try $old_CPPFLAGS"
Expand Down
175 changes: 2 additions & 173 deletions src/lib/json/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3065,64 +3065,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x$smart_include" = "x"; then
for prefix in $smart_prefix; do
if test "x$LOCATE" != "x"; then
DIRS=
file="${_prefix}/${1}"
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
done
if test "x$LOCATE" != "x"; then
DIRS=
file=json/json.h
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
for try in $_smart_include_dir; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for json/json.h in $try" >&5
$as_echo_n "checking for json/json.h in $try... " >&6; }
Expand Down Expand Up @@ -3317,64 +3259,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x$smart_include" = "x"; then
for prefix in $smart_prefix; do
if test "x$LOCATE" != "x"; then
DIRS=
file="${_prefix}/${1}"
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
done
if test "x$LOCATE" != "x"; then
DIRS=
file=json-c/json.h
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
for try in $_smart_include_dir; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for json-c/json.h in $try" >&5
$as_echo_n "checking for json-c/json.h in $try... " >&6; }
Expand Down Expand Up @@ -3451,7 +3335,7 @@ old_LIBS="$LIBS"
old_CPPFLAGS="$CPPFLAGS"
smart_lib=
smart_ldflags=
smart_lib_dir=
smart_lib_dir="/usr/local/lib /opt/lib"
if test "x$smart_try_dir" != "x"; then
for try in $smart_try_dir; do
Expand Down Expand Up @@ -3520,62 +3404,7 @@ LIBS="$old_LIBS"
fi
if test "x$smart_lib" = "x"; then
if test "x$LOCATE" != "x"; then
DIRS=
file=libjson-c${libltdl_cv_shlibext}
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\""
if test "x$LOCATE" != "x"; then
DIRS=
file=libjson-c.a
for x in `${LOCATE} $file 2>/dev/null`; do
base=`echo $x | sed "s%/${file}%%"`
if test "x$x" = "x$base"; then
continue;
fi
dir=`${DIRNAME} $x 2>/dev/null`
exclude=`echo ${dir} | ${GREP} /home`
if test "x$exclude" != "x"; then
continue
fi
already=`echo \$smart_lib_dir ${DIRS} | ${GREP} ${dir}`
if test "x$already" = "x"; then
DIRS="$DIRS $dir"
fi
done
fi
eval "smart_lib_dir=\"\$smart_lib_dir $DIRS\""
for try in $smart_lib_dir /usr/local/lib /opt/lib; do
for try in $smart_lib_dir; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for json_object_object_add_ex in -ljson-c in $try" >&5
$as_echo_n "checking for json_object_object_add_ex in -ljson-c in $try... " >&6; }
LIBS="-ljson-c $old_LIBS"
Expand Down
Loading

0 comments on commit edc6edb

Please sign in to comment.