1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4# Generic support for FLTK applications
5
6
7AC_COPYRIGHT([Copyright (C) 2009 Dave Freese, W1HKJ (w1hkj AT w1hkj DOT com)])
8
9AC_PREREQ([2.63])
10
11dnl major and minor must be integers; patch may
12dnl contain other characters or be empty
13m4_define(FLRIG_MAJOR,  [1])
14m4_define(FLRIG_MINOR,  [3])
15m4_define(FLRIG_PATCH,  [.54])
16
17AC_INIT([FLRIG], FLRIG_MAJOR.FLRIG_MINOR[]FLRIG_PATCH, [w1hkj AT w1hkj DOT com])
18
19AC_SUBST([FLRIG_VERSION_MAJOR], [FLRIG_MAJOR])
20AC_SUBST([FLRIG_VERSION_MINOR], [FLRIG_MINOR])
21AC_SUBST([FLRIG_VERSION_PATCH], [FLRIG_PATCH])
22AC_SUBST([FLRIG_VERSION], [FLRIG_MAJOR.FLRIG_MINOR[]FLRIG_PATCH])
23
24AC_DEFINE([FLRIG_VERSION_MAJOR], [FLRIG_MAJOR], [major version number])
25AC_DEFINE([FLRIG_VERSION_MINOR], [FLRIG_MINOR], [minor version number])
26AC_DEFINE([FLRIG_VERSION_PATCH], ["FLRIG_PATCH"], [patch/alpha version string])
27AC_DEFINE([FLRIG_VERSION], ["FLRIG_MAJOR.FLRIG_MINOR[]FLRIG_PATCH"], [version string])
28
29AC_SUBST([AC_CONFIG_ARGS], [$ac_configure_args])
30AC_CONFIG_AUX_DIR([build-aux])
31
32# define build, build_cpu, build_vendor, build_os
33AC_CANONICAL_BUILD
34# define host, host_cpu, host_vendor, host_os
35AC_CANONICAL_HOST
36# define target, target_cpu, target_vendor, target_os
37AC_CANONICAL_TARGET
38
39AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign std-options subdir-objects 1.9.6])
40
41#change the next config item for the specific application src's
42AC_CONFIG_SRCDIR([src/main.cxx])
43AC_CONFIG_HEADERS([src/config.h])
44AC_CONFIG_MACRO_DIR([m4])
45
46# Checks for programs.
47AC_PROG_CXX
48AC_PROG_CC
49AC_USE_SYSTEM_EXTENSIONS
50
51# Checks for libraries.
52
53# Checks for header files.
54AC_CHECK_HEADERS([stdlib.h string.h])
55
56# Checks for typedefs, structures, and compiler characteristics.
57AC_HEADER_STDBOOL
58AC_TYPE_SIZE_T
59
60# Checks for library functions.
61AC_CHECK_FUNCS([getaddrinfo gethostbyname hstrerror gmtime_r localtime_r memmove memset mkdir select setenv snprintf socket socketpair strcasecmp strcasestr strchr strdup strerror strlcpy strncasecmp strrchr strstr strtol uname unsetenv vsnprintf])
62
63### static flag
64# Set ac_cv_static to yes/no
65# Substitute RTLIB in Makefile
66AC_FL_STATIC
67
68### optimizations
69# Set ac_cv_opt to arg
70# Substitute OPT_FLAGS in Makefile
71AC_FL_OPT
72
73### debug flag
74# Set ac_cv_debug to yes/no
75# Override CXXFLAGS
76# Set ENABLE_DEBUG Makefile conditional
77# Substitute RDYNAMIC in Makefile
78AC_FL_DEBUG
79
80###### OS support
81### OSX
82# Set ac_cv_mac_universal to yes/no
83# Set DARWIN Makefile conditional
84# Substitute MAC_UNIVERSAL_CFLAGS and MAC_UNIVERSAL_LDFLAGS in Makefile
85AC_FL_MACOSX
86
87### win32
88# Set WIN32 Makefile conditional
89# Set HAVE_WINDRES Makefile conditional
90# Substitute WINDRES in Makefile
91AC_FL_WIN32
92
93### Non-POSIX compatibility (i.e. mingw32)
94# Sets various Makefile conditionals; see m4/np-compat.m4
95AC_FLRIG_NP_COMPAT
96
97### FLTK
98# Substitute FLTK_CFLAGS and FLTK_LIBS in Makefile
99# Set FLUID variable
100# Set HAVE_FLUID Makefile conditional
101AC_CHECK_FLTK
102
103### X11
104# Set ac_cv_x to yes/no
105# Define USE_X in config.h
106# Substitute X_CFLAGS and X_LIBS in Makefile
107if test "x$target_darwin" = "xno" && test "x$target_win32" = "xno"; then
108    AC_FLRIG_PKG_CHECK([x], [x11], [no], [yes])
109fi
110
111### libflxmlrpc
112# Set ac_cv_flxmlrpc to yes/no
113# Define USE_FLXMLRPC in config.h
114# Substitute FLXMLRPC_CFLAGS and FLXMLRPC_LIBS in Makefile
115
116AC_FLRIG_PKG_CHECK([flxmlrpc], [flxmlrpc >= 0.1.0],
117  [yes], [yes], [use external flxmlrpc library @<:@autodetect@:>@],
118  [ENABLE_FLXMLRPC])
119
120### build info
121# Define various build variables in config.h
122AC_FLRIG_BUILD_INFO
123
124AC_CONFIG_FILES([Makefile src/Makefile])
125
126AC_OUTPUT
127
128### summary
129
130ac_xmlrpc_report="internal lib";
131
132if test "x$ac_cv_flxmlrpc" = "xyes"; then
133  ac_xmlrpc_report="external lib";
134fi
135
136AC_MSG_RESULT([
137Configuration summary:
138
139  Version ..................... $VERSION
140
141  Target OS ................... $target_os
142
143  Have flxmlrpc library ....... $ac_xmlrpc_report
144
145  Static linking .............. $ac_cv_static
146  CPU optimizations ........... $ac_cv_opt
147  Debugging ................... $ac_cv_debug
148
149])
150