mirror of
				https://github.com/netwide-assembler/nasm.git
				synced 2025-10-10 00:25:06 -04:00 
			
		
		
		
	autoconf: unbreak --enable-lto, fix some language macros
PA_ADD_LANGFLAGS() was broken, resulting in among other things --enable-lto not working. Make autogen.sh fail if aclocal return error. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
		| @@ -17,9 +17,11 @@ m4_defun([_PA_LANGFLAG_VAR], | |||||||
|  [m4_fatal([PA_ADD_LANGFLAGS: Unknown language: $1])])]) |  [m4_fatal([PA_ADD_LANGFLAGS: Unknown language: $1])])]) | ||||||
|  |  | ||||||
| AC_DEFUN([PA_ADD_LANGFLAGS], | AC_DEFUN([PA_ADD_LANGFLAGS], | ||||||
| [m4_set_foreach(PA_LANG_SEEN_SET, [lang], | [m4_pushdef([_pa_langflags],m4_dquote($1))dnl | ||||||
|  [_pa_flag_found=no | m4_set_foreach(_PA_LANG_SEEN_SET,[_pa_lang],dnl | ||||||
|   m4_foreach_w([flag], [$1], | [_pa_flag_found=no | ||||||
|  |  m4_foreach_w([_pa_flag], _pa_langflags, | ||||||
|  [AS_IF([test $_pa_flag_found = no], |  [AS_IF([test $_pa_flag_found = no], | ||||||
|    [PA_ADD_FLAGS(_PA_LANGFLAG_VAR(lang),flag,[],[_pa_flag_found=yes])]) |   [PA_ADD_FLAGS(_PA_LANGFLAG_VAR(_pa_lang),_pa_flag,[],[_pa_flag_found=yes])]) | ||||||
|    ])])]) |   ])]) | ||||||
|  | m4_popdef([_pa_langflags])]) | ||||||
|   | |||||||
| @@ -10,7 +10,8 @@ AC_DEFUN([PA_OPTION_LTO], | |||||||
| [PA_ARG_BOOL([lto], | [PA_ARG_BOOL([lto], | ||||||
|  [Try to enable link-time optimization for this compiler], |  [Try to enable link-time optimization for this compiler], | ||||||
|  [$1], |  [$1], | ||||||
|  [PA_ADD_LANGFLAGS([-flto]) |  [PA_ADD_LANGFLAGS([-flto=auto -flto]) | ||||||
|  | PA_ADD_LANGFLAGS([-ffat-lto-objects]) | ||||||
| dnl Note: we use _PROG rather than _TOOL since we are prepending the full | dnl Note: we use _PROG rather than _TOOL since we are prepending the full | ||||||
| dnl CC name which ought to already contain the host triplet if needed | dnl CC name which ought to already contain the host triplet if needed | ||||||
|    ccbase=`echo "$CC" | awk '{ print $1; }'` |    ccbase=`echo "$CC" | awk '{ print $1; }'` | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								autoconf/m4/pa_prog_cc.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								autoconf/m4/pa_prog_cc.m4
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | dnl -------------------------------------------------------------------------- | ||||||
|  | dnl PA_PROG_CC() | ||||||
|  | dnl | ||||||
|  | dnl Similar to AC_PROG_CC, but add a prototype for main() to | ||||||
|  | dnl AC_INCLUDES_DEFAULT to avoid -Werror from breaking compilation. | ||||||
|  | dnl -------------------------------------------------------------------------- | ||||||
|  | AC_DEFUN([PA_PROG_CC], | ||||||
|  | [AC_PROG_CC | ||||||
|  |  AS_IF([test x$ac_cv_prog != xno], | ||||||
|  |  [ac_includes_default="$ac_includes_default | ||||||
|  | #ifndef __cplusplus | ||||||
|  | extern int main(void); | ||||||
|  | #endif"])]) | ||||||
| @@ -53,6 +53,7 @@ if test ! -f autoconf/aclocal.m4; then | |||||||
|     # aclocal failed, revert to previous files |     # aclocal failed, revert to previous files | ||||||
|     mv -f autoconf/m4.old/*.m4 autoconf/m4/ |     mv -f autoconf/m4.old/*.m4 autoconf/m4/ | ||||||
|     mv -f autoconf/aclocal.m4.old autoconf/aclocal.m4 |     mv -f autoconf/aclocal.m4.old autoconf/aclocal.m4 | ||||||
|  |     exit 1 | ||||||
| fi | fi | ||||||
| rm -rf autoconf/*m4.old | rm -rf autoconf/*m4.old | ||||||
| "$AUTOHEADER" -B autoconf | "$AUTOHEADER" -B autoconf | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ dnl the best very slow and doesn't buy us a single thing at all. | |||||||
| PA_CROSS_COMPILE | PA_CROSS_COMPILE | ||||||
|  |  | ||||||
| dnl Enable any available C extensions | dnl Enable any available C extensions | ||||||
| AC_PROG_CC | PA_PROG_CC | ||||||
| AC_USE_SYSTEM_EXTENSIONS | AC_USE_SYSTEM_EXTENSIONS | ||||||
| PA_ADD_CPPFLAGS([-std=c17], [], [], | PA_ADD_CPPFLAGS([-std=c17], [], [], | ||||||
| [PA_ADD_CPPFLAGS([-std=c11], [], [], | [PA_ADD_CPPFLAGS([-std=c11], [], [], | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user