Submitted By: Robert Connolly (ashes) Date: 2005-01-30 Initial Package Version: 1.4.2 Upstream Status: Not submitted Origin: None Description: Check for gcc -fpie, -fpic, -fstack-protector, and ld -pie, -z relro, -z now. Use whatever works. See: http://www.linuxfromscratch.org/~robert/Homogenic/ diff -Naur m4-1.4.2.orig/Makefile.in m4-1.4.2/Makefile.in --- m4-1.4.2.orig/Makefile.in 2005-01-30 05:45:44.000000000 +0000 +++ m4-1.4.2/Makefile.in 2005-01-30 07:02:19.306337798 +0000 @@ -43,7 +43,7 @@ bindir = $(exec_prefix)/bin infodir = $(prefix)/info -MDEFINES = CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \ +MDEFINES = CC='$(CC)' LIBS='$(LIBS)' \ prefix='$(prefix)' exec_prefix='$(exec_prefix)' \ bindir='$(bindir)' infodir='$(infodir)' diff -Naur m4-1.4.2.orig/configure m4-1.4.2/configure --- m4-1.4.2.orig/configure 2005-01-30 05:45:44.000000000 +0000 +++ m4-1.4.2/configure 2005-01-30 07:02:04.953380098 +0000 @@ -309,7 +309,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PRODUCT VERSION AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB CPP EGREP U ANSI2KNR ALLOCA LIBOBJS STACKOVF LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS PRODUCT VERSION AWK CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB FPIECFLAGS PIELDFLAGS FPICCFLAGS SSPCFLAGS SSPNOCFLAGS RELROLDFLAGS NOWLDFLAGS CPP EGREP U ANSI2KNR ALLOCA LIBOBJS STACKOVF LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -2513,6 +2513,359 @@ fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_save_CFLAGS=$CFLAGS +CFLAGS="-pie -fPIE $CFLAGS" +echo "$as_me:$LINENO: checking whether $CC accepts -pie -fPIE" >&5 +echo $ECHO_N "checking whether $CC accepts -pie -fPIE... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_fpie+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_fpie=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_fpie=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_fpie" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_fpie" >&6 + + +CFLAGS="$ac_save_CFLAGS" +if test $ac_cv_prog_cc_fpie = yes; then + FPIECFLAGS="-pie -fPIE" + PIELDFLAGS="-pie" +else + FPIECFLAGS="" + PIELDFLAGS="" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_save_CFLAGS=$CFLAGS +CFLAGS="-fPIC $CFLAGS" +echo "$as_me:$LINENO: checking whether $CC accepts -fPIC" >&5 +echo $ECHO_N "checking whether $CC accepts -fPIC... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_fpic+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_fpic=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_fpic=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_fpic" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_fpic" >&6 + +CFLAGS="$ac_save_CFLAGS" +if test $ac_cv_prog_cc_fpic = yes; then + FPICCFLAGS="-fPIC" +else + FPICCFLAGS="" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_save_CFLAGS=$CFLAGS +CFLAGS="-fstack-protector-all $CFLAGS" +echo "$as_me:$LINENO: checking whether $CC accepts -fstack-protector-all" >&5 +echo $ECHO_N "checking whether $CC accepts -fstack-protector-all... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_ssp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_ssp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_ssp=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_ssp" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_ssp" >&6 + + +CFLAGS="$ac_save_CFLAGS" +if test $ac_cv_prog_cc_ssp = yes; then + SSPCFLAGS="-fstack-protector-all" + SSPNOCFLAGS="-fno-fstack-protector" +else + SSPCFLAGS="" + SSPNOCFLAGS="" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_save_CFLAGS=$CFLAGS +CFLAGS="-Wl,-z,relro $CFLAGS" +echo "$as_me:$LINENO: checking whether the $CC linker accepts -z relro" >&5 +echo $ECHO_N "checking whether the $CC linker accepts -z relro... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_relro+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_relro=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_relro=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_relro" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_relro" >&6 + +CFLAGS="$ac_save_CFLAGS" +if test $ac_cv_prog_cc_relro = yes; then + RELROLDFLAGS="-z relro" +else + RELROLDFLAGS="" +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_save_CFLAGS=$CFLAGS +CFLAGS="-Wl,-z,now $CFLAGS" +echo "$as_me:$LINENO: checking whether the $CC linker accepts -z now" >&5 +echo $ECHO_N "checking whether the $CC linker accepts -z now... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_now+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_now=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_now=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_now" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_now" >&6 + +CFLAGS="$ac_save_CFLAGS" +if test $ac_cv_prog_cc_now = yes; then + NOWLDFLAGS="-z now" +else + NOWLDFLAGS="" +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -5699,6 +6052,13 @@ s,@SET_MAKE@,$SET_MAKE,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@FPIECFLAGS@,$FPIECFLAGS,;t t +s,@PIELDFLAGS@,$PIELDFLAGS,;t t +s,@FPICCFLAGS@,$FPICCFLAGS,;t t +s,@SSPCFLAGS@,$SSPCFLAGS,;t t +s,@SSPNOCFLAGS@,$SSPNOCFLAGS,;t t +s,@RELROLDFLAGS@,$RELROLDFLAGS,;t t +s,@NOWLDFLAGS@,$NOWLDFLAGS,;t t s,@CPP@,$CPP,;t t s,@EGREP@,$EGREP,;t t s,@U@,$U,;t t diff -Naur m4-1.4.2.orig/lib/Makefile.in m4-1.4.2/lib/Makefile.in --- m4-1.4.2.orig/lib/Makefile.in 2005-01-30 05:45:44.000000000 +0000 +++ m4-1.4.2/lib/Makefile.in 2005-01-30 07:02:04.955379535 +0000 @@ -24,7 +24,7 @@ AR = ar CC = @CC@ -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ @SSPCFLAGS@ @FPICCFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ RANLIB = @RANLIB@ diff -Naur m4-1.4.2.orig/src/Makefile.in m4-1.4.2/src/Makefile.in --- m4-1.4.2.orig/src/Makefile.in 2005-01-30 05:45:44.000000000 +0000 +++ m4-1.4.2/src/Makefile.in 2005-01-30 07:02:04.956379253 +0000 @@ -23,12 +23,12 @@ VPATH = @srcdir@ CC = @CC@ -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ @FPIECFLAGS@ @SSPCFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ -LDFLAGS = @LDFLAGS@ +LDFLAGS = @LDFLAGS@ @PIELDFLAGS@ @RELROLDFLAGS@ @NOWLDFLAGS@ LIBS = @LIBS@ STACKOVF = @STACKOVF@