]> www.hackdaworld.org Git - physik/nlsop.git/blob - configure
new runs
[physik/nlsop.git] / configure
1 #!/bin/sh
2
3 name="nlsop"
4
5 #defaults
6 prefix=/usr
7 dfblib=""
8 dfbinc=""
9 nodfb=0
10
11 echo $run_cmd
12
13 usage() {
14         echo "usage $0 <options>"
15         echo "options:"
16         echo "--prefix=PREFIX   specify install prefix"
17         echo "--with-dfblib=DIR specify directfb lib dir"
18         echo "--with-dfbinc=DIR specify directfb include dir"
19         echo
20         }
21
22 while [ "$1" ]; do
23         case "`echo $1 | awk -F= '{ print $1 }'`" in
24                 --prefix)       prefix=`echo $1 | awk -F= '{ print $2 }'`; shift;;
25                 --help)         usage; shift 1;;
26                 --with-dfblib)  dfblib=`echo $1 | awk -F= '{ print $2 }'`; shift;;
27                 --with-dfbinc)  dfbinc=`echo $1 | awk -F= '{ print $2 }'`; shift;;
28                 --without-dfb)  nodfb=1; shift ;;
29         esac
30 done
31
32 echo "checking for dfb stuff ..."
33 dfb_inc_dir="0"
34 if [ -z "$dfbinc" ]; then
35         for i in /usr/include /usr/local/include; do
36                 if [ -d $i/directfb ]; then
37                         dfb_inc_dir=$i/directfb
38                 fi
39         done
40 else
41         if [ -d $dfbinc/directfb ]; then
42                 dfb_inc_dir=$dfbinc/directfb
43         fi
44 fi
45 if [ "$dfb_inc_dir" = "0" ]; then
46         echo "dfb includes not found ..."
47         nodfb=1
48 fi
49 dfb_lib_dir="0"
50 if [ -z "$dfblib" ]; then
51         for i in /usr/lib /usr/local/lib; do
52                 if [ -f $i/libdirectfb.so ]; then
53                         dfb_lib_dir=$i
54                 fi
55         done
56 else
57         if [ -f $dfblib/libdirectfb.so ]; then
58                 dfb_lib_dir=$dfblib
59         fi
60 fi
61 if [ "$dfb_lib_dir" = "0" ]; then
62         echo "dfb libs not found ..."
63         nodfb=1
64 fi
65
66 [ "$nodfb" = "0" ] && echo "directfb installation looks good :)"
67
68 echo "creating Makefile"
69
70 cat > Makefile << EOF
71 # $name Makefile, created `date`
72
73 INCLUDEDIR = /usr/include
74 EOF
75
76 if [ "$nodfb" = "0" ]; then
77
78 cat >> Makefile << EOF
79 CFLAGS = -DDEBUG -DUSE_DFB_API -DFONT=\"$prefix/share/$name/decker.ttf\" -O3 -Wall -I$dfb_inc_dir
80 LIBS = -L$dfb_lib_dir -ldirectfb
81
82 OBJS = random.o dfbapi.o
83 EOF
84
85 else
86
87 cat >> Makefile << EOF
88 CFLAGS = -DDEBUG -DNODFB -O3 -Wall
89 LIBS = -lm
90
91 OBJS = random.o
92 EOF
93
94 fi
95
96 cat >> Makefile << EOF
97 OBJS2 = $name
98
99 $name: \$(OBJS)
100         \$(CC) \$(CFLAGS) -o \$@ \$(OBJS) \$(LIBS) ${name}.c
101
102 all: $name
103
104 clean:
105         rm \$(OBJS) \$(OBJS2)
106
107 remake: clean all
108
109 install:
110         mkdir -p $prefix/bin
111         cp $name $prefix/bin
112         chmod 755 $prefix/bin/$name
113         mkdir -p $prefix/share/$name
114         cp decker.ttf $prefix/share/$name
115         chmod 644 $prefix/share/$name/decker.ttf
116 EOF
117
118 echo "done"