ntdisp 

ntdisp Git Source Tree

Root/configure.ac

1m4_define([ntdisp_version],[0.5.0])
2m4_define([ntdisp_lt_version],[1:0:0])dnl XXX: update when required
3
4# GTK+3 yet requires GLib >= 2.28, so no need to explicitely depends
5# on GLib >= 2.26 for using GSettings from the GTK+3 front-end
6m4_define([gtkdoc_prereq],[1.9])dnl Historical value
7m4_define([glib_prereq],[2.18.0])dnl Required by g_set_error_literal
8m4_define([gobject_prereq],[2.10.1])dnl Version 2.10.0 is broken
9m4_define([gtk3_prereq],[3.0.0])
10
11
12dnl Historical value. Will be raised to 2.62
13dnl when GObject introspection will be added:
14dnl http://live.gnome.org/GObjectIntrospection/AutotoolsIntegration
15AC_PREREQ(2.59)
16
17AC_INIT([ntdisp],ntdisp_version,[http://dev.entidi.com/p/ntdisp/],[ntdisp],[http://ntdisp.entidi.com/])
18PACKAGE_DESCRIPTION="NtD In System Programming"
19AC_SUBST([PACKAGE_DESCRIPTION])
20
21AC_CONFIG_SRCDIR([configure.ac])
22AC_CONFIG_HEADERS([src/config.h])
23AC_CONFIG_AUX_DIR([build])
24AC_CONFIG_MACRO_DIR([build])
25dnl automake 1.10.1 is required for silent rules
26AM_INIT_AUTOMAKE([1.10.1 gnits no-dist-gzip dist-bzip2 -Wall -Wno-portability])
27m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
28
29
30# Libtool initialization
31
32AC_MSG_CHECKING([which libtool initialization strategy to adopt])
33AC_MSG_RESULT([m4_ifset([LT_INIT],[LT-INIT],[AC-PROG-LIBTOOL])])
34m4_ifset([LT_INIT],
35 [LT_INIT([disable-static win32-dll])],
36 [AC_DISABLE_STATIC
37 AC_LIBTOOL_WIN32_DLL
38 AC_PROG_LIBTOOL])
39
40
41# Checks for programs
42
43AC_PROG_CC
44AC_PROG_SED
45PKG_PROG_PKG_CONFIG
46AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums],[/usr/bin/glib-mkenums])
47AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal],[/usr/bin/glib-genmarshal])
48AC_PATH_PROG([MAKENSIS],[makensis],[/usr/bin/makensis])
49
50
51# Checks for header files
52
53AC_CHECK_HEADERS([string.h])
54AC_CHECK_HEADERS([fcntl.h])
55AC_CHECK_HEADERS([termios.h])
56
57
58# Checking typedefs, structures and compiler characteristics
59
60AC_LANG(C)
61AC_C_CONST
62
63
64# Custom options
65
66AC_ARG_WITH(api,
67 [AS_HELP_STRING([--with-api@<:@=posix/win32@:>@],
68 [Use POSIX or win32 API for serial communications @<:@default=posix@:>@])],
69 [],[with_api=posix])
70AS_CASE(["${with_api}"],
71 [posix], [enable_win32=no],
72 [win32], [enable_win32=yes],
73 [AC_MSG_ERROR([Invalid option passed to --with-api])])
74
75AC_ARG_ENABLE([cli],
76 AS_HELP_STRING([--disable-cli], [Do not build the command-line interface]),
77 [],[enable_cli="yes"])
78
79AC_ARG_ENABLE([gtk3],
80 AS_HELP_STRING([--disable-gtk3], [Do not build GTK3 front-end]),
81 [],[enable_gtk3="yes"])
82
83
84# Checks for external dependencies
85
86GTK_DOC_CHECK(gtkdoc_prereq)
87
88if test "x$enable_gtk_doc" == "xyes"; then
89 gtk_doc_report="yes (gtk-doc $($PKG_CONFIG --modversion gtk-doc) found)"
90else
91 gtk_doc_report="no"
92fi
93
94PKG_CHECK_MODULES([GLIB2],
95 [glib-2.0 >= ]glib_prereq
96 [gobject-2.0 >= ]gobject_prereq
97 [gthread-2.0])
98
99if test "x$enable_gtk3" != "xno" ; then
100 PKG_CHECK_MODULES([GTK3],
101 [gtk+-3.0 >= ]gtk3_prereq,
102 [gtk3_found="yes"],
103 [gtk3_found="no"])
104 if test "x$enable_gtk3" == "xyes" -a "x$gtk3_found" == "xno" ; then
105 AC_MSG_ERROR([GTK+3 support requested but GTK+3 development files not found])
106 elif test "x$enable_gtk3" == "xcheck" ; then
107 enable_gtk3="$gtk3_found"
108 fi
109 if test "x$enable_gtk3" == "xyes"; then
110 gtk3_report="yes (GTK+ $($PKG_CONFIG --modversion gtk+-3.0) found)"
111 GLIB_GSETTINGS
112 AC_DEFINE_UNQUOTED([NTDISP_SCHEMA],["com.entidi.NtdIsp"],
113 [Define to id of the schema to use for GSettings.])
114 else
115 gtk3_report="no"
116 fi
117fi
118
119
120# Final step
121
122dnl Define USRDIR for the NSis installer script
123USRDIR="$($PKG_CONFIG --variable=prefix gobject-2.0)"
124AC_SUBST([USRDIR])
125AM_SUBST_NOTMAKE([USRDIR])
126
127dnl -win$ARCH will be appended to the Windows installer file name
128AS_IF([test "x${host_cpu}" = "xx86_64"],[ARCH=64],[ARCH=32])
129AC_SUBST([ARCH])
130AM_SUBST_NOTMAKE([ARCH])
131
132dnl Define LIB_REQUIREMENTS to be used for generating the pkg-config file
133LIB_REQUIREMENTS="glib-2.0 >= glib_prereq, gobject-2.0 >= gobject_prereq, gthread-2.0"
134AC_SUBST([LIB_REQUIREMENTS])
135
136AM_CONDITIONAL([ENABLE_WIN32],test "x$enable_win32" = "xyes")
137AM_CONDITIONAL([ENABLE_CLI],test "x$enable_cli" = "xyes")
138AM_CONDITIONAL([ENABLE_GTK3],test "x$enable_gtk3" = "xyes")
139AC_SUBST([NTDISP_LT_VERSION],ntdisp_lt_version)
140
141dnl Conditional substitution in the ui definition file
142AS_IF([test "x$enable_win32" = "xyes"],
143 [keep='ENABLE_WIN32'; drop='!ENABLE_WIN32'],
144 [keep='!ENABLE_WIN32'; drop='ENABLE_WIN32'])
145AC_CONFIG_COMMANDS([ntdisp.ui],
146 [$SED -i -e "$pattern" src/gtk3/ntdisp.ui],
147 [pattern="/-- if $drop --/,/-- endif --/d;/-- if $keep --/d;/-- endif --/d"])
148
149
150AC_CONFIG_FILES([Makefile
151 build/ntdisp.nsi
152 src/Makefile
153 src/lib/Makefile
154 src/lib/ntdisp.pc
155 src/cli/Makefile
156 src/gtk3/Makefile
157 src/gtk3/ntdisp.ui
158 tests/Makefile
159 docs/Makefile
160 docs/lib/Makefile
161 docs/lib/bookinfo.xml
162 docs/cli/Makefile
163 docs/cli/ntdisp.1])
164AC_OUTPUT
165
166
167# Report
168
169AC_MSG_NOTICE([generating report
170
171AC_PACKAGE_NAME ntdisp_version will be built with the following options:
172------------------------------------------------------
173 Serial communications: use ${with_api} APIs
174 Build CLI binary: ${enable_cli}
175 Build GTK+3 front-end: ${gtk3_report}
176 Build API reference: ${gtk_doc_report}
177])

Archive Download this file

Branches

Tags