From 2cd6264d32bbbb76e7c9bbe51d72e8d938c30704 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Fri, 19 May 2006 09:03:39 +0000 Subject: [PATCH] Modernise it a bit and fix builtin_expect configure test Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2627 --- configure.in | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/configure.in b/configure.in index 119c00b4..037651df 100644 --- a/configure.in +++ b/configure.in @@ -51,11 +51,13 @@ AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(int *) AC_MSG_CHECKING(if environ can be included) -AC_TRY_LINK([#include -#include ],[*environ;], +AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include +#include ]],[[*environ;]])], [AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_INCLUDED,1,[environ can be included])],AC_MSG_RESULT(no)) + AC_MSG_CHECKING(if environ can be linked) -AC_TRY_LINK([extern char ** environ;],[*environ;], +AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern char ** environ;]],[[*environ;]])], [AC_MSG_RESULT(yes);AC_DEFINE(ENVIRON_LINKED,1,[environ can be linked])],AC_MSG_RESULT(no)) dnl Checks for libraries. @@ -63,19 +65,20 @@ dnl Checks for libraries. #Check if the compiler support attributes AH_TEMPLATE([C_HAS_ATTRIBUTE],[Determines if the compilers supports attributes for structures.]) AC_MSG_CHECKING(if compiler allows __attribute__) -AC_TRY_COMPILE([], [typedef struct { } __attribute__ ((packed)) junk;], - [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no)) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +typedef struct { } __attribute__((packed)) junk;]], +[[ ]])],[ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no)) #Check if the compiler supports __builtin_expect +#Switch language to c++ +AC_LANG_PUSH(C++) AH_TEMPLATE([C_HAS_BUILTIN_EXPECT],[Determines if the compilers supports __builtin_expect for branch prediction.]) AC_MSG_CHECKING(if compiler allows __builtin_expect) -AC_TRY_COMPILE([],[ -int main(int argc,char* argv[]){ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[ int x=10;if( __builtin_expect ((x==1),0) ) ; -return 0; -} -], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no)) - +]])], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no)) +#switch language back +AC_LANG_POP(C++) AM_PATH_ALSA(0.9.0, AC_DEFINE(HAVE_ALSA,1,[Define to 1 to use ALSA for MIDI]) , : ) @@ -217,12 +220,9 @@ if test x$target = xi386-pc-os2-emx ; then AC_MSG_CHECKING(for SDLNet_Init in SDL_net); LIBS_BACKUP=$LIBS; LIBS="$LIBS -lSDL_Net"; - AC_LINK_IFELSE([ - #include - int main(int argc,char * argv[]) { - return SDLNet_Init (); - }; - ], [AC_MSG_RESULT(yes); have_sdl_net_lib=yes], AC_MSG_RESULT(no)) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]],[[ + SDLNet_Init (); + ]])], [AC_MSG_RESULT(yes); have_sdl_net_lib=yes], AC_MSG_RESULT(no)) LIBS=$LIBS_BACKUP else AC_CHECK_LIB(SDL_net, SDLNet_Init, have_sdl_net_lib=yes, , ) @@ -323,7 +323,7 @@ esac AC_SUBST(WINDRES) -AC_OUTPUT([ +AC_CONFIG_FILES([ Makefile src/Makefile src/cpu/Makefile @@ -348,3 +348,4 @@ visualc_net/Makefile include/Makefile docs/Makefile ]) +AC_OUTPUT