-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathconfigure.ac.sh
executable file
·87 lines (72 loc) · 1.85 KB
/
configure.ac.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
bash=/bin/bash
set -a
# set and clear config
CONFIG="configure.ac"
echo "" > $CONFIG
# create pkgconfig-file (.pc) if needed
$bash "./debian/pkgconfig.pc.sh" > "./src/$PACKAGE_NAME.pc"
echo "
dnl use this file with autoconf to produce a configure script.
AC_INIT([$PACKAGE_NAME], [$PACKAGE_VERSION])
AC_CONFIG_SRCDIR([README])
AC_CANONICAL_TARGET
dnl Setup for automake
AM_INIT_AUTOMAKE([foreign])
" >> $CONFIG
for suffix in $PKGLIBSADD; do
ADD=${suffix%:*}
LIB=${suffix#*:}
echo "PKG_CHECK_MODULES($ADD, $LIB)" >> $CONFIG
done
for suffix in $LIBSADD; do
LIB=${suffix%:*}
FUNC=${suffix#*:}
echo "AC_CHECK_LIB($LIB, $FUNC,, AC_MSG_ERROR([library $LIB or $FUNC in $LIB not found!]))" >> $CONFIG
done
echo "
dnl Some defined values
AC_DEFINE(PACKAGE_DESC, \"$PACKAGE_DESC\")
AC_DEFINE(PACKAGE_VERSION_MAJOR, $PACKAGE_VERSION_MAJOR)
AC_DEFINE(PACKAGE_VERSION_MINOR, $PACKAGE_VERSION_MINOR)
AC_DEFINE(PACKAGE_VERSION_MICRO, $PACKAGE_VERSION_MICRO)
AC_DEFINE(PACKAGE_BUILD, \"$PACKAGE_BUILD\")
" >> $CONFIG
echo "
dnl Check types and sizes
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
" >> $CONFIG
echo "
dnl Check for tools
AC_PROG_CC
AM_PROG_LIBTOOL
CXXFLAGS=\"\"
CFLAGS=\"\"
AC_DEFINE(_GNU_SOURCE, 1)
" >> $CONFIG
echo "
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [Enable debug mode (default YES)]),
[debug=[yes]], [debug=[no]])
AC_MSG_CHECKING([debug mode])
if test x\$debug == xyes ; then
AC_DEFINE(_DEBUG, 1, [Debug mode])
AC_SUBST(GDB_CFLAG, \"-g\")
CFLAGS=\"-g -O0 \$CFLAGS\"
fi
AC_MSG_RESULT([\$debug])
" >> $CONFIG
echo "
dnl Finally create all the generated files
AC_CONFIG_FILES([ Makefile
src/Makefile
])
AC_OUTPUT
echo \"
Configuration for \$PACKAGE_NAME \$PACKAGE_VERSION:
debug mode: \$debug
\"
" >> $CONFIG