[elinks-users] elinks-0.9.2 build issues

Jonas Fonseca fonseca at diku.dk
Thu Oct 21 06:26:34 PDT 2004


Jonas Fonseca <fonseca at diku.dk> wrote Wed, Oct 20, 2004:
> Jonas Fonseca <fonseca at diku.dk> wrote Wed, Oct 20, 2004:
> > Nelson H. F. Beebe <beebe at math.utah.edu> wrote Tue, Oct 19, 2004:
> > > * On several systems, I get this error:
> > > 
> > > 	gcc: unrecognized option `-rdynamic'
> > 
> > I have met this error myself and suspect that the following code
> > from configure.in is wrong
> > 
> > 	dnl Check for -rdynamic
> > 	AC_MSG_CHECKING([for -rdynamic])
> > 	LDFLAGS_X="$LDFLAGS"
> > 	LDFLAGS="$LDFLAGS -rdynamic"
> > 	AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
> > 	test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
> > 	AC_MSG_RESULT($have_rdynamic)
> > 
> > Maybe actually compiling/linking some code will fix it
> > 
> > 	AC_TRY_LINK([int a = 5;], [if (a == 5) a = 7;], have_rdynamic=yes, have_rdynamic=no)
> 
> Obviously gcc only warns about unrecognized options. libtool.m4 has a
> nice macro that redirect output from the test compilation and then
> checks `test -s <gcc-output-file>' to see gcc printed a warning. I hope
> to replace the current -rdynamic check with something similar to what
> I described soon.

I have attached a patch that tries to fix the broken -rdynamic check.  I
will try to test it on 'exotic' machines at my university (DIKU) but it
would be great if others could test if it breaks configuration.

(Apply it by running `patch -p0 < attached_file.patch` from the toplevel
the ELinks-0.9 directory.)

-- 
Jonas Fonseca
-------------- next part --------------
Index: configure.in
===================================================================
RCS file: /home/cvs/elinks/elinks/configure.in,v
retrieving revision 1.337.2.25
diff -u -d -p -r1.337.2.25 configure.in
--- configure.in	24 Sep 2004 16:12:39 -0000	1.337.2.25
+++ configure.in	21 Oct 2004 13:19:25 -0000
@@ -124,12 +124,10 @@ if test "x${ac_cv_cpp_variadic_macros}" 
 fi
 
 dnl Check for -rdynamic
-AC_MSG_CHECKING([for -rdynamic])
-LDFLAGS_X="$LDFLAGS"
-LDFLAGS="$LDFLAGS -rdynamic"
-AC_TRY_LINK([], [], have_rdynamic=yes, have_rdynamic=no)
-test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
-AC_MSG_RESULT($have_rdynamic)
+EL_CHECK_COMPILER_OPTION(HAVE_RDYNAMIC, -rdynamic,
+[
+	LDFLAGS="$LDFLAGS -rdynamic"
+])
 
 dnl ===================================================================
 dnl Check for POSIX <regex.h>
--- /dev/null	2004-08-21 17:25:50.000000000 +0200
+++ m4/features.m4	2004-10-21 15:14:35.000000000 +0200
@@ -0,0 +1,53 @@
+dnl Save and restore the current build flags
+
+AC_DEFUN([EL_SAVE_FLAGS],
+[
+	CFLAGS_X="$CFLAGS";
+	CPPFLAGS_X="$CPPFLAGS";
+	LDFLAGS_X="$LDFLAGS";
+	LIBS_X="$LIBS";
+])
+
+AC_DEFUN([EL_RESTORE_FLAGS],
+[
+	CFLAGS="$CFLAGS_X";
+	CPPFLAGS="$CPPFLAGS_X";
+	LDFLAGS="$LDFLAGS_X";
+	LIBS="$LIBS_X";
+])
+
+dnl EL_CHECK_COMPILER_OPTION(VARIABLE-NAME, FLAGS,
+dnl			     [ACTION-SUCCESS], [ACTION-FAILURE])
+dnl ----------------------------------------------------------------
+dnl Check whether the given compiler option works
+dnl (based on AC_LIBTOOL_COMPILER_OPTION from libtool.m4)
+AC_DEFUN([EL_CHECK_COMPILER_OPTION],
+[
+	AC_MSG_CHECKING([if $CC supports $2])
+	$1=no
+	echo "int main() { return 0; }" > conftest.$ac_ext
+	rm -f conftest.$ac_objext
+	EL_SAVE_FLAGS
+	LDFLAGS="$LDFLAGS $2"
+	(eval echo "\$as_me:__oline__: \"$ac_compile\"") >&AS_MESSAGE_LOG_FD
+	(eval $ac_compile) 2>conftest.err
+	ac_status=$?
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+	echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+	if (exit $ac_status) && test -s conftest.err; then
+		# The compiler can only warn and ignore the option if not
+		# recognized. So say no if there are warnings.
+		if test ! -s conftest.err; then
+			$1=yes
+		fi
+	fi
+	rm -f conftest*
+	EL_RESTORE_FLAGS
+	AC_MSG_RESULT([$]$1)
+
+	if test x"[$]$1" = xyes; then
+		ifelse([$3], , :, [$3])
+	else
+		ifelse([$4], , :, [$4])
+	fi
+])


More information about the elinks-users mailing list