Jelajahi Sumber

* Check for valid sed at configure

Bryan Drewery 14 tahun lalu
induk
melakukan
966c4cc446
3 mengubah file dengan 77 tambahan dan 6 penghapusan
  1. 2 1
      autotools/configure.ac
  2. 71 1
      configure
  3. 4 4
      src/generate_defs.sh

+ 2 - 1
autotools/configure.ac

@@ -38,6 +38,7 @@ AC_CACHE_SAVE
 
 # Checks for programs
 AC_PROG_MAKE_SET
+AC_PROG_SED
 EGG_PROG_HEAD_1
 EGG_PROG_AWK
 EGG_PROG_BASENAME
@@ -271,7 +272,7 @@ if [ "$GIT_REQUIRED" = "1" ]; then
 fi
 ]
 
-CXX="$CXX" TCLINC="$TCLINC" SSL_INCLUDES="$SSL_INCLUDES" src/generate_defs.sh
+CXX="$CXX" TCLINC="$TCLINC" SSL_INCLUDES="$SSL_INCLUDES" SED="$SED" src/generate_defs.sh
 [
 if [ $? -ne 0 ]; then
   exit 1

+ 71 - 1
configure

@@ -633,6 +633,7 @@ OBJCOPY
 BASENAME
 AWK
 HEAD_1
+SED
 SET_MAKE
 GCC4DEB
 GCC3DEB
@@ -3840,6 +3841,75 @@ $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  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_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
 
 cat << 'EOF' > conftest.head
 a
@@ -9844,7 +9914,7 @@ if [ "$GIT_REQUIRED" = "1" ]; then
 fi
 
 
-CXX="$CXX" TCLINC="$TCLINC" SSL_INCLUDES="$SSL_INCLUDES" src/generate_defs.sh
+CXX="$CXX" TCLINC="$TCLINC" SSL_INCLUDES="$SSL_INCLUDES" SED="$SED" src/generate_defs.sh
 
 if [ $? -ne 0 ]; then
   exit 1

+ 4 - 4
src/generate_defs.sh

@@ -1,5 +1,9 @@
 #! /bin/bash
 
+if [ -z "$SED" -o -z "$CXX" ]; then
+  echo "This must be ran by configure" >&2
+  exit 1
+fi
 echo "Generating lib symbols"
 INCLUDES="-I${TCLINC} ${SSL_INCLUDES}"
 
@@ -25,10 +29,6 @@ for file in $(grep -l DLSYM_GLOBAL src/*.c|grep -v "src/_"); do
   pushd src >/dev/null 2>&1
   $CXX -E -I. -I.. -I../lib ${INCLUDES} -DHAVE_CONFIG_H ../${file} > $TMPFILE
   # Fix wrapped prototypes
-  SED=$(which gsed)
-  if [ $? -ne 0 ]; then
-    SED="sed"
-  fi
   $SED -i -e ':a;N;$!ba;s/,\n/,/g' $TMPFILE
   popd >/dev/null 2>&1