oops, that commit wasn't so clean
[hrr.git] / acinclude.m4
blob4095851dbf714be025137f9da1554b1178b23bb7
1 #  m m mm mmm .----------.  .---------------------. mmm mm m m
2 #  8 8 88 888 | .--------`  |  .------------------` 888 88 8 8
3 #  8 8 88 888 | ```````|`V```````|   |``||``|`````| 888 88 8 8
4 #  8 8 88 888 `------  | |  [] | |``````||  |  [] | 888 88 8 8
5 #  8 8 88 888 |``````  | |     | ````|````  |     | 888 88 8 8
6 #  ` ` `` ``` ``````````````>  |````````````|   |`` ``` `` ` `
7 #                ==============`            `---`
8 #                                 L A B O R A T O R I E S
9 #  
10 #This file is part of Hacker Radio Rec.
11 #  
12 #Hacker Radio Rec is free software: you can redistribute it and/or
13 #modify it under the terms of the GNU General Public License as
14 #published by the Free Software Foundation, either version 3 of
15 #the License or (at your option) any later version.
17 #Hacker Radio Rec is distributed in the hope that it will be
18 #useful, but WITHOUT ANY WARRANTY; without even the implied
19 #warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 #See the GNU General Public License for more details.
22 #               Copyright (C) 2009, Thea DeSilva
23 #  You can find a copy of GNU General Public License in COPYING
30 # 1 - library
31 # 2 - function
32 # 3 - error
34 AC_DEFUN(HRR_CHECK_LIB, [
35  HRR_SWLIB=""
36  HRR_SWDIR=""
37 LIB_SEARCH="/lib \
38             /lib \
39             /usr/lib \
40             /usr/unsupported/lib \
41             /usr/local/lib \
42             /usr/X386/lib \
43             /usr/lib/X11R4 \
44             /usr/X11R5/lib \
45             /usr/lib/X11R5 \
46             /usr/openwin/lib \
47             /usr/X11/lib \
48             /pub/X11R5/lib \
49             /usr/local/X11R5/lib \
50             /opt/lib \
51             /opt/X11R6/lib \
52             /opt/X11/lib \
53             /usr/X11R6/lib \
54             /usr/lib/X11R6 \
55             /pub/X11R6/lib \
56             /pub/lib \
57             /usr/local/X11R6/lib \
58             $HOME/local/lib "
61  AC_SEARCH_LIBS($2,$1, HRR_SWLIB=-l$1, HRR_SWLIB="nope")
62  if test "$HRR_SWLIB" = "nope"; then
63   printf "searching for %s..." $1
65   for i in $LIB_SEARCH ; do
66    if test -r $i/lib$1.a; then
67     HRR_SWDIR=-L$i
68     HRR_SWLIB=-l$1
69    fi
70   done
72   if test "$HRR_SWLIB" = "nope" ; then
73    echo "nope"
74    ./errors "$3"
75    exit
76   else
77    echo "found"
78   fi
79  fi
81  LDFLAGS=$LDFLAGS\ $HRR_SWDIR
82  LIBS=$LIBS\ $HRR_SWLIB
87 # 1 - header_file
88 # 2 - sub directory  e.g. SDL/
89 # 3 - error
91 AC_DEFUN(HRR_CHECK_HEAD, [
92 HEADER_SEARCH="/include \
93                /usr/include \
94                /usr/unsupported/include \
95                /usr/local/include \
96                /usr/X386/include \
97                /usr/include/X11R4 \
98                /usr/X11R5/include \
99                /usr/include/X11R5 \
100                /usr/openwin/include \
101                /usr/X11/include \
102                /pub/X11R5/include \
103                /usr/local/X11R5/include \
104                /opt/include \
105                /opt/X11R6/include \
106                /opt/X11/include \
107                /usr/X11R6/include \
108                /usr/include/X11R6 \
109                /pub/X11R6/include \
110                /pub/include \
111                /usr/local/X11R6/include \
112                $HOME/local/include "
115  printf "checking for %s... " $1
116  HRR_INC=""
117  AC_TRY_CPP([#include <$2$1>], , HRR_INC="nope")
118  if test "$HRR_INC" = "nope"; then
119   for i in $HEADER_SEARCH; do
120    if test -r $i/$2$1; then
121     HRR_INC=\ -I$i\ -I$i/$2
122    fi
123   done
124  fi
125 if test "$HRR_INC" = "nope"; then
126   echo "nope"
127   ./errors "$3"
128   exit;
129 else
130   echo "found"
131   CFLAGS=$CFLAGS\ $HRR_INC
132   CPPFLAGS=$CPPFLAGS\ $HRR_INC