-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
565 lines (447 loc) · 14.9 KB
/
configure.ac
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
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
# -*- Autoconf -*-
# This configuration template was created at Thu Nov 4 11:03:23 2004
# command line: ./build_init --package ldap_slp --version 0.1.4 --rootdir /home/jstevens/src/ldap_slp --subdir src --subdir src/port --subdir src/port/aix5 --subdir src/kernel --subdir src/cmd-utils --subdir src/cmd-utils/slp_client --subdir src/cmd-utils/slp_query --subdir src/cmd-utils/slp_srvreg --subdir src/cmd-utils/slp_attrreq
# Process this file with autoconf to produce a configure script.
AC_INIT([ldap_slp],[0.2.9],[rc8])
#-------------------------- Initialization --------------------------#
# get the processor, vendor, and host information
AC_CANONICAL_BUILD
# create a time-date stamp that will be available in config.h
config_time=`date`
AC_DEFINE_UNQUOTED([CONFIG_TIME], ["$config_time"], [Configuration Time])
# get the build host
config_host=$(hostname)'.'$(hostname -d)
AC_DEFINE_UNQUOTED([CONFIG_HOST], ["$config_host"], [Configuration Host])
AC_DEFINE_UNQUOTED([CONFIG_USER], ["$USER"], [Configuration User])
canonical_config="Configure/Build initiated by $USER@$config_host on $config_time"
AC_DEFINE_UNQUOTED([CANONICAL_CONFIG_STRING], ["$canonical_config"], [Canonical configuration string])
#AC_CONFIG_AUX_DIR(["/usr/share/automake-1.4/"])
#------------- define HOST_PROCESSOR, HOST_VENDOR, HOST_OS ------------#
# see http://gcc.gnu.org/install/specific.html for a list of targets
# -----------------------------------------------------------------------
#---------------- Get the cononical build string and set host variables -#
AC_DEFINE_UNQUOTED([CANONICAL_BUILD], ["$build"], [Canonical Build])
if [[ -n "$PRODUCTION" ]] ; then
AC_DEFINE_UNQUOTED([PRODUCTION_BUILD], ["TRUE"], [Build optimized code])
else
AC_DEFINE_UNQUOTED([DEBUG_BUILD], ["TRUE"], [Build for debugging])
fi
if [[ -n "$TRACE" ]] ; then
AC_DEFINE_UNQUOTED([TRACE_ENABLED], ["TRUE"], [define trace macro])
fi
AC_SUBST([PRODUCTION_BUILD])
AC_SUBST([DEBUG_BUILD])
AC_SUBST([TRACE_ENABLED])
# This next three case expressions provide conditional code blocks for
# the host processor, vendor, and operating system.
# Most of the conditional configuration code is in the operating
# system case expression.
case $build in
i?86-*-*)
AC_DEFINE([HOST_PROCESSOR], ["x86"], [Host Processor])
HOST_PROCESSOR=x86
;;
ia64-*-*)
AC_DEFINE([HOST_PROCESSOR], ["ia64"], [Host Processor])
HOST_PROCESSOR=ia64
;;
'@(x86_64-*-* | amd64-*-*)' )
AC_DEFINE([HOST_PROCESSOR], ["amd64"], [Host Processor])
HOST_PROCESSOR=amd64
;;
powerpc-*-*)
AC_DEFINE([HOST_PROCESSOR], ["power"], [Host Processor])
HOST_PROCESSOR=power
;;
powerpcle-*-*)
AC_DEFINE([HOST_PROCESSOR], ["power_le"], [Host Processor])
HOST_PROCESSOR=power_le
;;
s390-*-*)
AC_DEFINE([HOST_PROCESSOR], ["390"], [Host Processor])
HOST_PROCESSOR=390
;;
s390x-*-*)
AC_DEFINE([HOST_PROCESSOR], ["390_x"], [Host Processor])
HOST_PROCESSOR=390_x
;;
esac
case $build in
*-*-linux*)
AC_DEFINE([HOST_OS], ["linux"], [Host OS])
HOST_OS=linux
AC_DEFINE([OS_PORT_INCLUDE], ["lslp-linux.h"], [Portability Header])
OS_PORT_INCLUDE=lslp-linux.h
OS_PORT_SRC=lslp-linux.c
OS_PORT_OBJ=lslp-linux.o
AC_DEFINE([OS_PORT_DIR], ["src/port/linux"], [Portability Directory])
OS_PORT_DIR="src/port/linux"
AC_PROG_CC()
LINKER=$CC
EXE=
LIBS=
LIB_INCLUDE_FLAG=-l
THREAD_LIBS=-lpthread
REENTRANT_FLAG=-D_REENTRANT
NO_LINK_FLAG=-c
LIB_SUFFIX=.o
DLL_SUFFIX=.so
EXE_OUT=-o
OBJ_OUT=-o
INSTALL_EXE=install
INSTALL_FLAGS=--mode=install
LIBTOOL=/usr/bin/libtool
LIBTOOL_MODE_COMPILE=--mode=compile
LIBTOOL_MODE_LINK=--mode=link
LIBTOOL_MODE_CLEAN=--mode=clean
LIBTOOL_MODE_INSTALL=--mode=install
# check see if the production variable is set
if [[ -z "$PRODUCTION" ]] ; then
echo "Configuring Compiler for a debug build..."
CPPFLAGS=
CFLAGS="-fPIC -g -Wall"
CXXFLAGS=$CFLAGS
echo "Configuring Linker for a debug build..."
LDFLAGS=-g
else
echo "Configuring Compiler for a production build..."
CPPFLAGS=
CFLAGS="-fPIC -g -Wall"
CXXFLAGS=$CFLAGS
echo "Configuring Linker for a production build..."
LDFLAGS=-s
fi
AC_PROG_MAKE_SET
# Checks for libraries.
# AC_CHECK_LIB([dl], [dlopen])
prefix=/usr/local
exec_prefix=$prefix
bindir=$prefix/bin
sbindir=$prefix/sbin
libexecdir=$sbindir
libdir=$prefix/lib
includedir=$prefix/include
;;
*-*-aix*)
AC_DEFINE([HOST_OS], ["aix"], [Host OS])
HOST_OS=aix
AC_DEFINE([OS_PORT_INCLUDE], ["lslp-aix.h"], [Portability Header])
AC_DEFINE([OS_PORT_SRC], ["lslp-aix.c"], [Portability Source])
AC_DEFINE([OS_PORT_OBJ], ["lslp-aix.o"], [Portability Object])
OS_PORT_INCLUDE=lslp-aix.h
OS_PORT_SRC=lslp-aix.c
OS_PORT_OBJ=lslp-aix.o
AC_DEFINE([OS_PORT_DIR], ["src/port/aix5"], [Portability Directory])
AC_DEFINE([OS_PORT_PASEDIR], ["/QOpenSys/QIBM/ProdData/SC1"], [iSeries PASE Install Directory])
OS_PORT_DIR="src/port/aix5"
OS_PORT_PASEDIR="/QOpenSys/QIBM/ProdData/SC1"
AC_PROG_CC()
LINKER=$CC
EXE=
LIBS=
LIB_INCLUDE_FLAG=-l
THREAD_LIBS="-lpthread -lc -L/usr/lib/threads"
REENTRANT_FLAG="-D_REENTRANT -D_THREAD_SAFE"
NO_LINK_FLAG=-c
LIB_SUFFIX=.o
DLL_SUFFIX=.so
EXE_OUT=-o
OBJ_OUT=-o
INSTALL_EXE=install
INSTALL_FLAGS=--mode=install
LIBTOOL=/usr/bin/libtool
LIBTOOL_MODE_COMPILE=--mode=compile
LIBTOOL_MODE_LINK=--mode=link
LIBTOOL_MODE_CLEAN=--mode=clean
LIBTOOL_MODE_INSTALL=--mode=install
# check see if the production variable is set
if [[ -z "$PRODUCTION" ]] ; then
echo "Configuring Compiler for a debug build..."
# Thread safe: cc_r options: -D_THREAD_SAFE -qthreaded -lpthread -lc -L/usr/lib/threads
CPPFLAGS=
CFLAGS="-g -qMAXMEM=8192 -qldbl128 -qalign=natural -qlonglong -qthreaded -qcpluscmt -w"
CXXFLAGS=$CFLAGS
echo "Configuring Linker for a debug build..."
LDFLAGS=-g
else
echo "Configuring Compiler for a production build..."
CPPFLAGS=
CFLAGS="-g -qMAXMEM=8192 -qldbl128 -qalign=natural -qlonglong -qthreaded -qcpluscmt -w"
CXXFLAGS=$CFLAGS
echo "Configuring Linker for a production build..."
LDFLAGS=-s
fi
AC_PROG_MAKE_SET
# Checks for libraries.
# AC_CHECK_LIB([dl], [dlopen])
# i5/OS PASE symlinks /QOpenSys/usr/lib to /usr/lib
# i5/OS PASE symlinks SLP executables in /QOpenSys/QIBM/ProdData/SC1 to /QOpenSys/usr/bin
# /QOpenSys/usr/bin: slp_query, slp_srvreg, slp_attrreq, lslp_kernel, slp.conf
#
# Build process required files:
# /QOpenSys/usr/include: as400_protos.h as400_types.h, os400msg.h
# /QOpenSys/usr/lib: as400_libc.exp
prefix=/QOpenSys/usr
#prefix=/usr/local
exec_prefix=$prefix
bindir=$prefix/bin
sbindir=$prefix/sbin
libexecdir=$sbindir
libdir=$prefix/lib
includedir=$prefix/include
;;
*-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
# force the user to have VCINSTALLDIR defined in the
# environment before running the configuration script
#
if test -z "$VCINSTALLDIR" ; then
echo "Error - VCINSTALLDIR not defined in environment"
echo "Must define VCINSTALLDIR to point to the Visual Studio root"
exit 1
else
echo "MSFT Visual Studio located at $VCINSTALLDIR"
fi
AC_DEFINE([HOST_OS], ["windows"], [Host OS])
HOST_OS=windows
AC_DEFINE([OS_PORT_INCLUDE], ["lslp-windows.h"], [Portability Header])
AC_DEFINE([OS_PORT_SRC], ["lslp-windows.c"], [Portability Source])
AC_DEFINE([OS_PORT_OBJ], ["lslp-windows.obj"], [Portability Object])
OS_PORT_INCLUDE=lslp-windows.h
OS_PORT_SRC=lslp-windows.c
OS_PORT_OBJ=lslp-windows.obj
AC_DEFINE([OS_PORT_DIR], ["src/port/windows"], [Portability Directory])
OS_PORT_DIR="src/port/windows"
# use the MSFT SYSTEMDRIVE environment variable to construct
# the default pathways.
prefix=$SYSTEMDRIVE
exec_prefix=$prefix
bindir=$prefix\\WINDOWS\\system32
sbindir=$bindir
libexecdir=$bindir
libdir=$bindir
includedir="$VCINSTALLDIR\\Vc7\\include;$VCINSTALLDIR\\Vc7\\PlatformSDK\\include"
echo "MSFT cl INCLUDE variable set to: $includedir"
if [[ -z "$PRODUCTION" ]] ; then
echo "Configuring Compiler for a debug build..."
CPPFLAGS=""
CFLAGS="/nologo /c /Zi"
CXXFLAGS=$CFLAGS
LDFLAGS="/nologo /DEBUG"
LINKER_OPTIONS="/link /INCREMENTAL:NO /DEBUG /MAP /MAPINFO:EXPORTS /MAPINFO:LINES"
AC_SUBST([LINKER_OPTIONS])
else
echo "Configuring Compiler for a production build..."
CPPFLAGS=""
CFLAGS="/nologo /c "
CXXFLAGS=$CFLAGS
LDFLAGS="/nologo"
LINKER_OPTIONS="/link /INCREMENTAL:NO"
AC_SUBST([LINKER_OPTIONS])
fi
INCLUDE="$includedir"
AC_SUBST([INCLUDE])
LIB="$VCINSTALLDIR\\Vc7\\lib;$VCINSTALLDIR\\Vc7\PlatformSDK\\lib;$libdir"
echo "MSFT cl LIB variable set to: $LIB"
AC_SUBST([LIB])
;;
*-*-openbsd*)
AC_DEFINE([HOST_OS], ["openBSD"], [Target Operation System])
HOST_OS=openbsd
AC_DEFINE([OS_PORT_INCLUDE], ["lslp-linux.h"], [Portability Header])
OS_PORT_INCLUDE=lslp-linux.h
OS_PORT_SRC=lslp-linux.c
OS_PORT_OBJ=lslp-linux.o
HOST_OS=openBSD
AC_PROG_CC()
LINKER=$CC
EXE=
LIBS=
LIB_INCLUDE_FLAG=-l
THREAD_LIBS=-lpthread
REENTRANT_FLAG=-D_REENTRANT
NO_LINK_FLAG=-c
LIB_SUFFIX=.o
DLL_SUFFIX=.so
EXE_OUT=-o
OBJ_OUT=-o
INSTALL_EXE=installMa
INSTALL_FLAGS=
LIBTOOL_MODE_COMPILE=
LIBTOOL_MODE_LINK=
LIBTOOL_MODE_CLEAN=
LIBTOOL_MODE_INSTALL=
if [[ -z "$PRODUCTION" ]] ; then
CFLAGS="-g -Wall -Dlinux -DBSD -DDEBUG_ALLOC"
LDFLAGS=-g
LFLAGS="-p -v -d "
YFLAGS="-v -d"
else
CFLAGS="-O -Wall -Dlinux -DBSD"
LDFLAGS=-s
LFLAGS="-f -w"
YFLAGS=-l
fi
prefix=/usr/local
exec_prefix=$prefix
bindir=$prefix/bin
sbindir=$prefix/sbin
libexecdir=$sbindir
libdir=$prefix/lib
includedir=$prefix/include
;;
esac
#------------------ special windows|notwindows initializations --------------------
# The following if/else/endif block is a convenient way to do initialization that
# is different for Windows, but the same for the other platforms.
#
# Basically this block uses home-grown checks for Windows, but uses canned Autoconf
# macros for all the other platforms.
#
# I could have equally put this block in one or more of the case expressions above
# but it is more compact to do it this way.
#-----------------------------------------------------------------------------------
if [[ $HOST_OS == "windows" ]] ; then
# Define the dll import and export directives to be active on MSFT platforms
AC_DEFINE([DLL_EXPORT], [__declspec(dllexport)], [DLL Export directive for MSFT])
AC_DEFINE([DLL_IMPORT], [__declspec(dllimport)], [DLL Import directive for MSFT])
echo "defined DLL_EXPORT: __declspec(dllexport)"
echo "defined DLL_IMPORT: __declspec(dllimport)"
AC_DEFINE([_WIN32_WINNT], [0x400], [Required for Windows Platform Headers])
echo "_WIN32_WINNT Preprocessor variable set to WINNT 4.0 and Above"
windows_save_ifs=$IFS
IFS=';'
for dir in $includedir ; do
# home-grown header checks for MSFT. Loops to check all defined include dirs
IFS=$windows_save_ifs
if [[ -e "$dir\\inttypes.h" ]] ; then
AC_DEFINE([HAVE_INTTYPES_H], [1],
[Define to 1 if you have the <inttypes.h> header file])
fi
if [[ -e "$dir\\memory.h" ]] ; then
AC_DEFINE([HAVE_MEMORY_H], [1],
[Define to 1 if you have the <memory.h> header file])
fi
if [[ -e "$dir\\stdint.h" ]] ; then
AC_DEFINE([HAVE_STDINT_H], [1],
[Define to 1 if you have the <stdint.h> header file])
fi
if [[ -e "$dir\\stdlib.h" ]] ; then
AC_DEFINE([HAVE_STDLIB_H], [1],
[Define to 1 if you have the <stdlib.h> header file])
fi
if [[ -e "$dir\\strings.h" ]] ; then
AC_DEFINE([HAVE_STRINGS_H], [1],
[Define to 1 if you have the <strings.h> header file])
fi
if [[ -e "$dir\\string.h" ]] ; then
AC_DEFINE([HAVE_STRING_H], [1],
[Define to 1 if you have the <string.h> header file])
fi
if [[ -e "$dir\\sys\\stat.h" ]] ; then
AC_DEFINE([HAVE_SYS_STAT_H], [1],
[Define to 1 if you have the <sys/stat.h> header file])
fi
if [[ -e "$dir\\sys\\types.h" ]] ; then
AC_DEFINE([HAVE_SYS_TYPES_H], [1],
[Define to 1 if you have the <sys/types.h> header file])
fi
if [[ -e "$dir\\unistd.h" ]] ; then
AC_DEFINE([HAVE_UNISTD_H], [1],
[Define to 1 if you have the <unistd.h> header file])
fi
if [[ -e "$dir\\WinVer.h" ]] ; then
AC_DEFINE([HAVE_WINVER_H], [1],
[Define to 1 if you have <WinVer.h> header file])
fi
IFS=';'
done
IFS=$windows_save_ifs
AC_DEFINE_UNQUOTED([WINSOCK_2], [1], [Using Winsock 2 interface])
else
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
AC_DEFINE([DLL_EXPORT], [], [Dll Export directive for MSFT])
AC_DEFINE([DLL_IMPORT], [], [Dll Import directive for MSFT])
AC_CHECK_HEADERS([unistd.h])
AC_PATH_PROG([LDCONFIG], [ldconfig])
AC_PATH_PROG([ARCHIVE], [ar])
AC_PATH_PROG([INSTALL], [install])
fi
AC_PROG_LEX
AC_PROG_YACC
#--------------------Definitions and Substitutions--------------------------
# definitions
# each AC_SUBST will take a shell variable defined above or elsewhere
# and put it into the makefile
AC_SUBST([config_time])
AC_SUBST([config_host])
AC_SUBST([USER])
AC_SUBST([canonical_config])
AC_SUBST([build])
AC_SUBST([HOST_PROCESSOR])
AC_SUBST([HOST_OS])
AC_SUBST([HOST_VENDOR])
AC_SUBST([CPPFLAGS])
AC_SUBST([CFLAGS])
AC_SUBST([CXXFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([YACC])
AC_SUBST([YFLAGS])
AC_SUBST([LEX])
AC_SUBST([LFLAGS])
AC_SUBST([builddir])
AC_SUBST([abs_builddir])
AC_SUBST([top_builddir])
AC_SUBST([abs_top_builddir])
AC_SUBST([srcdir])
AC_SUBST([abs_srcdir])
AC_SUBST([top_srcdir])
AC_SUBST([abs_top_srcdir])
AC_SUBST([prefix ])
AC_SUBST([exec_prefix])
AC_SUBST([bindir])
AC_SUBST([sbindir])
AC_SUBST([libexecdir]) # programs to be run by other programs (not users)
AC_SUBST([libdir ]) # $(exec_prefix)/lib
AC_SUBST([includedir])
AC_SUBST([CVS_ROOT])
AC_SUBST([PORTAL])
AC_SUBST([PORTAL_MAILTO])
AC_SUBST([EXTRACT])
AC_SUBST([INSTALL_CMD])
AC_SUBST([UNINSTALL_CMD])
AC_SUBST([OS_PORT_INCLUDE])
AC_SUBST([OS_PORT_SRC])
AC_SUBST([OS_PORT_OBJ])
AC_SUBST([OS_PORT_DIR])
AC_SUBST([OS_PORT_PASEDIR])
AC_SUBST([LINKER])
AC_SUBST([LIB_INCLUDE_FLAG])
AC_SUBST([THREAD_LIBS])
AC_SUBST([REENTRANT_FLAG])
AC_SUBST([NO_LINK_FLAG])
AC_SUBST([LIB_SUFFIX])
AC_SUBST([DLL_SUFFIX])
AC_SUBST([EXE_OUT])
AC_SUBST([OBJ_OUT])
AC_SUBST([INSTALL_EXE])
AC_SUBST([INSTALL_FLAGS])
AC_SUBST([LIBTOOL])
AC_SUBST([LIBTOOL_MODE_COMPILE])
AC_SUBST([LIBTOOL_MODE_LINK])
AC_SUBST([LIBTOOL_MODE_CLEAN])
AC_SUBST([LIBTOOL_MODE_INSTALL])
AC_SUBST([DLL_EXPORT])
AC_SUBST([DLL_IMPORT])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile
src/Makefile
src/port/Makefile
src/port/aix5/Makefile
src/kernel/Makefile
src/cmd-utils/Makefile
src/cmd-utils/slp_client/Makefile
src/cmd-utils/slp_query/Makefile
src/cmd-utils/slp_srvreg/Makefile
src/cmd-utils/slp_attrreq/Makefile
])
AC_OUTPUT