comparison configure @ 0:76b593a6265c

starting project with configure script
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 23 Jun 2024 06:40:14 +0000
parents
children 99426da5603d
comparison
equal deleted inserted replaced
-1:000000000000 0:76b593a6265c
1 #!/bin/sh
2 # This configure script is custom and hand-coded;
3 # it is NOT a product of GNU Autoconf or any other such tools!
4
5 set -e
6
7 if [ ! -f configure ]
8 then
9 echo "This script needs to be run from the top of the source tree" 1>&2
10 exit 1
11 fi
12
13 # defaults that can be overridden
14 CC=gcc
15 CFLAGS=-O2
16 prefix=/usr/local
17 exec_prefix=
18 bindir=
19 osmo_prefix=
20
21 while [ $# != 0 ]
22 do
23 case "$1" in
24 --prefix=*)
25 prefix=`echo $1 | cut -c 10-`
26 ;;
27 --exec-prefix=*)
28 exec_prefix=`echo $1 | cut -c 15-`
29 ;;
30 --bindir=*)
31 bindir=`echo $1 | cut -c 10-`
32 ;;
33 --with-osmo=*)
34 osmo_prefix=`echo $1 | cut -c 13-`
35 ;;
36 CC=*)
37 CC=`echo $1 | cut -c 4-`
38 ;;
39 CFLAGS=*)
40 CFLAGS=`echo $1 | cut -c 8-`
41 ;;
42 *)
43 echo "error: non-understood option $1" 1>&2
44 exit 1;
45 ;;
46 esac
47 shift
48 done
49
50 # find Osmocom dependencies
51
52 if [ -n "$osmo_prefix" ]
53 then
54 PKG_CONFIG_PATH="$osmo_prefix/lib/pkgconfig"
55 export PKG_CONFIG_PATH
56 fi
57
58 osmo_depend="libosmocore libosmo-e1d"
59
60 OSMO_INCLUDE=`pkg-config --cflags-only-I $osmo_depend`
61 OSMO_LIBS=`pkg-config --libs-only-l $osmo_depend`
62 OSMO_LPATH=`pkg-config --libs-only-L $osmo_depend`
63 OSMO_RPATH=`echo "$OSMO_LPATH" | sed -e s/-L/-Wl,-rpath,/`
64
65 # inheritance rules for install directories
66
67 if [ -z "$exec_prefix" ]
68 then
69 exec_prefix="$prefix"
70 fi
71 if [ -z "$bindir" ]
72 then
73 bindir="$exec_prefix/bin"
74 fi
75
76 # report the final configuration
77
78 echo "C code will be compiled with:"
79 echo " CC=$CC"
80 echo " CFLAGS=$CFLAGS"
81 echo "Installation directory:"
82 echo " bindir=$bindir"
83 echo "See config.defs output for Osmocom dependencies"
84
85 # emit the Makefile include fragment
86 echo "CC=$CC" > config.defs
87 echo "CFLAGS=$CFLAGS" >> config.defs
88 echo "OSMO_INCLUDE=$OSMO_INCLUDE" >> config.defs
89 echo "OSMO_LIBS=$OSMO_LIBS" >> config.defs
90 echo "OSMO_LPATH=$OSMO_LPATH" >> config.defs
91 echo "OSMO_RPATH=$OSMO_RPATH" >> config.defs
92 echo "bindir=$bindir" >> config.defs