File: configure.ac

package info (click to toggle)
unixcw 3.3.1-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,168 kB
  • ctags: 1,741
  • sloc: sh: 11,464; ansic: 10,565; cpp: 1,594; awk: 245; makefile: 216; pascal: 115
file content (533 lines) | stat: -rw-r--r-- 14,130 bytes parent folder | download
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# Copyright (C) 2001-2006  Simon Baldwin (simon_baldwin@yahoo.com)
# Copyright (C) 2011-2014  Kamil Ignacak (acerion@wp.pl)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

# General initializations.
AC_PREREQ(2.57)

AC_INIT([unixcw], [3.3.1])
AC_CONFIG_SRCDIR([src/libcw/libcw.c])
AM_INIT_AUTOMAKE

# Specify a configuration header.
AC_CONFIG_HEADERS(src/config.h)

AC_CONFIG_FILES([src/libcw/libcw.pc])

# General checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AM_PROG_CC_C_O

# Check specifically for gzip and ldconfig, and substitute the harmless ":"
# if absent.
AC_PATH_PROG(GZIP, gzip, ,)
if test -z "$GZIP" ; then
  GZIP=":"
fi
AC_PATH_PROG(LDCONFIG, ldconfig, ,)
if test -z "$LDCONFIG" ; then
  LDCONFIG=":"
fi
AC_SUBST(GZIP)
AC_SUBST(LDCONFIG)




# Check for basic but essential libraries
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(m, floor)

# show-stoppers
if test $ac_cv_lib_m_floor = 'no' ; then
   AC_MSG_ERROR([math library is missing, cannot continue])
fi
if test $ac_cv_lib_pthread_pthread_create = 'no' ; then
   AC_MSG_ERROR([pthread library is missing, cannot continue])
fi



# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
# library's current:revision:age
#
# I'm defining it here so that it's available in config.h and can be
# used in libcw's cw_version() function that should return the
# numbers.
LIBCW_VERSION=\"6:1:1\"
AC_DEFINE_UNQUOTED([LIBCW_VERSION], $LIBCW_VERSION, [Library version, libtool notation])
AC_SUBST(LIBCW_VERSION)


# ########################################################################
# definitions of custom command line options for configure script
# ########################################################################


# Build support for console buzzer output? Yes by default.
AC_ARG_ENABLE([console],
    AS_HELP_STRING([--disable-console], [disable support for console buzzer audio output]),
    [],
    [enable_console=yes])

AC_MSG_CHECKING([whether to include console buzzer audio suport])
if test "$enable_console" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# Build support for OSS audio system? Yes by default.
AC_ARG_ENABLE([oss],
    AS_HELP_STRING([--disable-oss], [disable support for OSS audio output]),
    [],
    [enable_oss=yes])

AC_MSG_CHECKING([whether to include OSS audio support])
if test "$enable_oss" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# Build support for ALSA audio system? Yes by default.
AC_ARG_ENABLE([alsa],
    AS_HELP_STRING([--disable-alsa], [disable support for ALSA audio output]),
    [],
    [enable_alsa=yes])

AC_MSG_CHECKING([whether to include ALSA audio support])
if test "$enable_alsa" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# Build support for PulseAudio audio system? Yes by default.
AC_ARG_ENABLE(pulseaudio,
    AS_HELP_STRING([--disable-pulseaudio], [disable support for PulseAudio audio output]),
    [],
    [enable_pulseaudio=yes])

AC_MSG_CHECKING([whether to include PulseAudio audio support])
if test "$enable_pulseaudio" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# Build cwcp? Yes by default.
AC_ARG_ENABLE(cwcp,
    AS_HELP_STRING([--disable-cwcp], [do not build cwcp (application with curses user interface)]),
    [],
    [enable_cwcp=yes])

AC_MSG_CHECKING([whether to build cwcp])
if test "$enable_cwcp" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# Build xcwcp? Yes by default.
AC_ARG_ENABLE(xcwcp,
    AS_HELP_STRING([--disable-xcwcp], [do not build xcwcp (application with Qt4 user interface)]),
    [],
    [enable_xcwcp=yes])

AC_MSG_CHECKING([whether to build xcwcp])
if test "$enable_xcwcp" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# Enable development debugging? No by default.
AC_ARG_ENABLE(dev,
    AS_HELP_STRING([--enable-dev], [enable development support (messages/debug code/asserts)]),
    [],
    [enable_dev=no])

AC_MSG_CHECKING([whether to enable development support])
if test "$enable_dev" = "yes" ; then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi


# #####
#  end
# #####





# ########################################################################
# Process command line options, and if enabled - checking if requirements
# for enabled features are satisfied.
# ########################################################################


if test "$enable_console" = "no" ; then
    WITH_CONSOLE='no'
else
    AC_CHECK_HEADERS([sys/kd.h sys/vtkd.h sys/kbio.h])
    if test "$ac_cv_header_sys_kd_h" = 'no' \
	&& test "$ac_cv_header_sys_vtkd_h" = 'no' \
	&& test "$ac_cv_header_sys_kbio_h" = 'no' ; then

	WITH_CONSOLE='no'
	AC_MSG_WARN([Cannot find either sys/kd.h, sys/vtkd.h, or sys/kbio.h - support for console buzzer audio output will be disabled])
    else
	WITH_CONSOLE='yes'
    fi
fi

if test "$WITH_CONSOLE" = 'yes' ; then
    AC_DEFINE([LIBCW_WITH_CONSOLE], [1], [Define as 1 if your build machine can support console buzzer.])
fi



if test "$enable_oss" = "no" ; then
    WITH_OSS='no'
else
    AC_CHECK_HEADERS([soundcard.h sys/soundcard.h])
    if test "$ac_cv_header_soundcard_h" = 'no' \
	&& test "$ac_cv_header_sys_soundcard_h" = 'no' ; then

	WITH_OSS='no'
        AC_MSG_WARN([Cannot find either soundcard.h or sys/soundcard.h - support for OSS audio output will be disabled])
    else
	WITH_OSS='yes'
    fi
fi

if test "$WITH_OSS" = 'yes' ; then
    AC_DEFINE([LIBCW_WITH_OSS], [1], [Define as 1 if your build machine can support OSS.])
fi



if test "$enable_alsa" = "no" ; then
    WITH_ALSA='no'
else
    AC_CHECK_LIB(asound, snd_pcm_open)
    if test "$ac_cv_lib_asound_snd_pcm_open" = 'yes' ; then

	# Check for certain routines which are missing from liboss-salsa-dev
        # (kfreebsd's libasound implementation). If a function is found
	# build system defines HAVE_function_name in config.h.
	AC_CHECK_FUNCS([ \
	    snd_pcm_hw_params_test_periods \
	    snd_pcm_hw_params_test_buffer_size \
	    ])

	WITH_ALSA='yes'
    else
	WITH_ALSA='no'
	AC_MSG_WARN([Cannot find ALSA library files - support for ALSA audio output will be disabled])
    fi
fi

if test "$WITH_ALSA" = 'yes' ; then
    AC_DEFINE([LIBCW_WITH_ALSA], [1], [Define as 1 if your build machine can support ALSA.])
fi



if test "$enable_pulseaudio" = "no" ; then
    WITH_PULSEAUDIO='no'
else
    AC_CHECK_LIB(pulse-simple, pa_simple_new)
    if test "$ac_cv_lib_pulse_simple_pa_simple_new" = 'yes' ; then

	WITH_PULSEAUDIO='yes'
    else
	WITH_PULSEAUDIO='no'
	AC_MSG_WARN([Cannot find PulseAudio library files - support for PulseAudio audio output will be disabled])
    fi
fi

if test "$WITH_PULSEAUDIO" = 'yes' ; then
    AC_DEFINE([LIBCW_WITH_PULSEAUDIO], [1], [Define as 1 if your build machine can support PulseAudio.])
fi



if test "$enable_cwcp" = "no" ; then
   WITH_CWCP='no'
else
    AC_CHECK_LIB(curses, initscr)
    if test $ac_cv_lib_curses_initscr = 'yes' ; then
	WITH_CWCP='yes'
    else
	WITH_CWCP='no'
	AC_MSG_WARN([Cannot find libcurses - unable to build cwcp])
    fi
fi



if test "$enable_xcwcp" = "no" ; then
    WITH_XCWCP='no'
else
    # autodetection of Qt4 dependencies
    m4_include([configure.qt.inc])

    if [[ "$QT4CFLAGS" -a "$QT4MOC" ]] ; then
        # we have moc4 and path to Qt4 include files,
        # so we can build xcwcp
	WITH_XCWCP='yes'
    else
	WITH_XCWCP='no'
	AC_MSG_WARN([Cannot find Qt4 files - unable to build xcwcp])
    fi
fi


# Development support tools.
AM_CONDITIONAL(LIBCW_WITH_DEV, test "$enable_dev" = "yes")
if test "$enable_dev" = "yes" ; then
   WITH_DEV='yes'
   AC_DEFINE([LIBCW_WITH_DEV], [1], [Define as 1 if you want to enable development support.])
else
   WITH_DEV='no'
fi


# #####
#  end
# #####



# unixcw uses per-target linker object lists (target_LDADD)
LIBS=



# Checks for header files, and refuse to go on if no KIOCSOUND is available.
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h strings.h sys/ioctl.h \
                  sys/param.h sys/time.h unistd.h locale.h libintl.h])



AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([string.h strings.h])
if test "$ac_cv_header_string_h" = 'no' \
    && test "$ac_cv_header_strings_h" = 'no' ; then
  AC_MSG_WARN([Cannot find either string.h or strings.h])
fi

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_C_VOLATILE

# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRCOLL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([floor gettimeofday memset sqrt strchr strdup strrchr \
                strtoul getopt_long setlocale memmove select strerror strspn])
AC_FUNC_SELECT_ARGTYPES




# Decide on which subdirectories to build; substitute into SRC_SUBDIRS.
# Build cwcp if curses is available, and xcwcp if Qt is available.
SRC_SUBDIRS="libcw cwutils cw cwgen"

if test "$WITH_CWCP" = 'yes' ; then
    SRC_SUBDIRS="$SRC_SUBDIRS cwcp"
fi

if test "$WITH_XCWCP" = 'yes' ; then
    SRC_SUBDIRS="$SRC_SUBDIRS xcwcp"
fi

AC_SUBST(SRC_SUBDIRS)



# Used for debug purposes.
# CFLAGS=`echo "$CFLAGS" | sed 's/-O2/-O0/g'`



# Add -Wall, -W, -pedantic, and other paranoia to gcc command flags, and -Wall
# to with a few suppressions to icc command flags, then similarly, though less
# so, for g++ and icpc.
if test "`basename $CC`" = "gcc" ; then
  CFLAGS="$CFLAGS -Wall -W -pedantic -Wfloat-equal -Wpointer-arith -std=gnu99"
  CFLAGS="$CFLAGS -Wcast-qual -Wwrite-strings -Wmissing-prototypes"
  CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls"
else
  if test "`basename $CC`" = "icc" ; then
    CFLAGS="$CFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
  fi
fi
if test "`basename $CXX`" = "g++" ; then
  CXXFLAGS="$CXXFLAGS -Wall -W -pedantic -Wno-long-long"
else
  if test "`basename $CXX`" = "icpc" ; then
    CXXFLAGS="$CXXFLAGS -Wall -wd181,188,279,383,593,810,981,1469"
  fi
fi

# Determine if -fPIC or -KPIC is available for building .so libraries.
# Because gcc complains about invalid flags, but then continues, we have to
# check by searching the compile stdout and stderr for any output.
if test -z "$CFLAG_PIC" ; then
  AC_MSG_CHECKING([for -KPIC or -fPIC compiler options])
  cat >conftest.c <<-EOF
  int so_test() { return 0; }
EOF
  if $CC -fPIC -c conftest.c 2>&1 | egrep -q '.' ; then
    if $CC -KPIC -c conftest.c 2>&1 | egrep -q '.' ; then
      CFLAG_PIC=""
    else
      CFLAG_PIC="-KPIC"
    fi
  else
    CFLAG_PIC="-fPIC"
  fi
  rm -f conftest.c conftest.o
  if test -n "$CFLAG_PIC" ; then
    AC_MSG_RESULT($CFLAG_PIC)
  else
    AC_MSG_RESULT(no)
  fi
fi
AC_SUBST(CFLAG_PIC)

# Determine if the C compiler builds DSO files, by testing with -shared.
CC_LINKS_SO="no"
if test -n "$CC" ; then
  AC_MSG_CHECKING(whether cc builds .so files with -shared)
  cat >conftest.c <<-EOF
  int so_test() { return 0; }
EOF
  $CC -c conftest.c >/dev/null 2>/dev/null
  $CC -shared -o conftest.so conftest.o >/dev/null 2>/dev/null
  rm -f conftest.c conftest.o
  if test -f conftest.so ; then
    nm conftest.so | grep -q so_test
    if test $? -eq 0 ; then
      CC_LINKS_SO="yes"
    fi
  fi
  rm -f conftest.so
  if test $CC_LINKS_SO = "yes" ; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
fi
AC_SUBST(CC_LINKS_SO)

# A linker might also build DSO files with -G, but we'll prefer to use the
# compiler if it will cooperate.
LD_LINKS_SO="no"
AC_PATH_PROG(LD, ld, , )
if test -n "$LD" ; then
  AC_MSG_CHECKING(whether ld builds .so files with -G)
  cat >conftest.c <<-EOF
  int so_test() { return 0; }
EOF
  $CC -c conftest.c >/dev/null 2>/dev/null
  $LD -G -o conftest.so conftest.o >/dev/null 2>/dev/null
  rm -f conftest.c conftest.o
  if test -f conftest.so ; then
    nm conftest.so | grep -q so_test
    if test $? -eq 0 ; then
      LD_LINKS_SO="yes"
    fi
  fi
  rm -f conftest.so
  if test $LD_LINKS_SO = "yes" ; then
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
else
  LD=":"
fi
AC_SUBST(LD)
AC_SUBST(LD_LINKS_SO)




AC_CONFIG_FILES([Makefile.inc
	Makefile
	src/Makefile
	src/libcw/Makefile
	src/cwutils/Makefile
	src/cw/Makefile
	src/cwgen/Makefile])

if test "$WITH_CWCP" = 'yes' ; then
   AC_CONFIG_FILES([src/cwcp/Makefile])
fi
if test "$WITH_XCWCP" = 'yes' ; then
   AC_CONFIG_FILES([src/xcwcp/Makefile])
fi



AC_MSG_NOTICE([----------------------------------------------------])
AC_MSG_NOTICE([------------ unixcw build configuration ------------])
AC_MSG_NOTICE([build libcw:  .................................  yes])
AC_MSG_NOTICE([build cw & cwgen:  ............................  yes])
AC_MSG_NOTICE([build cwcp:  ..................................  $WITH_CWCP])
AC_MSG_NOTICE([build xcwcp:  .................................  $WITH_XCWCP])
if test "$WITH_XCWCP" = 'yes' ; then
    AC_MSG_NOTICE([    Qt4 CFLAGS is $QT4CFLAGS])
    AC_MSG_NOTICE([    Qt4 moc is $QT4MOC])
fi
AC_MSG_NOTICE([include console buzzer support:  ..............  $WITH_CONSOLE])
AC_MSG_NOTICE([include OSS support:  .........................  $WITH_OSS])
AC_MSG_NOTICE([include ALSA support:  ........................  $WITH_ALSA])
AC_MSG_NOTICE([include PulseAudio support:  ..................  $WITH_PULSEAUDIO])
AC_MSG_NOTICE([----------------------------------------------------])
if test "$WITH_DEV" = 'yes' ; then
   AC_MSG_NOTICE([enable dev support: ...........................  yes])
fi

AC_OUTPUT