# autoconf



## bork (Dec 23, 2009)

So, I'm modifying an autoconf script for some software I'm working on... I'm trying to test that ${host} has "freebsd" in it. I've tried all sorts of variants of the following


```
if test "${host}" = "*freebsd*"; then
fi

if test "${host}" =~ ".*freebsd.*"; then
fi
```

but none seem to work... Either the test returns false (unexpectedly), or I just get errors when I run the ./configure script. I'm pretty green to scripting on a 'nix box, so any suggestions are obviously more than welcome.

Thanks in advance.


----------



## DutchDaemon (Dec 23, 2009)

How is ${host} created?


----------



## DutchDaemon (Dec 23, 2009)

Try


```
if echo ${host} | grep -qi freebsd
```


----------



## bork (Dec 23, 2009)

DutchDaemon said:
			
		

> Try
> 
> 
> ```
> ...



That made me smile. Worked like a charm - thanks.


----------



## gordon@ (Dec 24, 2009)

You could use a shell statement to do the same work without an extra process being forked:


```
case "${host}" in
  *freebsd*)
    do magic here
    ;;
esac
```


----------



## bork (Dec 24, 2009)

gordon@ said:
			
		

> You could use a shell statement to do the same work without an extra process being forked:
> 
> 
> ```
> ...



Yeah, I tried something similar.. However, there's already a similar test in place for OSX. There's a bunch of stuff that's run as default commands that I want to hit as well, but (unless I'm off), there's no way to nicely fall through to those (I'd read somewhere that terminating the case with ;& would fall through to the next command set, but autoconf apparently laughed at me when I tried it.


----------

