Skip to contentSkip to conversation

configure: some fixes for OpenBSD

PATCH In review Brad Smith 3 participants 7 messages Aug 24, 2012

lore
Share & tools
lore

Brad Smith

author
#0 lore raw

PATCH 1/1 configure: some fixes for OpenBSD

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

configure +5 -2
index d97fd81..6073dd2 100755
@@ -303,8 +303,6 @@ if check_define __linux__ ; then
   targetos="Linux"
 elif check_define _WIN32 ; then
   targetos='MINGW32'
-elif check_define __OpenBSD__ ; then
-  targetos='OpenBSD'
 elif check_define __sun__ ; then
   targetos='SunOS'
 elif check_define __HAIKU__ ; then
@@ -332,6 +330,11 @@ SunOS)
   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
     cpu="x86_64"
   fi
+  ;;
+OpenBSD)
+  # 'uname -m' returns the meta arch macppc instead of the hw arch powerpc
+  cpu=`arch -s`
+  ;;
 esac
 
 if test ! -z "$cpu" ; then
Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
#1 lore raw
Quoted 4 lines · Brad Smith

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

I'm afraid I think this patch is moving in the wrong direction. Wherever possible we should be using compiler checks like check_define, not looking at the output of 'uname' and the like. The former will work when cross compiling, and the latter will give the wrong answers. In some places we have that kind of 'look at uname/etc' check but we should be trying to reduce and eliminate it where possible.

thanks
-- PMM

author
#2 lore raw
Quoted 6 lines · Peter Maydell
Quoted 4 lines · Brad Smith

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

Quoted 6 lines

I'm afraid I think this patch is moving in the wrong direction. Wherever possible we should be using compiler checks like check_define, not looking at the output of 'uname' and the like. The former will work when cross compiling, and the latter will give the wrong answers. In some places we have that kind of 'look at uname/etc' check but we should be trying to reduce and eliminate it where possible.

Ah, ok. I thought maybe it could be simplified in favor of using uname more so. That's fine with me. I'll drop it.

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
#3 lore raw
In reply to Peter Maydell

Il 24/08/2012 11:55, Peter Maydell ha scritto:

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

I'm afraid I think this patch is moving in the wrong direction. Wherever possible we should be using compiler checks like check_define, not looking at the output of 'uname' and the like. The former will work when cross compiling, and the latter will give the wrong answers. In some places we have that kind of 'look at uname/etc' check but we should be trying to reduce and eliminate it where possible.

Right, we should support GNU triplets and a --host argument, and replace uname checks with pattern matching on the triplet.

Paolo

author
#4 lore raw
Quoted 12 lines · Paolo Bonzini

Il 24/08/2012 11:55, Peter Maydell ha scritto:

Quoted 10 lines
Quoted 4 lines
Quoted 4 lines

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

I'm afraid I think this patch is moving in the wrong direction. Wherever possible we should be using compiler checks like check_define, not looking at the output of 'uname' and the like. The former will work when cross compiling, and the latter will give the wrong answers. In some places we have that kind of 'look at uname/etc' check but we should be trying to reduce and eliminate it where possible.

Quoted 2 lines

Right, we should support GNU triplets and a --host argument, and replace uname checks with pattern matching on the triplet.

That still requires a means of generating that triplet in the first place.

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
#5 lore raw

Il 24/08/2012 14:00, Brad Smith ha scritto:

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

I'm afraid I think this patch is moving in the wrong direction. Wherever possible we should be using compiler checks like check_define, not looking at the output of 'uname' and the like. The former will work when cross compiling, and the latter will give the wrong answers. In some places we have that kind of 'look at uname/etc' check but we should be trying to reduce and eliminate it where possible.

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

Right, we should support GNU triplets and a --host argument, and replace uname checks with pattern matching on the triplet.

That still requires a means of generating that triplet in the first place.

That's what GNU config.guess is for, but it is only used in the non-cross-compilation case. QEMU's homegrown configure hardly distinguishes between native and cross builds.

Paolo

author
#6 lore raw
Quoted 12 lines · Paolo Bonzini

Il 24/08/2012 14:00, Brad Smith ha scritto:

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

OpenBSD's uname works as expected with the -s flag so remove the special handling when determining the target OS. Use arch -s to retrieve the hardware architecture as uname -m will return the meta architecture instead of the hardware architecture (.e.g. macppc vs powerpc).

I'm afraid I think this patch is moving in the wrong direction. Wherever possible we should be using compiler checks like check_define, not looking at the output of 'uname' and the like. The former will work when cross compiling, and the latter will give the wrong answers. In some places we have that kind of 'look at uname/etc' check but we should be trying to reduce and eliminate it where possible.

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

Right, we should support GNU triplets and a --host argument, and replace uname checks with pattern matching on the triplet.

That still requires a means of generating that triplet in the first place.

That's what GNU config.guess is for, but it is only used in the non-cross-compilation case. QEMU's homegrown configure hardly distinguishes between native and cross builds.

OK well if you're going in that direction that's fine as config.guess knows how to do the right thing.

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.